MCQOPTIONS
Saved Bookmarks
This section includes 3 Mcqs, each offering curated multiple-choice questions to sharpen your Compilers knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
COMPILER is used to? |
| A. | convert low level into high level language |
| B. | convert high level into low level language |
| C. | translate assembly language into machine language |
| D. | none of these |
| Answer» C. translate assembly language into machine language | |
| 2. |
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:P → D* E*D → int ID {record that ID.lexeme is of type int}D → bool ID { record that ID.lexeme is of type bool}E → E1 + E2 {check that E1.type = E2.type = int; set E.type := int}E → !E1 {check that E1.type = bool; set E.type := bool}E → ID {set E.type := int}With respect to the above grammar; which one of the following choices is correct? |
| A. | The actions will lead to infinite loop. |
| B. | The actions can be used to correctly type-check any syntactically correct program. |
| C. | The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions. |
| D. | The actions can be used to type-check syntactically correct integer variable declarations and integer expressions. |
| Answer» E. | |
| 3. |
_____ is done by attaching rules or algorithms or program fragments to productions in a grammar. |
| A. | Syntax-directed translation |
| B. | Lexical analysis |
| C. | Execution |
| D. | Loading |
| Answer» B. Lexical analysis | |