C/C MCQ Quiz Hub

C Multiple Choice Questions C Functions Set 2

Choose a topic to test your knowledge and improve your C/C skills

What linkage does automatic variables have?





✅ Correct Answer: 3

Automatic variables are variables that are?





✅ Correct Answer: 1

Automatic variables:





✅ Correct Answer: 3

Automatic variables are allocated memory in?





✅ Correct Answer: 4

What is the output of this C code? void main() { int x; } here x is?





✅ Correct Answer: 1

Automatic variables are initialized to?





✅ Correct Answer: 2

The variable declaration with no storage class specified is by default:





✅ Correct Answer: 1

What is the output of this C code? int x = 5; void main() { int x = 3; printf("%d", x); { x = 4; } printf("%d", x); }





✅ Correct Answer: 4

What is the scope of an external variable?





✅ Correct Answer: 4

What is the scope of a function?





✅ Correct Answer: 4

Which variable has the longest scope? int b; int main() { int c; return 0; } int a;





✅ Correct Answer: 2

Array sizes are optional during array declaration by using ______ keyword.





✅ Correct Answer: 3

What is the output of this C code? void main() { int x = 3; { x = 4; printf("%d", x); } }





✅ Correct Answer: 1

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); }





✅ Correct Answer: 1

What is the output of this C code? static int x; void main() { int x; printf("x is %d", x); }





✅ Correct Answer: 2

What is the output of this C code? void main() { static int x; if (x++ < 2) main(); }





✅ Correct Answer: 4

Which of the following is true for static variable?





✅ Correct Answer: 2

Assignment statements assigning value to local static variables are executed only once?





✅ Correct Answer: 2

What is the format identifier for "static a = 20.5;?





✅ Correct Answer: 2

Functions have static qualifier for its declaration by default.





✅ Correct Answer: 2

Is initialization mandatory for local static variables?





✅ Correct Answer: 2