CS606-MidTerm-MehranAli.pdf

Verified academic study resource for CS606 (Compiler Design & Construction) under the Computer Science at Virtual University of Pakistan. This PDF document (Midterm Solved Past Paper & Revision File compiled by Rana Abubakar Khan) covers Mid-Term Exam Scope (Lectures 1 to 22) spanning approximately 240 pages across 4 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.

Course
CS606 – Compiler Design & Construction
Faculty
Computer Science
Format
PDF
Type
Midterm
Coverage
Mid-Term Exam Scope (Lectures 1 to 22)
Compiled by
Rana Abubakar Khan
Tags
MIDTERM

Focus on core definitions and repeated MCQs from Lectures 1–22. Remember that scoring in the First Half builds your safety buffer toward the mandatory 20% Two-Half passing rule in CS606.

What this file covers — CS606 syllabus roadmap

  1. Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
  2. Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
  3. Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
  4. Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)

Frequently asked questions

Where can I download CS606-MidTerm-MehranAli.pdf for free?

You can preview and download "CS606-MidTerm-MehranAli.pdf" (CS606 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs606-midterm-mehranali-pdf) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS606 file?

This document covers Mid-Term Exam Scope (Lectures 1 to 22) across 4 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.

What is the passing criteria for CS606 under the VU 20% Two-Half Rule?

Under official Virtual University regulations, students must score at least 20% in the First Half (Quizzes, Assignments, GDBs, and Midterm combined) AND independently at least 20% in the Final-Term examination paper. Scoring under 20% in the final exam results in an automatic F grade regardless of earlier marks.

Are CS606 solved past papers and handouts verified for 2026 exams?

Yes. All CS606 materials on MIHORA VU—including Moaaz, Waqar Siddhu, and team archives—are reviewed against the current VU syllabus to help students prepare for 2026 Midterm, Final-Term, and online quiz examinations.

Inside this file

CS606 Current Mid Term Solved subjective
Date 10-06-2014

Mehranali1991@gmail.com
Linker use in compiler?

A compiler generates object code files (machine language) from source code.A linker combines these
object code files into an executable.

Write a regular expression for the language of all words that starts and ends with different
letters. Answer:
a(a+b)*b+b(a+b)*a

Diff between/ Left recursion and Left factoring

1. Left recursion: when one or more productions can be reached from themselves with no
   tokens consumed in-between.
2. Left factoring: a process of transformation, turning the grammar from a left-recursive form
   to an equivalent non-left-recursive form.

 Bottom-up Parsing
 Bottom-up parsing is more general than top-down parsing. Bottom-up parsers handle a
 large class of grammars. It is the preferred method in practice. It is also called LR
 parsing; L means that tokens are read left to right and R means that the parser constructs a
 rightmost derivation. LR parsers do not need left-factored grammars.

Syntactic errors

in computing, an error in a program due to a code that does not conform to order
expected by the programming language

Example:

A syntax error occurs when a user (or programmer) has put words in an order that aprogram doe
s not understand.

Top down parser cannot be left recursive how we can handle it?
Answer:
Our expression grammar is left recursive. This can lead to non-termination in a top-down parser.
Non-termination is bad in any part of a compiler! For a top-down parser, any recursion must be a
right recursion. We would like to convert left recursion to right .

Question
What is the role of Automatic Code Generator with respect to compiler?
Answer:
It generates efficient tokens automatically. It is known as Lexer generator.

Question No2
How Linker play an important role with respects to compilers constructions?
A linker or link editor is a computer program that takes one or more source files generated by a
compiler and combines them into a single executable program.

Question No 4
Consider the following grammar. Calculate the first set of non- terminal S, A and B

S→ AB
A→ a│ε
B→ b│ε
Solution:
S→ AB
Rules for making first set:
1) If S→ A….Z then first of S will be First of A….Z
2) If First of A….Z all contains ε then first of S will also contain ε
3) If any (single) First set from A….Z doesn’t contain ε in their First set then First of S will also
doesn’t contain ε.
4) The first of A will be first non terminal on r.h.s
5) The first of B will also be the non terminal on r.h.s
6) Note: ε is also a terminal.

Now make first sets for S,A and B
First{A}={a, ε }
First{B}={b ,ε}

Q. Up frontier discovery useful for top down parser.

Answer:
A bottom-up parser builds the parse tree starting with its leaves and working toward its root. The
upper edge of this partially constructed parse tree is called its upper frontier

Q. In two pass assembler what is the objective of First Pass? 2 marks
Answer:
First pass contains Scanner + Parser in it. Scanner takes the streams of chcracters as input and
converts them into words or tokens
<Token type, word>
While Parser check those tokens for syntactic analysis and semantic analysis if found errors then
report them after that it develop an IR.
Q. What is Register allocation? 3 marks
Answer:
Registers in a CPU play an important role for providing high speed access to operands. Memory
access is an order of magnitude slower than register access. The back end attempts to have each
operand value in a register when it is used. However, the back end has to manage a limited set of
resources when it comes to the register file. The number of registers is small and some registers
are pre-allocated for specialize used, e.g., program counter, and thus are not available for use to
the back end. Optimal register allocation is NP-Complete.

Why bottom up parser is called LR parser?
Answer:
Bottom-up parsing is more general than top-down parsing. Bottom-up parsers handle a
large class of grammars. It is the preferred method in practice. It is also called LR
parsing; L means that tokens are read left to right and R means that the parser constructs a rightmost
derivation. LR parsers do not need left-factored grammars. LR parsers can
handle left-recursive grammars.

Best of luck

Remember me in your prays …!!!!!!

More CS606 files

All CS606 files · Midterm Prep 2026 · MCQs Bank