Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

What will be the output of the following C code?#include <stdio.h> void main() { int p = 15 & 14 | 16; printf("%d", p); }

A. 30
B. 15
C. 16
D. Compilation Error
E. None of these
Answer» B. 15
2.

What will be the output of the following C code?#include <stdio.h> void main() { int n = 15 & 14 & 16; printf("%d", n); }

A. 15
B. Compilation Error
C. 14
D. Runtime Error
Answer» F.
3.

While swapping 2 numbers what precautions to be taken care?q = (q / p); p = p * q; q = p / q;

A. This code doesn t swap 2 numbers
B. All data types are accepted except for (char *)
C. Data type should be either of short, int and long
D. Data type should be either of float and double
E. None of these
Answer» E. None of these
4.

Which of the following option is the correct representation of the following C statement?t = p * q + r / s * u;

A. t = ((p * q) + (r / (s * u)));
B. t = ((p * q) + ((r / s)* u));
C. Both t = ((p * q) + (r / (s * u))); and t = ((p * q) + ((r / s)* u));
D. t = (p * (q +(r /(s * u))));
E. None of these
Answer» D. t = (p * (q +(r /(s * u))));
5.

Comment on the following statement.int num = 1; printf("%d, %dnum", 3*num, num++);

A. 1, 3
B. 3, 1
C. Depend on compiler
D. 3, 1num
E. None of these
Answer» D. 3, 1num
6.

Which operators of the following have same precedence?N. "!=", M. "+=", S. "<<="

A. N, M and S
B. N and S
C. N and M
D. M and S
E. None of these
Answer» E. None of these
7.

What will be the output of the following C code?#include <stdio.h> void main() { char n1 = 'N'; char n2 = 'M'; int n3 = n1 + n2 % 3 - 3 * 2; printf("%d n", n3); }

A. 74
B. N
C. M
D. Garbage value
E. Compilation Error
Answer» B. N
8.

What will be the output of the following C code?#include <stdio.h> void main() { char num1 = '2'; char num2 = 'N'; int num3 = num1 && num2 || '2'; printf("%d n", num3); }

A. N
B. 0
C. 1
D. Compilation Error
E. Garbage value
Answer» D. Compilation Error
9.

What will be the output of the following C code?#include <stdio.h> void main() { int num = 12 + 13 - 14 + 18 - 15 % 14; printf("%d n", num); }

A. Compilation Error
B. 28
C. 12
D. 13
E. Runtime Error
Answer» C. 12
10.

What will be the output of the following C function?#include <stdio.h> int main() { Function(1); } void Function(int k) { if (k > 5) exit(0); printf("%d n", k); return Function(k++); }

A. 5 4 3 2 1
B. 1 2 3 4 5
C. 4 3 2 1
D. Compilation Error
E. Stack overflow
Answer» F.
11.

What will be the output of the following C code?#include <stdio.h> void main() { int t1 = 18; int t2 = 14 * 16 + 13 * 14 < 13 ? 14 : 13; printf("%d n", t2); }

A. 12
B. 13
C. 14
D. 15
E. 16
Answer» C. 14
12.

What will be the output of the following C code?#include <stdio.h> void main() { int n = 6 * 4 % 7 - 12 + 4; printf("%d", n); }

A. -12
B. Compilation Error
C. -5
D. Runtime Error
E. None of these
Answer» D. Runtime Error
13.

What will be the output of the following C code?#include <stdio.h> void main() { int p = 3 + 5 + 4 * 6 / 4 - 6; printf("%d", p); }

A. 4
B. 5
C. 6
D. 7
E. 8
Answer» F.
14.

What will be the output of the following C code? #include <stdio.h> void main() { int var = 15 - 14 + 12 * 15; printf("%d", var); }

A. 15
B. 14
C. 12
D. 811
E. 181
Answer» F.
15.

What will be the output of the following C code? #include <stdio.h> void main() { int n = 15; double m = n++ + ++n + n--; printf("%d", n); }

A. 12
B. 14
C. 16
D. 18
E. 20
Answer» D. 18
16.

What will be the output of the following C code?#include <stdio.h> void main() { double m = 5 & 3 && 4 || 5 | 6; printf("%lf", m); }

A. Compilation Error
B. 4.000000
C. 3.000000
D. 2.000000
E. 1.000000
Answer» F.
17.

What will be the output of the following C code? #include <stdio.h> void main() { double b = 3 && 5 & 4 % 3; printf("%lf", b); }

A. 1.000000
B. 2.000000
C. 3.000000
D. 4.000000
E. 5.000000
Answer» B. 2.000000
18.

What will be the output of the following C code?#include <stdio.h> int main() { int t1 = 3, t2 = 5; int t3 = ~t1 & t2; printf("%d n", t3); }

A. -3
B. 5
C. 3
D. -5
E. 4
Answer» F.
19.

What will be the output of the following C code?#include <stdio.h> int main() { int num1 = 5, num2 = 6; if (!num1 && num2) printf("Wrong n"); else printf("Right n"); }

A. Runtime Error
B. Undefined behaviour
C. Compilation Error
D. Wrong
E. Right
Answer» F.
20.

What will be the output of the following C code?#include <stdio.h> int main() { int a = 4, b = 4; int c = a ^ b & 3; printf("%d n", c); }

A. Compilation Error
B. 4
C. 3
D. Runtime Error
E. None of these
Answer» C. 3
21.

What will be the output of the following C code? #include <stdio.h> void main() { double n = 5 % 3 & 4 + 5 * 6; printf("%lf", n); }

A. 3
B. 4
C. 3.000000
D. 2
E. 2.00000
Answer» F.
22.

What will be the output of the following C code?#include <stdio.h> void main() { int p = 3 * 5 + 3 - 4; printf("%d", p); }

A. Compilation Error
B. Garbage value
C. Runtime Error
D. 14
E. None of these
Answer» E. None of these
23.

What will be the output of the following C code?#include <stdio.h> int main() { int a = 4, b = 3; int c = a && b = 4; printf("%d n", c); }

A. 3
B. 4
C. Runtime Error
D. Compilation Error
E. None of these
Answer» E. None of these
24.

What will be the final value of c in the following C code snippet? (Initial values: p = 1, q = 2, r = 1)r += (-r) ? p : q;

A. r = 2
B. r = 3
C. r = 1
D. Syntax Error
E. None of these
Answer» B. r = 3
25.

Which expression has to be present in the following?expression1 ? expression2 : expression3;

A. expression3
B. expression2
C. expression1
D. All of above
E. None of these
Answer» E. None of these
26.

What will be the data type of the following expression? (Initial data type: n = int, num1 = double, num2 = float)expression (n < 25)? num1 : num2;

A. float
B. double
C. int
D. All of above
E. None of these
Answer» C. int
27.

What will be the output of the following C code?#include <stdio.h> void main() { 2 < 3 ? return 2 : return 3; }

A. Runtime Error
B. 2
C. 3
D. Compilation Error
E. None of these
Answer» E. None of these
28.

What will be the output of the following C code?#include <stdio.h> void main() { int num1 = 12; int num2 = 10; int num3 = num1 < num2 ? num1 = num2 : num2++; printf("%d", num3); }

A. Compilation Error
B. 12
C. Runtime Error
D. 10
E. None of these
Answer» E. None of these
29.

What will be the value of the following assignment expression?(p = fun())!= 2 considering fun() returns 3

A. 1
B. 0
C. 5
D. 6
E. None of these
Answer» F.
30.

What is the type of the following assignment expression if p is of type float and q is of type int?q = p + q;

A. float
B. double
C. int
D. there is no type for an assignment expression
E. None of these
Answer» D. there is no type for an assignment expression
31.

What will be the output of the following C code?#include <stdio.h> int main() { int p = 2, q = 1; p &&= q; printf("%d n", p); }

A. Compilation Error
B. 2
C. 1
D. Runtime Error
E. None of these
Answer» B. 2
32.

What will be the output of the following C code? #include <stdio.h> int main() { int p = 4, q = 4; p /= p / q; printf("%d n", p); return 0; }

A. 1
B. 2
C. 3
D. 4
E. None of these
Answer» E. None of these
33.

What will be the output of the following C code?#include <stdio.h> int main() { int p = 5, q = 4; p *= p + q; printf("%d n", p); return 0; }

A. 5
B. 4
C. 45
D. Compilation Error
E. None of these
Answer» D. Compilation Error
34.

What will be the output of the following C code snippet?#include <stdio.h> void main() { unsigned int m = -10; printf("%d", m); }

A. -10
B. Compilation Error
C. Runtime Error
D. Garbage value
E. None of these
Answer» B. Compilation Error
35.

What will be the output of the following C code snippet? #include <stdio.h> void main() { 2 < 3 ? return 2: return 3; }

A. 2
B. Runtime Error
C. 3
D. Compilation Error
E. None of these
Answer» E. None of these
36.

What will be the output of the following C code?#include <stdio.h> void main() { char p = 'p'; int q = (p % 10)++; printf("%d n", q); }

A. 10
B. Compilation Error
C. p
D. Runtime Error
E. None of these
Answer» C. p
37.

What will be the output of the following C code? #include <stdio.h> void main() { int num1 = 2, num2 = 0, num3 = 6; int Res = num1 && num2 && num3++; printf("%d", num3); }

A. 0
B. 2
C. 6
D. 7
E. None of these
Answer» D. 7
38.

What will be the output of the following C code? #include <stdio.h> void main() { int var1 = 2, var2 = 0, var3 = 6; int R = var1 && var2 || var3++; printf("%d", var3); }

A. 2
B. 7
C. 6
D. Compilation Error
E. None of these
Answer» C. 6
39.

What will be the output of the following C code?#include <stdio.h> int main() { int p = 20, q = 10, r = 10; int s; s = p == (q + r); printf("%d", s); }

A. 20
B. 10
C. Compilation Error
D. 1
E. None of these
Answer» E. None of these
40.

What will be the output of the following C code?#include <stdio.h> void main() { int n = 12; int num = 2 == 3 && n++; printf("%d %d", num, n); }

A. 12
B. 2
C. 3
D. 0 12
E. 12 0
Answer» E. 12 0
41.

What will be the output of the following C code?#include <stdio.h> int main() { int p = 12, q = 6, r = 4; q != !p; r = !!p; printf("%d t%d", q, r); }

A. 4
B. 6
C. 12
D. 6 1
E. 1 6
Answer» E. 1 6
42.

What will be the final value of n4 in the following C code?#include <stdio.h> int main() { int n1 = 8, n2 = 4, n3 = 4; int n4; n4 = n2 + n3 == n1; printf("%d", n4); }

A. 8
B. 4
C. 1
D. 0
E. None of these
Answer» D. 0
43.

What will be the output of the following C code?#include <stdio.h> int main() { int num = 12; if (num == num--) printf("TRUE 1 t"); num = 10; if (num == --num) printf("TRUE 2 t"); }

A. TRUE 2
B. TRUE 1
C. Compilation Error
D. Runtime Error
E. None of these
Answer» B. TRUE 1
44.

What will be the output of the following C code?#include <stdio.h> int main() { int var1 = 16; double var2 = 3.26; int var3; var3 = var1 + var2; printf("%d", var3); }

A. 16
B. 3.26
C. 19
D. Compilation Error
E. None of these
Answer» D. Compilation Error
45.

What will be the output of the following C code?#include <stdio.h> int main() { int k = 2; if (k++ && (k == 3)) { printf("Yes n"); } else { printf("No n"); } }

A. No
B. Compilation Error
C. 3
D. Yes
E. None of these
Answer» E. None of these
46.

What will be the final value of L in the following C code?#include <stdio.h> int main() { int k = 12, L = 0; if (k || (L = k + 12)) //do something ; }

A. 0
B. Nothing
C. 12
D. Compilation Error
E. None of these
Answer» B. Nothing
47.

What will be the final value of L in the following C code?#include <stdio.h> int main() { int k = 0, L = 0; if (k && (L = k + 12)) //do something ; }

A. Nothing
B. 0
C. Depends on language standard
D. Depends on the compiler
E. None of these
Answer» C. Depends on language standard
48.

What will be the output of the following C code?#include <stdio.h> void main() { int n1 = 1, n2 = 3, n3 = 4; int R = n1 & n2 | n3; printf("%d", R); }

A. 1
B. 2
C. 3
D. 4
E. 5
Answer» F.
49.

What will be the output of the following C code?#include <stdio.h> int main() { int n1 = 5, n2 = 0, n3 = 7; n1 > n2 ? printf("%d", n3) : return n3; }

A. 5
B. 7
C. Compilation Error
D. Runtime Error
E. None of these
Answer» D. Runtime Error
50.

What will be the output of the following C code?#include <stdio.h> void main() { int num = 0; if (num = 0) { printf("It's zero n"); } else { printf("It's not zero n"); } }

A. Compilation Error
B. It's zero
C. Runtime Error
D. It's not zero
E. None of these
Answer» E. None of these