GATE CSE
First time here? Checkout the FAQ!
x
+3 votes
160 views

How many tokens will be generated by the scanner for the following statement ?

$x = x ∗ (a + b) - 5$;

  1. $12$
  2. $11$
  3. $10$
  4. $07$ 
asked in Compiler Design by Veteran (29k points)   | 160 views

1 Answer

+6 votes
Best answer

ans is A)   12 

x=x*(a+b)-5;

every character is token here

token no   character

1                  x

2                  =

3                  x

4                  *

5                 (      

6                  a

7                 +

8                 b

9                  ) 

10                -

11               5

12                ;

answered by Veteran (40.1k points)  
selected by
Top Users Feb 2017
  1. Arjun

    5278 Points

  2. Bikram

    4230 Points

  3. Habibkhan

    3942 Points

  4. Aboveallplayer

    3086 Points

  5. Debashish Deka

    2378 Points

  6. sriv_shubham

    2308 Points

  7. Smriti012

    2236 Points

  8. Arnabi

    2008 Points

  9. sh!va

    1672 Points

  10. mcjoshi

    1648 Points

Monthly Topper: Rs. 500 gift card

20,846 questions
26,002 answers
59,657 comments
22,100 users