IBPS SO IT Officer Professional Knowledge Quiz – Data Structure/Compiler Design – 1

Hello and welcome to exampundit. Here is a set of IBPS SO IT Officer Professional Knowledge Quiz on Data Structure/Compiler Design.

  1. Linked lists are suitable for which of the following problems?

(a) Insertion sort

(b) Binary search

(c) Radix sort

(d) Polynomial manipulation

(e) None of these

Answer

Option: B

Explanation: Through Linked list binary search can be performed efficiently.

 

  1. The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?

(a) Finite state automata

(b) Deterministic push down automata

(c) Non-deterministic push down automata

(d) Turing machine

(e) None of these

Answer

Option: A

Explanation: Finite state automata.

 

  1. In a compiler, keyboards of a language are recognized during

(a) parsing of the program

(b) the code generation

(c) the lexical analysis of the program

(d) data flow analysis

(e) None of these

Answer

Option: C

Explanation: The lexical analysis of program.

 

  1. Which data structure in a compiler is used for managing information about variables and their attributes?

(a) Abstract syntax-tree

(b) Symbol table

(c) Semantic stack

(d) Parser table

(e) None of these

Answer

Option: B

Explanation: Symbol table is a data structure in a compiler. It was devised for the purpose that it can be used to manage information about variable and their attributes.

 

  1. Which of the following statements are true?

1. There exist parsing algorithms for some programming languages whose complexities are less than θ (n3).

2. A programming language which allows recursive can be implemented with static storage allocation.

3. No L-attributed definition can be evaluated in the framework of bottom-up parsing.

4. Code improving transformations can be performed at both source language and intermediate code level.

(a) 1 and 2

(b) 1 and 4

(c) 3 and 4

(d) 1, 3 and 4

(e) None of these

Answer

Option: B

Explanation:

Statement 1 True: Parsing algorithms exists for some of the programming languages whose complexities are even less than q (n ^ 3).

Statement 2 False: A programming language allowing recursion cannot be implemented with static storage allocation.

Statement 3 False: L-attributed definition can be evaluated in framework of bottom up parsing.

Statement 4 True: Code improvement can be done at both source language level and intermediate language level.

 

  1. Some code optimizations are carried out on the intermediate code because

(a) they enhance the portability of the compiler to other target processors

(b) program analysis is more accurate on intermediate code than on machine code

(c) the information from data flow analysis cannot be used for optimization

(d) the information from the front end cannot be used for optimization

(e) None of these

Answer

Option: D

Explanation: Code optimizations are generally carried out on intermediate code. This is done to convert the source code to the machine language of the target machine on the basis of back end tools. It enhances the portability of the compilers to the other target processors.

 

  1. Which of the following are true?

1) A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursive can be implemented with static storage allocation

2) Multi-level access link (or display) arrangement is needed to arrange activation records only, if the programming language being implemented has nesting of procedures/functions.

3) Recursion in programming languages cannot be implemented with dynamic storage allocation

4) Nesting of procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stack-based allocation scheme for activation records.

5) Programming languages which permit a function to return a function as its result cannot be implemented with a stack based storage allocation scheme for activation records

(a) 2 and 5

(b) 1, 3 and 4

(c) 1, 2 and 5

(d) 2, 3 and 5

(e) None of these

Answer

Option: D

Explanation:

Statement 1 True: A programming language which does not permit global variables of any kind has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation.

Statement 2 False: It is not necessary to have nesting of procedures/function in the programming language being implemented when activation records are arranged using multi level access link.

Statement 3 True: Recursion in programming language cannot be implemented with dynamic storage allocation.

Statement 4 False: Nesting of procedures/functions and recursion can be implemented with a stack based allocation scheme for activation.

Statement 5 True: The programming languages which permit a function to return a function as its result cannot be implemented with a stack based storage allocation scheme for activation records.

 

  1. Which one of the following is a top-down parser?

(a) Recursive descent parser

(b) Operator precedence parser

(c) An LR (k) parser

(d) An LALR (k) parser

(e) None of these

Answer

Option: A

Explanation: Top-down parsing is a technique to analyze unknown data relationship. This is done by hypothesizing general parser tree structures and then considering whether the known fundamental structures are compatible with the hypothesis that was made earlier. Recursive descent parser is a top down parser.

 

 

  1. The grammar A → AA | (A) | is not suitable for predictive parsing because the grammar is

(a) ambiguous

(b) left-recursive

(c) right-recursive

(d) an operator grammar

(e) None of these

Answer

Option: B

Explanation: The grammar is a left recursive grammar. The predictive parser does not go hand in hand with left recursive grammar.

 

  1. Consider the grammar S → (S) | a

Let the number of states in SLR (1), LR(1) and LALR (1) parsers for the grammar be n1, n2 and n3 respectively. Which of the following relationships holds good?

(a) n1 < n2 < n3

(b) n1 = n3 < n2

(c) n1 = n2 = n3

(b) n1 ≥ n3 ≥ n2

(e) None of these

Answer

Option: B

Explanation:

Number of states is equal to SLR and LALR. LR have more number of states then the two due to the look ahead.

Let the number of states for SLR (1) be n1.

Number of states for LR(1) be n2.

Number of states for LALR(1) be n3.

Then, n1 = n3 < n2.

 

 

 

This post was last modified on November 14, 2018 10:09 pm