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.

Variable name resolving (number of significant characters for uniqueness of variable) depends on

A. Compiler and linker implementations
B. Assemblers and loaders implementations
C. C language
D. None
Answer» B. Assemblers and loaders implementations
2.

Variable names beginning with underscore is not encouraged. Why?

A. It is not standardized
B. To avoid conflicts since assemblers and loaders use such names
C. To avoid conflicts since library routines use such names
D. To avoid conflicts with environment variables of an operating system
Answer» D. To avoid conflicts with environment variables of an operating system
3.

What is the output of this C code(according to C99 standard)? #include struct p { int k; char c; float f; }; int main() { struct p x = {.c = 97}; printf("%f\n", x.f); }

A. 0.000000
B. Some garbage value
C. Compile time error
D. None of the mentioned
Answer» B. Some garbage value
4.

What is the output of this C code(according to C99 standard)? #include struct p { int k; char c; float f; }; int main() { struct p x = {.c = 97, .k = 1, 3}; printf("%f \n", x.f); }

A. 3.000000
B. 0.000000
C. Compile time error
D. Undefined behaviour
Answer» C. Compile time error
5.

What is the output of this C code? #include struct p { int k; char c; }; int p = 10; int main() { struct p x; x.k = 10; printf("%d %d\n", x.k, p); }

A. Compile time error
B. 10 10
C. Depends on the standard
D. Depends on the compiler
Answer» C. Depends on the standard
6.

What is the output of this C code(according to C99 standard)? #include struct p { int k; char c; float f; }; int main() { struct p x = {.c = 97, .f = 3, .k = 1}; printf("%f\n", x.f); }

A. 3.000000
B. Compile time error
C. Undefined behaviour
D. 1.000000
Answer» B. Compile time error
7.

What is the output of this C code?#include struct p { int k; char c; float f; }; int p = 10; int main() { struct p x = {1, 97}; printf("%f %d\n", x.f, p); }

A. Compile time error
B. 0.000000 10
C. Somegarbage value 10
D. 0 10
Answer» C. Somegarbage value 10
8.

What is the output of this C code? #include struct { int k; char c; } p; int p = 10; int main() { p.k = 10; printf("%d %d\n", p.k, p); }

A. Compile time error
B. 10 10
C. Depends on the standard
D. Depends on the compiler
Answer» B. 10 10
9.

What is the output of this C code? #include struct { int k; char c; }; int main() { struct p; p.k = 10; printf("%d\n", p.k); }

A. Compile time error
B. 10
C. Undefined behaviour
D. Segmentation fault
Answer» B. 10
10.

Number of bytes in memory taken by the below structure is #include struct test { int k; char c; };

A. Multiple of integer size
B. integer size+character size
C. Depends on the platform
D. Multiple of word size
Answer» B. integer size+character size
11.

Can the below code be compiled successfully? #include struct p { int k; char c; float f; }; int main() { struct p x = {.c = 97, .f = 3, .k = 1}; printf("%f\n", x.f); }

A. Yes
B. No
C. Depends on the standard
D. Depends on the platform
Answer» D. Depends on the platform
12.

What is the output of this C code? #include void main() { struct student { int no; char name[20]; }; struct student s; no = 8; printf("%d", no); }

A. Nothing
B. Compile time error
C. Junk
D. 8
Answer» C. Junk
13.

What is the output of this C code? #include

A. Nothing
B. Compile time error
C. Junk
D. 8
Answer» E.
14.

What is the output of this C code? #include struct student { int no; char name[20]; }; void main() { student s; s.no = 8; printf("hello"); }

A. Nothing
B. hello
C. Compile time error
D. Varies
Answer» D. Varies
15.

What is the output of this C code? #include struct student { int no; char name[20]; } void main() { struct student s; s.no = 8; printf("hello"); }

A. Compile time error
B. Nothing
C. hello
D. Varies
Answer» B. Nothing
16.

What is the output of this C code? #include struct student { int no = 5; char name[20]; }; void main() { struct student s; s.no = 8; printf("hello"); }

A. Nothing
B. Compile time error
C. hello
D. Varies
Answer» C. hello
17.

Which of the following cannot be a structure member?

A. Another structure
B. Function
C. Array
D. None of the mentioned
Answer» C. Array
18.

Which operator connects the structure name to its member name?

A.
B. <-
C. .
D. Both <- and .
Answer» D. Both <- and .
19.

User-defined data type can be derived by___________

A. struct
B. enum
C. typedef
D. all of the mentioned
Answer» E.
20.

Which of the following are themselves a collection of different data types?

A. string
B. structures
C. char
D. all of the mentioned
Answer» C. char
21.

What will be the output of the program ? #include int main() { int arr[1] = {10}; printf("%d", 0[arr]); return 0; }

A. 1
B. 0
C. 10
D. 6
Answer» D. 6
22.

What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes? #include void main() { int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0}; printf("%u, %u", a+1, &a+1); }

A. 65474, 65488
B. 65480, 65488
C. 65480, 65496
D. 65474, 65476
Answer» D. 65474, 65476
23.

What will be the output of the following code? void main() { int a[10]; printf("%d %d", a[-1], a[12]); }

A. 0 0
B. Garbage value 0
C. 0 Garbage Value
D. Garbage vlaue Garbage Value
Answer» E.
24.

What will be the output of the following program? void main() { char str1[] = "abcd"; char str2[] = "abcd"; if(str1==str2) printf("Equal"); else printf("Unequal"); }

A. Equal
B. Unequal
C. Error
D. None of these.
Answer» C. Error
25.

What will be printed after execution of the following code? void main() { int arr[10] = {1,2,3,4,5}; printf("%d", arr[5]); }

A. Garbage Value
B. 5
C. 6
D. 0
Answer» E.
26.

Consider the following type definition. typedef char x[10]; x myArray[5]; What will sizeof(myArray) be ? (Assume one character occupies 1 byte)

A. 15
B. 10
C. 50
D. 30
Answer» D. 30
27.

What will be the output of the program ? #include void main() { int a[5] = {5, 1, 15, 20, 25}; int i, j, m; i = ++a[1]; j = a[1]++; m = a[i++]; printf("%d, %d, %d", i, j, m); }

A. 3, 2, 15
B. 2, 3, 20
C. 2, 1, 15
D. 1, 2, 5
Answer» B. 2, 3, 20
28.

What will be the output of following program code? #include int main(void) { char p; char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8}; p = (buf + 1)[5]; printf("%d", p); return 0; }

A. 5
B. 6
C. 9
D. Error
Answer» D. Error
29.

What is the output of this C code? #include int main() { char str[11] = "hello"; char *str1 = "world"; strcat(str, str1); printf("%s %d", str, str[10]); }

A. helloworld 0
B. helloworld anyvalue
C. worldhello 0
D. Segmentation fault/code crash
Answer» B. helloworld anyvalue
30.

What is the output of this C code? #include int main() { char *str = "hello, world\n"; printf("%d", strlen(str)); }

A. Compilation error
B. Undefined behaviour
C. 13
D. 11
Answer» D. 11
31.

What is the output of this C code? #include #include int main() { char *str = "hello, world"; char str1[9]; strncpy(str1, str, 9); printf("%s %d", str1, strlen(str1)); }

A. hello, world 11
B. hello, wor 9
C. Undefined behaviour
D. Compilation error
Answer» D. Compilation error
32.

What is the output of this C code? #include int main() { char *str = "hello"; char str1[5]; strcpy(str, str1); printf("%s", str1); }

A. Compilation error
B. Undefined behaviour
C. hello, world
D. hello, wo 9
Answer» E.
33.

What is the output of this C code? #include int main() { char *str = "hello, world"; char *str1 = "hello, world"; if (strcmp(str, str1)) printf("equal"); else printf("unequal"); }

A. equal
B. unequal
C. Compilation error
D. Depends on the compiler
Answer» C. Compilation error
34.

What is the output of this C code? #include const int a = 1, b = 2; int main() { int x = 1; switch (x) { case a: printf("yes "); case b: printf("no\n"); break; } }

A. yes no
B. yes
C. no
D. Compile time error
Answer» E.
35.

Switch statement accepts.

A. int
B. char
C. long
D. all of the mentioned
Answer» E.
36.

What is the output of this C code? #include int main() { switch (printf("Do")) { case 1: printf("First\n"); break; case 2: printf("Second\n"); break; default: printf("Default\n"); break; } }

A. Do
B. DoFirst
C. DoSecond
D. DoDefault
Answer» D. DoDefault
37.

What is the output of this C code? #include #define max(a) a int main() { int x = 1; switch (x) { case max(2): printf("yes "); case max(1): printf("no "); break; } }

A. yes no
B. yes
C. no
D. Compile time error
Answer» D. Compile time error
38.

What is the output of this C code? #include int main() { float f = 1; switch (f) { case 1.0: printf("yes\n"); break; default: printf("default\n"); } }

A. yes
B. yes default
C. Undefined behaviour
D. Compile time error
Answer» E.
39.

What is the output of this C code? #include int main() { int x = 97; switch (x) { case 'a': printf("yes "); break; case 97: printf("no\n"); break; } }

A. yes
B. yes no
C. Duplicate case value error
D. Character case value error
Answer» D. Character case value error
40.

What is the output of this C code? #include int main() { int a = 1, b = 1; switch (a) { case a*b: printf("yes "); case a-b: printf("no\n"); break; } }

A. yes
B. no
C. Compile time error
D. yes no
Answer» D. yes no
41.

What is the output of this C code(When 1 is entered)? #include void main() { int ch; printf("enter a value btw 1 to 2:"); scanf("%d", &ch); switch (ch, ch + 1) { case 1: printf("1\n"); break; case 2: printf("2"); break; } }

A. 1
B. 2
C. 3
D. Run time error
Answer» C. 3
42.

What is the output of this C code(When 1 is entered)? #include void main() { char *ch; printf("enter a value btw 1 to 3:"); scanf("%s", ch); switch (ch) { case "1": printf("1"); break; case "2": printf("2"); break; } }

A. 1
B. Compile time error
C. 2
D. Run time error
Answer» C. 2
43.

What is the output of this C code? #include int main() { int x = 1, y = 0; x &&= y; printf("%d\n", x); }

A. Compile time error
B. 1
C. 0
D. Undefined behaviour
Answer» B. 1
44.

What is the output of this C code(When 2 is entered)? #include void main() { int ch; printf("enter a value btw 1 to 2:"); scanf("%d", &ch); switch (ch) { case 1: printf("1\n"); break; printf("hi"); default: printf("2\n"); } }

A. 1
B. hi 2
C. Run time error
D. 2
Answer» E.
45.

What is the output of this C code(when 1 is entered)? #include void main() { double ch; printf("enter a value btw 1 to 2:"); scanf("%lf", &ch); switch (ch) { case 1: printf("1"); break; case 2: printf("2"); break; } }

A. Compile time error
B. 1
C. 2
D. Varies
Answer» B. 1
46.

What is the output of this C code? #include int main() { int x = 2, y = 2; x /= x / y; printf("%d\n", x); return 0; }

A. 2
B. 1
C. 0.5
D. Undefined behaviour
Answer» B. 1
47.

What is the output of this C code(When 1 is entered)? #include void main() { int ch; printf("enter a value btw 1 to 2:"); scanf("%d", &ch); switch (ch) { case 1: printf("1\n"); default: printf("2\n"); } }

A. 1
B. 2
C. 1 2
D. Run time error
Answer» D. Run time error
48.

What is the output of this C code? #include int main() { int x = 2, y = 1; x *= x + y; printf("%d\n", x); return 0; }

A. 5
B. 6
C. Undefined behaviour
D. Compile time error
Answer» C. Undefined behaviour
49.

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

A. Run time error
B. Aries
C. -5
D. 5
Answer» D. 5
50.

What is the output of this C code? #include void main() { 1 < 2 ? return 1: return 2; }

A. returns 1
B. returns 2
C. Varies
D. Compile time error
Answer» E.