What will be the output of the following C code? #include <stdio.h> void main() { m(); printf("%d", x); } int x; void m() { x = 4; }
4
compile time error
0
undefined
What will be the output of the following C code?
#include <stdio.h> int x; void main() { printf("%d", x); }
Junk value
Run time error
0
undefined
What will be the output of the following C code?
#include <stdio.h> int x = 5; void main() { int x = 3; printf("%d", x); { x = 4; } printf("%d", x); }
Run time error
3 3
3 5
3 4
A function that uses variable types is called
keywords
Variable function
userdefined function
library function
What will be the output of the following C code? #include <stdio.h> int x = 5; void main() { int x = 3; printf("%d", x); { int x = 4; } printf("%d", x); }
3 3
3 4
3 5
Run time error
Functions in C are always _____
Internal
External
Both Internal and External
External and Internal are not valid term for functions
Global variables are _____
Internal
External
Both internal and external
None of the mentioned
Which of the following is an external variable in the following C code? #include <stdio.h> int func (int a) { int b; return b; } int main() { int c; func (c); } int d;
a
b
c
d
What will be the output of the following C code?
#include <stdio.h> int main() { printf("%d", d++); } int d = 10;
9
10
11
Compile time error
What will be the output of the following C code?
#include <stdio.h> double var = 8; int main() { int var = 5; printf("%d", var); }
5
8
Compile time error due to wrong format identifier for double
Compile time error due to redeclaration of variable with same name
What will be the output of the following C code? #include <stdio.h> double i; int main() { printf("%g\n",i); return 0; }
0
0.000000
Garbage value
Depends on the compiler
Which part of the program address space is p stored in the following C code?
#include <stdio.h> int *p = NULL; int main() { int i = 0; p = &i; return 0; }
Code/text segment
Data segment
Bss segment
Stack
Which part of the program address space is p stored in the following C code?
#include <stdio.h> int *p; int main() { int i = 0; p = &i; return 0; }
Code/text segment
Data segment
Bss segment
Stack
Can variable i be accessed by functions in another source file? #include <stdio.h> int i; int main() { printf("%d\n", i); }
Yes
No
Only if static keyword is used
Depends on the type of the variable
Property of the external variable to be accessed by any source file is called by the C90 standard as __________
external linkage
external scope
global scope
global linkage
What will be the output of the following C code?
#include <stdio.h> int *i; int main() { if (i == NULL) printf("true\n"); return 0; }
true
true only if NULL value is 0
Compile time error
Nothing
What will be the output of the following C code?
#include <stdio.h> int *i; int main() { if (i == 0) printf("true\n"); return 0; }
true
true only if NULL value is 0
Compile time error
Nothing
What will be the output of the following C code?
#include <stdio.h> static int x = 5; void main() { x = 9; { int x = 4; } printf("%d", x); }