My Cart
Your Cart 0

    Your cart is empty.

  • Total (Amount) ₹0.00
Previous year question hub

Code Generation and Optimization - Compiler Design - Computer Science & Information Technology Previous Year Questions

Practice Code Generation and Optimization - Compiler Design - Computer Science & Information Technology previous year questions organised from real papers, with year-wise coverage and clear topic navigation.

13Papers
7Years
19Questions
1Topics

Code Generation and Optimization question pattern

Every graph below is calculated only from this selection.

Questions by year

Year-wise coverage for Code Generation and Optimization. Each bar uses a separate theme-derived color.

Difficulty distribution

How the classified questions are distributed by difficulty.

Easy 9 47.4%
Medium 8 42.1%
Hard 2 10.5%

Question type distribution

MCQ, numerical, multiple-select and other formats found in these papers.

MCQ 15 78.9%
MSQ 3 15.8%
Numerical Answer Type (NAT) 1 5.3%

Subject weightage

Top subjects by unique question coverage.

Computer Science & Information Technology
19 Qs

Most asked topics

Top topics across the included previous year papers.

Compiler Design
19 Qs

Subtopic coverage

Top subtopics inside this exact selection.

Code Generation and Optimization
19 Qs

Paper coverage

Question coverage for the most populated papers. Every active PYP paper remains listed below.

Computer Science and Information Technology (CS) 2026
1 Qs
Computer Science and Information Technology (CS) 2026
1 Qs
Computer Science & Information Technology (CS) 2025 [Session 1]
2 Qs
Computer Science & Information Technology (CS) 2025 [Session 2]
1 Qs
Computer Science & Information Technology (CS) 2024 [Session 1]
1 Qs
Computer Science & Information Technology (CS) 2024 [Session 2]
1 Qs
Computer Science & Information Technology (CS) 2021 [Session 2]
2 Qs
Computer Science & Information Technology (CS) 2015 [Session 2]
1 Qs
Computer Science & Information Technology (CS) 2014 [Session 3]
2 Qs
Computer Science & Information Technology (CS) 2014 [Session 1]
1 Qs
Computer Science & Information Technology (CS) 2013 [Session 1]
2 Qs
Computer Science & Information Technology (CS) 2013 [Session 3]
2 Qs
Computer Science & Information Technology (CS) 2013 [Session 4]
2 Qs

Included previous year papers

Newest papers appear first. Sort by year, question coverage or name.

PaperYear / sessionQuestions in this viewOpen
Computer Science and Information Technology (CS) 202620261View paper
Computer Science and Information Technology (CS) 202620261View paper
Computer Science & Information Technology (CS) 2025 [Session 1]20252View paper
Computer Science & Information Technology (CS) 2025 [Session 2]20251View paper
Computer Science & Information Technology (CS) 2024 [Session 1]20241View paper
Computer Science & Information Technology (CS) 2024 [Session 2]20241View paper
Computer Science & Information Technology (CS) 2021 [Session 2]20212View paper
Computer Science & Information Technology (CS) 2015 [Session 2]20151View paper
Computer Science & Information Technology (CS) 2014 [Session 1]20141View paper
Computer Science & Information Technology (CS) 2014 [Session 3]20142View paper
Computer Science & Information Technology (CS) 2013 [Session 1]20132View paper
Computer Science & Information Technology (CS) 2013 [Session 3]20132View paper
Computer Science & Information Technology (CS) 2013 [Session 4]20132View paper

All Code Generation and Optimization previous year questions

Practice every matching question in batches of 20, with every available option.

1
2013 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2013 [Session 1]
Suppose the instruction set architecture of the processor has only two registers. The only allowed compiler optimization is code motion, which moves statements from one place to another while preserving correctness. What is the minimum number of spills to memory in the compiled code?
Open complete paper
2
2013 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2013 [Session 1]
What is the minimum number of registers needed in the instruction set architecture of the processor to compile this code segment without any spill to memory? Do not apply any optimization other than optimizing register allocation.
Open complete paper
3
2014 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2014 [Session 1]
Which one of the following is FALSE?
Open complete paper
4
2014 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2014 [Session 3]
One of the purposes of using intermediate code in compilers is to
Open complete paper
5
2014 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2014 [Session 3]
Consider the basic block given below.
a = b + c
c = a + d
d = b + c
e = d - b
a = e + b
The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are
Open complete paper
6
2015 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2015 [Session 2]
Consider the intermediate code given below.
(1)  i = 1
(2)  j = 1
(3)  t1 = 5 * i
(4)  t2 = t1 + j
(5)  t3 = 4 * t2
(6)  t4 = t3
(7)  a[t4] = -1
(8)  j = j + 1
(9)  if j <= 5 goto (3)
(10)  i=i+1
(11)  if i < 5 goto (2)
The number of nodes and edges in the control-flow-graph constructed for the above code, respectively, are
Open complete paper
7
2021 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2021 [Session 2]
Consider the following ANSI C code segment:
z = x + 3 + y->f1 + y->f2;
for (i = 0; i < 200; i = i + 2) {
if (z > i) {
p = p + x + 3;
q = q + y->f1;
} else {
p = p + y->f2;
q = q + x + 3;
}
}
Assume that the variable y points to a struct (allocated on the heap) containing two fields f1 and f2, and the local variables x, y, z, p, q, and i are allotted registers. Common sub-expression elimination (CSE) optimization is applied on the code. The number of addition and dereference operations (of the form y->f1 or y->f2) in the optimized code, respectively, are:
Open complete paper
8
2021 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2021 [Session 2]

For a statement \(S\) in a program, in the context of liveness analysis, the following sets are defined:

\(USE(S)\) : the set of variables used in \(S\)

\(IN(S)\) : the set of variables that are live at the entry of \(S\)

\(OUT(S)\) : the set of variables that are live at the exit of \(S\)

Consider a basic block that consists of two statements, \(S_1\) followed by \(S_2\). Which one of the following statements is correct?

Open complete paper
9
2024 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2024 [Session 1]
Consider the following pseudo-code.
L1: t1 = -1
L2: t2 = 0
L3: t3 = 0
L4: t4 = 4 * t3
L5: t5 = 4 * t2
L6: t6 = t5 * M
L7: t7 = t4 + t6
L8: t8 = a[t7]
L9: if t8 <= max goto L11
L10: t1 = t8
L11: t3 = t3 + 1
L12: if t3 < M goto L4
L13: t2 = t2 + 1
L14: if t2 < N goto L3
L15: max = t1
Which one of the following options CORRECTLY specifies the number of basic blocks and the number of instructions in the largest basic block, respectively ?
Open complete paper
10
2024 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2024 [Session 2]
Consider the following expression: x[i] = (p + r) * -s[i] + u/w. The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6).
(0)+pr
(1)
(2)uminus(1)
(3)
(4)/uw
(5)+(3)(4)
(6)
(7)=(6)(5)

Which one of the following options fills in the missing entries CORRECTLY?
Open complete paper
11
2025 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2025 [Session 1]

Which ONE of the following techniques used in compiler code optimization uses live variable analysis?

Open complete paper
12
2025 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2025 [Session 1]
Refer to the given 3-address code sequence. This code sequence is split into basic blocks. The number of basic blocks is ______. (Answer in integer)

Question diagram

Open complete paper
13
2025 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science & Information Technology (CS) 2025 [Session 2]
Consider the following statements about the use of backpatching in a compiler for intermediate code generation:
(I) Backpatching can be used to generate code for Boolean expression in one pass.
(II) Backpatching can be used to generate code for flow-of-control statements in one pass.
Which ONE of the following options is CORRECT?
Open complete paper
14
2026 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science and Information Technology (CS) 2026
Consider the control flow graph shown in the figure.
Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B4 and B5?
Note: All the variables are integers.

Question diagram

Open complete paper
15
2026 · Computer Science & Information Technology · Compiler Design · Code Generation and Optimization
Computer Science and Information Technology (CS) 2026
Consider the control flow graph given below.
[Image of control flow graph]
Which one of the following options is the set of live variables at the exit point of each basic block?

Question source image

Open complete paper