Beruflich Dokumente
Kultur Dokumente
Max. Marks: 40
[5]
[ 10 ]
) /hich one of the follo+ing statement is 0#,&E a) %he compound statement must start +ith braces i.e. 1 and end +ith 2. b) %he compound statement must be used only +ith if! +hile! do3+hile and s+itch3.case statement. c) %he statements if! +hile! do3+hile and s+itch3.case etc. can be +ritten +ithout using compound statement. d) %he statements if! +hile! do3+hile! for can be +ritten compound statement ! but s+itch3.case and function etc. can not be +ritten +ithout using compound statement. ") %he variable in C a) .ust start +ith an alphabet. b) .ust not contain sapce and special character except underscore. c) Can contain digits d) #ll of the above $) /hich of the follo+ing is used as logical #)4 operator a) 55 b) 6 6 c) 7 d) )one of the above 8) /hich one of the follo+ing bit+ise operator gives %9:E output only +hen there are dissimilar inputs a) 6 b) ; c) 5 d) <
Page 1 of 5
=) Consider the follo+ing code segment> i?@A a?$A +hile( i B 2@)1 aCCA i?aA 2 a) %he above loop executes 2@ times b) %he above loop executes 1D times c) %he above loop executes 1$ times d) %he above loop is infinite loop. E) /hich one of the follo+ing is not valid string constant a) FE>1$ '. ..G b) H9ed! /hite and (lueI c) HChap. (CountJ Fd)I d) H1. eK12I D) If i?= ! f? .1= and c? F+G then expression c 7? FpG 6 6 i C f B? 1@ +ill return> a) %9:E b) 0#,&E c) )one of the above 1@) If a?1! b?2! c? then after execution of follo+ing expression! +hat +ill be the value of the variable c L c C? (a M @ 55 a B?1@) L CCa > aNbA a) 2$ b) $ c) @.$ d) @
[ 10 ]
2) %here is absolutely no difference bet+een builtKin ,ibrary functions getch() and getche(). ) %he for loop is post tested loop. ") If a?$! then aCC and CCa +ill produce same result. $) If char arrO$P ? 1HQoodI2! then printf(HRcI!arrO"P) +ill display character FdG. 8) %he logical errors are sho+n by compiler. =) %he continue statement is used to bypass the remainder of the current pass through loop. E) %he dimension of the array can be a constant or it can be variable. D) C language allo+s arrays of more than t+oKdimension. 1@) In C the comment symbols are JS and SJ.
Page 2 of 5
Question $: Fin% the errors i& an' in the &ollo(in) pro)rams *(rite onl' errors+ 1. T includeBstdio.hM void .ain() 1 float a ? 2.2! b ? K8.2! x1 ? .@@$! x2 ? K12.EEA printf(HUR".2f R=.1fRRI! a! b)A printf(Hx1?R=. f x2 ? R=. fI! x1 x2)A getch() 2
2.
[ 10 ]
. TincludeBstdio.hM void main() 1 int a?1@@A b?aCC C 2@A printf(HRcI! b)A 2 ". TincludeBstdio.hM void main() 1 long int arrO$P ? 1 1@! 2@! @! "@! $@2A for(i?1A i B? $A iCC)1 printf(HRd NtI! arrOiP)A 2 2
T includeBstdio.hM void main() 1 printf(HJnEnter the Color(9N/N()I)A &+itch( toupper(getchar))1 Case F9G > printf(9E4)A brea*A Case F/G > printf(/-I%E)A brea*A Case F(G > printf((,:E)A brea*A 2 2
$. TincludeBstdio.hM void main() 1 char stringOP ? 1a!b!c!d!e2A i?@A +hile( string OiP 7? FJ@G) 1 printf(HRcI! stringOiP)A 2 2
Page 3 of 5
Question 5: Fin% the output o& the &ollo(in) pro)rams: 1. TincludeBstdio.hM [2] void main() 1 int abcO P ? 12 ! 12! "$! "! 2@2A int i?@!V?@! tA for(i ? @A iB"A iCC) for(V?iC1A VB$A VCC) 1 t ? abcOiPA abcOiP ? abcOVPA abcOVP ? tA 2 for(i?@A i B $A iCC) printf(HRdJtI! abcOiP)A getch()A 2 2. void main() [3] 1 char s1O1$P?1HQoodI2! s2O1@P?1H(etterI2! s O$P?1H(estI2A int first?@!i ! length1! length2A int *?@A V?@A i ? @A length1? strlen(s1)A length2 ? strlen(s2)A +hile( 1 ) 1 if(s2OVP ?? FJ@G) 1 i?@A first?1A 2 else 1 *? length1 C iA if (7first) 1 s1O*P ? s2OiPA iCCA 2else1 *? length1 C length1C iA s1O*P ? s OVPA VCCA 2 2 2 NS end of +hile SN s1O*P ? FJ@GA puts(s1)A
Page 4 of 5
getch()A 2
Page 5 of 5