

MCQOPTIONS
Saved Bookmarks
This section includes 204 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
In C all functions except can be called recursively. |
A. | True |
B. | False |
Answer» C. | |
2. |
If is 2 bytes wide.What will be the output of the program? |
A. | ab |
B. | cd |
C. | ef |
D. | gh |
Answer» C. ef | |
3. |
If a function contains two statements successively, the compiler will generate warnings. Yes/No ? |
A. | Yes |
B. | No |
Answer» B. No | |
4. |
Will the following functions work? |
A. | Yes |
B. | No |
Answer» B. No | |
5. |
In a function two statements should never occur. |
A. | Yes |
B. | No |
Answer» C. | |
6. |
What will be the output of the following C code?#include <stdio.h> void fun(); int main() { void fun(); fun(); return 0; } void fun() { printf("Hello..."); } |
A. | Depends on the compiler |
B. | Garbage value |
C. | Compilation Error |
D. | Hello... |
E. | None of these |
Answer» E. None of these | |
7. |
What will be the output of the following C code?#include <stdio.h> void N() { printf("Hello..."); } void main() { N(); } |
A. | Compilation Error |
B. | Hello... |
C. | Depends on compiler |
D. | Garbage value |
E. | None of these |
Answer» C. Depends on compiler | |
8. |
What will be the output of the following C code?#include <stdio.h> int main() { void funA(); void funB() { funA(); } funB(); } void FunA() { printf("Interview Mania"); } |
A. | Compilation Error |
B. | Interview Mania |
C. | Garbage value |
D. | Depends on the compiler |
E. | None of these |
Answer» E. None of these | |
9. |
What will be the output of the following C code?#include <stdio.h> void fun(); int main() { void fun(int); fun(); return 0; } void fun() { printf("200"); } |
A. | Compilation Error |
B. | 200 |
C. | Runtime Error |
D. | Depends on compiler |
E. | None of these |
Answer» B. 200 | |
10. |
What will be the output of the following C code?#include <stdio.h> void fun(); int main() { void fun(int); fun(100); return 0; } void fun(int n) { printf("200 "); } |
A. | 200 |
B. | 100 |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» B. 100 | |
11. |
What will be the output of the following C code? #include <stdio.h> void main() { static int n = 5; n++; if (n <= 10) { printf("Manjesh Ojha n"); main(); } } |
A. | "Manjesh Ojha" is printed 1 time |
B. | "Manjesh Ojha" is printed infinite time |
C. | "Manjesh Ojha" is printed 10 time |
D. | "Manjesh Ojha" is printed 5 time |
E. | None of these |
Answer» E. None of these | |
12. |
What will be the output of the following C code?#include <stdio.h> void main() { fun(); } void fun() { printf("Interview Mania"); fun(); } |
A. | Compilation Error |
B. | "Interview Mania" is printed 1 time |
C. | Nothing |
D. | "Interview Mania" is printed infinite time |
E. | None of these |
Answer» E. None of these | |
13. |
What will be the output of the following C code?#include <stdio.h> void main() { A(); void A() { printf("Interview Mania"); } } |
A. | Interview Mania |
B. | Compilation Error |
C. | Garbage value |
D. | Runtime Error |
E. | None of these |
Answer» C. Garbage value | |
14. |
What will be the output of the following C code?#include <stdio.h> void A(); void B() { A(); } void main() { void B() { printf("Interview Mania"); } } |
A. | Compilation Error |
B. | Interview Mania |
C. | Runtime Error |
D. | Depends on Compiler |
E. | None of these |
Answer» C. Runtime Error | |
15. |
What will be the output of the following C code?#include <stdio.h> int *fun(); void main() { int n = A(); printf("%d", n); } int *fun() { int num[5] = {51, 18, 25}; return num; } |
A. | 51 18 25 |
B. | 25 18 51 |
C. | 18 25 51 |
D. | Compilation Error |
E. | None of these |
Answer» B. 25 18 51 | |
16. |
What will be the output of the following C code?#include <stdio.h> void fun(int n) { printf("Interview"); } void fun(double n) { printf("Mania"); } void main() { fun(10); } |
A. | Interview |
B. | 10 |
C. | Mania |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
17. |
What will be the output of the following C code?#include <stdio.h> int *fun(); void main() { int *ptr = fun(); printf("Welcome "); printf("%d", ptr[0]); } int *fun() { int n[5] = {15, 18, 10}; return n; } |
A. | Compilation Error |
B. | Welcome |
C. | 15 18 10 |
D. | Segmentation fault |
E. | None of these |
Answer» E. None of these | |
18. |
What is the problem in the following C declarations?int function(int); double function(int); int function(float); |
A. | A function with same name cannot have different return types |
B. | A function with same name cannot have different number of parameters |
C. | A function with same name cannot have different signatures |
D. | All of above |
E. | None of these |
Answer» E. None of these | |
19. |
What will be the output of the following C code?#include <stdio.h> void main() { int n = fun(); printf("%d", n); } void fun() { printf("Welcome "); } |
A. | 8 |
B. | Welcome |
C. | Welcome 8 |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
20. |
What will be the data type returned for the following C function?#include <stdio.h> int function() { return (double)(char)10.0; } |
A. | char |
B. | double |
C. | multiple type-casting in return is illegal |
D. | float |
E. | int |
Answer» F. | |
21. |
What will be the output of the following C code? #include <stdio.h> int *fun() { int *ptr1 = 10; return ptr1; } void main() { int *ptr2 = fun(); printf("%d", ptr2); } |
A. | Garbage value |
B. | Compilation Error |
C. | Nothing |
D. | 10 |
E. | None of these |
Answer» E. None of these | |
22. |
What will be the output of the following C code?#include <stdio.h> enum color{Red, Yellow, Green}; enum color fun(); int main() { enum color n = fun(); printf("%d n", n); } int fun() { return Red; } |
A. | Red |
B. | Yellow |
C. | Green |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
23. |
What will be the output of the following C code?#include <stdio.h> double fun(); int main() { fun(); return 0; } fun() { printf("250"); return 250; } |
A. | 250 |
B. | Depends on compiler |
C. | Garbage value |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
24. |
What will be the output of the following C code?#include <stdio.h> int fun(); int main() { int n = fun(); } fun() { printf("100"); return 100; } |
A. | Compilation Error |
B. | 100 |
C. | Depends on compiler |
D. | Runtime Error |
E. | None of these |
Answer» C. Depends on compiler | |
25. |
What will be the output of the following C code?#include <stdio.h> int main() { struct S { char *name; struct S *next; }; struct S s1, s2; s1.name = "Ajit Kumar Gupta"; s1.next = NULL; ptrary[0] = &s1; strcpy(s2.name, s1.name); ptrary[1] = &s2; printf("%s n", ptrary[1]->name); return 0; } |
A. | Garbage value |
B. | Compilation Error |
C. | Ajit Kumar Gupta |
D. | Undefined behaviour |
E. | None of these |
Answer» C. Ajit Kumar Gupta | |
26. |
What will be the output of the following C code?#include <stdio.h> struct M { char *name; struct M *next; }; struct M *ptrary[10]; int main() { struct M m1, m2; m1.name = "xyz"; m1.next = NULL; ptrary[0] = &m1; strcpy(m2.name, m1.name); ptrary[1] = &m1; printf("%s n", ptrary[1]->name); return 0; } |
A. | Compilation Error |
B. | Garbage value |
C. | Prayag |
D. | Segmentation fault |
E. | None of these |
Answer» E. None of these | |
27. |
What will be the output of the following C code?#include <stdio.h> struct Z { char *name; struct Z *next; }; struct Z *ptrary[10]; int main() { struct Z z; z.name = "Raj"; z.next = NULL; ptrary[0] = &z; printf("%s n", ptrary[0]->name); return 0; } |
A. | Compilation Error |
B. | Garbage value |
C. | Raj |
D. | Undefined behaviour |
E. | None of these |
Answer» D. Undefined behaviour | |
28. |
What will be the output of the following C code?#include <stdio.h> struct Employee { char str[]; }; void main() { struct Employee Emp; printf("%d", sizeof(struct Employee)); } |
A. | Garbage value |
B. | Undefined behaveiour |
C. | Nothing |
D. | Size of char |
E. | Compilation Error |
Answer» F. | |
29. |
What will be the output of the following C code?#include <stdio.h> int main() { struct NN { char *name; struct NN *next; }; struct NN *ptrary[10]; struct NN n, nn; n.name = "Rahul"; n.next = NULL; ptrary[0] = &n; nn.name = (char*)malloc(sizeof(char)*3); strcpy(nn.name, n.name); nn.next = &nn; ptrary[1] = &nn; printf("%s n", ptrary[1]->next->next->name); } |
A. | Rahul |
B. | Garbage value |
C. | Compilation Error |
D. | Undefined behaviour |
E. | None of these |
Answer» B. Garbage value | |
30. |
What will be the output of the following C code?#include <stdio.h>#include <stdarg.h> void function(int, ...); int main() { function(21, 13, 15, 17, 101, 113); return 0; } void function(int n, ...) { int num, k = 0; va_list start; va_start(start, n); while (k != 5) { num = va_arg(start, int); k++; } printf("%d", num); } |
A. | 13 |
B. | 15 |
C. | 17 |
D. | 101 |
E. | 113 |
Answer» F. | |
31. |
What will be the output of the following C code?#include <stdio.h>#include <stdarg.h> int fun(char ch, ...); int main() { char ch1 = 100, ch2 = 101; fun(ch1, ch2); return 0; } int fun(char ch, ...) { va_list list; va_start(list, ch); char ch2 = va_arg(list, int); printf("%c n", ch2); va_end(list); } |
A. | 100 |
B. | d |
C. | 101 |
D. | e |
E. | None of these |
Answer» E. None of these | |
32. |
What will be the output of the following C code?#include <stdio.h>#include <stdarg.h> int fun(char ch, ...); int main() { char ch1 = 99, ch2 = 100; fun(ch1, ch2); return 0; } int fun(char ch, ...) { va_list list; va_start(list, ch1); char ch2 = va_arg(list, char); printf("%c n", ch2); va_end(list); } |
A. | c |
B. | Compilation Error |
C. | d |
D. | Undefined behaviour |
E. | None of these |
Answer» E. None of these | |
33. |
What will be the output of the following C code?#include <stdio.h>#include <stdarg.h> int fun(...); int main() { char ch = 99; fun(ch); return 0; } int fun(...) { va_list list; char ch = va_arg(list, char); printf("%c n", ch); } |
A. | c |
B. | 99 |
C. | Undefined behaviour |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
34. |
What will be the output of the following C code?#include <stdio.h> int fun(char ch, ...); int main() { char chr = 99; fun(chr); return 0; } int fun(char chr, ...) { printf("%c n", chr); } |
A. | 99 |
B. | Compilation Error |
C. | c |
D. | Undefined behaviour |
E. | None of these |
Answer» D. Undefined behaviour | |
35. |
What will be the output of the following C code?#include <stdio.h> struct B { char *name; struct B *next; }; struct B *ptrary[10]; int main() { struct B b; b->name = "Raj"; b->next = NULL; ptrary[0] = &b; printf("%s n", b->name); return 0; } |
A. | Compilation Error |
B. | Raj |
C. | Garbage value |
D. | Undefined behaviour |
E. | None of these |
Answer» B. Raj | |
36. |
What will be the output of the following C code?#include <stdio.h> void main() { char *str[3][3] = {{"Welcome", "to", "the"}, {"Interview", "Mania", "and"} , {"Enjoy", "C", "code"}}; printf("%s", str[2][2]); } |
A. | Interview |
B. | Mania |
C. | C |
D. | code |
E. | None of these |
Answer» E. None of these | |
37. |
What will be the output of the following C code?#include <stdio.h> void main() { int look_up[100] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}; printf("%d", look_up[6]); } |
A. | 10 |
B. | 12 |
C. | 14 |
D. | 16 |
E. | None of these |
Answer» E. None of these | |
38. |
What will be the output of the following C code?#include <stdio.h> void main() { char *ch[3] = {"Interview", "Mania"}; printf("%s", ch[1]); } |
A. | Compilation Error |
B. | Interview |
C. | Mania |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
39. |
What will be the output of the following C code?#include <stdio.h> struct Employee { char name[20]; }; void main() { struct Employee emp[] = {"AJIT", "KUMAR"}; printf("%c", emp[0].name[1]); } |
A. | A |
B. | J |
C. | I |
D. | K |
E. | None of these |
Answer» C. I | |
40. |
What will be the output of the following C code having void return-type function?#include <stdio.h> void fun() { return 5; } void main() { int n = 4; n = fun(); printf("%d", n); } |
A. | 5 |
B. | 4 |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
41. |
What will be the output of the following C code? #include <stdio.h> int main() { void functionA(), functionB(); functionB(); } void functionA() { printf("Ojha "); } void functionB() { printf("Manjesh "); functionA(); } |
A. | Ojha |
B. | Manjesh |
C. | Manjesh Ojha |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
42. |
What will be the output of the following C code?#include <stdio.h> int main() { void fun(); printf("Interview "); fun(); } void fun() { printf("Mania"); } |
A. | Interview |
B. | Mania |
C. | Interview Mania |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
43. |
What error will the following function give on compilation?fun(int x, int y ){ int x ; y = 54 ; return x ;} |
A. | Missing parentheses in return statement |
B. | The function should be defined as int fun(int x, int y ) |
C. | Re declaration of x |
D. | None of the above |
Answer» D. None of the above | |
44. |
Which of the following statements are correct about the following program?#include <studio.h>int main ( ){ printf ("%p n", main); return 0;} |
A. | It prints "main" infinite number of times. |
B. | It runs an infinite loop without printing anything. |
C. | Compiler report an error since main() cannot be called recursively. |
D. | Address of main( ) would get printed infinite number of times. |
E. | Address of main( ) would get printed once. |
Answer» F. | |
45. |
What will be the output of the following C code?#include <stdio.h>#include <stdarg.h> int function(int n, ...); int main() { int n = 102; float f = 105; function(n, f); return 0; } int function(int n, ...) { va_list list; va_start(list, n); float f = va_arg(list, float); printf("%f n", f); va_end(list); } |
A. | f |
B. | 102 |
C. | 105 |
D. | i |
E. | Undefined behaviour |
Answer» F. | |
46. |
Which of the following is the correct output for the program given below?#include <stdio.h>void function1 (char*) ;int main ( ){ char ch[100] ; ch[0] = 'A' , ch[1] = 'B' ; ch[2] = 'C' , ch[3] = 'D' ; function1 ( &ch[0] ); return 0 ;}void function1 (char*ch);{ ch++ ; printf ("%c" , *ch) ; ch++ ; printf ("%c n" , *ch);} |
A. | AB |
B. | BC |
C. | CD |
D. | No output |
Answer» C. CD | |
47. |
Which of the following is the correct output for the program given below?#include <stdio.h>void fun ( int*, int* ) ;int main( ){ int a = 6, b = 3 ; fun (&a, &b); printf ("%d %d n" , a, b); return 0 ;}void fun (int*a, int*b){ *a = *a* *a; *b = *b* *b ;} |
A. | 6 3 |
B. | 12 6 |
C. | 3 6 |
D. | 36 9 |
E. | 9 36 |
Answer» E. 9 36 | |
48. |
How many times the following program will print "Manjesh"?#include <stdio.h> int main ( ){ printf ("Manjesh n"); main ( ) ; return 0 ;} |
A. | Infinite number of times |
B. | 32767 times |
C. | 65535 times |
D. | Till the stack doesn't overflow |
Answer» E. | |
49. |
Which of the following is the correct output for the program given below?#include<stdio.h>int main ( ){ int fun (int); int k = fun (20); printf ("%d n" , --k) ; return 0 ;}int fun (int i){ return (k++) ;} |
A. | 19 |
B. | 20 |
C. | 21 |
D. | 18 |
Answer» B. 20 | |
50. |
What will be the output of the program?_x000D_ #include_x000D_ #include_x000D_ _x000D_ int main()_x000D_ {_x000D_ int i=0;_x000D_ i++;_x000D_ if(i |
A. | Prints "IndiaBIX" 5 times |
B. | Function main() doesn't calls itself |
C. | Infinite loop |
D. | Prints "IndiaBIx" |
Answer» E. | |