Explore topic-wise MCQs in C Programming.

This section includes 44 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.

The expression of the right hand side of operators doesn't get evaluated if the left hand side determines the outcome.

A. True
B. False
Answer» B. False
2.

In the expression the order of Assignment is NOT decided by Associativity of operators

A. True
B. False
Answer» C.
3.

Are the following two statement same?

A. Yes
B. No
Answer» C.
4.

Will the expression be disallowed by the compiler?

A. Yes
B. No
Answer» C.
5.

Which of the following is the correct order of evaluation for the below expression?

A. * / % + - =
B. = * / % + -
C. / * % - + =
D. * % / - + =
Answer» B. = * / % + -
6.

In which order do the following gets evaluated

A. 2134
B. 1234
C. 4321
D. 3214
Answer» B. 1234
7.

Which of the following is the correct order if calling functions in the below code?

A. f1, f2, f3
B. f3, f2, f1
C. Order may vary from compiler to compiler
D. None of above
Answer» D. None of above
8.

Which of the following are unary operators in C?

A. 1, 2
B. 1, 3
C. 2, 4
D. 1, 2, 3
Answer» E.
9.

What will be the output of the program?_x000D_ #include_x000D_ int main()_x000D_ {_x000D_ int i=4, j=-1, k=0, w, x, y, z;_x000D_ w = i || j || k;_x000D_ x = i && j && k;_x000D_ y = i || j &&k;_x000D_ z = i && j || k;_x000D_ printf("%d, %d, %d, %d\n", w, x, y, z);_x000D_ return 0;_x000D_ }

A. 1, 1, 1, 1
B. 1, 1, 0, 1
C. 1, 0, 0, 1
D. 1, 0, 1, 1
Answer» E.
10.

What will be the output of the program?_x000D_ #include_x000D_ int main()_x000D_ {_x000D_ int x=12, y=7, z;_x000D_ z = x!=4 || y == 2;_x000D_ printf("z=%d\n", z);_x000D_ return 0;_x000D_ }

A. z=0
B. z=1
C. z=4
D. z=2
Answer» C. z=4
11.

What will be the output of the program?_x000D_ #include_x000D_ int main()_x000D_ {_x000D_ int a=100, b=200, c;_x000D_ c = (a == 100 || b > 200);_x000D_ printf("c=%d\n", c);_x000D_ return 0;_x000D_ }

A. c=100
B. c=200
C. c=1
D. c=300
Answer» D. c=300
12.

What will be the output of the program?_x000D_ #include_x000D_ int main()_x000D_ {_x000D_ int i=2;_x000D_ int j = i + (1, 2, 3, 4, 5);_x000D_ printf("%d\n", j);_x000D_ return 0;_x000D_ }

A. 4
B. 7
C. 6
D. 5
Answer» C. 6
13.

What will be the output of the program?_x000D_ #include_x000D_ int main()_x000D_ {_x000D_ int i=-3, j=2, k=0, m;_x000D_ m = ++i || ++j && ++k;_x000D_ printf("%d, %d, %d, %d\n", i, j, k, m);_x000D_ return 0;_x000D_ }

A. 2, 2, 0, 1
B. 1, 2, 1, 0
C. -2, 2, 0, 0
D. -2, 2, 0, 1
Answer» E.
14.

What will be the output of the program?_x000D_ #include_x000D_ int main()_x000D_ {_x000D_ int i=-3, j=2, k=0, m;_x000D_ m = ++i && ++j || ++k;_x000D_ printf("%d, %d, %d, %d\n", i, j, k, m);_x000D_ return 0;_x000D_ }

A. 1, 2, 0, 1
B. -3, 2, 0, 1
C. -2, 3, 0, 1
D. 2, 3, 1, 1
Answer» D. 2, 3, 1, 1
15.

What will be the output of the program?_x000D_ #include_x000D_ int main()_x000D_ {_x000D_ int i=-3, j=2, k=0, m;_x000D_ m = ++i && ++j && ++k;_x000D_ printf("%d, %d, %d, %d\n", i, j, k, m);_x000D_ return 0;_x000D_ }

A. -2, 3, 1, 1
B. 2, 3, 1, 2
C. 1, 2, 3, 1
D. 3, 3, 1, 2
Answer» B. 2, 3, 1, 2
16.

Which of the following is the correct order if calling functions in the below code?_x000D_ a = f1(23, 14) * f2(12/4) + f3();

A. f1, f2, f3
B. f3, f2, f1
C. Order may vary from compiler to compiler
D. None of above
Answer» D. None of above
17.

What will be the output of the program? #include int main() { int i=2; int j = i + (1, 2, 3, 4, 5); printf("%d\n", j); return 0; }

A. 4
B. 7
C. 6
D. 5
Answer» C. 6
18.

What will be the output of the program? #include int main() { int i=-3, j=2, k=0, m; m = ++i && ++j || ++k; printf("%d, %d, %d, %d\n", i, j, k, m); return 0; }

A. 1, 2, 0, 1
B. -3, 2, 0, 1
C. -2, 3, 0, 1
D. 2, 3, 1, 1
Answer» D. 2, 3, 1, 1
19.

What will be the output of the program? #include int main() { int i=3; i = i++; printf("%d\n", i); return 0; }

A. 3
B. 4
C. 5
D. 6
Answer» C. 5
20.

What will be the output of the program? #include int main() { int x=4, y, z; y = --x; z = x--; printf("%d, %d, %d\n", x, y, z); return 0; }

A. 4, 3, 3
B. 4, 3, 2
C. 3, 3, 2
D. 2, 3, 3
Answer» E.
21.

What will be the output of the program? #include int main() { char ch; ch = 'A'; printf("The letter is"); printf("%c", ch >= 'A' && ch <= 'Z' ? ch + 'a' - 'A':ch); printf("Now the letter is"); printf("%c\n", ch >= 'A' && ch <= 'Z' ? ch : ch + 'a' - 'A'); return 0; }

A. The letter is aNow the letter is A
B. The letter is ANow the letter is a
C. Error
D. None of above
Answer» B. The letter is ANow the letter is a
22.

What will be the output of the program? #include int main() { int a=100, b=200, c; c = (a == 100 || b > 200); printf("c=%d\n", c); return 0; }

A. c=100
B. c=200
C. c=1
D. c=300
Answer» D. c=300
23.

What will be the output of the program? #include int main() { int k, num=30; k = (num>5 ? (num <=10 ? 100 : 200): 500); printf("%d\n", num); return 0; }

A. 200
B. 30
C. 100
D. 500
Answer» C. 100
24.

What will be the output of the program? #include int main() { int i=2; printf("%d, %d\n", ++i, ++i); return 0; }

A. 3, 4
B. 4, 3
C. 4, 4
D. Output may vary from compiler to compiler
Answer» E.
25.

The expression of the right hand side of || operators doesn't get evaluated if the left hand side determines the outcome.

A. 1
B.
Answer» B.
26.

Two different operators would always have different Associativity.

A. Yes
B. No
Answer» C.
27.

Will the expression *p = p be disallowed by the compiler?

A. Yes
B. No
Answer» C.
28.

What will be the output of the program? #include int main() { static int a[20]; int i = 0; a[i] = i ; printf("%d, %d, %d\n", a[0], a[1], i); return 0; }

A. 1, 0, 1
B. 1, 1, 1
C. 0, 0, 0
D. 0, 1, 0
Answer» D. 0, 1, 0
29.

What will be the output of the program? #include int main() { int x=12, y=7, z; z = x!=4 || y == 2; printf("z=%d\n", z); return 0; }

A. z=0
B. z=1
C. z=4
D. z=2
Answer» C. z=4
30.

What will be the output of the program? #include int main() { int i=-3, j=2, k=0, m; m = ++i || ++j && ++k; printf("%d, %d, %d, %d\n", i, j, k, m); return 0; }

A. 2, 2, 0, 1
B. 1, 2, 1, 0
C. -2, 2, 0, 0
D. -2, 2, 0, 1
Answer» E.
31.

Every operator has an Associativity

A. Yes
B. No
Answer» B. No
32.

What will be the output of the program? #include int main() { int x=55; printf("%d, %d, %d\n", x<=55, x=40, x>=10); return 0; }

A. 1, 40, 1
B. 1, 55, 1
C. 1, 55, 0
D. 1, 1, 1
Answer» B. 1, 55, 1
33.

Associativity of an operator is either Left to Right or Right to Left.

A. 1
B.
Answer» B.
34.

In the expression a=b=5 the order of Assignment is NOT decided by Associativity of operators

A. 1
B.
Answer» C.
35.

What will be the output of the program? #include int main() { int i=4, j=-1, k=0, w, x, y, z; w = i || j || k; x = i && j && k; y = i || j &&k; z = i && j || k; printf("%d, %d, %d, %d\n", w, x, y, z); return 0; }

A. 1, 1, 1, 1
B. 1, 1, 0, 1
C. 1, 0, 0, 1
D. 1, 0, 1, 1
Answer» E.
36.

Assuming, integer is 2 byte, What will be the output of the program? #include int main() { printf("%x\n", -2<<2); return 0; }

A. ffff
B. 0  
C. fff8
D. Error
Answer» D. Error
37.

What will be the output of the program? #include int main() { int i=-3, j=2, k=0, m; m = ++i && ++j && ++k; printf("%d, %d, %d, %d\n", i, j, k, m); return 0; }

A. -2, 3, 1, 1
B. 2, 3, 1, 2
C. 1, 2, 3, 1
D. 3, 3, 1, 2
Answer» B. 2, 3, 1, 2
38.

In which order do the following gets evaluated 1. Relational 2. Arithmetic 3. Logical 4. Assignment

A. 2134
B. 1234
C. 4321
D. 3214
Answer» B. 1234
39.

Are the following two statement same? 1. a <= 20 ? (b = 30): (c = 30); 2. (a <=20) ? b : (c = 30);

A. Yes
B. No
C. Yes
D. No
Answer» C. Yes
40.

Which of the following are unary operators in C? 1. ! 2. sizeof 3. ~ 4. &&

A. 1, 2
B. 1, 3
C. 2, 4
D. 1, 2, 3
Answer» E.
41.

Which of the following is the correct usage of conditional operators used in C?

A. a>b ? c=30 : c=40;
B. a>b ? c=30;
C. max = a>b ? a>c?a:c:b>c?b:c
D. return (a>b)?(a:b)
Answer» D. return (a>b)?(a:b)
42.

Associativity has no role to play unless the precedence of operator is same.

A. 1
B.
C. 1
D.
Answer» B.
43.

Which of the following is the correct order if calling functions in the below code? a = f1(23, 14) * f2(12/4) + f3();

A. f1, f2, f3
B. f3, f2, f1
C. Order may vary from compiler to compiler
D. None of above
Answer» D. None of above
44.

Which of the following is the correct order of evaluation for the below expression?z = x + y * z / 4 % 2 - 1

A. * / % + - =
B. = * / % + -
C. / * % - + =
D. * % / - + =
Answer» B. = * / % + -