Learn C MCQs

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

What is the value of x after the statement: x = 5 + 10 - 3;

1) 12

2) 10

3) 7

4) 15

Answer : Option 1

Which of the following functions is used to find the length of a string in C?

1) strlen()

2) size()

3) length()

4) strlength()

Answer : Option 1

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

1) 2

2) 1

3) 3

4) 0

Answer : Option 1

Which of the following is used to include a library in C?

1) #include

2) #include library

3) import library

4) require library

Answer : Option 1

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

1) 32

2) 24

3) 22

4) 17

Answer : Option 4

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

1) int

2) float

3) string

4) char

Answer : Option 3

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

1) 11

2) 8

3) 7

4) 12

Answer : Option 1

Which of the following operators is used to access members of a structure?

1) .

2) ->

3) ::

4) Both 1 and 2

Answer : Option 4

Which of the following functions is used to read a character from input in C?

1) getchar()

2) scanf()

3) getc()

4) All of the above

Answer : Option 4

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

1) 5

2) 10

3) 15

4) 20

Answer : Option 1