wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz on Input output & if Stmts

Total questions: 30

Worksheet time: 30mins

Name
Class
Date
1.
A console is a command line interface to take inputs from stdin and display outputs in stdout. Which of the following constitute console?
a)
The Mouse, The Keyboard
b)
The CPU , The Mouse
c)
The Screen, The Keyboard
d)
The CPU, The Screen
2.
C language has, scanf and printf as built-in I/O functions. To which category does scanf() function belong to?
a)
Un-Formatted Input Function
b)
Formatted Input Function
c)
Un-Formatted Output Function
d)
Formatted Output Function
3.
C language has, scanf and printf as built-in I/O functions. To which category does print() function belong to?
a)
Un-Formatted Input Function
b)
Formatted Input Function
c)
Un-Formatted Output Function
d)
Formatted Output Function
4.
Format specifier tells compiler the datatype of the variable. What format specifier is used for signed int datatype?
a)
%lf
b)
%f
c)
%ld
d)
%d
5.
Format specifier tells compiler the datatype of the variable. What format specifier is used for signed long int datatype?
a)
%lf
b)
%f
c)
%ld
d)
%d
6.
Format specifier tells compiler the datatype of the variable. What format specifier is used for float datatype?
a)
%lf
b)
%f
c)
%ld
d)
%d
7.
Format specifier tells compiler the datatype of the variable. What format specifier is used for double datatype?
a)
%lf
b)
%f
c)
%ld
d)
%d
8.
Format specifier tells compiler the datatype of the variable. What format specifier is used for char datatype?
a)
%c
b)
%d
c)
%f
d)
%s
9.
Format specifier tells compiler the datatype of the variable. What format specifier is used for string datatype?
a)
%c
b)
%d
c)
%f
d)
%s
10.

What is the output of the code,

printf("%06.2f", 6.66666);

a)
6.66667
b)
6.66666
c)
006.66
d)
006.67
11.

What is the output of the code,

printf("%6.3f", 66666.66666);

a)
66.667
b)
66666.667
c)
66666.6
d)
666.666
12.
In the printf("%-10.4f", a); statement,what does the (-) sign represent?
a)
printing - sign before the value of a
b)
subtracting 10 from the value of variable a
c)
right justification
d)
left justification
13.

What is the output of the code,

printf("%.3s", "hellohere");

a)
hel
b)
hellohere
c)
ere
d)
helloh.ere
14.
Escape sequences in c language are also called as ____________
a)
Frontslash characters
b)
Backslash characters
c)
Backspace Characters
d)
Shift Characters
15.
We want to print : I secured 60%. Which is the correct statement? \' is an escape sequence representing _____________
a)
int a = 60;<br />printf("%d", a%);
b)
int a = 60%;<br />printf("%d", a);
c)
int a = 60;<br />printf("%d%%",a);
d)
int a = 60;<br />printf("%d%%",a, %);
16.

What is the output of the statement?

printf("marks \\ total");

a)
marks \ total
b)
marks \\ total
c)
marks total
d)
Error
17.
What is the input function that reads a single character, the instant it is typed, without waiting for the Enter key to be hit.
a)
scanf()
b)
gets()
c)
getchar()
d)
getch()
18.
What is the input function that reads a single character, and displays it on the screen, the instant it is typed, without waiting for the Enter key to be hit.
a)
getch()
b)
getche()
c)
getchar()
d)
gets()
19.
What is the input function that reads a single character, and displays it on the screen, but it needs the Enter key to be hit.
a)
getch()
b)
getche()
c)
getchar()
d)
gets()
20.
The program needs to read "I have input data" typed by keyboard. Which fuction, should be used for this?
a)
getch()
b)
getche()
c)
getchar()
d)
gets()
21.
The program needs to output "I have received data" to the monitor. Which fuction, should be used for this?
a)
gets()
b)
puts()
c)
getch()
d)
putch()
22.
When the instructions are executed in the same order, as they appear in a program, then such control of instruction is called as ______________
a)
Sequence Control Instruction
b)
Selection or Decision Control Instruction
c)
Repetition or Loop Control Instruction
d)
Case Control Instruction
23.
Which of the following is used for writing a decision making statement?
a)
for
b)
while
c)
do…while
d)
if
24.
Which of the following is used for bi-directional control statement?
a)
while
b)
if - else
c)
do…while
d)
for
25.
Which of the following is used for multi-directional control statement?
a)
while
b)
if
c)
switch
d)
for
26.

What will be the output for the following program?

void main()

{

int a=300,b,c;

if(a>=400)

b=300;

c=200;

printf(“\n%d ,%d”,b,c);

}

a)
300, 200
b)
200, 200
c)
garbage value,200
d)
garbage value, garbage value
27.

What will be the output for the following program?

void main()

{

int a=500,b,c;

if(a>=400)

b=300;

c=200;

printf(“\n%d ,%d”,b,c);

}

a)
300, 200
b)
200, 200
c)
garbage value,200
d)
garbage value, garbage value
28.

What will be the output for the following program?void main()

{

int i=65;

char j=’A’;

if(i==j)

printf(“BETA”);

else

printf(“Bye”);

}

a)
Bye
b)
BETA
c)
No output
d)
garbage value
29.

What will be the output for the following program?

void main()

{

int i=5;

if (i = 4)

printf(“The value of i is 5”);

else

printf(“The value of i is not 5”);

}

a)
The value of i is 5
b)
Garbage value
c)
The value of i is not 5
d)
Error
30.
What is the ASCII value for "ESC" key?
a)
13
b)
14
c)
27
d)
26