-, -· - -- - . - - ---c,-- ----- .
8. Choo~e the ~orrect option·from the following : C'n-l ~ . .
: · · . . · ro am file ?
(1) Whi h of the following is an ex~ension of C p gr ·:
. . . . (c) s (d) t
( ) ·. . . . (b) h · ·. .
.. b f c character categories? -
·. (2) Which of the following _number refer~ to num er O ·
(a) 9... .· . .
(d) 8
(b) . 2 ,
-' · . . ~ ) .4_· .
··.· ·. · · · · ·· · · · • d · the .symbol ·= belong? '
. (3) Which of the followin~ C c.~aracter categones oes _ .. . ·
(a) Letter. . (b) :Slank Space
~pecial ~haracte~ . · . (d) Digit .
. . . ,•
(4) Which of the following is a valid keyword of C ?
. . '
(a) ofsize . ·'t-1b) ~iieof . · ~ ·(c) forsize (d) sizefor
, .
(5),I .W
•
hich of the following is an invalid: vapable name in C ? · ·
T • • ~· • • .. • • ... • • • • • • ' ' •
· .. · · -(~) Re~i~ter ::·· ~- <' : .(b) ·Reglster . .. ·: . · , (c) registre · .- ·
• • • • • ,I' '
.~Ster
(6) Which or'the foll~w1~g. is.an invalid integer constant in C ? ·
. v.t5oi<G · (b) ~xA · (c) OxB · · -. - (d) OxD .
(7) Whicl) of the following is valid real constant in C ? , . .. 1
(a) -2.0.5e5 .· \ (b) -20.Ses:s . 0) -2~.5e5 . .(d) -20.Se.5
(8) Which of. the following is valid _single character constant in c?
~a' · . · • (C) "a" . ·: (d) Both a andb
(b) '\a' · · :
·,
(9) Toe preprocessor (!mctive #define is.used to define WhiCh of the f~llowing in C? ·
(a) String constant . \_ASymbolic constants ..
(c) Integer·constant · · (d) s· 1 · · ·
. . mg e character constant · ·
_(. IO) Whlch of the following .function key is used 1 · d" · · · • · · · . · ?
0
irectly execute a program .
\/4)
. · ·
(a} F7 . (b) F9 .· · F5 (d) f8 .
6. C~ oo se th e correct optio~ fro
( 1) W hi c~ of the following
m the following: -~ 'o- \ 1· .
k~ywords refer to integer da
~ct.) . integer ta type ? /
. (b) Integer
(2) W hi ch of the following
refers to ~ empty value 7
(c) INTEGER Kci) :n ,
\_ )a~ id · (b) Void · (c) char . . (~) : float
(3) W hi ch of th e follo~µ1g
ref~rs to size·o f memory allo
cated to float as pe r gee _com
_(a ) 1 .._;' . .° . p,~ler"? ·.
(4) W hi ch of the fallowing
(b) 2 . :
U ,e 1/ 4 · .. (d) 6 . · .
is a valid keyword in C that
~ a r. identifies valid character va
· ... .· Ql)character · · lue ? .
(c) CHAR · ·. (d )~ ~ C T E R ~
(5) W hi ch of th e followin
g is .a m~er defined data type
in C ? .
(a) in t ~num .· . (c). char
(6) W hi ch of th e fo llo ~i ng (d) - float
1
is. us ed to provide an ·alias to e~ist
(a ) en um ing data types in C 7
· · (b )'d ef ·. . . ·(c)·p~inter
-. (7) 'n te ~ymbol & be lo ~g · ·, ~ ty p e d ~ f .
to. which of the following
operator types· in C ? .
' . (a) Reiational . (b) Arithmetic · (c)·Logicai . · . ~ it w is e
(8) Th e sy m bo l ! be lo ng
to w hi ch of th e following
operator type~ in C ?
(a) Relatio~al (b) -Arithmetic. . ~gical
(9) T h~ = _sy m bo l is us ed (d) Bitwise
·fo r which ~f the fo~lowing
oper~tions in C ?
·. (a ) Eq ua lit y C he e~
~ A s s i~ e n t , ·
. (c) C om m e~ t _. .
~
(d) Fonnula
(1 0) W hi ch of th e followin
~ .re fe r to _th e ~ e~ n g of va
\ ) a ~ t Increment ·. l~~++ irt C__?
... . (b) Post Decrement . · ·
(c) Pr e In cr em en t
· . (d) Pr e Dec~ement_ --~...:
.......,.:________
Choose the correct option from the foilowing : · C. h--l 2-
(1) Which of the followings are useful in C language 1/0 operations ?
. . '
(a) Monitor · (b) Keyboard ·.
' .
(c) Mouse (d) All of these
(2) Input in a program can be possible using which of th~ following device ? ·
. . '
~Keyboard (b.) Speaker (c) Printer (d) Monitor
(3) Which of the f ollowjng is not an input functions ?
(a) getchar() (b) getchO ' C puts() (d) getsO
r,
(4) · What is the output of statement; printf( ·"%4s", "~sha"); ? I '
(a) Krus · . (b) usha · ~sha . (d) Krush
. ,, .
·(5) .Which of the foll~wing function .is more appropriate for accepting a SµlQ~?
(a) getch0 ~ . · (c) getchar() . _(d) getcQ_
A~-.. . ~u u.\ .-l UC lll W lU lll l lI s1a1ement..
7. Choose the correct op
tion from the followin
g : C ~ Yl )3
(1) W ha t is the value
_of variabl~ flag after th
e e~ecution of followin
g if stat em en t ?
int flag=();
if(5 < 8) { fl ag =l ; }
~a) O \_)bn : (c ) 5 .
(2) W ha t is th e valu (d ) 8
e -of variable 1s' after th
e execution of followin
g switch statement ?
. X =. 3·,
switch ( x. ) {
case 1: s = 'A'; break;
case 2: s = 'B'; break;
case 3: s_= 'C'; break;
. \
default: s := 'D '; break;
} .
(a ) A
(b ) B
(d ) D
(3 ) What is the valu
e of variable s~m after
the execution of follow
ing statements ?
in t numf? erl=5, number2=10, Sillll
:=0;
if (numberl > number2
)
su m = su m + numberl;
else
sum = sum + number2
;
(a ) 0 - ~5
(~) ' 12
(4J What will be the output when following program segment is executed ?
int numberl=lO, number2=20;
if ( ( numberl+numher2) > 35 II (numberl > number2) )
printf("%d", number!);
else
printf("%d", number2);
(a) 10 ✓-~ (d) Error
~ 20 ~
.. ,
. (c) 35 _
(5) What will be the output when following program segment is. executed?·
char chr='A';
switch (chr)
{
case 'A': p~tf(" A"); ~reak; •
case 'B': printf("B"); break;
case 'C': printf("C"); break;
(b) B (c) C (d) Error
8. Choose the correct option from the fo~lowing : ~ f) ,..... 1
'1
. program .segme~t?
(1) How many ·times printf statement is executed in the following
. .
int numl ,,,.= 3, num2
t'
= 6;
::> -~
while(numl < num2) { ·
.'
printf(" Hello Students ... ");
numl = numl + 1;
}
. : (b) 2 (d) 6
. (a) 1
(2) Wha~ is .the ~utput of following program segment ?
' ..
int a = 5, b = 10;
do
{.
= a + 1;
a
}while( a < = b);
printf(" %d", a);
. (a) 10 . (b) 9.' 1
v(c)1_ (d)- 15
. . .
(3) What is the output of following program ~egment ?
int majn( ){
inti; · . I
for(i = 0; i < 10; i++);
printf("%d" ;_i); .
· (a) 0123456789 (c) 10
-----~----------- -------~---------
?jl?.
. ' . .
·- - - - - - - ____
. . '• ' . . - .
Computer Studie.
l
(4) What is the value of a number variable after execution of following code ?·
int number = •1;
while(number < 5){
number = number + 1;
if( number = = 3) {
continue;
}
}
(a) 1 (b) 3 (c) 5· ~ o n e of these
LABORATORY EXERCISE
7. Choose the correct option from the following : C. \') ,... \ ~
•
( 1) What happens if a C program tries to access a value fyo~ an array element whose
subscript exceeds the size of array ?
. .
(a) The element will be set to 0 .
(b) The c?mpiler would report .an ertor: .
. .
~ h e pr?gram may crash or gives garbage data ..
(d) The array _
size increases automatically.
(2) ~at will be the o~~ut of following program segment?
int num[S] =· {l, 2, 3, 4, 5};
int i, j;
i = uum[l];
j = num[2];
printf("% d~ %d, %d", i, j, num[O]);
~a) 1, 2, 3 · ~ 3, 1 . (c) 1, 2, 0 (d) 3,4,5
(3) What w_ill be the .o utput of followfug program segment ?
int num[S] = { 1, 2, 3 }; ··
. .
printf("%d, %d", num[O], n:um[3]);
(a) 1, 2 .· \7' l, 0 (c) 1, 3 (d) 2,3
j
ot a pru~1ru11.
Choose the co.rre ct op tio n fro m the fol
.
low ing : ·.c_ h-- l (o
(1) The main() fun cti on in C l~ gu ag e is a . .
·\)ef' User defined fynction · · .. (b) Lib rar y function
(c) Ke yw ord (d) Reserved function
(2)' By default the main() function returns r
(a) Char value (b) Aoat value
~Integer value · d. Double value ..
(3) . Which keyword is used as a return type when function does not return any value?
(a) int (b) main ~oid (d) auto
i s not an inbuilt library func ·on ?
(4) · Which of the following _
(a) pow() (b) printf() sumO (d) sqrt()
(5) • What will be the value of variable number2 after execution of following ·code : . ·
t
: intmainO{
int numberl = 2, number2;
number2 ·= sqr(numberl);
• I
printf("number2 = %d" ,number2);.
. . .
return O;
}
int sqr(int n) {
return(n*n);
}//End of pro~am ·
~umber2 = 4 (b) number2 - -6
(c) number2 =8 (d) number2 = 18