Tokens MCQ Quiz in मराठी - Objective Question with Answer for Tokens - मोफत PDF डाउनलोड करा

Last updated on Mar 13, 2025

पाईये Tokens उत्तरे आणि तपशीलवार उपायांसह एकाधिक निवड प्रश्न (MCQ क्विझ). हे मोफत डाउनलोड करा Tokens एमसीक्यू क्विझ पीडीएफ आणि बँकिंग, एसएससी, रेल्वे, यूपीएससी, स्टेट पीएससी यासारख्या तुमच्या आगामी परीक्षांची तयारी करा.

Latest Tokens MCQ Objective Questions

Top Tokens MCQ Objective Questions

Tokens Question 1:

Consider statement in C programming language

a + = b >> 24 ! = 4;

The number of tokens identified by the lexical phase while scanning the above statements is ____.

Answer (Detailed Solution Below) 8

Tokens Question 1 Detailed Solution

The first phase of compiler is called lexical analysis or scanning. The lexical analyzer reads the stream of characters making up the source program and groups the characters into meaningful sequence called lexemes.

For each lexeme, the lexical analyzer produces as output a token of the form that it passes on to the subsequent phase, syntax analysis.

Tokens in given statement:

a

identifier

+ =

assignment operator

b

identifier

>> 

bitwise operator

24

number

! =

relational operator

4

number

;

statement terminator

 

Therefore, there are 8 tokens

Tokens Question 2:

Match the compiler phase with the output it produces.

A. Lexical Analysis

1. Machine code

B. Syntax Analysis

2. Token stream

C. Intermediate Code Generation

3. Parse Tree

D. Code Generator

4. Three address code

  1. A-1, B-2, C-4, D-1
  2. A-2, B-3, C-4, D-1
  3. A-2, B-3, C-1, D-4
  4. A-1, B-3, C-4, D-2

Answer (Detailed Solution Below)

Option 2 : A-2, B-3, C-4, D-1

Tokens Question 2 Detailed Solution

Phases in a compiler:

F1 R.S NIta 07.10.2019 D 1

The correct answer: A → 2, B → 3, C  → 4, D  → 1.

Important Point:

A parse tree is also called syntax tree

Three address code is one of the intermediate representation.

Tokens Question 3:

Number of tokens in the given statement is?

printf(“Hello”);

  1. 4
  2. 5
  3. 3
  4. 1

Answer (Detailed Solution Below)

Option 2 : 5

Tokens Question 3 Detailed Solution

tokens are

1. printf

2. (

3. “Hello”

4. )

5. ;

Tokens Question 4:

Which of the following is not a token of C program

  1. 1.02e+2
  2. #define
  3. MAX
  4. "Testbook"

Answer (Detailed Solution Below)

Option 2 : #define

Tokens Question 4 Detailed Solution

A token is a sequence of characters that can be treated as a single logical entity. C tokens are the basic building blocks in C language which are constructed together to write a C program.

●  Each and every smallest individual unit in a C program are known as C tokens.

●  C tokens are of six types. They are,

1.Keywords                 (eg: int, while),

2.Identifiers                 (eg: main, total, MAX),

3.Constants                 (eg: 10, 20, 1.02e+2),

4.Strings                      (eg: “total”, “hello”, "Testbook"),

5.Special symbols       (eg: (), {}),

6.Operators                 (eg: +, /,-,*)

#define is C Preprocessor, which is not part of the compiler but is a separate step in the compilation process. So it is not a token.

Tokens Question 5:

If C is a programming language, then which of the following can be a token produced by lexical analysis phase?

  1. “testbook”
  2. ++
  3. /=
  4. goto

Answer (Detailed Solution Below)

Option :

Tokens Question 5 Detailed Solution

  • The first phase of compiler is called lexical analysis or scanning. The lexical analyzer reads the stream of characters making up the source program and groups the characters into meaningful sequence called lexemes. For each lexeme, the lexical analyzer produces as output a token of the form that it passes on to the subsequent phase, syntax analysis.
  • Tokens may be of the form of identifiers, keywords, constants etc. from the input program.

 

“testbook” string

++

unary operator (incremental operator)

/=

Assignment operator

goto

keyword

 

All operators are token

a /= 2 

a = a/2

Therefore option all option are correct

Tokens Question 6:

Which of the following is/are true?

I. Keyword are determined during parsing of a language

II. The output of a lexical analyzer is parse tree

III. Type checking is done during parsing

  1. Only I and II
  2. Only III
  3. Only I and III
  4. None of these

Answer (Detailed Solution Below)

Option 4 : None of these

Tokens Question 6 Detailed Solution

  • Lexical analysis is the process of converting a sequence of characters into a sequence of tokens. A token can be a keyword. Therefore, keyword of a language is determined during lexical analysis of the program and output of a lexical analyzer is tokens
  • Type checking is done at semantic analysis phase and parsing is done at syntax analysis phase.

Tokens Question 7:

The number of tokens in the following C statement is

int i  = 10;

float b = 12.0;

printf("x = %i, y = %f", i++, ++b);

Answer (Detailed Solution Below) 21

Tokens Question 7 Detailed Solution

Line no.

Tokens

Number of Tokens

Line 1

int | i | = | 10 | ; |

5

Line 2

float | b | = | 12.0 | ; |

5

Line 3

Printf | ( | "x = %i, y = %f" | , ||++ | , | ++ |b | ) | ; |

 

11

 

Total Number of tokens = 5 + 5 + 11 = 21

Notes:

| is used to separate the token

Tokens Question 8:

Consider the following statements:

S1: New entries are created in symbol table for each new identifier during lexical analysis.

S2: Lexical analyzer detects ill-formed numeric literals and input characters that are not in the source language.

Which of the following is true?

  1. Only S1
  2. Only S2
  3. Both S1 and S2
  4. Neither S1 nor S2

Answer (Detailed Solution Below)

Option 3 : Both S1 and S2

Tokens Question 8 Detailed Solution

The correct answer is option 3 i.e. Both S1 and S2.

A lexical analyzer creates a symbol-table entry as soon as it sees the characters that make up a lexeme. Also, it detects ill-formed numeric literals and input characters that are not in the source language.​​

Tokens Question 9:

The number of tokens in the following C statements is

printf ("i = %d, j = %f, &i = %x\n", i, j, &i);

  1. 10
  2. 46
  3. 12
  4. 35

Answer (Detailed Solution Below)

Option 3 : 12

Tokens Question 9 Detailed Solution

The correct answer is option 3.

Concept:

A lexical token is a sequence of characters that can be treated as a unit in the grammar of the programming languages.

Example of tokens:

Type token (id, number, real, . . . )

Punctuation tokens (IF, void, return, . . . )

Alphabetic tokens (keywords)

Explanation:

printf ("i = %d, j = %f, &i = %x\n", i, j, &i);

F1 Harshita  Shraddha 17.02.2022 D 1

Hence the correct answer is 12.

Tokens Question 10:

The number of tokens in the following C statement is

int i  = 10;

float b = 12.0;

printf("x = %i, y = %f", i++, ++b);

  1. 19
  2. 21
  3. 23
  4. 25

Answer (Detailed Solution Below)

Option 2 : 21

Tokens Question 10 Detailed Solution

Line no.

Tokens

Number of Tokens

Line 1

int | i | = | 10 | ; |

5

Line 2

float | b | = | 12.0 | ; |

5

Line 3

Printf | ( | "x = %i, y = %f" | , | i  |++ | , | ++ || ) | ; |

11

 

Total Number of tokens = 5 + 5 + 11 = 21

Notes:

| is used to separate the token

Get Free Access Now
Hot Links: teen patti master old version teen patti 100 bonus teen patti king teen patti gold downloadable content teen patti bonus