Вы находитесь на странице: 1из 4

C Questions

Total Marks: 30 I. Answer the following: [5 marks each] 1. Determine which of the following are Valid identifiers. If invalid, state the reason. (a) Sample1 (b) 5sample (c) Data_ (d) !et"rn (e) #fine (f) Variable (g) $1%&'&%1&& (h) (ame ) age (i) _val (*) (ame_and_age +. /. (a) (b) (c) (d) (e) 4. II. ,hat are the characteristics of arra-s. ,hich of the following are invalid. ,h-. - 0 1 0 a223 - 0 1 0 22a3 - 0 2a3 - 20 a3 - 20 2a3 ,hat is a storage class and what are the different storage classes. [

Choose the right answer: mark each] 1. 5redict the o"tp"t of the following program. int f"nct+(int b) 6 if(b00 &) ret"rn b3 else f"nct1(b%%)3 7 int f"nct1(int a) 6 if(a 00 &) ret"rn a3 else f"nct+(a%%)3 7 int main()

6 int a 0 3 printf(89d:,f"nct1(a)3 ret"rn &3 7 (a) (b) (c) (d) +. & ;ompile <time error Infinite loop ,hat will be the o"tp"t of the following program. int main() 6 int a 0 5&&, b 0 1&&, c 0 /&, d 0 4&, e 0 1$3 if((((a=b).c>d)=0e)))?((e@0d).((aA5)00b)>(c 00 d))) printf(8S"ccess:)3 else printf(8Bail"re:)3 ret"rn &3 7 VCDID > S"ccess VCDID > Bail"re I(VCDID (one of the above ,hat will be the o"tp"t of the following program.
int main() { int i=5; printf("\n%d",++i + ++i + ++i + ++i + ++i ); }

(a) (b) (c) (d) /.

(a) (b) (c) (d) 4.

14 41 4& 15

C pointer that does not point to an-thing is called a ____________ pointer (a) Void pointer (b) ("ll pointer (c) Either of the above (d) (either of the above Docal variables can be store b- compiler (a) in register or heap (b) in register or stacF

5.

(c) in stacF or heap . (d) global memor-. G. ,hat will be stored in H if the following code is e1ec"ted. int main() 6 int 1 0 5, - 0 1&, H3 int a 0 4, b 0 +3 H 0 122 2 22- I bAa3 printf(8Jhe val"e of H 0 9d:,H)3 ret"rn &3 7 1& 5 G $

(a) (b) (c) (d) .

,hat will be o"tp"t of the following program. int main() 6 char Ip10 8name:3 char Ip+3 p+0(charI)malloc(+&)3 while(Ip+22 0 Ip122)3 printf(89sKn:,p+)3 7 (a) (b) (c) (d) empt- string name either of the above none of the above 5redict the val"e of 1 ) - in the given code snippet> main() 6 int 10+&,-0/53 10-22 2 1223 -0 22- 2 2213 printf(89d 9dKn:,1,-)3 7 (a) (b) 5 $4 55 4/

'.

(c) (d) $.

5 $/ 5' $4

St"d- the code> void show() main() 6 show()3 7 void show (char Is) 6 printf(L9snL,s)3 7 ,hat will happen if it is compiled ) r"n on a ; ;ompiler. (a) It will compile ) nothing will be printed when it is e1ec"ted (b)it will compile b"t not linF (c)the compiler will generate an error (d)the compiler will generate a warning DooF at the ;ode> #incl"de void main() 6 char s1MN0LabcdL3 char s+M1&N3 char s/MN0LefghL3 int i3 clrscr()3 i0strcmp(strcat(s/,strcp-(s+,s1))strcat(s/,LabcdL))3 printf(L9dL,i)3 7 ,hat will be the o"tp"t. (a) (o o"tp"t (b) C (on Integer (c) & (d) Oarbage

1&.

Вам также может понравиться