Learn C MCQs

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

What will be the output of printf("%d", 15 >> 1);?

1) 7

2) 8

3) 15

4) 3

Answer : 7

Which of the following is used to terminate a loop in C?

1) continue

2) exit

3) break

4) return

Answer : break

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

1) 15

2) 20

3) 30

4) None of the above

Answer : 15

What does the keyword `static` mean when applied to a variable in C?

1) The variable retains its value between function calls.

2) The variable cannot be modified.

3) The variable is a constant.

4) None of the above

Answer : The variable retains its value between function calls.

Which of the following is a valid return type for a function in C?

1) void

2) int

3) char

4) All of the above

Answer : All of the above

Which of the following data types can hold a decimal value in C?

1) int

2) float

3) char

4) short

Answer : float

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

1) 12

2) 13

3) 14

4) 15

Answer : 14

Which of the following statements is used to create a loop in C?

1) for

2) while

3) do while

4) All of the above

Answer : All of the above

What is the correct syntax to declare a pointer to a function in C?

1) int (*funcPtr)();

2) int *funcPtr();

3) funcPtr *int();

4) int funcPtr();

Answer : int (*funcPtr)();

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

1) 0

2) 1

3) 5

4) Error

Answer : 1