1. Which of the following is a stage of the compilation process?
(A) Syntax analysis
(B) Intermediate code generation
(C) Code generation
(D) All of the mentioned
Answer :- d
2. A programmer writes instructions to multiply two numbers instead of adding them by mistake within a program. Which of the following is true in this context?
(A) Lexical analysis phase of compilation process can detect the error
(B) Syntax analysis phase of compilation process can detect the error
(C) In code generation phase the error can be detected
(D) This error cannot be detected by a compiler
Answer :- d
3. Name the system program that is used to combine a program’s several compiled modules into a executable form:
(A) Interpreter
(B) Assembler
(C) Compiler
(D) Linking Loader
Answer :- d
4. The output of a lexical analyzer is:
(A) A parse tree
(B) Intermediate code
(C) A stream of tokens
(D) Machine code
Answer :- c
5. How many lexemes are there in the following code: int main( ) { printf(“%d + %d = %d”, 3, 1, 4); return 0; }
(A) 18
(B) 20
(C) 22
(D) 24
Answer :- b
6. Which of the following is/are true for RISC architecture?
(A) Simplified instruction set leads to faster processing
(B) Execution in a pipeline is not possible
(C) Higher power consumption
(D) Has simple addressing modes
Answer :- a,d
7. Which particular task of compilation process uses context free grammars (CFG)?
(A) Code optimization
(B) Tokenization of input code
(C) Parsing of tokenized input
(D) None of the above
Answer :- c
8. Which of the following machine model is necessary and sufficient for designing lexical analyzer?
(A) Finite state automata
(B) Pushdown automata
(C) Turing machine
(D) None of the above
Answer :- a
9. Which of the following items are stored in the symbol table?
(A) Variable names and constants from the source program
(B) Procedure and function names from the source program
(C) Label names present in the source program
(D) All of the above mentioned
Answer :- d
10. Suppose that the access time of an implemented symbol table is logarithmic. Then the symbol table has been implemented using:
(A) Search tree
(B) Linear list
(C) Hash table
(D) None of the above
Answer :- a
11. Which of the following can be managed fully during compilation?
(A) Static memory allocation
(B) Dynamic memory allocation
(C) Both (A) and (B)
(D) Neither (A) nor (B)
Answer :- a
12. Which of the following is NOT TRUE in the context of syntax analysis phase of compilation?
(A) Input to the syntax analysis phase are tokens from lexical analyzer
(B) Syntax analysis phase checks syntactic (grammatical) correctness
(C) It checks if the input program can be derived from the start symbol of a grammar using the grammar rules
(D) Syntax analysis phase can determine if a variable is declared before it is being used
Answer :- d