Is initialization mandatory for local static variables?
1.Yes
2.No
3.Depends on the compiler
4.Depends on the standard
What linkage does automatic variables have?
1. Internal linkage
2.External linkage
3.No linkage
4.None of the mentioned
Array sizes are optional during array declaration by using ______ keyword.
1.auto
2.static
3.extern
4.register
Assignment statements assigning value to local static variables are executed only once?
1.true
2.False
3.Depends on the code
4.None of the mentioned
Automatic variables are allocated memory in?
1. heap
2.Data segment
3.Code segment
4.stack
Automatic variables are initialized to?
1.0
2.Junk value
3.Nothing
4.Both (a) & (b)
Automatic variables are variables that are?
1.Declared within the scope of a block, usually a function
2.Declared outside all functions
3.Declared with auto keyword
4.Declared within the keyword extern
Automatic variables:
1.Exist only within that scope in which it is declared
2.Cease to exist after the block is exited
3. Both (a) & (b)
4.Only 1
Functions have static qualifier for its declaration by default.
1.True
2.False
3.Depends on the compiler
4.Depends on the standard
The variable declaration with no storage class specified is by default:
1.auto
2.extern
3.static
4.register
What is the format identifier for "static a = 20.5;?
1.%s
2. %d
3.%f
4. Illegal declaration due to absence of data type
What is the output of this C code? int x = 5; void main() { int x = 3; m(); printf("%d", x); } void m() { x = 8; n(); } void n() { printf("%d", x); }
1.8 3
2.8 5
3.3 8
4. 5 3
What is the output of this C code? int x = 5; void main() { int x = 3; printf("%d", x); { x = 4; } printf("%d", x); }
1.Run time error
2.3 3
3.3 5
4.3 4
What is the output of this C code? static int x; void main() { int x; printf("x is %d", x); }
1.0
2.Junk value
3.Run time error
4.Nothing
What is the output of this C code? void main() { int x = 3; { x = 4; printf("%d", x); } }
1.4
2.3
3.0
4.Undefined
What is the output of this C code? void main() { int x; } here x is?
1. automatic variable
2.static variable
3.global variable
4.register variable
What is the output of this C code? void main() { static int x; if (x++ < 2) main(); }
1. Infinite calls to main
2.Run time error
3.Varies
4.main is called twice
What is the scope of a function?
1.Whole source file in which it is defined
2.From the point of declaration to the end of the file in which it is defined
3.Any source file in a program
4. From the point of declaration to the end of the file being compiled
What is the scope of an external variable?
1.Whole source file in which it is definedB.
2. From the point of declaration to the end of the file in which it is defined
3.Any source file in a program
4.From the point of declaration to the end of the file being compiled
Which of the following is true for static variable?
1. It can be called from another function
2.It exists even after the function ends.
3. It can be modified in another function by sending it as a parameter.
4.All of the mentioned
Which variable has the longest scope? int b; int main() { int c; return 0; } int a;
1.a
2.b
3.c
4.Both (a) and (b)