C Quick Test 1. The C language terminator is a.semicolon b.colon c.period d.

exclamation mark

2. What is false about the following A compound statement is a.A set of simple statments b.Demarcated on either side by curly brackets c.Can be used in place of simple statement d. A C function is not a compound statement.

. What is true about the following C !unctions a."eed not return any #alue b.$hould always return an integer c.$hould always return a float d.$hould always return more than one #alue.

%. &ain must be written as a.the first function in the program

b.$econd function in the program c.'ast function in the program d.any where in the program

(. Which of the following about automatic #ariables within a function is correct ) a.its type must be declared before using the #ariable b.they are local c.they are not initialised to *ero d.they are global.

+. Write one statement e,ualent to the following two statements x-s,r.a/0 return.x/0 Choose from one of the alternati#es a.return.s,r.a//0 b.printf.1s,r.a/1/0 c.return.a2a2a/0 d.printf.13d14s,r.a//0

5. Which of the following about the C comments is incorrect ) a.commentscan go o#er multiple lines b.comments can start any where in the line

1( .a line can contain comments with out any language statements d.5 b.x-+/ y-50 else y-10 a.comments can occur within comments 6. 9ead the function con#. What is the #alue of y in the following code) x-50y-70 if.7 c.int t/ : int u0 u-(.8 2 .+ 8./ gi#en below con#.c.1 d.t< 2/0 return.u70 = What a.

while. = c.2x unaltered within theloop2..00/: . =while. Which of the following is not an infinite loop ) a.x-70 do: .b. . Which of the following represents true statement either x is inthe range of 17 and (7 or y is *ero a.x--7/0 ...7 c.28 17.1+.. d..x>-17 ?? x@-(7 AA y--70 b. c. 11. = b..1 d..1/: .for.

13d14i/0= a. while.2 ..d..i/0 i-func.int i/ : if.. = 12. What does the following function print) func.B define T9CD 7 .7 d..T9CD/: .i/0 printf.i32/return 70 eale return 10 = main. b..1 c.0 i-func./ : int .

Eow does the C compiler interpret the following two statements p-pFx0 . G8G 1(.Fy0 a.-.float 1%.-.Fy b.Fy d. 1( .p-pFx.uestions 1%41(41+415 use the following alternati#es a.p-pFx.string d. 11 e 721 1+.-.Fy c.p-pFx.int b.0 .Fy !or ..-.1 .-.char c. 17e7( 15.p-pFx0 .

9ead the folllowing code B define &AH 177 B define &I" 177 .27 .x>&AH/ x-10 else if..1 c. if.<1 d.. ...16. A memory of 27 bytes is allocated to a string declared as char 2s then the following two statements are executedJ s-1Dtrance1 l-strlen..x@&I"/ x-<10 x-(70 if the initial #alue of x-2774what is the #laue after executing this code) a.277 b..(7 18.s/0 what is the #alue of l ) a.

8 d.6 c. .b.13d3d14n1L2M4no4.. Ki#en the piece of code int aL(7M0 int 2pa0 pa-a0 to access the +th element of the array which of the following is incorrect) a.n1 F 2/4no/ F 1/0 . printf..aF(/ b.2pa F (/ 21. Consider the following structureJ struct num nam: int no0 char nameL2(M0 =0 struct num nam n1LM-::1241!red1=4:1(41&artin1=4:641Neter1=4:114"icholas1==0 .21 27.2.....2.aL(M c..paL(M d.2..

848 c.ui#alent to which of the following) a.Identify the in correct expression a.-%0 b.64unpredictable #alue 22.int a0 float b0 a-b. cond 1)cond 2)cond )Jexp 1Jexp 2Jexp Jexp %0 is e.What does the abo#e statement print) a. 9egarding the scope of the #aribles0identify the incorrect statementJ a.648 b..a-b-c-d-70 float a-int b.(0 d.(0 2 .static #ariables are are automatically initialised to 7 c.646 d.if cond 1 .the address of a register #ariable is not accessiable d..static #ariables cannot be initialised with any expression 2%.automatic #ariables are automatically initialised to 7 b.a-b.

if cond exp 10 else if cond 2 exp 20 .exp 10 else if cond 2 exp 20 else if cond exp 0 else exp %0 b.if cond 1 if cond 2 if cond exp 10 else exp 20 else exp 0 else exp %0 c.if cond 1 ?? cond 2 ?? cond exp 1 Aexp 2Aexp Aexp %0 d.

not a#ailable 2+.22 b. Which of the following is in#alid a.a2-b c.3 d.O c.else if cond exp 0 else exp %0 2(.x--17/ else if.a22-b 25. What is y #alue of the code if input x-17 y-(0 if .x--8/ elae y-60 a.a>>-b d.8 . The operator for exponencation is a.aF-b b.

What does the following code do) fn.n/: case %JaF-a2r0 case JaF-a2r0 case 2JaF-a2r0 case 1JaF-a2r0 = = a.computes simple interest for one year b.computes simple interest for four year d.b.6 c.13dPn14aFF/0 .computes amount on compound interest for 1 to % years c.a@(/ printf.int n4int p4int r/ : static int a-p0 switch.5 26.computes compound interst for 1 year 28. a-70 while.+ d.

is e.infinite b..expn 1/:.calls itself b.1EiPn1/0 a.i-70i-170iF-2/ printf. Which of the following go out of the loopo if expn 2 becoming false a.. Eow many times does the loop iterated ) for .ui#alent to a loop c. 1.( c.how many times does the loop occurs) a.does not ha#e a return #alue at all 2.if. What is incorrect among teh following A recursi#e functiion a.2 c..+ 7.( d.expn 2/continue0= ..has a termination cond d..while.17 b..% d.

b.i>-7/: printf..expn 2/0 d.expn 2/continue0./ b./ c.free.=while.13u14i/ i<<0 = = how many times the loop wxecuted a./ .8 c. Consider the following program main.while..while...calloc.Qexpn 1/:if.realloc.Qexpn 2/:if.expn 1/continue0.expn 1/continue0.if. Nick out the odd one out a.do:.17 b./ d.= .= c.11 d./ :unsigned int i-170 while.infinite %.malloc..

<+ d. B define prod./ : int x-20 int y. Consider the following program main./ : int aL(M-:14 4+4547=0 int 2b0 b-?aL2M0 = the #alue of bL<1M is a.a4b/-a2b main.none +.13d14prod.+ .0 printf.(. c.1 b.6 b.xF24y<17//0 = the output of the program is a.

cQ. Consider the following program sigment int n4sum-10 switch.n/ : case 2Jsum-sumF20 case Jsum2-20 break0 defaultJsum-70= if n-24 what is the #alue of sum a. d.if.if.if./ .+ c.1? .7 b.a@b/then %.c. Identify the incorrect one 1.none 6.5 d.c--1/ a.none 5.if.1 only b.c-1/ 2.

Consider the following C code main.3u %7. !ind the output of the following program main.+ c.3o c. only d.all 8./ .c.none %1.3d b./ : int x-(4 2p0 p-?x0 printf.The format specified for hexa decimal is a.13d14FF2p/0 = a.( b.3x d.7 d.

: int i. int 2aL(M refers to a. % .pointerto a pointer .i/0 i<<0 = int func.array of pointers b.i>7/ : x-func.int n/ : static sum-70 sum-sumFn0 return.6 c.pointer to an array c.sum/0 = the final #alue of x is a.4x0 while.+ b.1 d.

d. Which of the following statements is incorrect a.uestions from %5 to (7 ...typedef union : int n(0 float n+0 = CDT0 d. %+..typedef struct new: int n10 char n20 = DATA0 b..typedef struct : int n 0 char 2n%0 =ICD0 c.Btypedef union : int n50 float n60 = TCDAT0 'ost ..

Answers to the above C questions 1<( D4C4D4C4C +<17 D4C4C4A4D 11<1( D4C4A4A4A 1+<27 R4C4D4C4A 21<2( C4D4R4D4A 2+< 7 C4R4R4A4D 1< ( R4C4C4C4R +<%7 A4R4A4R4R %1<%( A4D4D4D4A %+<(7 R4C4C4A4A .