Learn C MCQs

Prepare C MCQs (Multiple choice Questions) for exam and job interviews.

What is the output of printf("%d", 5 | 3);?

1) 5

2) 3

3) 7

4) 1

Answer : 7

Which operator is used to perform logical AND in C?

1) &&

2) &

3) ||

4) !

Answer : &&

Which of the following is not a standard library in C?

1) stdio.h

2) stdlib.h

3) conio.h

4) math.h

Answer : conio.h

What will be the output of printf("%d", 8 & 3);?

1) 2

2) 3

3) 1

4) 0

Answer : Option 4

Which of the following is used to define a macro in C?

1) #define

2) #macro

3) macro

4) None of the above

Answer : #define

What is the output of printf("%d", 4 * 2 / 2);?

1) 4

2) 2

3) 8

4) 1

Answer : 4

Which of the following is a correct syntax to declare a structure?

1) struct name {int a;};

2) struct {int a;};

3) struct name();

4) struct name;

Answer : struct name {int a;};

What will be the output of printf("%d", 3 + 4 * 2);?

1) 11

2) 14

3) 10

4) 7

Answer : 11

Which of the following correctly initializes an array in C?

1) int arr[5] = {1, 2, 3, 4, 5};

2) int arr[5] = (1, 2, 3, 4, 5);

3) int arr[] = {1, 2, 3, 4};

4) Both 1 and 3

Answer : Both 1 and 3

Which of the following statements is true for strings in C?

1) Strings are null-terminated.

2) Strings can be of any length.

3) Strings are mutable.

4) Both 1 and 2

Answer : Both 1 and 2