wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PROGRAMMING IN C MCQ

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

C language was developed by

a)

James Gosling

b)

Bjarne Stroustrup

c)

Dennis Ritchie

d)

Ken Thompson

2.

Which of the following is a valid C identifier?

a)

int

b)

2value

c)

_total

d)

total-value

3.

Which symbol is used to end a statement in C?

a)

:

b)

,

c)

;

d)

.

4.

Which of the following is a keyword in C?

a)

main

b)

printf

c)

return

d)

value

5.

The correct format specifier for an integer is

a)

%f

b)

%d

c)

%s

d)

%c

6.

Which function is used to take input from the user in C?

a)

printf()

b)

get()

c)

scanf()

d)

input()

7.

Which data type is used to store a single character?

a)

int

b)

float

c)

double

d)

char

8.

Which operator is used to assign a value?

a)

==

b)

=

c)

!=

d)

<=

9.

Which of the following is a relational operator?

a)

&&

b)

++

c)

>

d)

=

10.

Which operator has the highest precedence?

a)

=

b)

+

c)

*

d)

()

11.

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

a)

3.33

b)

3

c)

0

d)

Error

12.

Logical AND operator in C is

a)

&

b)

&&

c)

|

d)

||

13.

Which operator is used for incrementing a variable?

a)

+

b)

+=

c)

++

d)

--

14.

Which header file is required for printf() and scanf()?

a)

stdlib.h

b)

conio.h

c)

string.h

d)

stdio.h

15.

Which function is the entry point of a C program?

a)

start()

b)

main()

c)

first()

d)

begin()

16.

Which statement is used to make a decision in C?

a)

for

b)

while

c)

if

d)

switch

17.

The if-else statement is known as

a)

looping statement

b)

conditional statement

c)

jump statement

d)

arithmetic statement

18.

Which statement is used to select one option from multiple choices?

a)

if

b)

if-else

c)

switch

d)

for

19.

Which keyword is used to exit a loop immediately?

a)

exit

b)

continue

c)

break

d)

stop

20.

Which loop is an entry-controlled loop?

a)

do-while

b)

while

c)

both while and for

d)

none

21.

Which loop executes at least once even if the condition is false?

a)

for

b)

while

c)

do-while

d)

if

22.

What is the correct syntax of a while loop?

a)

while(condition) { statements; }

b)

while { condition; }

c)

while condition do

d)

while(condition);

23.

Which keyword is used to skip the current iteration of a loop?

a)

break

b)

continue

c)

goto

d)

exit

24.

Which statement transfers control to a labeled statement?

a)

break

b)

continue

c)

goto

d)

return

25.

The switch statement works with

a)

float values

b)

character and integer values

c)

strings

d)

double values

26.

Which loop is best when the number of iterations is known?

a)

while

b)

do-while

c)

for

d)

goto

27.

Which keyword ends a case in switch?

a)

stop

b)

exit

c)

break

d)

end

28.

Infinite loop can be created using

a)

for(;;)

b)

while(0)

c)

do-while(0)

d)

if(1)

29.

Which statement is used to exit from a function?

a)

break

b)

exit

c)

continue

d)

return

30.

What is the output of for(i=1;i<=3;i++) printf("%d",i);

a)

123

b)

012

c)

321

d)

Error