How many tokens will be generated by the scanner for the following statement x…
2014
How many tokens will be generated by the scanner for the following statement
x = x * (a + b) − 5;
- A.
12
- B.
11
- C.
10
- D.
07
Attempted by 95 students.
Show answer & explanation
Correct answer: A
To count tokens, identify each individual element separated by spaces or operators. The statement contains identifiers x, a, b; operators =, *, +, −; literals 5; and delimiters (, ), ;. Counting these distinct elements yields a total of twelve tokens.
A video solution is available for this question — log in and enroll to watch it.