Learn C MCQs

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

Which of the following data types can be used to create a file pointer in C?

1) FILE

2) char

3) int

4) void

Answer : Option 1

Which of the following is a valid variable name in C?

1) 1variable

2) variable_1

3) variable-1

4) variable 1

Answer : Option 2

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

1) 2

2) 2.5

3) 3

4) 2.0

Answer : Option 1

Which of the following functions is used to convert a string to an integer in C?

1) atoi()

2) strtoi()

3) convert()

4) parseInt()

Answer : Option 1

Which operator is used to get the address of a variable?

1) *

2) &

3) ->

4) #

Answer : Option 2

Which keyword is used to declare an array in C?

1) array

2) list

3) set

4) None of the above

Answer : Option 4

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 a valid declaration of a pointer in C?

1) int *ptr;

2) int ptr*;

3) *int ptr;

4) int ptr;

Answer : Option 1

Which function can be used to read a line of text in C?

1) getline()

2) fgets()

3) getchar()

4) readline()

Answer : Option 2

Which of the following is a correct syntax to declare a constant in C?

1) const int x;

2) #define x 10

3) int x = 10;

4) All of the above

Answer : Option 4