Learn C MCQs

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

Which of the following functions can be used to find the absolute value of a number?

1) abs()

2) fabs()

3) Both 1 and 2

4) None of the above

Answer : Option 3

What is the output of printf("%d", 8 >> 2);?

1) 2

2) 4

3) 1

4) 3

Answer : Option 1

Which of the following is a valid way to declare a string?

1) char str[];

2) char str[10];

3) Both 1 and 2

4) char str;

Answer : Option 3

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

1) 16

2) 14

3) 10

4) 12

Answer : Option 1

What does the `continue` statement do in a loop?

1) Skips the current iteration

2) Ends the loop

3) Starts the loop over

4) None of the above

Answer : Option 1

What is the output of printf("%d", 1 + 2 + 3);?

1) 6

2) 5

3) 4

4) 7

Answer : Option 1

Which of the following is not a valid type in C?

1) int

2) float

3) double

4) string

Answer : Option 4

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

1) 1

2) 0

3) 5

4) 10

Answer : Option 1

Which of the following is the correct way to declare a multi-dimensional array?

1) int arr[3][4];

2) int arr[4][3];

3) Both 1 and 2

4) None of the above

Answer : Option 3

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

1) 6

2) 8

3) 5

4) 7

Answer : Option 4