retagged by
36,411 views
41 votes
41 votes

The number of tokens in the following C statement is

printf("i=%d, &i=%x", i, &i);
  1. $3$
  2. $26$
  3. $10$
  4. $21$
retagged by

7 Answers

Best answer
57 votes
57 votes

answer - C

Tokens are:

  1. printf 
  2. (
  3. "i=%d, &i=%x"
  4. ,
  5. i
  6. ,
  7. &
  8. i
  9. )
  10. ;
edited by
12 votes
12 votes

printf("i=%d,&i=%x",i&i);  it has 9 token but option are not matching 

the same question came in gate 2001  
printf("i=%d,&i=%x",i,&i); with this statement it has 10 token

1.printf 
2.(
3."i=%d,&i=%x"
4.,
5.i
6.,
7.&
8.i
9.)
10.;

11 votes
11 votes

print =  token1

(   =  token2

"i=%d%x"  =  token3 ////anything inside "  " is considered as 1 token

,   =   token4

i = token5

, = token6

&  = token7

i = token8

) = token9

; = token10

so total 10 tokens

5 votes
5 votes

1.printf
2.(
3."i=%d, &i=%x"
4.,
5.i
6.,
7.&
8.i
9.)
10.;
option C

 

Answer:

Related questions

24 votes
24 votes
5 answers
3