Acd Lab Test G1

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Satyabrata Roy
S
Satyabrata Roy
Community Contributor
Quizzes Created: 1 | Total Attempts: 234
Questions: 21 | Attempts: 234

SettingsSettingsSettings
Acd Lab Test G1 - Quiz


Questions and Answers
  • 1. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    B. B
    Explanation
    A Lex compiler generates transition tables.

    Rate this question:

  • 2. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    C. C
    Explanation
    Yacc semantic action is a sequence of statements.

    Rate this question:

  • 3. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    B. B
    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.

    Rate this question:

  • 4. 

    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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    D. D
    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).

    Rate this question:

  • 5. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    C. C
    Explanation
    YACC builds up LALR parsing table.

    Rate this question:

  • 6. 

    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 

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    B. B
    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.

    Rate this question:

  • 7. 

    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∙ 

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    C. C
    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.

    Rate this question:

  • 8. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    C. C
    Explanation
    The YACC specification consists of 3 sections.

    Rate this question:

  • 9. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    B. B
    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.

    Rate this question:

  • 10. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    A. A
    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.

    Rate this question:

  • 11. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    A. A
  • 12. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    B. B
    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.

    Rate this question:

  • 13. 

    Input of Lex is?    a. set to regular expression          b. statement           c. Numeric data             d. ASCII data 

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    A. A
    Explanation
    The input of Lex is set to a regular expression.

    Rate this question:

  • 14. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    C. C
    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.

    Rate this question:

  • 15. 

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

    • A.

      C

    • B.

      A

    • C.

      B

    • D.

      D

    Correct Answer
    A. C
    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.

    Rate this question:

  • 16. 

    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. 

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

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

    Rate this question:

  • 17. 

    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 

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    A. A
    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.

    Rate this question:

  • 18. 

    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 → є} 

    • A.

      B

    • B.

      A

    • C.

      C

    • D.

      D

    Correct Answer
    B. A
    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 → є}.

    Rate this question:

  • 19. 

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

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    D. D
    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.

    Rate this question:

  • 20. 

    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 

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    B. B
    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.

    Rate this question:

  • 21. 

    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 

    • A.

      A

    • B.

      B

    • C.

      C

    • D.

      D

    Correct Answer
    B. B
    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.

    Rate this question:

Quiz Review Timeline +

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
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.