

MCQOPTIONS
Saved Bookmarks
This section includes 202 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
51. |
What will be the output of the following C code? #include <stdio.h> int main() { char *ptr[1] = {"Manjesh Ojha"}; printf("%s", (ptr)[0]); return 0; } |
A. | Garbage value |
B. | Compilation Error |
C. | Manjesh Ojha |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
52. |
What will be the output of the following C code?#include <stdio.h> void main() { char *ch[7] = {"Welcome", "To", "Interview", "Mania"}; int k = 0; for (k = 0; k < 7; k++) printf("%s ", ch[k]); } |
A. | Welcome To Interview Mania |
B. | (null) (null) (null) |
C. | Welcome To Interview Mania (null) (null) (null) |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
53. |
What will be the output of the following C code?#include <stdio.h> void main() { char *ch[20] = {"Hey", "How", "Hope"}; printf("%d n", sizeof(ch[10])); } |
A. | Hey |
B. | How |
C. | 8 |
D. | Hope |
E. | None of these |
Answer» D. Hope | |
54. |
What will be the output of the following C code?#include <stdio.h> void main() { char *ch[10] = {"Interview", "Mania", "World"}; printf("%d n", sizeof(ch)); } |
A. | 80 |
B. | Interview |
C. | Mania |
D. | World |
E. | None of these |
Answer» B. Interview | |
55. |
What will be the output of the following C code?#include <stdio.h> void main() { char *ch[10] = {"Interview", "Mania", "World"}; int k = 0, L = 0; ch[0] = "World"; for (k = 0; k < 10; k++) printf("%s n", ch[k]); } |
A. | Interview |
B. | Mania |
C. | World |
D. | Garbage value |
E. | Segmentation fault |
Answer» F. | |
56. |
What will be the output of the following C code?#include <stdio.h> int main() { int k = 20, L = 25; int *num[] = {&k, &L}; printf("%d ", (*num)[1]); return 0; } |
A. | Compilation Error |
B. | 25 |
C. | 20 |
D. | Garbage value |
E. | None of these |
Answer» E. None of these | |
57. |
What will be the output of the following C code? #include <stdio.h> int main() { int m = 20, n = 22; int *Array[] = {&m, &n}; printf("%d", *Array[0]); return 0; } |
A. | 22 |
B. | Compilation Error |
C. | Undefined behaviour |
D. | 20 |
E. | Garbage value |
Answer» E. Garbage value | |
58. |
What will be the output of the following C code? #include <stdio.h> int main() { int k = 10, L = 11; int *num[] = {&k, &L}; printf("%d", (*num)[0]); return 0; } |
A. | Compilation Error |
B. | Garbage value |
C. | Segmentation fault |
D. | Undefined behaviour |
E. | 10 |
Answer» F. | |
59. |
What will be the output of the following C code?#include <stdio.h> int main() { char **ptr = {"Welcome", "to", "Interview Mania"}; printf("%s", (ptr)[0]); return 0; } |
A. | Welcome to Interview Mania |
B. | Garbage value |
C. | Compilation Error |
D. | Segmentation fault |
E. | None of these |
Answer» E. None of these | |
60. |
What will be the output of the following C code? #include <stdio.h> void main() { char ch[12][14] = {"India", "Hindusatan", "Bharat"}; printf("%p n", ch); printf("%p", ch[0]); } |
A. | India |
B. | Hindusatan |
C. | Bharat |
D. | Same memory address |
E. | Different memory address |
Answer» E. Different memory address | |
61. |
What will be the output of the following C code?#include <stdio.h> void main() { char num[15][20] = {"Interveiw", "Mania", "World"}; printf("%s", num[2]); } |
A. | Interveiw |
B. | Mania |
C. | World |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
62. |
What will be the output of the following C code (considering sizeof char is 1 and pointer is 4)?#include <stdio.h> int main() { char *ch[2] = {"Manjesh", "Ojha"}; printf("%d", sizeof(ch)); return 0; } |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
E. | Depends on compiler |
Answer» F. | |
63. |
Which of the following statements are true?I. Pointer to ArrayII. Multi-dimensional array |
A. | I are dynamic, II are dynamic |
B. | I are static, II are static |
C. | I are static, II are dynamic |
D. | I are dynamic, II are static |
E. | None of these |
Answer» E. None of these | |
64. |
What will be the output of the following C code?#include <stdio.h> int main() { char *Str[1] = {"WELCOME"}; printf("%s", Str[0]); return 0; } |
A. | Garbage value |
B. | Compilation Error |
C. | Runtime Error |
D. | WELCOME |
E. | None of these |
Answer» E. None of these | |
65. |
What will be the output of the following C code?#include <stdio.h> int main() { char str[1][20] = {"Interview Mania"}; printf("%s", str[0]); return 0; } |
A. | Garbage value |
B. | Compilation Error |
C. | Interview Mania |
D. | Nothing |
E. | None of these |
Answer» D. Nothing | |
66. |
What will be the output of the following C code?#include <stdio.h> void main() { char ch[12][16] = {"Interview", "Mania", "World"}; printf("%d", sizeof(ch[1])); } |
A. | 16 |
B. | 12 |
C. | Garbage value |
D. | Compilation Error |
E. | Runtime Error |
Answer» B. 12 | |
67. |
Which function is not called in the following C program? #include <stdio.h> void f() { printf("f"); } void fun() { f(); } void function() { fun(); } void main() { void (*p)(); p = function; p(); } |
A. | Function "f" |
B. | Function "fun" |
C. | Function "function" |
D. | All of above |
E. | None of these |
Answer» F. | |
68. |
Comment on the following two operations.int *ArrayA[] = {{11, 20, 13}, {11, 21, 13, 41}}; //- 1int ArrayB[][] = {{15, 25, 35}, {10, 25, 30, 45}}; //- 2 |
A. | Neither of them work |
B. | I works, II doesn t |
C. | II works, I doesn t |
D. | Both of them work |
E. | None of these |
Answer» E. None of these | |
69. |
What will be the output of the following C code?#include <stdio.h> void first(int (*p)(int)); int second(int); int (*funptr)(int); int ((*fun(int)))(int); int main() { funptr = fun(0); funptr(15); } int ((*fun(int k)))(int) { return second; } int second(int k) { printf("%d n", k + 1); } |
A. | 15 |
B. | Compilation Error |
C. | Undefined behaviour |
D. | 16 |
E. | None of these |
Answer» E. None of these | |
70. |
Comment on the following two operations.int *arr[] = {{11, 20, 13}, {11, 20, 31, 40}}; //- 1int array[5][5] = {{10, 12, 30}, {11, 21, 30, 14}};//- 2 |
A. | 1 won t work, 2 will work |
B. | Neither of them will work |
C. | 1 and 2, both will work |
D. | 1 will work, 2 will not |
E. | None of these |
Answer» B. Neither of them will work | |
71. |
What will be the output of the following C code?#include <stdio.h> int multiply(int p, int q, int r) { return p * q * r; } void main() { int (fun_ptr)(int, int, int); fun_ptr = multiply; printf("The multiplication of three numbers is : %d", fun_ptr(12, 2, 5)); } |
A. | The multiplication of three numbers is : 120 |
B. | Nothing |
C. | Compilation Error |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
72. |
What will be the output of the following C code?#include <stdio.h> int multiply(int p, int q, int r) { return p * q * r; } void main() { int (*fun_ptr)(int, int, int); fun_ptr = multiply; printf("The multiplication of given numbers is : %d", fun_ptr(12, 2, 5)); } |
A. | Compilation Error |
B. | Nothing |
C. | The multiplication of given numbers is : 120 |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
73. |
What will be the output of the following C code? #include void function() { printf("Interview mania World"); } void main() { void *p() = function; p++ p(); } |
A. | Illegal application of ++ to void data type & pointer function initialized like a variable |
B. | Illegal application of ++ to void data type |
C. | pointer function initialized like a variable |
D. | All of above |
E. | None of these |
Answer» B. Illegal application of ++ to void data type | |
74. |
What will be the output of the following C code?#include <stdio.h> void f(int); void (*fun)() = f; int main(int argc, char *argv[]) { fun(16); return 0; } void f(int k) { printf("%d n", k); } |
A. | Undefined behaviour |
B. | Compilation Error |
C. | Garbage value |
D. | 16 |
E. | None of these |
Answer» E. None of these | |
75. |
What will be the output of the following C code? #include <stdio.h> int subtract(int p, int q, int r) { return p - q - r; } void main() { int (*fun_ptr)(int, int, int); fun_ptr = &subtract; printf("The Subtraction of three numbers is : %d", (*fun_ptr)(21, 13, 41)); } |
A. | Nothing |
B. | The Subtraction of three numbers is : -33 |
C. | Undefined behaviour |
D. | Garbage value |
E. | Compilation Error |
Answer» C. Undefined behaviour | |
76. |
What will be the output of the following C code? #include <stdio.h> void main() { struct Employee { int id; char emp_name[30]; }; struct Employee Emp; id = 101; printf("%d", id); } |
A. | Garbage value |
B. | Compilation Error |
C. | Nothing |
D. | Null |
E. | 101 |
Answer» C. Nothing | |
77. |
What will be the output of the following C code? #include <stdio.h> void A(int (*n)(int)); int B(int); int (*P)() = B; int main() { A(P); } void A(int(*j)(int )) { j(121); } int B(int j) { printf("%d n", j); return j; } |
A. | Compilation Error |
B. | Segmentation fault |
C. | Garbage value |
D. | 121 |
E. | None of these |
Answer» E. None of these | |
78. |
What will be the output of the following C code?#include <stdio.h> void first(int (*x)(int)); int second(int i); int (*third)(int) = second; int main() { first(third(13)); } void first(int (*k)(int)) { k(12); } int second(int k) { printf("%d n", k); return k; } |
A. | Compilation Error |
B. | Nothing |
C. | Garbage value |
D. | Segmentation fault |
E. | None of these |
Answer» E. None of these | |
79. |
What will be the output of the following C code?#include <stdio.h> void function(int); void (*fun)(float) = function; int main() { fun(12); } void function(int n) { printf("%d n", n); } |
A. | 12 |
B. | Undefined behaviour |
C. | 12.000000 |
D. | Compilation Error |
E. | None of these |
Answer» C. 12.000000 | |
80. |
What will be the output of the following C code?#include <stdio.h> void function(int); void (*fun)(void) = function; int main(int argc, char *argv[]) { fun(20); return 0; } void function(int k) { printf("%d n", k); } |
A. | Compilation Error |
B. | Garbage value |
C. | 20 |
D. | Runtime Error |
E. | None of these |
Answer» B. Garbage value | |
81. |
What will be the output of the following C code?#include <stdio.h> struct clothes { int size; char brand_name[20]; }; struct clothes c; void main() { c.size = 36; printf("%s", c.brand_name); } |
A. | Compilation Error |
B. | Nothing |
C. | 36 |
D. | Garbage value |
E. | None of these |
Answer» C. 36 | |
82. |
What will be the output of the following C code?#include <stdio.h> void main() { struct color { int color_code; char color_name[30]; }; struct color c; c.color_code = 000004; printf("%s", c.color_name); } |
A. | 000004 |
B. | Compilation Error |
C. | Garbage value |
D. | Nothing |
E. | None of these |
Answer» E. None of these | |
83. |
What will be the output of the following C code?#include <stdio.h> struct color { int color_code; char color_name[20]; }; void main() { color c; c.color_name = "Yellow"; printf("Yellow"); } |
A. | Yellow |
B. | Garbage value |
C. | Compilation Error |
D. | Nothing |
E. | None of these |
Answer» D. Nothing | |
84. |
What will be the output of the following C code?#include <stdio.h> struct Employee { int id = 5; char emp_name[23]; }; void main() { struct Employee Emp; Emp.id = 102; printf("Interview Mania"); } |
A. | Interview Mania |
B. | Garbage value |
C. | Compilation Error |
D. | 102 |
E. | None of these |
Answer» D. 102 | |
85. |
What will be the output of the following C code?#include <stdio.h> struct Employee { int id; char emp_name[25]; }; void main() { struct Employee Emp; Emp.id = 101; printf("Ajit Kumar Gupta"); } |
A. | 101 |
B. | Compilation Error |
C. | Garbage value |
D. | Ajit Kumar Gupta |
E. | None of these |
Answer» E. None of these | |
86. |
What will be the output of the following C code?#include <stdio.h> void (*(f1)())(int, float); typedef void (*(*f2)())(int, float); void f3(int k, float f1); int main() { f2 p = f1; p(); } void (*(f1)())(int, float) { return f3; } void f3(int k, float f1) { printf("%d %f n", k, f1); } |
A. | Nothing |
B. | Compilation Error |
C. | Garbage value |
D. | Undefined behaviour |
E. | None of these |
Answer» B. Compilation Error | |
87. |
What will be the output of the following C code? #include <stdio.h> void (*(fun)())(int, float); typedef void (*(*A)())(int, float); void function(int k, float fun); int main() { A = fun; A(); } void (*(fun)())(int, float) { return function; } void function(int k, float fun) { printf("%d %f n", k, fun); } |
A. | Compilation Error |
B. | Garbage value |
C. | Nothing |
D. | Undefined behaviour |
E. | None of these |
Answer» B. Garbage value | |
88. |
What does this declaration say?int (*(*B)())[12]; |
A. | B is function which returns array of integers |
B. | B is function which returns function pointer which in turn returns pointer to integer array |
C. | B is pointer to the function which returns array of pointers |
D. | B is pointer to the function which returns pointer to integer array |
E. | None of these |
Answer» E. None of these | |
89. |
What will be the output of the following C code?#include <stdio.h> void (*(fun)())(int, float); void (*(*A)())(int, float) = fun; void ((*B)(int, float)); void function(int j, float fun); int main() { B = A(); B(11, 21); } void (*(fun)())(int, float) { return function; } void function(int j, float fun) { printf("%d %f n", j, fun); } |
A. | 11 21.000000 |
B. | Compilation Error |
C. | Undefined behaviour |
D. | Garbage value |
E. | None of these |
Answer» B. Compilation Error | |
90. |
What will be the output of the following C code?#include <stdio.h> int main() { int *((*ptr)())[20]; ptr(); printf("After ptr n"); } int *((*ptr)())[20] { int **s; s = (int*)malloc(sizeof(int)* 20); return s; } |
A. | After ptr |
B. | Garbage vlaue |
C. | Undefined behaviour |
D. | Compilation Error |
E. | None of these |
Answer» E. None of these | |
91. |
What will be the output of the following C code?#include &lt,stdio.h> void main() { char *n= "KRISHANA"; char *m = n + 3; printf("%c %c", *m, n[5]); } |
A. | S A |
B. | A S |
C. | KRISHANA |
D. | Compilation Error |
E. | None of these |
Answer» B. A S | |
92. |
Comment on the following declaration.int (*p)(); // i char *p[]; // ii |
A. | Both i) and ii) will work legal and flawlessly |
B. | i) is illegal, ii) is legal |
C. | i) is legal, ii) is illegal |
D. | Both i) and ii) and cannot exist due to same name |
E. | None of these |
Answer» B. i) is illegal, ii) is legal | |
93. |
What makes the following declaration denote?char *s[15]; |
A. | s is a function pointer of 15 elements returning char |
B. | s is an array of 15 element pointer to type char |
C. | s is a pointer to an array of 15 elements |
D. | All of above |
E. | None of these |
Answer» C. s is a pointer to an array of 15 elements | |
94. |
What makes the following declaration denote?int **p; |
A. | p is a pointer to an int pointer |
B. | p is a pointer to pointer to type int |
C. | p is a function pointer that returns pointer to int type |
D. | All of above |
E. | None of these |
Answer» B. p is a pointer to pointer to type int | |
95. |
Read the following expression?void (*p)(int); |
A. | p is pointer to function passing void returning int |
B. | p is pointer to void that converts its type to int |
C. | p is pointer to function passing int returning void |
D. | p is pointer to int that converts its type to void |
E. | None of these |
Answer» D. p is pointer to int that converts its type to void | |
96. |
What will be the output of the following C code?#include <stdio.h> int calc(int m, int n, int t) { return m * n * t; } void main() { int *fun_ptr; fun_ptr = calc; printf("The product of three numbers is : %d", fun_ptr(12, 10, 2)); } |
A. | Nothing |
B. | Compilation Error |
C. | Garbage value |
D. | The product of three numbers is : 240 |
E. | None of these |
Answer» C. Garbage value | |
97. |
What will be the output of the following C code?#include <stdio.h> int main() { char str[12][16] = {"Ajit", "Kumar"}; printf("%s", *str + 0); return 0; } |
A. | Compilation Error |
B. | Kumar |
C. | Ajit |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
98. |
What will be the output of the following C code?#include <stdio.h> int main() { char *ch[21] = {"Interview", "Mania"}; printf("%s", *(ch + 1)); return 0; } |
A. | Mania |
B. | Interview |
C. | Garbage value |
D. | Compilation Error |
E. | None of these |
Answer» B. Interview | |
99. |
What will be the output of the following C code?#include <stdio.h> int main() { char str[12][16] = {"Interview", "Mania"}; printf("%d", sizeof(str)); return 0; } |
A. | Interview |
B. | Mania |
C. | 192 |
D. | Garbage value |
E. | None of these |
Answer» D. Garbage value | |
100. |
What will be the output of the following C code? #include <stdio.h> int main() { char *ch = {"I", "T", "E", "R", "V", "I", "E", "W"}; printf("%s", ch); } |
A. | I |
B. | Garbage value |
C. | Runtime Error |
D. | No output |
E. | None of these |
Answer» B. Garbage value | |