WorksheetsPROGRAMMING IN C MCQ
Total questions: 30
Worksheet time: 15mins
C language was developed by
James Gosling
Bjarne Stroustrup
Dennis Ritchie
Ken Thompson
Which of the following is a valid C identifier?
int
2value
_total
total-value
Which symbol is used to end a statement in C?
:
,
;
.
Which of the following is a keyword in C?
main
printf
return
value
The correct format specifier for an integer is
%f
%d
%s
%c
Which function is used to take input from the user in C?
printf()
get()
scanf()
input()
Which data type is used to store a single character?
int
float
double
char
Which operator is used to assign a value?
==
=
!=
<=
Which of the following is a relational operator?
&&
++
>
=
Which operator has the highest precedence?
=
+
*
()
What is the output of: printf("%d", 10/3);
3.33
3
0
Error
Logical AND operator in C is
&
&&
|
||
Which operator is used for incrementing a variable?
+
+=
++
--
Which header file is required for printf() and scanf()?
stdlib.h
conio.h
string.h
stdio.h
Which function is the entry point of a C program?
start()
main()
first()
begin()
Which statement is used to make a decision in C?
for
while
if
switch
The if-else statement is known as
looping statement
conditional statement
jump statement
arithmetic statement
Which statement is used to select one option from multiple choices?
if
if-else
switch
for
Which keyword is used to exit a loop immediately?
exit
continue
break
stop
Which loop is an entry-controlled loop?
do-while
while
both while and for
none
Which loop executes at least once even if the condition is false?
for
while
do-while
if
What is the correct syntax of a while loop?
while(condition) { statements; }
while { condition; }
while condition do
while(condition);
Which keyword is used to skip the current iteration of a loop?
break
continue
goto
exit
Which statement transfers control to a labeled statement?
break
continue
goto
return
The switch statement works with
float values
character and integer values
strings
double values
Which loop is best when the number of iterations is known?
while
do-while
for
goto
Which keyword ends a case in switch?
stop
exit
break
end
Infinite loop can be created using
for(;;)
while(0)
do-while(0)
if(1)
Which statement is used to exit from a function?
break
exit
continue
return
What is the output of for(i=1;i<=3;i++) printf("%d",i);
123
012
321
Error
