0% found this document useful (0 votes)
14 views3 pages

12th Computer CHP 10

The document contains a series of theoretical questions and answers related to input and output functions in C programming. It covers topics such as standard input/output, format specifiers, escape sequences, and the differences between various functions like scanf, printf, getch, and getche. Additionally, it explains the significance of using specific characters and syntax in input/output operations.

Uploaded by

zukihusnain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

12th Computer CHP 10

The document contains a series of theoretical questions and answers related to input and output functions in C programming. It covers topics such as standard input/output, format specifiers, escape sequences, and the differences between various functions like scanf, printf, getch, and getche. Additionally, it explains the significance of using specific characters and syntax in input/output operations.

Uploaded by

zukihusnain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

IT Series » Computer Science (MS

272
Accesa
Short Questions

Part 1: Theoretical Questions

Q.1. Define standard input.


is known as input. The inpu k
The process of giving something to compulerto the input via keyboard.
given by keyboard. The term standard input refers
Q.2. List some important functions for input. getche)
getch)
scanf() gets)
Q.3. What is meant by standard output? ouh
from computer is known às output. The
The process of getting something standard disphv
vutput reters to the output
mostly d1splayed on monitor. The termoutput of thatprogram.
monitor. The result of a program is the
names of two output functions. Where are they stored?
Q.4. Write They are slored in the header file std
printf() and puts().
Two output tunctions are
use of "printf" function? Write its syntax.
Q.5. What is the display
is used to display output on the monitor. It can funch
The printf function screen in specified format. The
syntax of printí
on
constants or values of variables
printt(Furmat String, argument_list);
control string in printf function? speri
Q.6. What is
double quotes. It may consist of Text, Format
in
is given
The controlstringParameters.
Escape sequences and
specifiers in C language?
Q.7. What is use of format
format according to which values will be
to specify the format of the vale
Format specifier is used data type of variable, field width and
determines the
and displayed. It important to be specified in I/Ooperations? ntom
specifiers are They
in 1/0 operations. prntmk
Q.8. Why format to be specified
The format
specifiers are important
variable during inut using scanf() or
type of data in a
Compiler about the
printi). two format
specifiers.
and purpose of any and character
the name od Thechara
Q.9. Write down integer format specifier integer.
Two format
specifiers include
used to read or print. a decimal
specifier %d is
specifier oc. The format to read or print a single character.
format specifier %c is
used specifiers?
symbol is used to start format
0.10. Which started with the symbol %.
Formatspecifiers are specifiers? character
forma!s

three types of format integerformat


specifier,
Q.11. List format specifiers are
Three types of specifier.
floating-point format
and
Input and Output 273

prmat specifiers for integer values.


at specifiers for integer values are l%d, %i, %o, %u, and %x.
h3. List uree format specifiers for floating-point values.
Three format specifiers for floating-point values %of, %e arnd %g.
h4. List the format specifiers for charaçter values.
The format specifiers for character values are %c and %s.
5. Write the purpose of %c and %d format specifiers.
The formal specifier %c is uSed lor single character values. The format specifier %d is
kd for signed decimal integer value
h6. Give an example to take multiple inpuls using single scanf function.
scanf("%d %d %f",&a, &b, &c),
7. What is the use of field width specifiers in C language?
Thenumber of columnsused to display a value on screen is called field-width. A field
Hth specifier describes the numbe of columns that should be used to print avalue. It
jermines how the value will be displayed on the screen.
/8. Which characters are used to modifythe formatof output?
Escape sequences are specal characters used in format string to modify the format of
lput.These characters are not displayed in the output. These characters always begin with
kkslash "\". The backslash is known as escape character.
9. Name six escape character provided by C
Six escape sequences LIsed in C language are la, \b, \f, \n, \r and \t.
2o. Write the purpose of using \n escape sequence?
This escape sequenceis used toinsert newline in output.
21. Write the purpose of using \t escape sequence?
Ihis escapesequence is used to insert a TAB in the output.
2. What is the use of "scanf" function? Write its syntax.
Ihe scanf function is used to get input from the user. The input is stored in a variable.
FSyntax of scanf function is as follows:
Scanf(control string, &variable1, &variable2, &variabie3 ...);
23. Why is the ampersand (&c) used in scanf function?
The ampersand (&) refers to the memory location of the variable in which the input is
red. It is placed before variable name.
24. What happens if the &sign is missed in thescanf function?
locate the
If the in scanf function, the function will not be able to
iable in sign It will be unable to store the value into the variable. The program will
& is missed
memory.
garbage value in the variable.
5. Differentiate between printf and scanf functions.
The printf function is used to display different values on the screen. It can display text,
stant or format. The scanf function is used to get different
values
Des of inputs fromofthevariables
User. The specified
in input is storedin variables in specified format.
V o p t1
er 0In

274
IT Series Computer
character input.
Science(MS Atm WriteCCs
names of functions used for after
thes
The three
Q.26. List functions used for character input are scanf(), getch() and getche). print("%
"getch" function?
Q.27. What is the use of
WriteCs
is usedtoinput single character from user. It is an
The getch( )functionexecuted, printf("
character". When it is the character entered by user is not abbre
"get
Q.28. What is the difference between scanf
and getch function? displayed
The scanf() function is used to get different types of inputs from the user
n WriteC s
Scanf("
value. The getch() as
needs to press Enter after typing the input is used to itu Q Write
function
character. The user does not need to press Enter after typing the input valie
Thefile i
"getche" function? C\My
Q.29. What is the use of Ans: prir
The getche function is used to input single character from user. It is an sk sin
character". When it is used, the character entered by the user is displayed on the Qs. Write
"get C
Compare getch and getche functions?
Q.30.
getch and getche are used to input single character. When getch is used. the m
getche is used, character appears
entered by user does not appear on screen. When
getche) functions?
Q.31. Which header file is required to use getch)and
Ans: pr
header file conio.h.ThsQ9. Write tt
The functions getch() and getche() are defined in the
use these functions. char a
file must be included in the program to scanf("
between gets and puts functions.
Q.32. Differentiate from the user. The input sSM10. Write t
to input string values
The gets function is used display string values on the screen. taa a, b anc
is used to
string variable. The puts function int a, b
string constant or string variable. screen in C?
Scanf(
Q.33. Which function is
used to clear the abbreviationof cer printf(
used to clear the screen. It is
an
cursor blinksonte QI1. Write
The clrscr function is cleared and the
When this function is executed, the screen is Hello'
corner. Thisfunction is
available in the header file conio.h. Sequencecharacters
and escape butescpe
Dear\
Ans: p
3
Q.34. Differentiate
between format specifiers functionsspecity
te
Q12. Write
both with input and outputare usedtotheoulpu
Format specifiers are
used
functions. Format specifierscharactersto Hellow
The
character is only used in output to insert special
data and escape Sequence characteris used
WritingtheCode
CPrAns:og
Part2: following message:
Qi3, Rewn
printf statement
the
to print float a
single

You might also like