Which phase in the compiler design performs data type checking?

A

Lexical analysis 

B

Syntax analysis

C

Semantic analysis

D

Code generation

উত্তরের বিবরণ

img

Answer: ) Semantic analysis

Explanation:

A compiler works in several phases:

Lexical analysis →→Converts source code into tokens (keywords, identifiers, operators)

Syntax analysis →→   Builds parse tree and checks grammar rules (structure of code)

Semantic analysis →→ Checks meaning of code:

 Example:
int a;
float b;
a = b; // Semantic analysis may warn about type mismatch


Syntax analysis: Correct (assignment statement follows grammar)

Semantic analysis: Detects type mismatch  performs data type checking

 

Unfavorite

0

Updated: 2 days ago

Related MCQ

 ______ sort uses a divide and conquer approach? 

Created: 2 days ago

A

Insertion

B

Quick

C

Bubble

D

Selection


Unfavorite

0

Updated: 2 days ago

Consider 3 processes (P1, P2, P3) and 2 resources (R1, R2). If P1 holds R1 & requests R2, P2 holds R2 & requests R1, what is the minimum number of additional resource units of R1 or R2 needed to the deadlock assuming no preemption? 


Created: 2 days ago

A

0 unit 

B

1 unit of R1 or 1 unit of R2 

C

2 units (1 of R1 & 1 of R2)

D

Not enough information

Unfavorite

0

Updated: 2 days ago

 UDP is a ______ protocol. 

Created: 2 days ago

A

Connection-less 

B

Connection-oriented

C

Application layer 

D

Network access layer

Unfavorite

0

Updated: 2 days ago

© LXMCQ, Inc. - All Rights Reserved

Developed by WiztecBD