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 : 12

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 : strlen()

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

1) 2

2) 1

3) 3

4) 0

Answer : 2

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

1) #include <library>

2) #include library

3) import library

4) require library

Answer : #include <library>

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

1) 32

2) 24

3) 22

4) 17

Answer : 17

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

1) int

2) float

3) string

4) char

Answer : string

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

1) 11

2) 8

3) 7

4) 12

Answer : 11

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

1) .

2) ->

3) ::

4) Both 1 and 2

Answer : Both 1 and 2

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 : All of the above

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

1) 5

2) 10

3) 15

4) 20

Answer : 5