GATE CSE
First time here? Checkout the FAQ!
x
+3 votes
223 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 (29.2k points)   | 223 views

1 Answer

+7 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 (42.7k points)  
selected by


Top Users Apr 2017
  1. akash.dinkar12

    3660 Points

  2. Divya Bharti

    2580 Points

  3. Deepthi_ts

    2040 Points

  4. rude

    1966 Points

  5. Tesla!

    1768 Points

  6. Debashish Deka

    1614 Points

  7. Shubham Sharma 2

    1610 Points

  8. Prashant.

    1492 Points

  9. Arjun

    1472 Points

  10. Arunav Khare

    1464 Points

Monthly Topper: Rs. 500 gift card

22,088 questions
28,063 answers
63,298 comments
24,173 users