21. In which parsing, the parser constructs the parse tree from the start symbol and transforms it into the input symbol
- Bottom-up parsing
- Top-down parsing
- Both (A) and (B)
- None of the above
Answer : B Explanation: In top-down parsing, the parser constructs the parse tree from the start symbol and transforms it into the input symbol. It is also referred to as predictive or recursive parsing.
22. Which of the following error can a compiler check?
- Syntax Error
- Logical Error
- Both (A) and (B)
- Compiler cannot check errors
Answer : A Explanation: Logical flaws can never be checked by a compiler. A compiler can only check Syntax errors.
23. What does a top-down parser generate?
- Right-most derivation in reverse
- Left-most derivation in reverse
- Right-most derivation
- Left-most derivation
Answer : D Explanation: Top-down parser generates left most derivation. So, option D is correct.
24. In a compiler, keywords of a language are recognized during
- Parsing of the program
- The code generation
- The lexical analysis of the program
- Dataflow analysis
Answer : C Explanation: In a compiler, keywords of a language are recognized during the lexical analysis of the program.
25. ________ is a process of finding a parse tree for a string of tokens
- Tokenizing
- Recognizing
- Analysing
- Parsing
Answer : D Explanation: Parsing is a process of finding a parse tree for a string of tokens.
Software Engineering MCQ Questions And Answers
26. Grammar of the programming is checked at which phase of the compiler?
- Syntax analysis
- Semantic analysis
- Code generation
- Code optimization
Answer : A Explanation: Grammar of the programming is checked at syntax analysis phase of the compiler.
27. ________ is considered as a sequence of characters in a token
- Pattern
- Texeme
- Lexeme
- Mexeme
Answer : C Explanation: Lexeme is considered as a sequence of characters in a token. So, option C is correct.
28. Which of the following is known as a compiler for a high-level language that runs on one machine and produces code for a different machine?
- Multipass compiler
- Cross compiler
- One pass compiler
- Optimizing compiler
Answer : B Explanation: Cross compiler is known as a compiler for a high-level language that runs on one machine and produces code for a different machine.
29. Identify the most powerful parser?
- LALR
- Canonical LR
- Operator-precedence
- SLR
Answer : B Explanation: The most powerful parser is the Canonical LR.
30. Which of the following is a definition of compiler?
- Acceptance of a program written in a high-level language and produces an object program
- Translation of assembly language into machine language
- Program is put into memory and executes it
- None of the above
Answer : A Explanation: Definition of compiler in above case is acceptance of a program written in a high-level language and produces an object program because a compiler is a software or group of programs that converts source code written in one programming language into the target code in the target language, often having a binary form known as object code.