Learn C MCQs

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

Which of the following is the correct way to define an array of pointers in C?

1) int *arr[10];

2) int arr*;

3) int *arr();

4) None of the above

Answer : Option 1

What is the output of printf("%d", 6 % 4);?

1) 2

2) 1

3) 0

4) 6

Answer : Option 1

Which of the following statements is true regarding arrays in C?

1) Array index starts from 0.

2) Arrays can hold different data types.

3) Arrays must have a fixed size.

4) Both 1 and 3

Answer : Option 4

What will be the output of printf("%d", sizeof(char));?

1) 1

2) 2

3) 4

4) Depends on the system

Answer : Option 1

Which of the following is used to include header files in C?

1) #include

2) #define

3) import

4) require

Answer : Option 1

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

1) 1

2) 2

3) 3

4) 0

Answer : Option 1

Which of the following is a user-defined data type in C?

1) struct

2) enum

3) union

4) All of the above

Answer : Option 4

Which function is used to convert a string to a float in C?

1) atof()

2) strtof()

3) float()

4) None of the above

Answer : Option 1

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

1) 16

2) 11

3) 10

4) 8

Answer : Option 2

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

1) #define

2) const

3) Both 1 and 2

4) None of the above

Answer : Option 3