Lp Quiz Test 4

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 Rsoni
R
Rsoni
Community Contributor
Quizzes Created: 1 | Total Attempts: 405
| Attempts: 405 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Construct LL(1) parsing table for the following grammar: 
                Program → begin d Semi X end
                X → d semi X / s Y
                Y → semi s Y / λ
 
 begindsemiends$
Program1     
X 2  3 
Y  45  
 
What will be the entry for 2:

Explanation

The entry for 2 in the LL(1) parsing table will be X → d semi X. This is because when the parser sees a non-terminal X followed by the terminal "d", it knows that it should use the production X → d semi X to expand X.

Submit
Please wait...
About This Quiz
Lp Quiz Test 4 - Quiz

LP Quiz Test 4 evaluates understanding of LL(1) parsing tables for specific grammar rules and identifies handles in bottom-up parsing. It's designed to assess key skills in compiler design, particularly in parsing techniques, enhancing learners' ability to analyze and apply grammatical rules in computational contexts.

Tell us your name to personalize your report, certificate & get on the leaderboard!
2. Construct LL(1) parsing table for the following grammar: 
                Program → begin d Semi X end
                X → d semi X / s Y
                Y → semi s Y / λ
 
 begindsemiends$
Program1     
X 2  3 
Y  45  
 
What will be the entry for 1:

Explanation

not-available-via-ai

Submit
3. Construct LL(1) parsing table for the following grammar: 
                Program → begin d Semi X end
                X → d semi X / s Y
                Y → semi s Y / λ
 
 begindsemiends$
Program1     
X 2  3 
Y  45  
 
What will be the entry for 4:

Explanation

not-available-via-ai

Submit
4. Construct LL(1) parsing table for the following grammar: 
                Program → begin d Semi X end
                X → d semi X / s Y
                Y → semi s Y / λ
 
 begindsemiends$
Program1     
X 2  3 
Y  45  
 
What will be the entry for 3:

Explanation

not-available-via-ai

Submit
5. Construct LL(1) parsing table for the following grammar: 
                Program → begin d Semi X end
                X → d semi X / s Y
                Y → semi s Y / λ
 
 begindsemiends$
Program1     
X 2  3 
Y  45  
 
What will be the entry for 5:

Explanation

The entry for 5 in the LL(1) parsing table will be Y → λ. This is because when the parser sees a "semi" token in the input, it can choose to expand Y → λ, which represents an empty production. This allows the parser to skip over the "semi" token and continue parsing the rest of the input.

Submit
6. Consider the following grammar: S → CC C →cC / d The above grammar is

Explanation

The given grammar is LL(1) because it is a left-to-right, leftmost derivation with one lookahead symbol. In LL(1) parsing, the parser scans the input from left to right, and at each step, it uses a single lookahead symbol to decide which production rule to apply. In this grammar, the non-terminal S can only derive to CCC or cC, and there is no ambiguity or conflict in the productions. Therefore, the grammar is LL(1).

Submit
7.  Consider the following grammar:                E → E + n / E * n / nfor the sentence n+n*n, the handles in the bottom-up parsing will be:

Explanation

The given grammar is a right-recursive grammar, which means that the rightmost non-terminal in the production rule is expanded first. In the given sentence "n+n*n", the handles are the substrings that match the right side of a production rule and can be reduced to the left side of that rule.

Starting from the leftmost non-terminal, we can see that the handle "n" matches the right side of the production rule E -> n. This handle can be reduced to E.

Next, the handle "E+n" matches the right side of the production rule E -> E + n. This handle can be reduced to E.

Finally, the handle "E*n" matches the right side of the production rule E -> E * n. This handle can also be reduced to E.

Therefore, the handles in the bottom-up parsing of the given sentence are n, E+n, and E*n.

Submit
8. Consider SLR(1) and LR(0) table for any given CFG. Which one of the following is false?

Explanation

The Goto entries in the SLR(1) and LR(0) tables may be different. The Goto entries in the SLR(1) table represent the next state to transition to when a non-terminal symbol is encountered, while the Goto entries in the LR(0) table represent the next state to transition to when a production rule is completed. Since the SLR(1) and LR(0) parsing methods have different lookahead sets, it is possible for the Goto entries to differ between the two tables.

Submit
9. Consider the following two statementsa) Every SLR(1) grammar is also LR(0) grammar.b) Every LL(1) grammar is also LL(2) grammar.Which of the following option is correct?

Explanation

not-available-via-ai

Submit
10. If the parse tree of a word w generated by a Chomsky normal form grammar has no path of length greater than i, then the word w is of length:

Explanation

If the parse tree of a word w generated by a Chomsky normal form grammar has no path of length greater than i, then the word w is of length no greater than 2 ^ i. This is because the Chomsky normal form grammar restricts the length of the paths in the parse tree. Each rule in the grammar either replaces a non-terminal symbol with two non-terminal symbols or with a terminal symbol. Therefore, at each step, the number of symbols in the word doubles. So, if there is no path of length greater than i, then the word can have at most 2 ^ i symbols.

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
  • Mar 01, 2017
    Quiz Created by
    Rsoni
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Construct LL(1) parsing table for the following...
Construct LL(1) parsing table for the following...
Construct LL(1) parsing table for the following...
Construct LL(1) parsing table for the following...
Construct LL(1) parsing table for the following...
Consider the following grammar: S → CC C →cC / d The above...
 Consider the following...
Consider SLR(1) and LR(0) table for any given CFG. Which one of the...
Consider the following two statementsa) Every SLR(1) grammar is also...
If the parse tree of a word w generated by a Chomsky normal form...
Alert!

Advertisement