Skip to content

ISRO Scientist/Engineer CSE 2020Compiler Design › Not yet assigned to a topic

ISRO Scientist/Engineer CSE 2020 PYQ: The number of tokens in the following C code segment is switch(inputvalue) { case 1 : b =c*d; break; default…

The number of tokens in the following C code segment is

switch(inputvalue)
{
    case 1 : b =c*d; break;
    default : b =b++; break;
}
  1. A
    27
  2. B
    29
  3. C
    26
    Correct answer
  4. D
    24

Answer

(C) $26$

Approach

Tokenize the given C code segment by identifying every keyword, identifier, constant, operator, and punctuation mark as a separate token. Count them systematically.

Reviewed by ISRO IQ Editorial Team.