Compiler design Soved MCQ 2020-21 HNB Garhwal University

HNB Garhwal University Exam Paper 2020- 21

Compiler Design



1. Users write the programs in which language?

(A) Low-Level language

(B) High level language

(C) Decimal format

(D) Middle level language


2. Which computer program accepts the high level language and converts it into assembly language?

(A) Interpreter

(B) Linker

(C) Assembler

(D) Compiler


3. Does the compiler program translate the whole source code in one step?

(A) No

(B) Depends on the compiler

(C) Don’t know

(D) Yes
 

4.Which of the following files is an output of the assembler?


(A) Program file

(B) Object file

(C) Data file

(D) Task file
 

5. Which tool is used for grouping of characters in tokens in the compiler

(A) Parser

(B) Code optimizer

(C) Code generator

(D) Scanner
 

6. What is the linker?

(A) It is always used before the program execution.

(B) It is required to create the load module.

(C) It is the same as the loader

(D) None of the above
 

7. Parsing is categorized into how many types?

(A) Three types

(B) Four types

(C) Two types

(D) Five types
 

8. In which parsing the parser constructs tha parse tree from the start symbol and transforms it into the input symbol?


(A) Bottom up parsing

(B) Top down parsing

(C) None of the above

(D) Both A and B
 

9. Which derivation is generated by the top down parser?

(A) Right most derivation in reverse

(B) Left most derivation in reverse

(C) Right most derivation

(D) Left most derivation
 

10. Which derivation is generated by the bottom up parser?

(A) Right most derivation in reverse

(B) Left most derivation in reverse

(C) Right most derivation

(D) Left most derivation
 

11. Which parser is most powerful in the following parser?

(A) Operator precedence

(B) SLR

(C) Canonical LR

(D) LALR
 

12. The output of the lexical analyzer is


(A) String character

(B) A syntax tree

(C) A set of RE

(D) A set of tokens
 

13. From the following grammars, which describes the lexical syntax?

(A) Lexical grammar

(B) Context free grammar

(C) Syntactic grammar

(D) Regular grammar
 

14. Which grammar gives multiple parse trees for the same string?


(A) Unambiguous

(B) Regular

(C) Ambiguous

(D) All of the above
 

15. In compiler lexical analyzer is used for:

(A) Removing comments

(B) Removing whitespace

(C) Breaking the syntaxes in the set of tokens

(D) All of the mentioned
 

16. Which is considered as the sequence of characters in a token?

(A) Mexeme

(B) Lexeme


(C) Texeme

(D) Pattern


17. Which part of the compiler highly used the grammar concept

(A) Code optimization

(B) Code generation

(C) Parser

(D) Lexical analysis
 

18. Which phase of the compiler checks the grammar of the programming?

(A) Code optimization

(B) Semantic analysis

(C) Code generation

(D) Syntax analysis
 

19. Which of the following components is important for semantic analysis?

(A) Yace

(B) Lex

(C) Symbol table

(D) Type checking


20. Which phase of the compiler is also known as scanner?

(A) Syntax analysis

(B) Lexical analysis

(C) Semantic analysis

(D) Code generation


21. Which phase of the compiler is also known as parse?

(A) Code optimization

(B) Semantic analysis

(C) Syntax analysis

(D) Lexical analysis


22. Which of the following parser is a top down parser

(A) An LALR parser

(B) A LR parser

(C) Operator precedence parser

(D) Recursive descent parser
 

23. Keywords are recognized in a compiler during

(A) The code generation

(B) The data flow analysis

(C) The lexical analysis of the program


(D) The program parsing


24. Leaf nodes in a parse tree indicate:


(A) Sub terminals

(B) Half terminals

(C) Non terminals

(D) Terminals


25. Which graph describes the basic block and successor relationship?

(A) Control graph

(B) DAG

(C) Flow graph

(D) Hamilton graph
 

26. Which language is accepted by the push down automate?

(A) Type 0 language

(B) Type 1 language

(C) Type 2 language

(D) Type 3 language
 

27. The most general phase of structured grammar is


(A) Context sensitive grammar

(B) Context free grammar

(C) Regular grammar

(D) All of the above
 

28. In the compiler the function of using intermediate code is:


(A) To improve the register allocation

(B) To increase the error reporting and recovery

(C) To make semantic analysis easier

(D) To increase the chance of re using the machine independent code optimizer in other compiler
 

29. In how many types of optimization can be divided?

(A) Two types

(B) Three types

(C) four types

(D) five types


30. The value of which variable is updated inside the loop by a loop invariant value?


(A) Loop

(B) strength

(C) induction

(D) invariable
 

31. which compiler runs on one machine and generates code for multiple machines

(A) Multipass compiler

(B) Cross compiler

(C) Optimizing compiler

(D) One pass compiler
 

32. Which of the following is not a characteristic of the compiler?

(A) More execution time

(B) Debugging process is slow

(C) The execution takes place after the removal of all syntax errors

(D) Firstly scans the entire program and then transforms it into machine understandable code
 

33. Which phenomenon happens when the nonterminal on the left side is repeated as the first symbol on the right side?

(A) Left most derivation

(B) Left recursion


(C) Left factoring

(D) Left parsing


34. In which derivation the right most non terminal symbol is replaced at each step?

(A) Right look ahead

(B) Right claim

(C) Right most

(D) Right non terminal
 

35. In which derivation the leftmost non terminal symbol is replaced at each step?

(A) Left recursion

(B) Left non terminal

(C) Left pushdown

(D) Left most

Post a Comment

0 Comments