Chapter-10(Input and output)
1
|
Which
of the following is not a valid escape code?
|
|||
|
\t
|
\r
|
\y
|
\f
|
2
|
Which
character signifies the beginning of an escape sequence?
|
|||
|
{
|
\
|
//
|
/
|
3
|
%f
is used for
|
|||
|
Double
|
Float
|
Integer
|
Short
|
4
|
Getch()
stands for
|
|||
|
Go character
|
Get character
|
Give character
|
All of these
|
5
|
An
ampersand before the name of a variable denotes
|
|||
|
Actual value
|
Variable name
|
Address
|
Data Type
|
6
|
The
general form of format specifier for the floating point value:
|
|||
|
%m.nf
|
m.n%
|
m%.nf
|
m.n%f
|
7
|
Which
of the following is NOT legal element of control string in printf statement”
|
|||
|
Ordinary characters
|
Escape sequence
|
Format specifier
|
Variables
|
8
|
Which
of the following format spercifier used for string?
|
|||
|
%f
|
%d
|
%c
|
%s
|
9
|
Format
specifier is started with symbol
|
|||
|
?
|
%
|
&
|
None
|
10
|
Which
of the following is displayed by printf function?
|
|||
|
Text
|
Constant or values of variables
|
A and B
|
None
|
11
|
The
format specifier %u is used for:
|
|||
|
Integer
|
Unsigned short
|
Unsigned float
|
Unsigned long int
|
12
|
Which
of the following is an input function:
|
|||
|
scanf
|
printf
|
sqrt()
|
getch ()
|
13
|
The
function that is used to display output on screen is called:
|
|||
|
printf
|
scanf
|
pow
|
none
|
14
|
The
function getche() is defined in:
|
|||
|
stdio.h
|
conio.h
|
string.h
|
math.h
|
Q-2: Write short answers any TEN, each question
carry 2 marks. 2x10=20
i.
Differentiate
between printf and scanf functions.
ii.
Differentiate
between gets and puts functions.
iii.
Write
output of the following program.
Char Word1, Word2, Word3;
Wor1= ‘A’;
Word2= ‘B’;
Word3= ‘C’;
Printf(“%c %c Word3”, Word1, Word2);
iv.
Write
a C statement to print the value of unsigned long y.
v.
List
out the names of different functions used for character input.
vi.
Explain
“clscr”.
vii.
Explain
“getch”.
viii.
List
out different types of format specifiers.
ix.
Which
symbol is used to start format specifiers?
x.
List
some important functions for input.
xi.
Define
standard input.
xii.
What
is control string in printf functions?
xiii.
State
the purpose of %d format specifier.
Q-3: Write detail answers any 2 from the
following questions. 2x8=16
·
Define and explain with
example “printf” and “scanf”. 1x8=8
·
Write programs. 2x4=8
(a) Write a program that displays average marks using field width of 5
characters and precision of 2 characters,
(b) Write a program that displays the ASCII code of the character typed by
the user.