Probability Engine · CSC365

Compiler Design and Construction (BSc CSIT, CSC365): the questions likely to come

29 analyzed questions from 7 past papers (2074-2081), grouped by syllabus unit — each with its probability, how often it's been asked, and where to study the answer.

7
Papers analyzed
2074-2081
29
Analyzed questions
across 7 syllabus units
3
Very likely units
high-probability topics
5
Units = 80% of marks
study these first
Model answers for this subject are being written. Every question links to its original paper so you can study from the source meanwhile.
Pick a unit
U3 · Q1/10 · 208010 marks
Syntax Analysis (Parsing)

Explain top-down parsing. Construct the predictive (LL(1)) parsing table for the grammar E -> E+T | T, T -> T*F | F, F -> (E) | id after removing left recursion.

34%
Possible to appearAppeared in 2 of the last 2 board papers
Seen in
How well do you know this?rating moves you on
MODEL ANSWERU3 · 10 marks

Top-Down Parsing

Top-down parsing builds the parse tree from the root (start symbol) down to the leaves (terminals), attempting a leftmost derivation of the input. The two main approaches are:

  • Recursive-descent parsing (may use backtracking).
  • Predictive / LL(1) parsing — a non-backtracking, table-driven method that uses one symbol of look-ahead. It requires the grammar to be free of left recursion and to be left-factored.

Step 1: Remove Left Recursion

Given grammar:

EE+TT,TTFF,F(E)idE \to E+T \mid T, \quad T \to T*F \mid F, \quad F \to (E) \mid id

After eliminating left recursion:

ETEE \to T\,E' E+TEεE' \to +T\,E' \mid \varepsilon TFTT \to F\,T' TFTεT' \to *F\,T' \mid \varepsilon F(E)idF \to (E) \mid id

Step 2: FIRST and FOLLOW Sets

Non-terminalFIRSTFOLLOW
EE{ (, id }{ ), $ }
EE'{ +, ε\varepsilon }{ ), $ }
TT{ (, id }{ +, ), $ }
TT'{ *, ε\varepsilon }{ +, ), $ }
FF{ (, id }{ +, *, ), $ }

Step 3: LL(1) Predictive Parsing Table

Entry M[A, a] holds the production used when non-terminal AA is on the stack and aa is the look-ahead.

id+*()$
EETEE\to TE'ETEE\to TE'
E'E+TEE'\to +TE'EεE'\to\varepsilonEεE'\to\varepsilon
TTFTT\to FT'TFTT\to FT'
T'TεT'\to\varepsilonTFTT'\to *FT'TεT'\to\varepsilonTεT'\to\varepsilon
FFidF\to idF(E)F\to (E)

Blank cells denote error entries. Since no cell has more than one production, the grammar is LL(1) and can be parsed top-down without backtracking.

AI-generated answer · unverifiedView in 2080 paper →
U3 · Question 1 of 10
Question Priority · U3ranked by appearance likelihood — study top-down

Syntax Analysis (Parsing)

Analyzed next53%
1
★ TOP PICK

Explain top-down parsing. Construct the predictive (LL(1)) parsing table for the grammar E -> E+T | T, T -> T*F | F, F -> (E) | id after removing left recursion.

10 marksSEEN IN
34%
2

Explain the general structure of an LR parser. Construct the LR(0) item sets for the grammar S -> AA, A -> aA | b.

10 marksSEEN IN
30%
3

Construct the LR(1) parsing table for the grammar S -> CC, C -> cC | d and parse the input string cdd.

10 marksSEEN IN
28%
4

Eliminate left recursion and perform left factoring on the grammar A -> Aab | Ac | bd | f.

5 marksSEEN IN
53%
5

What is an ambiguous grammar? Show with an example.

5 marksSEEN IN
53%
6

Differentiate between LL(1) and LR parsers.

5 marksSEEN IN
53%
7

Explain the handle and handle pruning in shift-reduce parsing.

5 marksSEEN IN
53%
8

What is operator precedence parsing?

5 marksSEEN IN
42%
9

Differentiate between top-down and bottom-up parsing.

5 marksSEEN IN
42%
10

Differentiate between a parse tree and a syntax tree.

5 marksSEEN IN
26%
03The mock

Sit a probable paper

A full mock exam built from the most likely questions, mirroring the real paper's structure. Every slot is a real past question.

Most Probable Paper

Mirrors the real structure · 60 marks · based on 7 past papers

Section A: Long Answer QuestionsAttempt any TWO questions.
  1. 1.

    Explain the different phases of a compiler with a suitable diagram, showing the output of each phase for the statement position = initial + rate * 60.

    [10 marks]
    IntroductionVery likelyfrom 2081 paper →

    This question has recurred in 3 of 7 years; so far only in internal assessments, not the board; and its topic (Introduction) appears in 100% of years.

  2. 2.

    Explain top-down parsing. Construct the predictive (LL(1)) parsing table for the grammar E -> E+T | T, T -> T*F | F, F -> (E) | id after removing left recursion.

    [10 marks]
    Syntax Analysis (Parsing)Very likelyfrom 2080 paper →

    This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic (Syntax Analysis (Parsing)) appears in 100% of years.

  3. 3.

    Explain the general structure of an LR parser. Construct the LR(0) item sets for the grammar S -> AA, A -> aA | b.

    [10 marks]
    Syntax Analysis (Parsing)Very likelyfrom 2079 paper →

    This question has recurred in 2 of 7 years; so far only in internal assessments, not the board; and its topic (Syntax Analysis (Parsing)) appears in 100% of years.

Section B: Short Answer QuestionsAttempt any EIGHT questions.
  1. 1.

    Eliminate left recursion and perform left factoring on the grammar A -> Aab | Ac | bd | f.

    [5 marks]
    Syntax Analysis (Parsing)Very likelyfrom 2081 paper →

    This question has recurred in 4 of 7 years; so far only in internal assessments, not the board; and its topic (Syntax Analysis (Parsing)) appears in 100% of years.

  2. 2.

    What is an ambiguous grammar? Show with an example.

    [5 marks]
    Syntax Analysis (Parsing)Very likelyfrom 2081 paper →

    This question has recurred in 4 of 7 years; so far only in internal assessments, not the board; and its topic (Syntax Analysis (Parsing)) appears in 100% of years.

  3. 3.

    Differentiate between LL(1) and LR parsers.

    [5 marks]
    Syntax Analysis (Parsing)Very likelyfrom 2081 paper →

    This question has recurred in 4 of 7 years; so far only in internal assessments, not the board; and its topic (Syntax Analysis (Parsing)) appears in 100% of years.

  4. 4.

    Explain the handle and handle pruning in shift-reduce parsing.

    [5 marks]
    Syntax Analysis (Parsing)Very likelyfrom 2081 paper →

    This question has recurred in 4 of 7 years; so far only in internal assessments, not the board; and its topic (Syntax Analysis (Parsing)) appears in 100% of years.

  5. 5.

    Differentiate between a compiler and an interpreter.

    [5 marks]
    IntroductionVery likelyfrom 2081 paper →

    This question has recurred in 4 of 7 years; so far only in internal assessments, not the board; and its topic (Introduction) appears in 100% of years.

  6. 6.

    What is a symbol table? Explain its role in a compiler.

    [5 marks]
    IntroductionVery likelyfrom 2081 paper →

    This question has recurred in 4 of 7 years; so far only in internal assessments, not the board; and its topic (Introduction) appears in 100% of years.

  7. 7.

    Explain the role of the lexical analyzer in a compiler.

    [5 marks]
    Lexical AnalysisVery likelyfrom 2081 paper →

    This question has recurred in 4 of 7 years; so far only in internal assessments, not the board; and its topic (Lexical Analysis) appears in 100% of years.

  8. 8.

    What are regular expressions? Write a regular expression for identifiers.

    [5 marks]
    Lexical AnalysisVery likelyfrom 2081 paper →

    This question has recurred in 4 of 7 years; so far only in internal assessments, not the board; and its topic (Lexical Analysis) appears in 100% of years.

  9. 9.

    What is operator precedence parsing?

    [5 marks]
    Syntax Analysis (Parsing)Very likelyfrom 2080 paper →

    This question has recurred in 3 of 7 years; so far only in internal assessments, not the board; and its topic (Syntax Analysis (Parsing)) appears in 100% of years.

04The receipts

Behind the numbers

The raw evidence the predictions are computed from: marks per unit per year, syllabus weights, trends, and coverage.

Show the heatmap, topic table and coverage analysis

The receipt: marks per unit, per year

Each row is a syllabus unit, each column an exam year, each cell the marks that unit earned that year. Click any cell to see the actual questions behind it.

Marks:nonefew → many
2074
2075
2077
2078
2079
2080
2081
Total
U3Syntax Analysis (Parsing)
180
U1Introduction
85
U2Lexical Analysis
75
U4Syntax-Directed Translation
65
U6Code Optimization
50
U5Intermediate Code Generation
35
U7Code Generation
35
#Syllabus unitProbabilityAppearedAvg marksSyllabus weightExam vs syllabusTrendQuestions
1U3Syntax Analysis (Parsing)Very likely100%25.731%14 lecture hrsBalancedexam 34% · syllabus 31%Fading10 recurring10 total
2U1IntroductionVery likely100%12.19%4 lecture hrsOver-examinedexam 16% · syllabus 9%Steady4 recurring4 total
3U2Lexical AnalysisVery likely100%10.718%8 lecture hrsBalancedexam 14% · syllabus 18%Steady4 recurring4 total
4U4Syntax-Directed TranslationLikely71%1313%6 lecture hrsBalancedexam 12% · syllabus 13%Steady4 recurring4 total
5U6Code OptimizationLikely57%12.59%4 lecture hrsBalancedexam 10% · syllabus 9%Steady3 recurring3 total
6U5Intermediate Code GenerationLikely71%713%6 lecture hrsUnder-examinedexam 7% · syllabus 13%Steady2 recurring2 total
7U7Code GenerationLikely71%77%3 lecture hrsBalancedexam 7% · syllabus 7%Steady2 recurring2 total

Study smart, not hard

Drag the slider: studying the top 5 units in priority order covers ~87% of all observed marks.

  1. ~80% line

Lecture time vs exam marks

Where the exam pays more than the curriculum spends: ● lectures vs ● exam marks, as a share of the whole course. A long teal-leading bar = high-yield unit.

U3Syntax Analysis (Parsing)
31% of lectures → 34% of marks
U1Introduction
9% of lectures → 16% of markshigh yield
U2Lexical Analysis
18% of lectures → 14% of marks
U4Syntax-Directed Translation
13% of lectures → 12% of marks
U6Code Optimization
9% of lectures → 10% of marks
U5Intermediate Code Generation
13% of lectures → 7% of markslow yield
U7Code Generation
7% of lectures → 7% of marks

Topics are the official CSC365 syllabus units. Predictions are data-driven probabilities computed from 7 past papers (2074-2081) by mapping each real question to its syllabus unit. They indicate what has historically been likely, not guaranteed questions. Always study the full syllabus.