GATE CSE
First time here? Checkout the FAQ!
x
+3 votes
133 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 (28.1k points)   | 133 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 (37.9k points)  
selected by
Top Users Jan 2017
  1. Debashish Deka

    8968 Points

  2. sudsho

    5326 Points

  3. Habibkhan

    4798 Points

  4. Bikram

    4532 Points

  5. Vijay Thakur

    4486 Points

  6. saurabh rai

    4222 Points

  7. Arjun

    4196 Points

  8. santhoshdevulapally

    3808 Points

  9. Sushant Gokhale

    3596 Points

  10. Kapil

    3486 Points

Monthly Topper: Rs. 500 gift card

19,212 questions
24,104 answers
53,151 comments
20,319 users