COMPILER DESIGN

SEMANTIC ANALYSIS

TYPE CHECKING

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The number of tokens in the following C statement isprintf("i = %d, &i = %x", i, &i);
A
7
B
9
C
8
D
10
Explanation: 

Detailed explanation-1: -Tokens types are keywords, identifiers, constants, strings, operators, etc. Therefore, there are 10 tokens in total.

Detailed explanation-2: -A token is a sequence of characters that can be treated as a unit in the grammar of the programming languages. Lexical Analysis is the first phase of compiler also known as scanner. It converts the High level input program into a sequence of Tokens. Counting all the boxes, the total number of tokens comes out to be 26.

Detailed explanation-3: -One can define tokens in C as the smallest individual elements in a program that is meaningful to the functioning of a compiler. A token is the smallest unit used in a C program.

There is 1 question to complete.