Acd Lab Test G1

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Satyabrata Roy
S
Satyabrata Roy
Community Contributor
Quizzes Created: 1 | Total Attempts: 424
| Attempts: 424 | Questions: 21
Please wait...
Question 1 / 21
0 %
0/100
Score 0/100
1. Input of Lex is?    a. set to regular expression          b. statement           c. Numeric data             d. ASCII data 

Explanation

The input of Lex is set to a regular expression.

Submit
Please wait...
About This Quiz
Acd Lab Test G1 - Quiz

ACD Lab Test G1 is designed to assess knowledge in compiler design, focusing on lexical analysis, parsing techniques, and grammar rules relevant to computing.

Personalize your quiz and earn a certificate with your name on it!
2. A compiler that runs on one machine and produces code for a different machine is called    a. Cross compilation    b. One pass compilation      c. Two pass compilation    d. None of the above 

Explanation

A compiler that runs on one machine and produces code for a different machine is called cross compilation. This means that the compiler is able to generate executable code for a different target architecture or platform than the one it is running on. Cross compilation is commonly used in software development when building applications for different operating systems or hardware platforms.

Submit
3. Consider a syntax directed translation scheme.If the value of an attribute of a node is a function of  the attributes of its children then the attribute is called a     A. Canonical attribute     B. Synthesized attribute    C. Inherited attributes    D. None of the above 

Explanation

In a syntax directed translation scheme, if the value of an attribute of a node is determined solely by the attributes of its children, then the attribute is called a synthesized attribute. This means that the value of the attribute is computed or derived from the values of the attributes of the children nodes.

Submit
4. YACC specification consists_______________sections.A. 0B. 1C. 3D. 5

Explanation

The YACC specification consists of 3 sections.

Submit
5. A................. is a logically cohesive operation that takes as input one representation of the source program and produces as output as another representation.   a) Phase                        b) Pass                               c) Semantic Analysis      d) None of above. 

Explanation

A phase is a logically cohesive operation that takes as input one representation of the source program and produces as output another representation.

Submit
6. The input to syntax analysis is__________________.A. A sequence of lexemesB. A sequence of tokensC. A sequence of charactersD. A sequence of patterns

Explanation

The input to syntax analysis is a sequence of tokens. Syntax analysis is a phase in the compilation process where the sequence of tokens is analyzed to determine if it conforms to the grammar rules of a programming language. Tokens are the smallest meaningful units of a program, and they are generated by the lexical analysis phase. Therefore, the correct answer is B.

Submit
7. The minimum value for k in LR(k) is_____________________.A. 1B. 0C. 2D. 3

Explanation

In LR(k), k represents the number of lookaheads used by the parser to make decisions. The minimum value for k in LR(k) is 0, which means that the parser does not use any lookaheads to make decisions. This implies that the parser can make decisions based solely on the current input symbol without considering any future input symbols. Therefore, the correct answer is B.

Submit
8. YACC builds up      a)   SLR parsing table                            b) Canonical LR parsing table      c)   LALR parsing table                         d) None of the above 

Explanation

YACC builds up LALR parsing table.

Submit
9. Yacc semantic action is a sequence of?a. Tokens                 b. Expression                        c.  statement                          d. Rules

Explanation

Yacc semantic action is a sequence of statements.

Submit
10. Which of the following is an LR(0) itemA. [S->.Aab]B. [S->Aa,b,D]C. [S->Aab,]D. [S->Aa,b]

Explanation

not-available-via-ai

Submit
11. In LR(1)___________ means the right most derivation is used to construct the parse treeA. R       B. LRC.LR(1)D.L

Explanation

In LR(1) parsing, the rightmost derivation is used to construct the parse tree. This means that the rightmost non-terminal in a production rule is always expanded first during the parsing process. This approach ensures that the parser can handle left-recursive and right-recursive productions efficiently, as it always chooses the rightmost non-terminal to expand. Therefore, option A is the correct answer.

Submit
12. LEX and YACC is a tool used for automatically generating.................    a) Lexical Analyzers     b) Semantic Analyzer          c) Syantactic Analyzer   d) Symbol table 

Explanation

LEX and YACC are tools used for automatically generating a) Lexical Analyzers. LEX is a lexical analyzer generator that takes a set of regular expressions and produces a program that matches input against those expressions. YACC is a parser generator that takes a context-free grammar and produces a program that recognizes the structure of input according to that grammar. Therefore, the correct answer is c) Syntactic Analyzer, as it refers to the process of analyzing the syntax of a program based on a given grammar.

Submit
13. Yacc resolves conflicts by of type ?     A. Reduce – Reduce             B. Shift reduce             C. Shift – Shift            D.    A and B 

Explanation

Yacc resolves conflicts by both reducing and shifting. This means that when faced with a conflict, Yacc can either choose to reduce the grammar rule or shift the input token. The correct answer, option D, states that Yacc resolves conflicts by both reducing and shifting, which is the most accurate explanation for how Yacc handles conflicts.

Submit
14. A Lex compiler generates?a. Lex object code           b. Transition tables        c. Tokens               d. None of above

Explanation

A Lex compiler generates transition tables.

Submit
15. Find the best match between the element of Group-1 and Group -2 given below.                             Group-1                           Group -2                       P. Data-flow analysis         1. Lexical analysis                      Q: Regular expression        2. Semantic analysis                      R: Type Checking              3.Parsing                      S: Pushdown Automata      4. Code optimization            A. P-4, Q-1, R-3, S-2                                           B. P-2, Q-1, R-4, S-3      C. P-1, Q-4, R-2, S-3                                           D. P-4, Q-1, R-2, S-3

Explanation

The correct answer is d) P-4, Q-1, R-2, S-3. This is because data-flow analysis is a type of code optimization (P-4), lexical analysis involves regular expressions (Q-1), semantic analysis involves type checking (R-2), and parsing involves pushdown automata (S-3).

Submit
16. Consider the following grammar      S → FR                 R → *S | є              F → id      in the predictive parser table, M, of the grammar the entries M[S, id] and M[R, $] respectively      (A) {S → FR} and {R →є }                                  (B) {S → FR} and { }      (C) {S → FR} and {R → *S}                               (D) {F → id} and {R → є} 

Explanation

In the given grammar, the entry M[S, id] in the predictive parser table indicates that when the parser is in state S and the next input symbol is id, the production rule S → FR should be applied. Similarly, the entry M[R, $] indicates that when the parser is in state R and the next input symbol is $ (end of input), the production rule R → є (epsilon) should be applied. Therefore, the correct answer is (A) {S → FR} and {R → є}.

Submit
17. Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has   n2 states. The relationship between n1 and n2 is     (A) n1 is necessarily less than n2                (B) n1 is necessarily equal to n2     (C) n1 is necessarily greater than n2           (D) None of these 

Explanation

The LALR parser is a more powerful parser than the SLR parser, which means that it can handle a larger class of grammars. Therefore, it is possible for the LALR parser to have more states (n2) than the SLR parser (n1). Hence, the correct answer is that n1 is necessarily equal to n2.

Submit
18. Consider the grammar: S -> L= R | RL ->* R | idR -> LWhich of the following set of LR (0) items definitely does not represent a valid state of an LR (0) parser?     A. S -> L =∙R, R -> ∙L                                               B. L -> id.     C. S -> L∙ = R, R -> L∙                                              D. R -> L∙ 

Explanation

The set of LR(0) items in option C represents a shift-reduce conflict, which is not valid in an LR(0) parser. In this state, the parser has already seen the production S -> L = R and is expecting the next token to be "=", but it also has the option to reduce R -> L. This ambiguity in the parser's action leads to a conflict and makes this state invalid.

Submit
19. ................ Grammars are known as context sensitive grammars.     a) Type 0                  b) Type 1                                 c) Type 2                        d) Type 3 

Explanation

Context-sensitive grammars are a type of formal grammar that generate languages known as context-sensitive languages. These grammars have rules that allow for the rewriting of symbols based on the context in which they appear. Type 1 grammars, also known as context-sensitive grammars, are able to generate context-sensitive languages and are more powerful than Type 2 (context-free) and Type 3 (regular) grammars. Therefore, the correct answer is b) Type 1.

Submit
20. Which of the following software tool is parser generator?    a. Lex                                          b. Yacc                   c. Both A and B            d. None of these 

Explanation

Lex and Yacc are both software tools used for creating parsers. Lex is a lexical analyzer generator, which is used to generate lexical analyzers for tokenizing input into a stream of tokens. Yacc, on the other hand, is a parser generator, which is used to generate parsers for analyzing the structure of the input based on a specified grammar. Both Lex and Yacc are commonly used together to create a complete parser for a programming language or other formal language. Therefore, the correct answer is c. Both A and B.

Submit
21. Which of the following grammar rules violate the requirements of an operator grammar? P,Q,R are non-terminals and r,s,t are terminals.(i) P -> Q R(ii) P -> s R(iii) P -> є(iv) P -> Q t R r    (A) (i) only           (B) (i) and (iii) only             (C) (ii) and (iii) only            (D) (iii) and (iv) only 

Explanation

Option (ii) violates the requirements of an operator grammar because it has a terminal symbol (s) appearing before a non-terminal symbol (R). In an operator grammar, the non-terminal symbols should appear before the terminal symbols. Option (i) does not violate the requirements as it follows the correct order of non-terminal symbols (Q) followed by (R). Option (iii) does not violate the requirements as it allows for an empty production (є). Option (iv) does not violate the requirements as it follows the correct order of non-terminal symbols (Q), (R), and (r) followed by the terminal symbol (t). Therefore, the correct answer is (B) (i) and (iii) only.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 20, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 25, 2017
    Quiz Created by
    Satyabrata Roy
Cancel
  • All
    All (21)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Input of Lex is?    a. set to regular...
A compiler that runs on one machine and produces code for a different...
Consider a syntax directed translation scheme.If the value of an...
YACC specification consists_______________sections.A. 0B. 1C. 3D. 5
A................. is a logically cohesive operation that takes as...
The input to syntax analysis is__________________.A. A sequence of...
The minimum value for k in LR(k) is_____________________.A. 1B. 0C....
YACC builds up      a)   SLR...
Yacc semantic action is a sequence of?a....
Which of the following is an LR(0) itemA. [S->.Aab]B....
In LR(1)___________ means the right most derivation is used to...
LEX and YACC is a tool used for automatically...
Yacc resolves conflicts by of type ?     A. Reduce...
A Lex compiler generates?a. Lex object...
Find the best match between the element of Group-1 and Group -2 given...
Consider the following grammar      S →...
Assume that the SLR parser for a grammar G has n1 states and the LALR...
Consider the grammar: S -> L= R | RL ->* R | idR -> LWhich of...
................ Grammars are known as context sensitive...
Which of the following software tool is parser...
Which of the following grammar rules violate the requirements of an...
Alert!

Advertisement