Compiler Design NTA UGC NET Question Analysis

Compiler Design NTA UGC NET Question Analysis

Q.1➡ | UGC NET DEC 2023
Three address codes can be represented in special structures known as:
(A) Quadruples
(B) Triples
(C) Patterns
(D) Indirect Triples
Choose the correct answer from the options given below :
i ➥ (A) and (B) Only
ii ➥ (A), (B) and (D) Only
iii ➥ (B) and (C) Only
iv ➥ (B), (C) and (D) Only
Best Explanation:
Answer: (III)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line


Q.2➡ | UGC NET DEC 2023
Consider a Grammar E→E+n | E x n | n for a sentence n+n×n, the handles in the right-sentential form of the reduction are?
i ➥ n, E+n and E+n×n
ii ➥ n, E+n and E+Exn
iii ➥ n, n+n and n+n×n
iv ➥ n, E+n and Exn
Best Explanation:
Answer: (IV)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line


Q.3➡ | UGC NET DEC 2023
One of the purposes of using intermediate code in compilers is to:
i ➥ make parsing and semantic analysis simpler
ii ➥ improve error recovery and error reporting
iii ➥ increase the chances of reusing the machine independent code optimizer in other compilers
iv ➥ improve the register allocation
Best Explanation:
Answer: (III)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.4➡ | UGC NET DEC 2023
Arrange the following phases of a compiler as per their order of execution (start to end)
(A) Target code generation
(B) Syntax Analysis
(C) Code optimization
(D) Semantic Analysis
(E) Lexical Analysis
Choose the correct answer from the options given below :
i ➥ (B), (E), (D), (A), (C)
ii ➥ (E), (D), (B), (A), (C)
iii ➥ (E), (B), (D), (C), (A)
iv ➥ (B), (D), (Ε), (A), (C)
Best Explanation:
Answer: (III)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.5➡ | UGC NET DEC 2023
Match List – I with List – II according to input to the compiler phase that process it :
List – I
(A) Syntax tree
(B) Intermediate representation
(C) Token stream
(D) Character stream

List – II
(I) Code generator
(II) Semantic analyzer
(III) Lexical analyze
(IV) Syntax analyser
Choose the correct answer from the options given below :
i ➥ (A)-(IV), (B)-(III), (C)-(I), (D)-(II)
ii ➥ (A)-(II), (B)-(I), (C)-(IV), (D)-(III)
iii ➥ (A)-(II), (B)-(IV), (C)-(I), (D)-(III)
iv ➥ (A)-(IV), (B)-(I), (C)-(II), (D)-(III)
Best Explanation:
Answer: (II)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.6➡ | UGC NET JUNE 2023
The compiler for high level language that runs on one machine and produces code for other machine is called-
i ➥ Cross compiler
ii ➥ Multipass compiler
iii ➥ Optimizing Compiler
iv ➥ One pass Compiler
Best Explanation:
Answer: I (*)
Explanation:

It is a defination of Cross compiler
A Two pass/multi-pass Compiler is a type of compiler that processes the source code or abstract syntax tree of a program multiple times. In multipass Compiler, we divide phases into two passes as:
First Pass: is refers as
(a). Front end
(b). Analytic part
(c). Platform independent

Second Pass: is refers as
(a). Back end
(b). Synthesis Part
(c). Platform Dependent
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.7➡ | UGC NET JUNE 2023
The maximum yield length of the following CNF CFG is
S→AB
A→CD
B→e
C→a
D→b
i ➥ 8
ii ➥ 7
iii ➥ 4
iv ➥ 5
Best Explanation:
Answer: iii
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line
Q.8➡ | UGC NET JUNE 2023
Which of the following parser is most powerful parser?
i ➥ Operator precedence
ii ➥ SLR
iii ➥ Canonical LR
iv ➥ LALR
Best Explanation:
Answer: C
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.9➡ | UGC NET JUNE 2023
Which phase of compiler checks the grammar of programming? 
i ➥ Code optimization
ii ➥ Semantic analysis
iii ➥ Code generators
iv ➥ Syntax analysis
Best Explanation:
Answer: IV
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line
Q.10➡ | NET December 20222
The item generated by the production A → ɛ is :
i ➥ A →.
ii ➥ A → ɛ.
iii ➥ A → .ɛ
iv ➥ A → ɛ
Best Explanation:
Answer: (i)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.11➡ | NET December 2022
Which of the following statements are correct?
(A) The first three address instruction in the intermediate code is a leader.
(B) The instruction which is exactly at the middle of the given three address code is a leader.
(C) Any instruction that is the target of a conditional or unconditional jump is a leader.
(D) Any instruction that immediately follows a conditional or unconditional jump is a leader.
Choose the correct answer from the options given below:
i ➥ A, B and C
ii ➥ B, C and D
iii ➥ A, C and D
iv ➥ A, B, C and D
Best Explanation:
Answer: (iii)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.12➡ | NET June 2022
Consider the grammar S—>SbS|a.
Consider the following statements:
(A) Two Parse tree
(B) Two left most derivation
(C) Two right most derivation
Which of the following is correct?
i ➥ All (A), (B) and (C) are true
ii ➥ Only (B) is true
iii ➥ Only (C) is true
iv ➥ Only (A) is true
Best Explanation:
Answer: (iv)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.13➡ | NET June 2022
Consider the following statements:
Statement (I) : LALR Parser is more powerful than canonical LR parser
Statement (II) : SLR parser is more powerful that LALR
Which of the following is correct?       
i ➥ Statement (I) true and statement (II) false
ii ➥ Statement (I) false and statement (II) true
iii ➥ Both statement (I) and Statement (II) false
iv ➥ Both statement (I) and statement (II) true
Best Explanation:
Answer: (iii)
Explanation: Upload Soon
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.14➡ | NET June 2021
Given below are two statements
Statement I: LL(1) and LR are examples of Bottom-up parsers.
Statement II: Recursive descent parser and SLR are examples of Top-down parsers
In light of the above statements, choose the correct answer from the options given below Options:-
i ➥ Both Statement I and Statement II are false
ii ➥ Both Statement I and Statement II are true
iii ➥ Statement I is false but Statement II is true
iv ➥ Statement I is true but Statement II is false

Show Answer With Best Explanation

Answer: I
Explanation: Upload Soon

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.15➡ | NTA UGC NET November 2020
Which of the following grammars is (are) ambiguous?
(A) s → ss | asb | bsa | λ
(B) s → asbs | bsas | λ
(C) s → aAB
A → bBb
B → A | λ where λ denotes empty string

Choose the correct answer from the options given below:
i➥ (A) and (C) only
ii ➥ (B) only
iii ➥ (B) and (C) only
iv ➥ (A) and (B) only

Show Answer With Best Explanation

Answer: I
Explanation: Upload Soon

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.16➡ | NTA UGC NET November 2020
Which of the following are applications of symbol table?
A) Storage allocation
B) Checking type compatibility
C) Suppressing duplicate error messages
Choose the correct answer from the options given below:
i➥ (A) and (B) only
ii ➥ (A) and (C) only
iii ➥ (B) and (C) only
iv ➥ (A), (B) and (C) only

Show Answer With Best Explanation

Answer: IV
Explanation: Upload Soon

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.17➡ | NTA UGC NET November 2020
Which of the following is not an intermediate code form?
i➥ Syntax trees
ii ➥ Three address codes
iii ➥ Quadruples
iv ➥ Post fix Notation

Show Answer With Best Explanation

Answer: *marks to all
Explanation: Upload Soon

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.18➡ | NTA UGC NET December 2019
Which of the component module of DBMS does rearrangement and possible ordering of operations, eliminate redundancy in query and use efficient algorithms and indexes during the execution of a query?
i➥ Query compiler
ii ➥ Query optimizer
iii ➥ Stored data manager
iv ➥ Database processor

Show Answer With Best Explanation

Answer: II

Explanation:
The SQL Server Query Optimizer is a cost-based optimizer. The query optimizer attempts to determine the most efficient way to execute a given query by considering the possible query plans. Database users do not typically interact with a query optimizer, which works in the background.

Query Optimizer does rearrangement and possible ordering of operations, eliminate redundancy in query and use efficient algorithms and indexes during the execution of a query.

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.19➡ | NTA UGC NET June 2019
Replacing the expression 4*2.14 by 8.56 is known as
i➥ Constant folding
ii ➥ Induction variable
iii ➥ Strength reduction
iv ➥ Code reduction

Show Answer With Best Explanation

Answer: I
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.20➡ | NTA UGC NET June 2019
Which data structure is used by the compiler for managing variables and their attributes?
i➥ Binary tree
ii ➥ link list
iii ➥ Symbol table
iv ➥ Parse table

Show Answer With Best Explanation

Answer: III
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.21➡ | NTA UGC NET June 2019
Shift-reduce parser consists of
(a) input buffer
(b) stack
(c) parse table
choose the correct option from those given below:
i➥ (a) and (b) only
ii ➥ (a) and (c) only
iii ➥ (c) only
iv ➥ (a), (b) and (c)

Show Answer With Best Explanation

Answer: IV
Explanation:

Explanation:
Components of a shift-reduce parser:
Stack:
The stack is a data structure that holds a sequence of grammar symbols or states during the parsing process. Initially, it contains only the bottom-of-stack marker (often denoted by $) to indicate an empty stack.
Input Buffer:
The input buffer is a buffer that holds the remaining input to be parsed. It initially contains the entire input string.
Parsing Table:
The parsing table is a key data structure that guides the parser’s actions. It typically contains information about state transitions and actions to be taken based on the current state of the parser and the next input symbol.
Shift Operation:
The shift operation involves moving a symbol from the input buffer to the top of the stack. This operation reflects the parser’s recognition of a portion of the input that matches a valid part of the grammar.
Reduce Operation:
The reduce operation involves replacing a group of symbols on the top of the stack with a non-terminal symbol, according to a production in the grammar. This operation is applied when a portion of the input matches the right-hand side of a production.
Accept Operation:
The accept operation is performed when the entire input has been successfully parsed, and the stack contains only the start symbol. This indicates that the input conforms to the grammar.
Error Handling:
Shift-reduce parsers need mechanisms for error detection and recovery. If the input cannot be successfully parsed, error-handling routines are invoked to handle the issue gracefully.
The shift-reduce parsing process involves a series of shifts and reduces until the entire input is reduced to the start symbol, or an error is detected. The parsing table dictates the actions to be taken at each step, depending on the current state and the next input symbol.
More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.22➡ | NTA UGC NET June 2019
On translating the expression given below into quadruple representation, how many operations are required?
(i*j)+(e+f)*(a*b+c)
i➥ 5
ii ➥ 6
iii ➥ 3
iv ➥ 7

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.23➡ | NTA UGC NET December 2018
The grammar S ⟶ (S) | SS | ∈ is not suitable for predictive parsing because the grammar is
i➥ An Operator Grammar
ii ➥ Right Recursive
iii ➥ Left Recursive
iv ➥ Ambiguous

Show Answer With Best Explanation

Answer: IV
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.24➡ | NTA UGC NET December 2018
Consider the following Grammar G :
S ➝ A | B
A➝ a | c
B➝ b | c
Where {S,A,B} is the set of non-terminals, {a,b,c} is the set of terminals.

Which of the following statement(s) is/are correct ?
S1 : LR(1) can parse all strings that are generated using grammar G.
S2 : LL(1) can parse all strings that are generated using grammar G.
i➥ Both S1 and S2
ii ➥ Only S2
iii ➥ Neither S1 nor S2
iv ➥ Only S1

Show Answer With Best Explanation

Answer: III
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.25➡ | NTA UGC NET June 2018
Consider the following two Grammars :
G1 : S → SbS|a
G2 : S → aB|ab, A→GAB|a, B→ABb|b
Which of the following option is correct ?
i➥ Only G1 is ambiguous
ii ➥ Only G2 is ambiguous
iii ➥ Both G1 and G2 are ambiguous
iv ➥ Both G1 and G2 are not ambiguous

Show Answer With Best Explanation

Answer: III
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.26➡ | NTA UGC NET June 2018
A bottom-up parser generates:
i➥ Leftmost derivation in reverse
ii ➥ Right-most derivation in reverse
iii ➥ Left-most derivation
iv ➥ Right-most derivation

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.27➡ | NTA UGC NET November 2017 Paper 2
Which of the following statements is/are TRUE ?
(i) The grammar S → SS | a is ambiguous (where S is the start symbol).
(ii) The grammar S → 0S1 | 01S | e is ambiguous (the special symbol e represents the empty string and S is the start symbol).
(iii) The grammar (where S is the start symbol).
S → T/U
T → x S y ? xy ? e
U → yT
generates a language consisting of the string yxxyy.
i➥ Only (i) and (ii) are TRUE
ii ➥ Only (i) and (iii) are TRUE
iii ➥ Only (ii) and (iii) are TRUE
iv ➥ All of (i), (ii) and (iii) are TRUE

Show Answer With Best Explanation

Answer: IV
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.28➡ | NTA UGC NET November 2017 Paper 2
A bottom-up parser generates:
i➥ Leftmost derivation in reverse
ii ➥ Right-most derivation in reverse
iii ➥ Left-most derivation
iv ➥ Right-most derivation

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.29➡ | NTA UGC NET November 2017 Paper 2
Match the description of several parts of a classic optimizing compiler in List – I, with the names of those parts in List – II:
Match the description of several parts of a classic optimizing compiler in List – I, with the names of those parts in  List – II:A ➥ (a)-(iii), (b)-(iv), (c)-(ii), (d)-(i) B ➥ (a)-(iv), (b)-(iii), (c)-(ii), (d)-(i) C ➥ (a)-(ii), (b)-(iv), (c)-(i), (d)-(iii) D ➥ (a)-(ii), (b)-(iv), (c)-(iii), (d)-(i)
i➥ (a)-(iii), (b)-(iv), (c)-(ii), (d)-(i)
ii ➥ (a)-(iv), (b)-(iii), (c)-(ii), (d)-(i)
iii ➥ (a)-(ii), (b)-(iv), (c)-(i), (d)-(iii)
iv ➥ (a)-(ii), (b)-(iv), (c)-(iii), (d)-(i)

Show Answer With Best Explanation

Answer: I
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.30➡ | NTA UGC NET January 2017 Paper 2
Consider the following statements related to compiler construction :
I. Lexical Analysis is specified by context-free grammars and implemented by pushdown automata.
II. Syntax Analysis is specified by regular expressions and implemented by finite-state machine.
Which of the above statement(s) is/are correct ?
i➥ Only I
ii ➥ Only II
iii ➥ Both I and II
iv ➥ Neither I nor II

Show Answer With Best Explanation

Answer: IV
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.31➡ | NTA UGC NET August 2016 Paper 2
Which of the following is FALSE?
i➥ The grammar S→aS|aSbS|∈, where S is the only non-terminal symbol, and ∈ is the null string, is ambiguous.
ii ➥ An unambiguous grammar has same leftmost and rightmost derivation.
iii ➥ An ambiguous grammar can never be LR(k) for any k.
iv ➥ Recursive descent parser is a top-down parser

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.32➡ | NTA UGC NET August 2016 Paper 2
In compiler optimization, operator strength reduction uses mathematical identities to replace slow math operations with faster operations. Which of the following code replacements is an illustration of operator strength reduction ?
i➥ Replace P + P by 2 * P or Replace 3 + 4 by 7.
ii ➥ Replace P * 32 by P << 5
iii ➥ Replace P * 0 by 0
iv ➥ Replace (P << 4) – P by P * 15

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.33➡ | NTA UGC NET August 2016 Paper 2
Which of the following are the principles tasks of the linker?
I. Resolve external references among separately compiled program units.
II. Translate assembly language to machine code.
III. Relocate code and data relative to the beginning of the program.
IV. Enforce access-control restrictions on system libraries
i➥ I and II
ii ➥ I and III
iii ➥ II and III
iv ➥ I and IV

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.34➡ | NTA UGC NET July 2016 Paper 2
In _____, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other.
i➥ Loop unrolling
ii ➥ Strength reduction
iii ➥ Loop concatenation
iv ➥ Loop jamming

Show Answer With Best Explanation

Answer: IV
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.35➡ | NTA UGC NET July 2016 Paper 2
Which of the following is not typically a benefit of dynamic linking?
I. Reduction in overall program execution time.
II. Reduction in overall space consumption in memory.
III. Reduction in overall space consumption on disk.
IV. Reduction in the cost of software updates.
i➥ I and IV
ii ➥ I only
iii ➥ II and III
iv ➥ IV only

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.36➡ | NTA UGC NET July 2016 Paper 2
Which of the following is FALSE?
i➥ The grammar S → a Sb |bSa|SS|∈, where S is the only non-terminal symbol and ∈ is the null string, is ambiguous
ii ➥ SLR is powerful than LALR.
iii ➥ An LL(1) parser is a top-down parser.
iv ➥ YACC tool is an LALR(1) parser generator.

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.37➡ | NTA UGC NET December 2015 Paper 2
Loop unrolling is a code optimization technique
i➥ that avoids tests at every iteration of the loop.
ii ➥ that improves performance by decreasing the number of instructions in a basic block.
iii ➥ that exchanges inner loops with outer loops
iv ➥ that reorders operations to allow multiple computations to happen in parallel

Show Answer With Best Explanation

Answer: I
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.38➡ | NTA UGC NET June 2015 Paper 3
Given the following grammars:
G 1 : S → AB|aaB
A → aA | ∈
B → bB | ∈

G2: S → A|B
A → aAb | ab
B → abB | ∈

Which of the following is correct?
i➥ G1 is ambiguous and G2 is unambiguous grammars
ii ➥ G1 is unambiguous and G2 is ambiguous grammars
iii ➥ Both G1 and G2 are ambiguous grammars
iv ➥ Both G1 and G2 are unambiguous grammars

Show Answer With Best Explanation

Answer: III
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.39➡ | NTA UGC NET June 2015 Paper 2
Which one from the following is false?
i➥ LALR parser is Bottom up parser
ii ➥ A parsing algorithm which performs a left to right scanning and a right most deviation is RL (1)
iii ➥ LR parser is Bottom up parser.
iv ➥ In LL(1), the 1 indicates that there is a one – symbol look – ahead.

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

Q.40➡ | NTA UGC NET June 2015 Paper 2
Which phase of compiler generates stream of atoms?
i➥ Syntax Analysis
ii ➥ Lexical Analysis
iii ➥ Code Generation
iv ➥ Code Optimization

Show Answer With Best Explanation

Answer: II
Explanation:

More DiscussionExplanation On YouTubeLearn Topic WiseHelp-Line

error: Content is protected !!
Open chat
1
Hi,how Can We Help You ?