GATE CS 2021_Set1 Question Paper with Solutions: 65 Questions, Answer Key & Section-wise Analysis
GATE CS 2021_Set1 previous year paper: 65 questions with answer key and detailed solutions, section-wise breakdown and free sample questions.
65 Qs
Total Questions
100 Marks
Total Marks
0 Mins
Duration
Section-wise Paper Structure
Engineering Mathematics
12 Qs
18% of total marks
Algorithms
7 Qs
11% of total marks
Theory of Computation
5 Qs
8% of total marks
Programming and Data Structures
5 Qs
8% of total marks
Operating System
5 Qs
8% of total marks
Databases
5 Qs
8% of total marks
Computer Networks
5 Qs
8% of total marks
Compiler Design
5 Qs
8% of total marks
Computer Organization and Architecture
4 Qs
6% of total marks
Quantitative Aptitude
3 Qs
5% of total marks
Digital Logic
3 Qs
5% of total marks
Verbal Aptitude
2 Qs
3% of total marks
Spatial Aptitude
2 Qs
3% of total marks
Analytical Aptitude
2 Qs
3% of total marks
Free Solved Questions with Step-by-Step Solutions
Authentic examination problems with detailed derivations and answer keys.
Question 1
2021 Slot Set1 PYQ
Level 3: Exam Standard
Let p and q be two propositions. Consider the following two formulae in propositional logic.
S1:(¬p∧(p∨q))→qS2:q→(¬p∧(p∨q)) Which one of the following choices is correct?
Question 2
2021 Slot Set1 PYQ
Level 3: Exam Standard
There are five bags each containing identical sets of ten distinct chocolates. One chocolate is picked from each bag.
The probability that at least two chocolates are identical is ___________
Question 3
2021 Slot Set1 PYQ
Level 3: Exam Standard
In an undirected connected planar graph G, there are eight vertices and five faces. The number of edges in G is __________.
Question 4
2021 Slot Set1 PYQ
Level 3: Exam Standard
Let P be an array containing n integers. Let t be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum values in an arbitrary array of n elements. Which one of the following choices is correct?
Question 5
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following three functions.
f1=10nf2=nlognf3=nn Which one of the following options arranges the functions in the increasing order of asymptotic growth rate?
Question 6
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following array.
Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort the above array in ascending order?
Question 7
2021 Slot Set1 PYQ
Level 3: Exam Standard
Suppose that L1 is a regular language and L2 is a context-free language. Which one of the following languages is NOT necessarily context-free?
Question 8
2021 Slot Set1 PYQ
Level 3: Exam Standard
Let ⟨M⟩ denote an encoding of an automaton M. Suppose that Σ={0,1}. Which of the following languages is/are NOT recursive?
Question 9
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following language.
L={w∈{0,1}∗∣w ends with the substring 011} Which one of the following deterministic finite automata accepts L?
Question 10
2021 Slot Set1 PYQ
Level 3: Exam Standard
A binary search tree T contains n distinct elements. What is the time complexity of picking an element in T that is smaller than the maximum element in T?
Question 11
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following sequence of operations on an empty stack.
push(54); push(52); pop(); push(55); push(62); s = pop();
Consider the following sequence of operations on an empty queue.
#include <stdio.h>
int main()
{
int i, j, count;
count = 0;
i = 0;
for (j = -3; j <= 3; j++)
{
if ((j >= 0) && (i++))
count = count + j;
}
count = count + i;
printf("%d", count);
return 0;
}
Which one of the following options is correct?
Question 13
2021 Slot Set1 PYQ
Level 3: Exam Standard
In the context of operating systems, which of the following statements is/are correct with respect to paging?
Question 14
2021 Slot Set1 PYQ
Level 3: Exam Standard
Which of the following standard C library functions will <i>always</i> invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?
Question 15
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory foo. Which of the following operations will necessarily require a full scan of foo for successful completion?
Question 16
2021 Slot Set1 PYQ
Level 3: Exam Standard
Suppose a database system crashes again while recovering from a previous crash. Assume checkpointing is not done by the database either during the transactions or during recovery. Which of the following statements is/are correct?
Question 17
2021 Slot Set1 PYQ
Level 3: Exam Standard
A relation r(A,B) in a relational database has 1200 tuples. The attribute A has integer values ranging from 6 to 20, and the attribute B has integer values ranging from 1 to 20. Assume that the attributes A and B are independently distributed.
The estimated number of tuples in the output of σ(A>10)∨(B=18)(r) is __________.
Question 18
2021 Slot Set1 PYQ
Level 3: Exam Standard
The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:
empAge(empNo,age) Consider the following relational algebra expression:
ΠempNo(empAge⋈(age>age1)ρempNo1,age1(empAge)) What does the above expression generate?
Question 19
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following two statements.
S1: Destination MAC address of an ARP reply is a broadcast address. S2: Destination MAC address of an ARP request is a broadcast address.
Which one of the following choices is correct?
Question 20
2021 Slot Set1 PYQ
Level 3: Exam Standard
Assume that a 12-bit Hamming codeword consisting of 8-bit data and 4 check bits is d8d7d6d5c8d4d3d2c4d1c2c1, where the data bits and the check bits are given in the following tables:
Data bits
d8
d7
d6
d5
d4
d3
d2
d1
1
1
0
x
0
1
0
1
Check bits
c8
c4
c2
c1
y
0
1
0
Which one of the following choices gives the correct values of x and y?
Question 21
2021 Slot Set1 PYQ
Level 3: Exam Standard
A TCP server application is programmed to listen on port number P on host S. A TCP client is connected to the TCP server over the network. Consider that while the TCP connection was active, the server machine S crashed and rebooted. Assume that the client does not use the TCP keepalive timer. Which of the following behaviors is/are possible?
Question 22
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following statements.
S1: The sequence of procedure calls corresponds to a preorder traversal of the activation tree. S2: The sequence of procedure returns corresponds to a postorder traversal of the activation tree.
Which one of the following options is correct?
Question 23
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following statements.
S1: Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1). S2: For any context-free grammar, there is a parser that takes at most O(n3) time to parse a string of length n.
Which one of the following options is correct?
Question 24
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:
PDDEEE→D∗E∗→intID{record that ID.lexeme is of type int}→boolID{record that ID.lexeme is of type bool}→E1+E2{check that E1.type=E2.type=int;set E.type:=int}→!E1{check that E1.type=bool;set E.type:=bool}→ID{set E.type:=int} With respect to the above grammar, which one of the following choices is correct?
Question 25
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider a computer system with a byte-addressable primary memory of size 232 bytes. Assume the computer system has a direct-mapped cache of size 32 KB (1 KB = 210 bytes), and each cache block is of size 64 bytes. The size of the tag field is __________ bits.
Question 26
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127.
S:1E:10000001F:11110000000000000000000 Here S, E and F denote the sign, exponent and fraction components of the floating point representation.
The decimal value corresponding to the above representation (rounded to 2 decimal places) is __________.
Question 27
2021 Slot Set1 PYQ
Level 3: Exam Standard
A five-stage pipeline has stage delays of 150, 120, 150, 160 and 140 nanoseconds. The registers that are used between the pipeline stages have a delay of 5 nanoseconds each. The total time to execute 100 independent instructions on this pipeline, assuming there are no pipeline stalls, is __________ nanoseconds.
Question 28
2021 Slot Set1 PYQ
Level 3: Exam Standard
The ratio of boys to girls in a class is 7 to 3.
Among the options below, an acceptable value for the total number of students in the class is:
Question 29
2021 Slot Set1 PYQ
Level 3: Exam Standard
We have 2 rectangular sheets of paper, M and N, of dimensions 6 cm x 1 cm each. Sheet M is rolled to form an open cylinder by bringing the short edges of the sheet together. Sheet N is cut into equal square patches and assembled to form the largest possible closed cube. Assuming the ends of the cylinder are closed, the ratio of the volume of the cylinder to that of the cube is __________
Question 30
2021 Slot Set1 PYQ
Level 3: Exam Standard
Items
Cost (₹)
Profit %
Marked Price (₹)
P
5,400
---
5,860
Q
---
25
10,000
Details of prices of two items P and Q are presented in the above table. The ratio of cost of item P to cost of item Q is 3:4. Discount is calculated as the difference between the marked price and the selling price. The profit percentage is calculated as the ratio of the difference between selling price and cost, to the cost (Profit %=CostSelling price−Cost×100).
The discount on item Q, as a percentage of its marked price, is ______
Question 31
2021 Slot Set1 PYQ
Level 3: Exam Standard
Let the representation of a number in base 3 be 210. What is the hexadecimal representation of the number?
Question 32
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider a 3-bit counter, designed using T flip-flops, as shown below:
Assuming the initial state of the counter given by PQR as 000, what are the next three states?
Question 33
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following Boolean expression.
F=(X+Y+Z)(X+Y)(Y+Z) Which of the following Boolean expressions is/are equivalent to F (complement of F)?
Question 34
2021 Slot Set1 PYQ
Level 3: Exam Standard
Consider the following sentences:
(i) Everybody in the class is prepared for the exam. (ii) Babu invited Danish to his home because he enjoys playing chess.
Which of the following is the CORRECT observation about the above two sentences?
Question 35
2021 Slot Set1 PYQ
Level 3: Exam Standard
Some people suggest anti-obesity measures (AOM) such as displaying calorie information in restaurant menus. Such measures sidestep addressing the core problems that cause obesity: poverty and income inequality.
Which one of the following statements summarizes the passage?
Question 36
2021 Slot Set1 PYQ
Level 3: Exam Standard
A polygon is convex if, for every pair of points, P and Q belonging to the polygon, the line segment PQ lies completely inside or on the polygon.
Which one of the following is NOT a convex polygon?
Question 37
2021 Slot Set1 PYQ
Level 3: Exam Standard
A circular sheet of paper is folded along the lines in the directions shown. The paper, after being punched in the final folded state as shown and unfolded in the reverse order of folding, will look like _______.
Question 38
2021 Slot Set1 PYQ
Level 3: Exam Standard
_____ is to surgery as writer is to ________
Which one of the following options maintains a similar logical relation in the above sentence?
Question 39
2021 Slot Set1 PYQ
Level 3: Exam Standard
Given below are two statements 1 and 2, and two conclusions I and II.
Statement 1: All bacteria are microorganisms.
Statement 2: All pathogens are microorganisms.
Conclusion I: Some pathogens are bacteria.
Conclusion II: All pathogens are not bacteria.
Based on the above statements and conclusions, which one of the following options is logically CORRECT?
Unlock All 65 Questions in Real Examination Mode
Practice with the authentic timer, on-screen calculator, instant percentile ranking, and section-wise analytics.
Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.
Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.
Built around you, not around a syllabus PDF
Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.
Revision that hits your weak spots
We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.
Questions calibrated to the real exam
Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.
Notes written for recall, not for volume
Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.
One place for everything
Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.
Honest progress
No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.
Unlock the whole course
Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.
Let p and q be two propositions. Consider the following two formulae in propositional logic.
S1:(¬p∧(p∨q))→qS2:q→(¬p∧(p∨q)) Which one of the following choices is correct?
A.
Both S1 and S2 are tautologies.
B.
S1 is a tautology but S2 is not a tautology.
C.
S1 is not a tautology but S2 is a tautology.
D.
Neither S1 nor S2 is a tautology.
Correct Answer:
B
Step-by-Step Solution
Key idea: This is a tautology checking question, recognizable because it asks to classify propositional formulae as tautologies. We can simplify the expressions algebraically using logical equivalences.
Step 1: Simplify the common subexpression.
Both S1 and S2 contain the term (¬p∧(p∨q)).
Using the Distributive Law:
¬p∧(p∨q)≡(¬p∧p)∨(¬p∧q)
Since (¬p∧p) is a contradiction (False):
≡F∨(¬p∧q)≡¬p∧q.
Step 2: Analyze S1.
S1:(¬p∧q)→q
Using the Implication Law (A→B≡¬A∨B):
≡¬(¬p∧q)∨q
Using De Morgan's Law:
≡(p∨¬q)∨q
Using Associative Law:
≡p∨(¬q∨q)
Since (¬q∨q) is a tautology (True):
≡p∨T≡T.
Since S1 simplifies to True for all values of p and q, S1 is a tautology.
Step 3: Analyze S2.
S2:q→(¬p∧q)
Using the Implication Law:
≡¬q∨(¬p∧q)
Using the Distributive Law in reverse:
≡(¬q∨¬p)∧(¬q∨q)
≡(¬q∨¬p)∧T≡¬q∨¬p.
This expression is not always true (e.g., if p=T and q=T, it evaluates to F∨F=F).
Therefore, S2 is not a tautology (it is a contingency).
There are five bags each containing identical sets of ten distinct chocolates. One chocolate is picked from each bag.
The probability that at least two chocolates are identical is ___________
A.
0.3024
B.
0.4235
C.
0.6976
D.
0.8125
Correct Answer:
C
Step-by-Step Solution
Insight: "at least two identical" is the complement of "all distinct", so count the distinct case and subtract from 1.
Exam route:
Total ways to pick one chocolate from each of 5 bags = 105=100,000.
Ways to get all 5 chocolates distinct (slot-filling) = 10×9×8×7×6=30,240.
P(all distinct)=100,00030,240=0.3024.
P(at least two identical)=1−0.3024=0.6976.
Learning route:
This is a complementary-counting question, signalled by the phrase "at least two".
Step 1 — Build the sample space. Each bag is independent and has 10 distinct chocolates, so picking one from each of 5 bags gives 105 equally likely outcomes.
Step 2 — Count the complementary event. "All distinct" means no two of the five picked chocolates share a label. The first pick has 10 choices, the second must avoid the first (9 choices), the third avoids the first two (8 choices), and so on: 10×9×8×7×6=30,240.
Step 3 — Subtract from 1. P(at least two identical)=1−100,00030,240=1−0.3024=0.6976.
Wrong path: If you forget to complement, you land on 0.3024 (option A), which is the probability that all are distinct — the exact opposite of what is asked.
Verification: 0.6976+0.3024=1.0000, so the two complementary events partition the sample space correctly.
In an undirected connected planar graph G, there are eight vertices and five faces. The number of edges in G is __________.
Correct Answer:
11.00
Step-by-Step Solution
Insight: Euler's formula for connected planar graphs directly relates vertices, edges, and faces.
Exam route: V−E+F=2⟹8−E+5=2⟹E=11.
Learning route:
Step 1: Identify the graph properties. The graph is undirected, connected, and planar.
Step 2: Recall Euler's formula for connected planar graphs: V−E+F=2.
Step 3: Substitute the given values. We have V=8 vertices and F=5 faces (including the outer face).
Step 4: Solve for E:
8−E+5=2
13−E=2
E=11.
Question 4 · Algorithms · 2021_Set1MCQ
Let P be an array containing n integers. Let t be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum values in an arbitrary array of n elements. Which one of the following choices is correct?
A.
t>2n−2
B.
t>3⌈2n⌉ and t≤2n−2
C.
t>n and t≤3⌈2n⌉
D.
t>⌈log2(n)⌉ and t≤n
Correct Answer:
C
Step-by-Step Solution
Key idea: This is a comparison bounds question, recognisable because it asks for the lowest upper bound on the number of comparisons required to find both the minimum and maximum values simultaneously.
Step 1: The naive approach finds the minimum in n−1 comparisons and the maximum in another n−1 comparisons, totaling 2n−2 comparisons.
Step 2: The optimal approach processes elements in pairs. Divide the n elements into ⌈n/2⌉ pairs.
Step 3: Compare the two elements within each pair. This takes ⌈n/2⌉ comparisons and yields a local minimum and a local maximum for each pair.
Step 4: Find the global minimum by comparing the ⌈n/2⌉ local minimums. This takes ⌈n/2⌉−1 comparisons.
Step 5: Find the global maximum by comparing the ⌈n/2⌉ local maximums. This takes ⌈n/2⌉−1 comparisons.
Step 6: Total comparisons t=⌈n/2⌉+2(⌈n/2⌉−1)=3⌈n/2⌉−2.
Step 7: This value is strictly less than or equal to 3⌈n/2⌉. For n≥3 (with the minor exception of n=4 where it equals n), it is greater than n. Among the choices, Option C is the only one that correctly bounds the optimal count from above by 3⌈n/2⌉ and generally satisfies the lower bound for meaningful array sizes.
Answer: C
Question 5 · Algorithms · 2021_Set1MCQ
Consider the following three functions.
f1=10nf2=nlognf3=nn Which one of the following options arranges the functions in the increasing order of asymptotic growth rate?
A.
f3,f2,f1
B.
f2,f1,f3
C.
f1,f2,f3
D.
f2,f3,f1
Correct Answer:
D
Step-by-Step Solution
Key idea: This is a function growth comparison question, recognizable because it asks to order three functions by asymptotic growth rate.
Why this method applies: When comparing functions with variables in both the base and the exponent, taking the logarithm of all functions preserves their relative order and simplifies the expressions into comparable polynomial/logarithmic forms.
Step 1: Take the base-2 logarithm of each function.
logf1=log(10n)=nlog10=Θ(n).
logf2=log(nlogn)=(logn)(logn)=(logn)2.
logf3=log(nn)=nlogn.
Step 2: Compare the growth rates of the logarithms.
We need to order (logn)2, nlogn, and n.
Divide all three by logn (valid since logn>0 for large n):
We get logn, n, and lognn.
Step 3: Apply the standard hierarchy of growth rates.
It is a well-known fact that logn≪n≪lognn.
Therefore, multiplying back by logn, we have (logn)2≪nlogn≪n.
Step 4: Since the logarithms are ordered as logf2≪logf3≪logf1, the original functions follow the exact same order: f2≪f3≪f1.
Answer: Option D is correct.
Question 6 · Algorithms · 2021_Set1MCQ
Consider the following array.
Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort the above array in ascending order?
A.
Selection sort
B.
Mergesort
C.
Insertion sort
D.
Quicksort using the last element as pivot
Correct Answer:
C
Step-by-Step Solution
Key idea: This is a sorting algorithm operation counting question, recognisable because it provides a specific array and asks which algorithm uses the least number of comparisons. The added layer is recognizing the initial state of the array.
Step 1: Observe the given array: [23,32,45,69,72,73,89,97].
Step 2: Notice that the array is already sorted in ascending order. Let n=8.
Step 3: Evaluate each option for an already sorted array:
Selection sort: Always performs 2n(n−1) comparisons regardless of input order. For n=8, this is 28×7=28 comparisons.
Mergesort: Always performs Θ(nlogn) comparisons. For n=8, it is around 8×3=24 comparisons (specifically, 17 to 21 depending on implementation).
Insertion sort: For an already sorted array, the inner loop condition fails immediately on the first check for each element. It performs exactly n−1 comparisons. For n=8, this is $7$ comparisons.
Quicksort (last element as pivot): For an already sorted array, this is the worst-case scenario. It performs 2n(n−1) comparisons. For n=8, this is 28 comparisons.
Step 4: Compare the counts: $7$ (Insertion) is the least.
Answer: C
Question 7 · Theory of Computation · 2021_Set1MCQ
Suppose that L1 is a regular language and L2 is a context-free language. Which one of the following languages is NOT necessarily context-free?
A.
L1∩L2
B.
L1⋅L2
C.
L1−L2
D.
L1∪L2
Correct Answer:
C
Step-by-Step Solution
Key idea: This is a closure properties question involving the interaction between Regular and Context-Free Languages (CFLs), recognizable because it asks which operation does NOT preserve the CFL property.
Step 1: Recall the closure properties of CFLs. CFLs are closed under union, concatenation, Kleene star, and intersection with Regular languages.
Step 2: Evaluate Option A: L1∩L2. Since L1 is regular and L2 is CFL, their intersection is guaranteed to be CFL.
Step 3: Evaluate Option B: L1⋅L2. Since Regular languages are a subset of CFLs, this is the concatenation of two CFLs, which is always CFL.
Step 4: Evaluate Option D: L1∪L2. The union of a regular language and a CFL is always CFL.
Step 5: Evaluate Option C: L1−L2. By definition, L1−L2=L1∩L2. If this were always CFL, then by choosing L1=Σ∗ (which is regular), we would have Σ∗∩L2=L2 is always CFL. This would mean CFLs are closed under complement, which is false. Thus, L1−L2 is NOT necessarily CFL.
Answer: C
Question 8 · Theory of Computation · 2021_Set1MSQ
Let ⟨M⟩ denote an encoding of an automaton M. Suppose that Σ={0,1}. Which of the following languages is/are NOT recursive?
A.
L={⟨M⟩∣M is a DFA such that L(M)=∅}
B.
L={⟨M⟩∣M is a DFA such that L(M)=Σ∗}
C.
L={⟨M⟩∣M is a PDA such that L(M)=∅}
D.
L={⟨M⟩∣M is a PDA such that L(M)=Σ∗}
Correct Answer:
["D"]
Step-by-Step Solution
Insight: DFA properties are all decidable. PDA emptiness is decidable, but PDA universality (L(M) = Σ*) is undecidable.
Exam route: Options A, B, and C are decidable (recursive). Option D is undecidable (not recursive).
Learning route:
Option A: DFA emptiness is decidable by checking reachability of final states from the start state.
Option B: DFA universality is decidable by checking if all states are reachable and final, or by complement and emptiness.
Option C: PDA emptiness is decidable by checking if any final state is reachable in the underlying graph of the PDA.
Option D: PDA universality (L(M)=Σ∗) is undecidable. If it were decidable, we could decide the acceptance problem for TMs, which is impossible.
Question 9 · Theory of Computation · 2021_Set1MCQ
Consider the following language.
L={w∈{0,1}∗∣w ends with the substring 011} Which one of the following deterministic finite automata accepts L?
A.
B.
C.
D.
Correct Answer:
C
Step-by-Step Solution
Key idea: This is a DFA design question for a specific suffix pattern, recognizable by the "ends with" phrasing. The core method is tracking the longest suffix of the input that matches a prefix of the target pattern.
Step 1: Define the target pattern. We want strings ending in "011". The states must remember how much of "011" we have successfully matched at the end of the string read so far.
Step 2: Define the states based on the longest matched suffix:
q0: Start state. No part of "011" matched (or the string ends in '1' but not '01' or '011').
q1: The string ends in "0".
q2: The string ends in "01".
q3: The string ends in "011". This is the only final state.
Step 3: Determine transitions strictly using the longest suffix rule:
From q0: reading '0' gives suffix "0" →q1. Reading '1' gives suffix "1" (no prefix match) →q0.
From q1 (ends in "0"): reading '0' gives "00", longest suffix matching prefix is "0" →q1. Reading '1' gives "01" →q2.
From q2 (ends in "01"): reading '0' gives "010", longest matching prefix is "0" →q1. Reading '1' gives "011" →q3.
From q3 (ends in "011"): reading '0' gives "0110", longest matching prefix is "0" →q1. Reading '1' gives "0111", longest matching prefix is ϵ→q0.
Step 4: Match this logic to the given options. Option C is the only diagram that correctly routes q3 on '1' back to q0 and q3 on '0' to q1, avoiding the trap of accepting "0111" or "011011".
Answer: C
Question 10 · Programming and Data Structures · 2021_Set1MCQ
A binary search tree T contains n distinct elements. What is the time complexity of picking an element in T that is smaller than the maximum element in T?
A.
Θ(nlogn)
B.
Θ(n)
C.
Θ(logn)
D.
Θ(1)
Correct Answer:
D
Step-by-Step Solution
Insight: This is a BST complexity trick question, recognizable because it asks for the time complexity of finding "an element" smaller than the maximum, not a specific element like the second maximum.
Exam route: The maximum element in a BST is the rightmost node. We need ANY element smaller than it. If the root has a right child, the root itself is strictly smaller than the maximum (which is in the right subtree). If the root has no right child, the root IS the maximum, but since n is distinct and presumably n≥2, the root must have a left child, which is strictly smaller. In either case, we can pick a valid element by inspecting only the root and its immediate children. This takes Θ(1) time.
Learning route:
Step 1: Understand the goal. We need to find ANY element in the BST that is strictly less than the maximum element. We do not need to find the second largest, just any valid candidate.
Step 2: Identify the maximum element. In a BST, the maximum is always the rightmost node.
Step 3: Consider the root node. There are two cases for the root:
Case A: The root has a right child. This means the maximum element is somewhere in the right subtree. Therefore, the root's value is strictly less than the maximum. We can simply pick the root.
Case B: The root has no right child. This means the root itself is the maximum element. However, since the tree has n distinct elements (and for the question to be meaningful, n≥2), the root must have a left child. The left child's value is strictly less than the root (the maximum). We can simply pick the left child.
Step 4: Analyze the time complexity. In both cases, we only need to check the root and at most one of its immediate children (the right child, or if null, the left child). This requires a constant number of pointer dereferences.
Step 5: Conclude. The time complexity is Θ(1).
Wrong path: Assuming we must find the exact "second maximum" element (the inorder predecessor of the max), which would take O(h) or O(logn) time in a balanced tree, leading to Option C. Or assuming we must traverse the whole tree, leading to Option B.
Question 11 · Programming and Data Structures · 2021_Set1NAT
Consider the following sequence of operations on an empty stack.
push(54); push(52); pop(); push(55); push(62); s = pop();
Consider the following sequence of operations on an empty queue.
Insight: This is a data structure simulation question, recognizable because it provides a sequence of standard stack (LIFO) and queue (FIFO) operations and asks for the final extracted values.
Exam route: Trace the stack to find s=62, trace the queue to find q=24, and sum them to get 86.
Learning route:
Step 1: Simulate the stack operations. The stack starts empty.
push(54): Stack is [54]
push(52): Stack is [54, 52]
pop(): Removes 52. Stack is [54]
push(55): Stack is [54, 55]
push(62): Stack is [54, 55, 62]
s = pop(): Removes and assigns 62 to s. Stack is [54, 55]. So, s = 62.
Step 2: Simulate the queue operations. The queue starts empty.
enqueue(21): Queue is [21]
enqueue(24): Queue is [21, 24]
dequeue(): Removes 21. Queue is [24]
enqueue(28): Queue is [24, 28]
enqueue(32): Queue is [24, 28, 32]
q = dequeue(): Removes and assigns 24 to q. Queue is [28, 32]. So, q = 24.
Step 3: Calculate the final value. s + q = 62 + 24 = 86.
Question 12 · Programming and Data Structures · 2021_Set1MCQ
Consider the following ANSI C program.
#include <stdio.h>
int main()
{
int i, j, count;
count = 0;
i = 0;
for (j = -3; j <= 3; j++)
{
if ((j >= 0) && (i++))
count = count + j;
}
count = count + i;
printf("%d", count);
return 0;
}
Which one of the following options is correct?
A.
The program will not compile successfully.
B.
The program will compile successfully and output 10 when executed.
C.
The program will compile successfully and output 8 when executed.
D.
The program will compile successfully and output 13 when executed.
Correct Answer:
B
Step-by-Step Solution
Insight: This is a short-circuit evaluation question with a post-increment side effect hidden inside the loop condition.
Exam route: Build a 7-row trace table. The key pivot is that && skips i++ entirely when j < 0, and at j=0 the post-increment returns 0 (false) so the body is skipped but i still increments.
Learning route:
Initialize: count = 0, i = 0.
For j = -3, -2, -1: (j >= 0) is false. Short-circuit skips (i++). Neither the body nor the increment runs. i stays 0, count stays 0.
For j = 0: (j >= 0) is true, so (i++) is evaluated. Post-increment returns the old value 0, which is falsy. The overall condition is false. Body is skipped. But the side effect fires: i becomes 1. count stays 0.
For j = 1: (i++) returns 1 (truthy). Body runs: count = 0 + 1 = 1. Side effect: i becomes 2.
For j = 2: (i++) returns 2 (truthy). Body runs: count = 1 + 2 = 3. Side effect: i becomes 3.
For j = 3: (i++) returns 3 (truthy). Body runs: count = 3 + 3 = 6. Side effect: i becomes 4.
After loop: count = count + i = 6 + 4 = 10.
Wrong path producing 13: A student who ignores short-circuit evaluation assumes i++ runs for all 7 values of j, making i = 7. They also incorrectly add negative j values. This is wrong because && guarantees the right operand is never evaluated when the left is false.
Wrong path producing 8: A student who forgets that post-increment still fires at j=0 (even though the body is skipped) would compute final i = 3 instead of 4, yielding 6 + 3 = 9 or possibly miscount the body executions.
Verification: Body executes for j = 1, 2, 3, accumulating 1+2+3=6. The increment i++ fires 4 times (at j = 0, 1, 2, 3), so final i = 4. Total =6+4=10. Confirmed.
Generalization: In any A && B condition, if A is false, B (including all its side effects) is completely skipped. Track the boolean test value and the post-side-effect value of any incremented variable as separate columns.
Question 13 · Operating System · 2021_Set1MSQ
In the context of operating systems, which of the following statements is/are correct with respect to paging?
A.
Paging helps solve the issue of external fragmentation.
B.
Page size has no impact on internal fragmentation.
C.
Paging incurs memory overheads.
D.
Multi-level paging is necessary to support pages of different sizes.
Correct Answer:
["A","C"]
Step-by-Step Solution
Insight: Paging eliminates external fragmentation by using fixed-size frames, but it introduces internal fragmentation and memory overhead due to the page table. Multi-level paging is an optimization for page table size, not for variable page sizes.
Exam route:
A: True. Fixed-size frames mean any free frame can hold any page, eliminating external fragmentation.
B: False. Internal fragmentation is directly proportional to page size (average waste is half a page).
D: False. Multi-level paging reduces the contiguous memory required for the page table. Variable page sizes are handled by other mechanisms (e.g., huge pages), not by making the page table multi-level.
Learning route:
Let's evaluate each statement based on OS memory management principles:
"Paging helps solve the issue of external fragmentation." -> True. Because memory is divided into fixed-size frames, any free frame can be allocated to any page. There are no variable-sized holes that cannot be used.
"Page size has no impact on internal fragmentation." -> False. Internal fragmentation occurs in the last page of a process. A larger page size means a larger potential wasted space (on average, half the page size).
"Paging incurs memory overheads." -> True. The page table must be stored in physical memory, consuming space that could otherwise be used for process data.
"Multi-level paging is necessary to support pages of different sizes." -> False. Multi-level paging is designed to save memory by only allocating page table pages that are actually needed. Supporting different page sizes (like huge pages) is a separate feature, often implemented via multiple page table levels with different indexing, but multi-level paging itself is not "necessary" for it, nor is that its primary purpose.
Question 14 · Operating System · 2021_Set1MSQ
Which of the following standard C library functions will <i>always</i> invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?
A.
exit
B.
malloc
C.
sleep
D.
strlen
Correct Answer:
["A"]
Step-by-Step Solution
Insight: Process termination fundamentally requires kernel intervention to reclaim resources (PCB, file descriptors), making exit the only function that unconditionally crosses the user-kernel boundary.
Exam route: Evaluate each option for "always". strlen is pure user-space math. malloc manages a user-space heap and only calls the OS (brk/mmap) on exhaustion. sleep can sometimes be optimized or interrupted, but exit must always invoke the kernel to destroy the process.
Learning route:
strlen: Operates entirely on user-space memory. No syscall.
malloc: Uses pre-allocated user-space heap. Only invokes a syscall if the heap is exhausted. Not always.
sleep: While it often invokes nanosleep, certain implementations or edge cases (like sleep(0)) might return without a full context switch, or it's simply less absolute than process termination.
exit: A user process cannot destroy itself or free kernel-managed resources. It must always invoke the exit or exit_group syscall to hand control to the OS for cleanup. This is unconditional.
Question 15 · Operating System · 2021_Set1MSQ
Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory foo. Which of the following operations will necessarily require a full scan of foo for successful completion?
A.
Creation of a new file in foo
B.
Deletion of an existing file from foo
C.
Renaming of an existing file in foo
D.
Opening of an existing file in foo
Correct Answer:
["A","C"]
Step-by-Step Solution
Insight: This is a directory operation question testing the distinction between presence checks (can stop early) and absence checks (must scan all). The key word is "necessarily" — it asks which operations cannot exit early under any circumstances.
Exam route:
Creation of new file: Must ensure the name is unique (absence check) → necessarily requires full scan.
Deletion of existing file: Only needs to find the file (presence check) → can stop early.
Renaming of existing file: Must find the old name (presence) AND ensure the new name is unique (absence) → necessarily requires full scan.
Opening of existing file: Only needs to find the file (presence check) → can stop early.
Answer: A and C.
Learning route:
In a linear list directory, operations are classified by whether they require a presence check or an absence check.
A presence check looks for a specific file. If found, the operation can terminate immediately. Delete and open only need to find the file, so they can stop early.
An absence check must prove a file name does not exist. This requires scanning every entry to ensure no duplicate exists. Create must verify the new name is unique, so it necessarily requires a full scan. Rename must find the old name (can stop early) but also verify the new name is unique (must scan all), so it necessarily requires a full scan.
Common trap: Confusing worst-case time complexity with "necessarily" requiring a full scan. Delete takes O(N) in the worst case, but it does not necessarily require a full scan because it can exit early if the file is found at the beginning.
Verification: Create → absence check → full scan ✓. Delete → presence check → can stop ✓. Rename → absence check for new name → full scan ✓. Open → presence check → can stop ✓.
Question 16 · Databases · 2021_Set1MSQ
Suppose a database system crashes again while recovering from a previous crash. Assume checkpointing is not done by the database either during the transactions or during recovery. Which of the following statements is/are correct?
A.
The same undo and redo list will be used while recovering again.
B.
The system cannot recover any further.
C.
All the transactions that are already undone and redone will not be recovered again.
D.
The database will become inconsistent.
Correct Answer:
["A","C"]
Step-by-Step Solution
Insight: Crash recovery algorithms (Undo/Redo) are designed to be idempotent.
Exam route: Recognize that without checkpointing, the log is scanned from the beginning. The same undo/redo lists are generated. Because Undo and Redo are idempotent, reapplying them to already processed transactions has no effect, preventing inconsistency.
Learning route:
A crash during recovery means the log on stable storage is unchanged (Write-Ahead Logging ensures this).
Upon restart, the system scans the log from the start (since no checkpoints exist).
It will reconstruct the exact same Undo and Redo lists (Statement A is correct).
Undo and Redo operations are idempotent. Applying Undo to an already undone transaction, or Redo to an already redone transaction, leaves the database state unchanged.
Thus, transactions already processed will not be effectively "recovered again" in a way that alters the database, avoiding double-application errors (Statement C is correct).
The system can recover fully (B is false), and the database remains consistent (D is false).
Question 17 · Databases · 2021_Set1NAT
A relation r(A,B) in a relational database has 1200 tuples. The attribute A has integer values ranging from 6 to 20, and the attribute B has integer values ranging from 1 to 20. Assume that the attributes A and B are independently distributed.
The estimated number of tuples in the output of σ(A>10)∨(B=18)(r) is __________.
Correct Answer:
820.00
Step-by-Step Solution
Insight: This is a query result estimation question, recognizable by the request to estimate tuple counts under independence assumptions.
Exam route: Apply the inclusion-exclusion principle for the OR condition: T(C1 OR C2) = T(C1) + T(C2) - T(C1 AND C2).
Learning route:
Step 1: Identify total tuples T_R = 1200.
Step 2: Calculate distinct values for A and B.
V(A) = 20 - 6 + 1 = 15.
V(B) = 20 - 1 + 1 = 20.
Step 3: Estimate T(C1) for A > 10. Valid values for A are 11 to 20 (10 values).
T(C1) = 1200 * (10 / 15) = 800.
Step 4: Estimate T(C2) for B = 18. This is an exact match.
T(C2) = 1200 / 20 = 60.
Step 5: Estimate T(C1 AND C2). By independence assumption:
T(C1 OR C2) = T(C1) + T(C2) - T(C1 AND C2) = 800 + 60 - 40 = 820.
Final Answer: 820.
Question 18 · Databases · 2021_Set1MCQ
The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:
empAge(empNo,age) Consider the following relational algebra expression:
ΠempNo(empAge⋈(age>age1)ρempNo1,age1(empAge)) What does the above expression generate?
A.
Employee numbers of only those employees whose age is the maximum.
B.
Employee numbers of only those employees whose age is more than the age of exactly one other employee.
C.
Employee numbers of all employees whose age is not the minimum.
D.
Employee numbers of all employees whose age is the minimum.
Correct Answer:
C
Step-by-Step Solution
Insight: This is a self-join pattern in relational algebra, recognizable by the rename operator ρ and a theta-join condition comparing an attribute with its renamed version.
Exam route: The condition age > age1 means the employee's age is strictly greater than the age of at least one other employee in the table. This is the logical definition of "not the minimum".
Learning route:
Step 1: The expression creates two logical copies of empAge: the original (with attributes empNo, age) and a renamed version (with attributes empNo1, age1).
Step 2: The theta-join ⋈age>age1 pairs every employee with every other employee who has a strictly smaller age.
Step 3: The projection ΠempNo extracts the employee numbers of the first copy (the ones with the larger age).
Step 4: If an employee's age is the absolute minimum in the table, there is no age1 strictly smaller than it. Thus, they will not participate in any join pair and will not appear in the result.
Step 5: Every other employee (whose age is not the minimum) will have at least one match (e.g., the employee with the minimum age), so they will appear in the result.
Final Answer: Option C.
Question 19 · Computer Networks · 2021_Set1MCQ
Consider the following two statements.
S1: Destination MAC address of an ARP reply is a broadcast address. S2: Destination MAC address of an ARP request is a broadcast address.
Which one of the following choices is correct?
A.
Both S1 and S2 are true.
B.
S1 is true and S2 is false.
C.
S1 is false and S2 is true.
D.
Both S1 and S2 are false.
Correct Answer:
C
Step-by-Step Solution
Insight: ARP request is a broadcast because the sender doesn't know the target MAC. ARP reply is a unicast because the responder knows the requester's MAC.
Exam route: S1 says reply is broadcast (False). S2 says request is broadcast (True). Option C matches.
Learning route:
Analyze S1: When Host B receives an ARP request, it knows exactly who asked (from the sender MAC and IP in the request payload). Therefore, it sends the ARP reply directly to Host A using a unicast frame. S1 is FALSE.
Analyze S2: When Host A wants to find Host B's MAC, it doesn't know it yet. It must ask everyone on the local network. It sends an ARP request with the destination MAC set to the broadcast address (FF:FF:FF:FF:FF:FF). S2 is TRUE.
Conclusion: S1 is false and S2 is true.
Answer: Option C.
Question 20 · Computer Networks · 2021_Set1MCQ
Assume that a 12-bit Hamming codeword consisting of 8-bit data and 4 check bits is d8d7d6d5c8d4d3d2c4d1c2c1, where the data bits and the check bits are given in the following tables:
Data bits
d8
d7
d6
d5
d4
d3
d2
d1
1
1
0
x
0
1
0
1
Check bits
c8
c4
c2
c1
y
0
1
0
Which one of the following choices gives the correct values of x and y?
A.
x is 0 and y is 0.
B.
x is 0 and y is 1.
C.
x is 1 and y is 0.
D.
x is 1 and y is 1.
Correct Answer:
A
Step-by-Step Solution
Insight: Hamming code check bits cover positions based on binary representation. Don't forget that higher positions (like 12) are covered by multiple check bits (c4 and c8).
Map the 12-bit codeword to positions 1 to 12 (rightmost is position 1):
Pos 1: c1=0
Pos 2: c2=1
Pos 3: d1=1
Pos 4: c4=0
Pos 5: d2=0
Pos 6: d3=1
Pos 7: d4=0
Pos 8: c8=y
Pos 9: d5=x
Pos 10: d6=0
Pos 11: d7=1
Pos 12: d8=1
Calculate x using c1 (covers 1, 3, 5, 7, 9, 11):
Parity sum = c1⊕d1⊕d2⊕d4⊕d5⊕d7=0⊕1⊕0⊕0⊕x⊕1=x⊕0=x.
For even parity, sum must be 0 ⟹x=0.
Calculate y using c8 (covers 8, 9, 10, 11, 12):
Parity sum = c8⊕d5⊕d6⊕d7⊕d8=y⊕x⊕0⊕1⊕1=y⊕0⊕0⊕1⊕1=y.
For even parity, sum must be 0 ⟹y=0.
Verify with c4 (covers 4, 5, 6, 7, 12):
Sum = c4⊕d2⊕d3⊕d4⊕d8=0⊕0⊕1⊕0⊕1=0. (Even, matches c4=0).
Answer: x=0,y=0 (Option A).
Question 21 · Computer Networks · 2021_Set1MSQ
A TCP server application is programmed to listen on port number P on host S. A TCP client is connected to the TCP server over the network. Consider that while the TCP connection was active, the server machine S crashed and rebooted. Assume that the client does not use the TCP keepalive timer. Which of the following behaviors is/are possible?
A.
If the client was waiting to receive a packet, it may wait indefinitely.
B.
The TCP server application on S can listen on P after reboot.
C.
If the client sends a packet after the server reboot, it will receive a RST segment.
D.
If the client sends a packet after the server reboot, it will receive a FIN segment.
Correct Answer:
["A","B","C"]
Step-by-Step Solution
Insight: A server crash wipes its TCP state (Transmission Control Block). The client, unaware of the crash, keeps its state. If the client sends data, the rebooted server will reject it with a RST because it has no matching connection record.
Exam route:
A: True. Without keepalive, a passive client waiting for data will never know the server died.
B: True. Crash clears RAM, freeing port P for a new application to bind.
C: True. Client sends data -> server OS finds no TCB -> replies with RST.
D: False. Server doesn't know the connection exists, so it cannot gracefully close it with a FIN.
Learning route:
When a server crashes, its operating system reboots and all volatile memory (including TCP connection states or TCBs) is lost.
The client machine does not crash and retains its TCB for the connection.
If the client is passively waiting for data (Option A), it will wait indefinitely because no keepalive mechanism is used to probe the server's liveness.
After reboot, the server's OS starts fresh. The port P is no longer bound to the old crashed application, so a new server application can successfully call listen() on port P (Option B).
If the client sends a data segment after the reboot (Option C), the segment arrives at the server. The server's TCP stack looks for a TCB matching the source/destination IP and ports. Since it finds none, it responds with a Reset (RST) segment to indicate the connection does not exist.
The server will not send a FIN (Option D) because a FIN is used for graceful closure of a known, active connection. The server has no knowledge of the connection to close.
Question 22 · Compiler Design · 2021_Set1MCQ
Consider the following statements.
S1: The sequence of procedure calls corresponds to a preorder traversal of the activation tree. S2: The sequence of procedure returns corresponds to a postorder traversal of the activation tree.
Which one of the following options is correct?
A.
S1 is true and S2 is false
B.
S1 is false and S2 is true
C.
S1 is true and S2 is true
D.
S1 is false and S2 is false
Correct Answer:
C
Step-by-Step Solution
Insight: Procedure calls push frames onto the stack (preorder), and returns pop them only after all nested calls finish (postorder).
Exam route: Recall that an activation tree's call sequence matches preorder traversal (node before children), and return sequence matches postorder traversal (children before node). Both statements are true.
Learning route:
An activation tree represents the dynamic execution of a program, where each node is a specific invocation.
When a procedure P calls Q, Q becomes a child of P. The call event happens before Q executes any of its own internal calls. This perfectly matches preorder traversal, which visits a node before its children. Thus, S1 is true.
When Q finishes executing, it returns to P. This return event can only happen after all of Q's children (and their descendants) have finished and returned. This perfectly matches postorder traversal, which visits a node only after all its children have been visited. Thus, S2 is true.
Therefore, both S1 and S2 are true.
Question 23 · Compiler Design · 2021_Set1MCQ
Consider the following statements.
S1: Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1). S2: For any context-free grammar, there is a parser that takes at most O(n3) time to parse a string of length n.
Which one of the following options is correct?
A.
S1 is true and S2 is false
B.
S1 is false and S2 is true
C.
S1 is true and S2 is true
D.
S1 is false and S2 is false
Correct Answer:
C
Step-by-Step Solution
Insight: SLR(1) is a strict subset of unambiguous grammars, and the CYK/Earley algorithms guarantee O(n3) parsing time for any context-free grammar.
Exam route: Evaluate S1: All LR(k) grammars are unambiguous, but not all unambiguous grammars are SLR(1) (e.g., some require LALR(1) or CLR(1) lookahead). Evaluate S2: CYK algorithm parses any CFG in O(n3). Both statements are fundamental theorems.
Learning route:
Statement S1: "Every SLR(1) grammar is unambiguous" is TRUE. If a grammar is ambiguous, it generates multiple parse trees, making deterministic LR parsing impossible. "There are certain unambiguous grammars that are not SLR(1)" is also TRUE. For example, some grammars are LR(1) but not SLR(1) due to FOLLOW set overlaps, yet they remain perfectly unambiguous.
Statement S2: "For any context-free grammar, there is a parser that takes at most O(n3) time" is TRUE. The Cocke-Younger-Kasami (CYK) algorithm can parse any CFG (after conversion to Chomsky Normal Form) in O(n3) time. Earley's algorithm also achieves O(n3) for any CFG.
Conclusion: Both S1 and S2 are true.
Question 24 · Compiler Design · 2021_Set1MCQ
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:
PDDEEE→D∗E∗→intID{record that ID.lexeme is of type int}→boolID{record that ID.lexeme is of type bool}→E1+E2{check that E1.type=E2.type=int;set E.type:=int}→!E1{check that E1.type=bool;set E.type:=bool}→ID{set E.type:=int} With respect to the above grammar, which one of the following choices is correct?
A.
The actions can be used to correctly type-check any syntactically correct program.
B.
The actions can be used to type-check syntactically correct integer variable declarations and integer expressions.
C.
The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions.
D.
The actions will lead to an infinite loop.
Correct Answer:
B
Step-by-Step Solution
Key idea: Trace the syntax-directed translation (SDT) actions to see what types are actually supported and checked.
Step 1: Look at the declaration rules. The grammar allows declaring variables as int or bool and records them in the symbol table.
Step 2: Look at the expression rules. The rule E -> ID has the action {set E.type := int}. It hardcodes the type to int and completely ignores the symbol table lookup.
Step 3: Because E -> ID always returns int, any boolean variable used in an expression will be incorrectly treated as an integer. Therefore, the SDT cannot correctly type-check any program (Option A is false) and cannot type-check boolean expressions (Option C is false).
Step 4: The SDT does not contain any recursive or cyclic dependencies that would cause an infinite loop (Option D is false).
Step 5: Since the expression rules only support int (e.g., E1 + E2 checks for int), the SDT can only successfully type-check integer variable declarations and integer expressions.
Answer: B
Question 25 · Computer Organization and Architecture · 2021_Set1NAT
Consider a computer system with a byte-addressable primary memory of size 232 bytes. Assume the computer system has a direct-mapped cache of size 32 KB (1 KB = 210 bytes), and each cache block is of size 64 bytes. The size of the tag field is __________ bits.
Correct Answer:
17.00
Step-by-Step Solution
Insight: This is a direct address-decomposition question — split the 32-bit address into Tag, Index, Offset using cache size and block size.
Exam route:
Cache = 32 KB = 215 B, Block = 64 B = 26 B.
Lines = 215/26=29=512.
Index = log2(512)=9 bits.
Offset = log2(64)=6 bits.
Tag = 32−9−6=17 bits.
Learning route:
This is a standard address-decomposition question, recognisable because the problem gives cache size, block size, and address width and asks for the tag field size.
In a direct-mapped cache every physical address is split into three contiguous fields: Tag | Index | Offset.
The Offset selects the byte within a block. Block = 64 B, so Offset = log2(64)=6 bits.
The Index selects the cache line. Number of lines = Cache / Block = 215/26=29=512. So Index = log2(512)=9 bits.
The Tag is whatever remains: Tag = 32−9−6=17 bits.
The main memory size (232 B) is consistent with the 32-bit address but is not needed for the calculation — only cache size, block size, and address width matter.
Verification: Tag + Index + Offset = 17+9+6=32 ✓.
Answer: 17
Question 26 · Computer Organization and Architecture · 2021_Set1NAT
Consider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127.
S:1E:10000001F:11110000000000000000000 Here S, E and F denote the sign, exponent and fraction components of the floating point representation.
The decimal value corresponding to the above representation (rounded to 2 decimal places) is __________.
Correct Answer:
-7.75
Step-by-Step Solution
Key idea: This is an IEEE 754 single-precision decoding question, recognisable because it gives S, E, F fields and asks for the decimal value.
Step 1: Identify the fields. S=1 (negative), E=100000012, F=111100000000000000000002.
Step 2: Compute the exponent. E=100000012=129. True exponent =129−127=2.
Step 3: Compute the significand. Since 0<E<255, this is normalized. The implicit leading $1$ gives:
Question 27 · Computer Organization and Architecture · 2021_Set1NAT
A five-stage pipeline has stage delays of 150, 120, 150, 160 and 140 nanoseconds. The registers that are used between the pipeline stages have a delay of 5 nanoseconds each. The total time to execute 100 independent instructions on this pipeline, assuming there are no pipeline stalls, is __________ nanoseconds.
Correct Answer:
17160
Step-by-Step Solution
Key idea: This is a pipeline execution time calculation, recognisable because it provides stage delays, register delays, and a number of instructions, asking for total execution time with no stalls.
Step 1: The pipeline clock cycle is determined by the slowest stage, because every stage must complete within one clock period. Find the maximum stage delay: max(150,120,150,160,140)=160 ns.
Step 2: Add the pipeline register delay to get the cycle time. Each pipeline register sits between stages and adds overhead. Cycle time =160+5=165 ns.
Step 3: Use the pipeline execution time formula for n instructions on a k-stage pipeline with no stalls: T=(k+n−1)×cycle time.
We have 2 rectangular sheets of paper, M and N, of dimensions 6 cm x 1 cm each. Sheet M is rolled to form an open cylinder by bringing the short edges of the sheet together. Sheet N is cut into equal square patches and assembled to form the largest possible closed cube. Assuming the ends of the cylinder are closed, the ratio of the volume of the cylinder to that of the cube is __________
A.
2π
B.
π3
C.
π9
D.
3π
Correct Answer:
C
Step-by-Step Solution
Insight: Rolling a sheet along its short edge makes the long edge the circumference. A closed cube requires exactly 6 square faces.
Exam route: Cylinder circumference = 6, height = 1 ⟹r=3/π, Volume = 9/π. Cube has 6 faces of 1x1 ⟹ Volume = 1. Ratio = 9/π.
Learning route:
Sheet M (6 cm x 1 cm) is rolled by bringing the short edges together. This means the seam is 1 cm long, so the cylinder height h=1 cm.
The circumference of the cylinder is the long edge, C=6 cm.
From C=2πr=6, we get the radius r=2π6=π3 cm.
Volume of the cylinder Vcyl=πr2h=π(π3)2(1)=π(π29)=π9 cm3.
Sheet N (6 cm x 1 cm) is cut into equal square patches to form the largest possible closed cube. A closed cube has exactly 6 faces.
The only way to cut a 6x1 sheet into 6 equal squares is to make six 1x1 cm squares.
These 6 squares assemble into a cube of edge length a=1 cm.
Volume of the cube Vcube=a3=13=1 cm3.
The ratio of the volume of the cylinder to that of the cube is π9:1=π9.
Wrong path: Rolling along the long edge, making circumference = 1 and height = 6. This gives r=1/(2π) and Volume = 6/(4π)=3/(2π), which is not an option. Or assuming an open cube (5 faces), which doesn't divide 6 evenly into squares.
Details of prices of two items P and Q are presented in the above table. The ratio of cost of item P to cost of item Q is 3:4. Discount is calculated as the difference between the marked price and the selling price. The profit percentage is calculated as the ratio of the difference between selling price and cost, to the cost (Profit %=CostSelling price−Cost×100).
The discount on item Q, as a percentage of its marked price, is ______
A.
25
B.
12.5
C.
10
D.
5
Correct Answer:
C
Step-by-Step Solution
Insight: The cost price of Q can be derived from the given ratio with P's cost price, then selling price follows from the profit percentage, and finally the discount percentage is calculated from the marked price.
Identify knowns: CP_P = 5400, and the ratio CP_P : CP_Q = 3 : 4.
Calculate CP_Q: Since 3 parts = 5400, 1 part = 1800. Thus, CP_Q = 4 * 1800 = 7200.
Use Profit % for Q (25%) to find SP_Q: SP_Q = CP_Q (1 + 25/100) = 7200 1.25 = 9000.
Use MP_Q (10000) to find the absolute Discount: Discount = MP_Q - SP_Q = 10000 - 9000 = 1000.
Calculate Discount %: The base for discount percentage is always the Marked Price. So, (1000 / 10000) * 100 = 10%.
Question 31 · Digital Logic · 2021_Set1MCQ
Let the representation of a number in base 3 be 210. What is the hexadecimal representation of the number?
A.
15
B.
21
C.
D2
D.
528
Correct Answer:
A
Step-by-Step Solution
Insight: Route through Base 10 to convert from Base 3 to Hexadecimal (Base 16).
Exam route:
(210)3=2(9)+1(3)+0(1)=2110.
21÷16=1 R $5$. Result is 1516.
Learning route:
The question requires converting a Base 3 number to Hexadecimal. Since 3 and 16 are not powers of the same base, we must use Base 10 as an intermediate.
Step 1: Convert (210)3 to Base 10. The positional weights for Base 3 are 32=9, 31=3, 30=1.
2×9+1×3+0×1=18+3+0=2110.
Step 2: Convert 2110 to Base 16. Divide 21 by 16. The quotient is 1 and the remainder is 5.
Reading the remainders gives 1516.
Verification: (15)16=1(16)+5(1)=2110. Matches.
Question 32 · Digital Logic · 2021_Set1MCQ
Consider a 3-bit counter, designed using T flip-flops, as shown below:
Assuming the initial state of the counter given by PQR as 000, what are the next three states?
A.
011, 101, 000
B.
001, 010, 111
C.
011, 101, 111
D.
001, 010, 000
Correct Answer:
A
Step-by-Step Solution
Insight: This is a synchronous counter where the T inputs are driven by combinational logic of the current state, requiring step-by-step state tracing using the T flip-flop characteristic equation.
Exam route: Extract excitation equations: TP=R, TQ=P, TR=Q. Use Q+=T⊕Q. Starting from PQR=000, compute next states: 000→011→101→000.
Learning route:
Step 1: Identify the flip-flop type and its characteristic equation. For T flip-flops, Qnext=T⊕Q.
Step 2: Read the circuit diagram to find the excitation equations for each flip-flop input.
TP is connected to R, so TP=R.
TQ is connected to P, so TQ=P.
TR is connected to Q, so TR=Q.
Step 3: Substitute the current state PQR=000 into the excitation equations.
TP=0, TQ=0=1, TR=0=1.
Step 4: Calculate the next state using Qnext=T⊕Q.
P+=0⊕0=0
Q+=1⊕0=1
R+=1⊕0=1
Next state is $011$.
Step 5: Repeat for the next state $011$.
TP=1, TQ=0=1, TR=1=0.
P+=1⊕0=1, Q+=1⊕1=0, R+=0⊕1=1.
Next state is $101$.
Step 6: Repeat for $101$.
TP=1, TQ=1=0, TR=0=1.
P+=1⊕1=0, Q+=0⊕0=0, R+=1⊕1=0.
Next state is $000$.
Verification: The sequence 000→011→101→000 perfectly matches the first option.
Question 33 · Digital Logic · 2021_Set1MSQ
Consider the following Boolean expression.
F=(X+Y+Z)(X+Y)(Y+Z) Which of the following Boolean expressions is/are equivalent to F (complement of F)?
A.
(X+Y+Z)(X+Y)(Y+Z)
B.
XY+Z
C.
(X+Z)(Y+Z)
D.
XY+YZ+XYZ
Correct Answer:
["B","C","D"]
Step-by-Step Solution
Insight: Simplify F first using consensus and absorption, then apply De Morgan's laws to find F′.
Exam route: (X+Y+Z)(X′+Y)=Y+X′Z. Then (Y+X′Z)(Y′+Z)=Z(Y+X′). Complementing gives F′=XY′+Z′.
Learning route:
Step 1: Simplify F=(X+Y+Z)(X′+Y)(Y′+Z).
Apply the rule (A+B)(A′+C)=AC+A′B+BC with A=X,B=Y+Z,C=Y:
This is algebraically identical to XY′+Z′. (Correct)
Option A simplifies to X′Z′+Y′Z′, which fails for X=1,Y=1,Z=0 (gives 0, but F′=1). (Incorrect)
Question 34 · Verbal Aptitude · 2021_Set1MCQ
Consider the following sentences:
(i) Everybody in the class is prepared for the exam. (ii) Babu invited Danish to his home because he enjoys playing chess.
Which of the following is the CORRECT observation about the above two sentences?
A.
(i) is grammatically correct and (ii) is unambiguous
B.
(i) is grammatically incorrect and (ii) is unambiguous
C.
(i) is grammatically correct and (ii) is ambiguous
D.
(i) is grammatically incorrect and (ii) is ambiguous
Correct Answer:
C
Step-by-Step Solution
Insight: Indefinite pronouns like 'Everybody' are grammatically singular, while personal pronouns must have a single, unmistakable antecedent to avoid ambiguity.
Exam route: Sentence (i) uses 'Everybody', which is singular and correctly pairs with the singular verb 'is'. Sentence (ii) uses the pronoun 'he', which could logically refer to either 'Babu' or 'Danish', making the sentence ambiguous. Therefore, (i) is correct and (ii) is ambiguous.
Learning route:
Step 1: Analyze sentence (i). 'Everybody' belongs to the class of indefinite pronouns (along with someone, anyone, nobody), which always take singular verbs. 'Is' is singular, so the sentence is grammatically correct.
Step 2: Analyze sentence (ii). The pronoun 'he' is used in the dependent clause. The main clause contains two male nouns: 'Babu' and 'Danish'. Because both are valid antecedents for 'he', the reader cannot know who enjoys playing chess. This is a classic ambiguous reference error.
Step 3: Match these findings to the options. Option C correctly identifies (i) as correct and (ii) as ambiguous.
Common trap: Students might think 'Everybody' implies a plural group and incorrectly select 'are', or they might assume 'he' naturally refers to the subject 'Babu' and miss the ambiguity.
Verification: Rewriting (ii) to remove ambiguity (e.g., "Babu invited Danish because Babu enjoys chess") proves the original was structurally flawed in its clarity.
Question 35 · Verbal Aptitude · 2021_Set1MCQ
Some people suggest anti-obesity measures (AOM) such as displaying calorie information in restaurant menus. Such measures sidestep addressing the core problems that cause obesity: poverty and income inequality.
Which one of the following statements summarizes the passage?
A.
The proposed AOM addresses the core problems that cause obesity.
B.
If obesity reduces, poverty will naturally reduce, since obesity causes poverty.
C.
AOM are addressing the core problems and are likely to succeed.
D.
AOM are addressing the problem superficially.
Correct Answer:
D
Step-by-Step Solution
Insight: The passage contrasts superficial measures (AOM) with core problems (poverty). The correct summary must capture this contrast without introducing outside facts.
Exam route: AOM "sidesteps addressing the core problems", meaning it only addresses the issue superficially. Option D captures this perfectly.
Learning route:
Identify the core argument: The author notes that AOM (like displaying calorie information) are suggested by some, but explicitly states that these measures "sidestep addressing the core problems" (which are poverty and income inequality).
Evaluate Option A: Claims AOM "addresses the core problems". This directly contradicts the word "sidestep". Incorrect.
Evaluate Option B: Claims "obesity causes poverty". This causal link is never mentioned in the passage. It relies on outside assumptions. Incorrect.
Evaluate Option C: Claims AOM are "likely to succeed". The passage is critical of AOM for missing the root cause; it does not predict success. Incorrect.
Evaluate Option D: Claims AOM are addressing the problem "superficially". This is a perfect paraphrase of "sidestep addressing the core problems". If you ignore the root cause, you are only treating the surface. Correct.
Conclusion: Option D is the only valid summary.
Question 36 · Spatial Aptitude · 2021_Set1MCQ
A polygon is convex if, for every pair of points, P and Q belonging to the polygon, the line segment PQ lies completely inside or on the polygon.
Which one of the following is NOT a convex polygon?
A.
B.
C.
D.
Correct Answer:
A
Step-by-Step Solution
Insight: A polygon is concave if it has at least one interior angle strictly greater than 180∘ (a reflex angle), which creates a visible inward "dent".
Exam route: Visually scan each option for an inward dent. Option A has a clear inward vertex at (55,65), making the interior angle there >180∘. Options B (triangle), C (rectangle), and D (trapezoid) have all interior angles <180∘.
Learning route:
Recall the definition: A convex polygon has all interior angles <180∘. A concave polygon has at least one interior angle >180∘.
Apply the Line Segment Test: In Option A, pick a point near the top-left edge and another near the bottom-left edge. The straight line segment connecting them passes outside the polygon's boundary, proving it is concave.
Verify other options: Triangles (Option B) always have an angle sum of 180∘, so no single angle can exceed 180∘. Rectangles (Option C) and trapezoids (Option D) are standard convex quadrilaterals with all angles <180∘.
Conclusion: Option A is the only non-convex (concave) polygon.
Question 37 · Spatial Aptitude · 2021_Set1MCQ
A circular sheet of paper is folded along the lines in the directions shown. The paper, after being punched in the final folded state as shown and unfolded in the reverse order of folding, will look like _______.
A.
B.
C.
D.
Correct Answer:
A
Step-by-Step Solution
Key idea: This is a paper folding and punching problem. We must reverse the folding steps to determine the location and orientation of the punched holes on the unfolded sheet.
Step 1: Analyze the final folded state and the punch.
The final state is a quarter-circle sector (top-right quadrant of the original circle, if we assume standard folding).
The punch consists of:
A small circular hole near the center (the corner of the sector).
A rectangular notch on the curved edge.
A rectangular notch on the straight vertical edge.
A rectangular notch on the straight horizontal edge.
Actually, looking at the SVG for the final state:
It's a quarter circle.
Punches:
A small rectangle on the vertical radius.
A small rectangle on the horizontal radius.
A larger rectangle-like shape on the arc? No, it looks like a hole inside.
Let's look at the options to infer the punch pattern.
The options show:
A central circular hole.
Four rectangular holes arranged symmetrically.
Let's trace the folds backwards.
Fold 1: Vertical fold (Left over Right? Or Right over Left?). The arrow shows the left side folding to the right. So we have a semi-circle (Right half).
Fold 2: Horizontal fold (Bottom over Top? Or Top over Bottom?). The arrow shows the bottom folding up. So we have a quarter-circle (Top-Right quadrant).
The punch is made in this Top-Right quadrant.
Unfold Step 1 (Reverse Horizontal Fold):
Reflect the punch pattern across the horizontal axis (the bottom edge of the current quarter circle).
The Top-Right quadrant becomes the Right Half (Top-Right and Bottom-Right).
Any hole in the Top-Right will have a mirror image in the Bottom-Right.
Unfold Step 2 (Reverse Vertical Fold):
Reflect the entire Right Half pattern across the vertical axis (the left edge of the semi-circle).
The Right Half becomes the Full Circle.
Any hole in the Right Half will have a mirror image in the Left Half.
Analysis of Holes:
Central Hole: The punch near the corner (center of circle) reflects to itself or creates a cluster. In the options, there is a single central circular hole. This implies the punch was at the center or created a symmetric pattern that merges.
Rectangular Holes:
In the final quadrant, there appear to be punches on the edges.
Option A shows 4 rectangular holes: Top, Bottom, Left, Right.
This symmetry corresponds to a single punch in the quadrant that gets reflected 3 times.
Let's look at the specific shape in the final fold SVG:
There is a small rectangular cut on the vertical edge.
There is a small rectangular cut on the horizontal edge.
There is a cut on the arc?
Comparing with Option A:
Option A has rectangles at 12, 6, 3, 9 o'clock positions.
If we punch a rectangle at the midpoint of the vertical radius in the folded state, unfolding horizontally creates a pair at 3 o'clock (if it was on the edge) or similar.
Let's look at the "notch" shapes in the final fold.
One notch on the vertical straight edge.
One notch on the horizontal straight edge.
One notch on the curved edge?
If we unfold a notch on the vertical edge of the Top-Right quadrant:
Reflect across Horizontal: It stays in the Right Half (Top-Right and Bottom-Right? No, the vertical edge is the axis of the first fold? No, the vertical edge is the center of the original circle? No.
Let's re-evaluate the fold axes.
Circle folded vertically. Axis is vertical diameter. Result: Semi-circle.
Semi-circle folded horizontally. Axis is horizontal diameter. Result: Quarter-circle.
The straight edges of the final quarter-circle are the radii along the axes.
Vertical straight edge: Part of the vertical diameter.
Horizontal straight edge: Part of the horizontal diameter.
Punches in the final state:
A punch on the vertical straight edge. When unfolded horizontally (Step 1), this punch is on the axis of reflection? No, the horizontal fold axis is the horizontal edge. The vertical edge is perpendicular to it. So the punch on the vertical edge reflects to a punch on the vertical edge in the lower quadrant. So we have two punches on the vertical radius (one up, one down).
Then unfold vertically (Step 2). The vertical radius is the axis of reflection. Punches on the axis reflect to themselves? Or do they split? If it's a hole on the edge, it becomes a symmetric hole centered on the axis.
A punch on the horizontal straight edge. When unfolded horizontally, this is on the axis. It becomes a symmetric hole centered on the horizontal axis.
Option A shows:
Rectangles at Top and Bottom (on vertical axis).
Rectangles at Left and Right (on horizontal axis).
This matches perfectly if there were punches on the straight edges of the folded quadrant.
Answer: A
Question 38 · Analytical Aptitude · 2021_Set1MCQ
_____ is to surgery as writer is to ________
Which one of the following options maintains a similar logical relation in the above sentence?
A.
Plan, outline
B.
Hospital, library
C.
Doctor, book
D.
Medicine, grammar
Correct Answer:
C
Step-by-Step Solution
Insight: This is a Worker-to-Product/Action analogy. The logical relationship is "A [Professional] performs/produces [Action/Product]".
Exam route: A Writer produces a Book. Following the same directional relationship, a Doctor performs Surgery. Therefore, the missing pair is Doctor, book.
Learning route:
Step 1: Isolate the known contiguous pair: "writer" and the blank. We know a writer's primary output is a "book".
Step 2: Formulate the Bridge Sentence: "A [Worker] produces/performs [Product/Action]".
Step 3: Apply to the first part: "A [Worker] performs surgery". The professional who performs surgery is a "Doctor".
Step 4: Verify directionality. Doctor → Surgery (Worker → Action). Writer → Book (Worker → Product). The logical relation is perfectly maintained.
Question 39 · Analytical Aptitude · 2021_Set1MCQ
Given below are two statements 1 and 2, and two conclusions I and II.
Statement 1: All bacteria are microorganisms.
Statement 2: All pathogens are microorganisms.
Conclusion I: Some pathogens are bacteria.
Conclusion II: All pathogens are not bacteria.
Based on the above statements and conclusions, which one of the following options is logically CORRECT?
A.
Only conclusion I is correct
B.
Only conclusion II is correct
C.
Either conclusion I or II is correct.
D.
Neither conclusion I nor II is correct.
Correct Answer:
D
Step-by-Step Solution
Insight: Two subsets of a larger set may or may not overlap; without explicit information, neither overlap nor disjointness can be definitively concluded.
Exam route: Draw Venn diagram with Bacteria and Pathogens inside Microorganisms. They can be disjoint or overlapping. Since neither is a definite conclusion, select Option D.
Learning route: Let Microorganisms be the universal set. Bacteria and Pathogens are both subsets. The premises do not specify the relationship between Bacteria and Pathogens. If they overlap, Conclusion I (Some pathogens are bacteria) is true, and Conclusion II (All pathogens are not bacteria / No pathogens are bacteria) is false. If they are disjoint, Conclusion I is false, and Conclusion II is true. Because we cannot determine which scenario is the actual case from the premises alone, neither conclusion is logically correct as a definite deduction. Option C is a trap for those who recognize they are contradictory, but in strict syllogism, we only accept conclusions that are definitively true in all valid diagrams.
Wrong path: A student might see that I and II are contradictory and select Option C (Either I or II). This breaks because in strict syllogism, a conclusion must be definitely true based on the premises. Since we cannot deduce which one is true from the given statements, neither is a valid definite conclusion. Generalization: A conclusion must hold in every valid Venn diagram to be correct; do not fall for the "Either/Or" trap when neither is definitively provable. Verification: Both disjoint and overlapping diagrams satisfy the premises, proving neither conclusion is definite.