Learn C MCQs

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

What is the default return type of functions in C if not specified?

1) void

2) float

3) int

4) char

Answer : Option 3

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

1) stop

2) end

3) break

4) exit

Answer : Option 3

Which of the following is the bitwise AND operator in C?

1) &&

2) &

3) |

4) and

Answer : Option 2

Which function is used to copy a string in C?

1) copy()

2) strcat()

3) strcpy()

4) string_copy()

Answer : Option 3

Which function is used to compare two strings in C?

1) strcat()

2) strcomp()

3) compare()

4) strcmp()

Answer : Option 4

What is the correct syntax to define a function in C?

1) function return_type(parameters)

2) function_name return_type()

3) return_type function_name(parameters)

4) None of the above

Answer : Option 3

Which keyword is used to prevent a variable from being modified?

1) static

2) const

3) volatile

4) register

Answer : Option 2

What is the output of the expression 10 % 3?

1) 3

2) 0

3) 1

4) 10

Answer : Option 3

What is the correct syntax to declare a two-dimensional array in C?

1) int arr(5,5);

2) int arr[5,5];

3) int arr[5][5];

4) None of the above

Answer : Option 3

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

1) 1

2) True

3) 5

4) 0

Answer : Option 1