Question text and figures as in the official paper, with the answer from the official key. Worked solutions for every question are in your report after you take the paper as a 3-hour test.
Research in the workplace reveals that people work for many reasons ________.
(A)
money beside
(B)
beside money
(C)
money besides
(D)
besides money
Answer (official key): D
Worked solution: in your report after you take this paper.
Q2 · General Aptitude · MCQ · 1 mark
Find the smallest number y such that y×162 is a perfect cube.
(A)
24
(B)
27
(C)
32
(D)
36
Answer (official key): D
Worked solution: in your report after you take this paper.
Q3 · General Aptitude · MCQ · 1 mark
Rahul, Murali, Srinivas and Arul are seated around a square table. Rahul is sitting to the left of Murali. Srinivas is sitting to the right of Arul. Which of the following pairs are seated opposite each other?
(A)
Rahul and Murali
(B)
Srinivas and Arul
(C)
Srinivas and Murali
(D)
Srinivas and Rahul
Answer (official key): C
Worked solution: in your report after you take this paper.
Q4 · General Aptitude · MCQ · 1 mark
After Rajendra Chola returned from his voyage to Indonesia, he ________ to visit the temple in Thanjavur.
(A)
was wishing
(B)
is wishing
(C)
wished
(D)
had wished
Answer (official key): C
Worked solution: in your report after you take this paper.
Q5 · General Aptitude · MCQ · 1 mark
The probability that a 6-digit number does NOT contain the digits 0, 5, or 9 is:
(A)
0.36
(B)
0.66
(C)
0.76
(D)
0.96
Answer (official key): C
Worked solution: in your report after you take this paper.
Six people are seated around a circular table. There are at least two men and two women. There are at least three right-handed persons. Every woman has a left-handed person to her immediate right. None of the women are right-handed. The number of women at the table is:
“The hold of the nationalist imagination on our colonial past is such that anything inadequately or improperly nationalist is just not history.”
Which of the following statements best reflects the author's opinion?
(A)
Nationalists are highly imaginative.
(B)
History is viewed through the filter of nationalism.
(C)
Our colonial past never happened.
(D)
Nationalism has to be both adequately and properly imagined.
Answer (official key): B
Worked solution: in your report after you take this paper.
Q9 · General Aptitude · MCQ · 2 marks
Arun, Gulab, Neel and Shweta must choose one shirt each from a pile of four shirts coloured red, pink, blue and violet respectively. Arun dislikes the colour red and Shweta dislikes the colour violet. Gulab and Neel like all the colours. In how many different ways can they choose the shirts so that no one has a shirt with a colour he or she dislikes?
(A)
21
(B)
18
(C)
16
(D)
14
Answer (official key): D
Worked solution: in your report after you take this paper.
Q10 · General Aptitude · MCQ · 2 marks
A contour line joins locations having the same height above the mean sea level. The following is a contour plot of a geographical region. Contour lines are shown at 25 m intervals in this plot.
If in a flood, the water level rises to 525 m, which of the villages P, Q, R, S, T get submerged?
(A)
P, Q
(B)
P, Q, T
(C)
R, S, T
(D)
Q, R, S
Answer (official key): C
Worked solution: in your report after you take this paper.
Q11 · Databases · MCQ · 1 mark
The following functional dependencies hold true for the relational schema R(V,W,X,Y,Z):
V→WVW→XY→VXY→Z
Which of the following is irreducibly equivalent for this set of functional dependencies?
(A)
V→W,V→X,Y→V,Y→Z
(B)
V→W,W→X,Y→V,Y→Z
(C)
V→W,V→X,Y→V,Y→X,Y→Z
(D)
V→W,W→X,Y→V,Y→X,Y→Z
Answer (official key): A
Worked solution: in your report after you take this paper.
Q12 · Theory of Computation · MCQ · 1 mark
Consider the following context-free grammar over the alphabet Σ={a,b,c} with S as the start symbol:
S→abScT∣abcTT→bT∣b
Which one of the following represents the language generated by the above grammar?
(A)
{(ab)n(cb)n∣n≥1}
(B)
{(ab)mcbn1cbn2⋯cbnm∣m,n1,n2,…,nm≥1}
(C)
{(ab)m(cbn)m∣m,n≥1}
(D)
{(ab)n(cbm)m∣m,n≥1}
Answer (official key): B
Worked solution: in your report after you take this paper.
Q13 · Computer Organization and Architecture · MCQ · 1 mark
Consider the C struct defined below:
struct data {
int marks[100];
char grade;
int cnumber;
};
struct data student;
The base address of student is available in register R1. The field student.grade can be accessed efficiently using:
(A)
Post-increment addressing mode, (R1)+
(B)
Pre-decrement addressing mode, -(R1)
(C)
Register direct addressing mode, R1
(D)
Index addressing mode, X(R1), where X is an offset represented in 2's complement 16-bit representation
Answer (official key): D
Worked solution: in your report after you take this paper.
Q14 · Algorithms · MCQ · 1 mark
Consider the following functions from positive integers to real numbers:
10,n,n,log2n,n100.
The correct arrangement of the above functions in increasing order of asymptotic complexity is:
(A)
log2n,n100,10,n,n
(B)
n100,10,log2n,n,n
(C)
10,n100,n,log2n,n
(D)
n100,log2n,10,n,n
Answer (official key): B
Worked solution: in your report after you take this paper.
Q15 · Algorithms · MCQ · 1 mark
Consider the following table:
Algorithms
Design Paradigms
(P) Kruskal
(i) Divide and Conquer
(Q) Quicksort
(ii) Greedy
(R) Floyd-Warshall
(iii) Dynamic Programming
Match the algorithms to the design paradigms they are based on.
(A)
(P)↔(ii),(Q)↔(iii),(R)↔(i)
(B)
(P)↔(iii),(Q)↔(i),(R)↔(ii)
(C)
(P)↔(ii),(Q)↔(i),(R)↔(iii)
(D)
(P)↔(i),(Q)↔(ii),(R)↔(iii)
Answer (official key): C
Worked solution: in your report after you take this paper.
Q16 · Probability and Statistics · Numerical · 1 mark
Let X be a Gaussian random variable with mean 0 and variance σ2. Let
Y=max(X,0)
where max(a,b) is the maximum of a and b.
The median of Y is __________.
Answer (official key): 0
Worked solution: in your report after you take this paper.
Q17 · Compiler Design · MCQ · 1 mark
Consider the following intermediate program in three address code:
p = a - b
q = p * c
p = u * v
q = p + q
Which one of the following corresponds to a static single assignment form of the above code?
(A)
p1 = a - b
q1 = p1 * c
p1 = u * v
q1 = p1 + q1
(B)
p3 = a - b
q4 = p3 * c
p4 = u * v
q5 = p4 + q4
(C)
p1 = a - b
q1 = p2 * c
p3 = u * v
q2 = p4 + q3
(D)
p1 = a - b
q1 = p * c
p2 = u * v
q2 = p + q
Answer (official key): B
Worked solution: in your report after you take this paper.
Q18 · Digital Logic · Numerical · 1 mark
Consider the Karnaugh map given below, where x represents “don't care” and blank represents 0.
Assume for all inputs (a,b,c,d), the respective complements (a,b,c,d) are also available. The above logic is implemented using 2-input NOR gates only.
The minimum number of gates required is __________.
Consider a database that has the relation schema EMP(EmpId, EmpName, DeptName). An instance of the schema EMP and a SQL query on it are given below.
EmpId
EmpName
DeptName
1
XYA
AA
2
XYB
AA
3
XYC
AA
4
XYD
AA
5
XYE
AB
6
XYF
AB
7
XYG
AB
8
XYH
AC
9
XYI
AC
10
XYJ
AC
11
XYK
AD
12
XYL
AD
13
XYM
AE
SELECT AVG(EC.Num)
FROM EC
WHERE (DeptName, Num) IN
(SELECT DeptName, COUNT(EmpId) AS EC(DeptName, Num)
FROM EMP
GROUP BY DeptName);
The output of executing the SQL query is __________.
Answer (official key): 2.6
Worked solution: in your report after you take this paper.
Q20 · Discrete Mathematics · Numerical · 1 mark
Let T be a tree with 10 vertices. The sum of the degrees of all the vertices in T is __________.
Answer (official key): 18
Worked solution: in your report after you take this paper.
Q21 · Discrete Mathematics · MCQ · 1 mark
The statement (¬p)⇒(¬q) is logically equivalent to which of the statements below?
I. p⇒q
II. q⇒p
III. (¬q)∨p
IV. (¬p)∨q
(A)
I only
(B)
I and IV only
(C)
II only
(D)
II and III only
Answer (official key): D
Worked solution: in your report after you take this paper.
Q22 · Computer Networks · MCQ · 1 mark
A sender S sends a message m to receiver R, which is digitally signed by S with its private key.
In this scenario, one or more of the following security violations can take place.
(I) S can launch a birthday attack to replace m with a fraudulent message.
(II) A third-party attacker can launch birthday attack to replace m with a fraudulent message.
(III) R can launch a birthday attack to replace m with a fraudulent message.
Which of the following are possible security violations?
(A)
(I) and (II) only
(B)
(I) only
(C)
(II) only
(D)
(II) and (III) only
Answer (official key): B
Worked solution: in your report after you take this paper.
Q23 · Operating System · MCQ · 1 mark
Threads of a process share:
(A)
global variables but not heap.
(B)
heap but not global variables.
(C)
neither global variables nor heap.
(D)
both heap and global variables.
Answer (official key): D
Worked solution: in your report after you take this paper.
Q24 · Theory of Computation · Numerical · 1 mark
Consider the language L given by the regular expression
(a+b)∗b(a+b)
over the alphabet {a,b}.
The smallest number of states needed in a deterministic finite-state automaton (DFA) accepting L is __________.
Answer (official key): 4
Worked solution: in your report after you take this paper.
Q25 · Computer Organization and Architecture · MCQ · 1 mark
The n-bit fixed-point representation of an unsigned real number X uses f bits for the fraction part. Let i=n−f. The range of decimal values for X in this representation is:
(A)
2−f to 2i
(B)
2−f to (2i−2−f)
(C)
0 to 2i
(D)
0 to (2i−2−f)
Answer (official key): D
Worked solution: in your report after you take this paper.
Q26 · Computer Organization and Architecture · MCQ · 1 mark
When two 8-bit numbers A7⋯A0 and B7⋯B0 in 2's complement representation, with A0 and B0 as the least significant bits, are added using a ripple-carry adder, the sum bits obtained are S7⋯S0 and the carry bits are C7⋯C0.
An overflow is said to have occurred if:
(A)
the carry bit C7 is 1
(B)
all the carry bits (C7,⋯,C0) are 1
(C)
(A7B7S7+A7B7S7) is 1
(D)
(A0B0S0+A0B0S0) is 1
Answer (official key): C
Worked solution: in your report after you take this paper.
Q27 · Linear Algebra · MCQ · 1 mark
Let c1,…,cn be scalars, not all zero, such that
i=1∑nciai=0
where ai are column vectors in Rn.
Consider the set of linear equations
Ax=b
where
A=[a1,…,an]
and
b=i=1∑nai.
The set of equations has:
(A)
a unique solution at x=Jn, where Jn denotes an n-dimensional vector of all 1
(B)
no solution
(C)
infinitely many solutions
(D)
finitely many solutions
Answer (official key): C
Worked solution: in your report after you take this paper.
Q28 · Programming and Data Structures · MCQ · 1 mark
Consider the C code fragment given below.
typedef struct node {
int data;
node* next;
} node;
void join(node* m, node* n) {
node* p = n;
while (p->next != NULL) {
p = p->next;
}
p->next = m;
}
Assuming that m and n point to valid NULL-terminated linked lists, invocation of join will:
(A)
append list m to the end of list n for all inputs.
(B)
either cause a null pointer dereference or append list m to the end of list n.
(C)
cause a null pointer dereference for all inputs.
(D)
append list n to the end of list m for all inputs.
Answer (official key): B
Worked solution: in your report after you take this paper.
Q29 · Programming and Data Structures · MCQ · 1 mark
Consider the following C code:
#include <stdio.h>
int *assignval(int *x, int val) {
*x = val;
return x;
}
void main() {
int *x = malloc(sizeof(int));
if (NULL == x) return;
x = assignval(x, 0);
if (x) {
x = (int *) malloc(sizeof(int));
if (NULL == x) return;
x = assignval(x, 10);
}
printf("%d\n", *x);
free(x);
}
The code suffers from which one of the following problems?
(A)
compiler error as the return of malloc is not typecast appropriately
(B)
compiler error because the comparison should be made as x == NULL and not as shown
(C)
compiles successfully but execution may result in dangling pointer
(D)
compiles successfully but execution may result in memory leak
Answer (official key): D
Worked solution: in your report after you take this paper.
Q30 · Discrete Mathematics · MCQ · 1 mark
Consider the first-order logic sentence
F:∀x(∃yR(x,y)).
Assuming non-empty logical domains, which of the sentences below are implied by F?
I. ∃y(∃xR(x,y))
II. ∃y(∀xR(x,y))
III. ∀y(∃xR(x,y))
IV. ¬∃x(∀y¬R(x,y))
(A)
IV only
(B)
I and IV only
(C)
II only
(D)
II and III only
Answer (official key): B
Worked solution: in your report after you take this paper.
Q31 · Operating System · Numerical · 1 mark
Consider the following CPU processes with arrival times and length of CPU bursts as given below:
Process
Arrival time
Burst
P1
0
7
P2
3
3
P3
5
5
P4
6
2
If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is __________ milliseconds.
Answer (official key): 3
Worked solution: in your report after you take this paper.
Q32 · Compiler Design · MCQ · 1 mark
Consider the following grammar:
P→xQRSQ→yz∣ϵR→w∣ϵS→v
What is FOLLOW(Q)?
(A)
{R}
(B)
{w}
(C)
{w,v}
(D)
\{w,\}$
Answer (official key): C
Worked solution: in your report after you take this paper.
Q33 · Programming and Data Structures · MCQ · 1 mark
Let T be a binary search tree with 15 nodes. The minimum and maximum possible heights of T are:
Note: The height of a tree with a single node is 0.
(A)
4 and 15 respectively
(B)
3 and 14 respectively
(C)
4 and 14 respectively
(D)
3 and 15 respectively
Answer (official key): B
Worked solution: in your report after you take this paper.
Q34 · Computer Organization and Architecture · Numerical · 1 mark
Consider a two-level cache hierarchy with L1 and L2 caches. An application incurs 1.4 memory accesses per instruction on average.
For this application, the miss rate of L1 cache is 0.1. The L2 cache experiences, on average, 7 misses per 1000 instructions.
The miss rate of L2 expressed correct to two decimal places is __________.
Answer (official key): 0.05
Worked solution: in your report after you take this paper.
Q35 · Computer Networks · MCQ · 1 mark
Consider a TCP client and a TCP server running on two different machines. After completing data transfer, the TCP client calls close to terminate the connection and a FIN segment is sent to the TCP server. Server-side TCP responds by sending an ACK, which is received by the client-side TCP.
As per the TCP connection state diagram, in which state does the client-side TCP connection wait for the FIN from the server-side TCP?
(A)
LAST-ACK
(B)
TIME-WAIT
(C)
FIN-WAIT-1
(D)
FIN-WAIT-2
Answer (official key): D
Worked solution: in your report after you take this paper.
Q36 · Theory of Computation · MCQ · 2 marks
Consider the context-free grammars over the alphabet {a,b,c} given below. S and T are non-terminals.
G1:S→aSb∣T,T→cT∣ϵG2:S→bSa∣T,T→cT∣ϵ
The language L(G1)∩L(G2) is:
(A)
Finite.
(B)
Not finite but regular.
(C)
Context-Free but not regular.
(D)
Recursive but not context-free.
Answer (official key): B
Worked solution: in your report after you take this paper.
Q37 · Calculus · MCQ · 2 marks
The value of
x→1limx3−3x2+2x7−2x5+1
(A)
is 0
(B)
is -1
(C)
is 1
(D)
does not exist
Answer (official key): C
Worked solution: in your report after you take this paper.
Q38 · Computer Networks · MCQ · 2 marks
A computer network uses polynomials over GF(2) for error checking with 8 bits as information bits and uses
x3+x+1
as the generator polynomial to generate the check bits.
In this network, the message 01011011 is transmitted as:
(A)
01011011010
(B)
01011011011
(C)
01011011101
(D)
01011011100
Answer (official key): C
Worked solution: in your report after you take this paper.
Q39 · Linear Algebra · MCQ · 2 marks
Let u and v be two vectors in R2 whose Euclidean norms satisfy
∥u∥=2∥v∥.
What is the value of α such that
w=u+αv
bisects the angle between u and v?
(A)
2
(B)
1/2
(C)
1
(D)
−1/2
Answer (official key): A
Worked solution: in your report after you take this paper.
Q40 · Programming and Data Structures · MCQ · 2 marks
Consider the C functions foo and bar given below:
int foo(int val) {
int x = 0;
while (val > 0) {
x = x + foo(val--);
}
return val;
}
int bar(int val) {
int x = 0;
while (val > 0) {
x = x + bar(val - 1);
}
return val;
}
Invocations of foo(3) and bar(3) will result in:
(A)
Return of 6 and 6 respectively.
(B)
Infinite loop and abnormal termination respectively.
(C)
Abnormal termination and infinite loop respectively.
(D)
Both terminating abnormally.
Answer (official key): C
Worked solution: in your report after you take this paper.
Q41 · Databases · MCQ · 2 marks
Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that DeptId can be permitted to be NULL in the relation EMP.
Consider the following queries on the database expressed in tuple relational calculus.
I. {t∣∃u∈EMP(t[EmpName]=u[EmpName]∧∀v∈DEPT(t[DeptId]=v[DeptId]))}
II. {t∣∃u∈EMP(t[EmpName]=u[EmpName])∧∃v∈DEPT(t[DeptId]=v[DeptId])}
III. {t∣∃u∈EMP(t[EmpName]=u[EmpName])∧∃v∈DEPT(t[DeptId]=v[DeptId])}
Which of the above queries are safe?
(A)
I and II only
(B)
I and III only
(C)
II and III only
(D)
I, II and III
Answer (official key): D
Worked solution: in your report after you take this paper.
Q42 · Operating System · MCQ · 2 marks
A multithreaded program P executes with x number of threads and uses y number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e., if a thread holds a lock l, then it cannot re-acquire lock l without releasing it. If a thread is unable to acquire a lock, it blocks until the lock becomes available.
The minimum value of x and the minimum value of y together for which execution of P can result in a deadlock are:
(A)
x=1,y=2
(B)
x=2,y=1
(C)
x=2,y=2
(D)
x=1,y=1
Answer (official key): D
Worked solution: in your report after you take this paper.
Q43 · Discrete Mathematics · MCQ · 2 marks
Let p, q, and r be propositions and the expression (p→q)→r be a contradiction. Then, the expression (r→p)→q is:
(A)
a tautology.
(B)
a contradiction.
(C)
always TRUE when p is FALSE.
(D)
always TRUE when q is TRUE.
Answer (official key): D
Worked solution: in your report after you take this paper.
Q44 · Theory of Computation · MCQ · 2 marks
If G is a grammar with productions
S→SaS∣aSb∣bSa∣SS∣ϵ
where S is the start variable, then which one of the following strings is not generated by G?
(A)
abab
(B)
aaab
(C)
abbaa
(D)
babba
Answer (official key): D
Worked solution: in your report after you take this paper.
Q45 · Databases · MCQ · 2 marks
In a database system, unique timestamps are assigned to each transaction using Lamport's logical clock. Let TS(T1) and TS(T2) be the timestamps of transactions T1 and T2 respectively.
T1 holds a lock on the resource R, and T2 has requested a conflicting lock on the same resource R.
The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
if TS(T2) < TS(T1) then
T1 is killed
else
T2 waits
Assume any transaction that is not killed terminates eventually.
Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?
(A)
The database system is both deadlock-free and starvation-free.
(B)
The database system is deadlock-free, but not starvation-free.
(C)
The database system is starvation-free, but not deadlock-free.
(D)
The database system is neither deadlock-free nor starvation-free.
Answer (official key): A
Worked solution: in your report after you take this paper.
Q46 · Programming and Data Structures · MCQ · 2 marks
Worked solution: in your report after you take this paper.
Q47 · Digital Logic · MCQ · 2 marks
Consider a combination of T and D flip-flops connected as shown below. The output of the D flip-flop is connected to the input of the T flip-flop and the output of the T flip-flop is connected to the input of the D flip-flop.
Initially, both Q0 and Q1 are set to 1 before the 1st clock cycle. The outputs are:
(A)
Q1Q0 after the 3rd cycle are 11 and after the 4th cycle are 00 respectively
(B)
Q1Q0 after the 3rd cycle are 11 and after the 4th cycle are 01 respectively
(C)
Q1Q0 after the 3rd cycle are 00 and after the 4th cycle are 11 respectively
(D)
Q1Q0 after the 3rd cycle are 01 and after the 4th cycle are 01 respectively
Answer (official key): B
Worked solution: in your report after you take this paper.
Q48 · Operating System · MCQ · 2 marks
Recall that Belady's anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements:
S1: Random page replacement algorithm, where a page chosen at random is replaced, suffers from Belady's anomaly.
S2: LRU page replacement algorithm suffers from Belady's anomaly.
Which of the following is CORRECT?
(A)
S1 is true, S2 is true
(B)
S1 is true, S2 is false
(C)
S1 is false, S2 is true
(D)
S1 is false, S2 is false
Answer (official key): B
Worked solution: in your report after you take this paper.
Q49 · Theory of Computation · MCQ · 2 marks
Let A and B be finite alphabets and let # be a symbol outside both A and B. Let f be a total function from A∗ to B∗. We say f is computable if there exists a Turing machine M which, given an input x in A∗, always halts with f(x) on its tape.
Let Lf denote the language
{x#f(x)∣x∈A∗}.
Which of the following statements is true?
(A)
f is computable if and only if Lf is recursive.
(B)
f is computable if and only if Lf is recursively enumerable.
(C)
If f is computable then Lf is recursive, but not conversely.
(D)
If f is computable then Lf is recursively enumerable, but not conversely.
Answer (official key): A
Worked solution: in your report after you take this paper.
Q50 · Linear Algebra · MCQ · 2 marks
Let A be an n×n real-valued square symmetric matrix of rank 2 with
i=1∑nj=1∑nAij2=50.
Consider the following statements.
I. One eigenvalue must be in [−5,5]
II. The eigenvalue with the largest magnitude must be strictly greater than 5
Which of the above statements about eigenvalues of A is/are necessarily CORRECT?
(A)
Both I and II
(B)
I only
(C)
II only
(D)
Neither I nor II
Answer (official key): B
Worked solution: in your report after you take this paper.
Q51 · Theory of Computation · MCQ · 2 marks
Consider the following languages over the alphabet Σ={a,b,c}.
L1={anbncm∣m,n≥0}
and
L2={ambncn∣m,n≥0}.
Which of the following are context-free languages?
I. L1∪L2
II. L1∩L2
(A)
I only
(B)
II only
(C)
I and II
(D)
Neither I nor II
Answer (official key): A
Worked solution: in your report after you take this paper.
Q52 · Algorithms · MCQ · 2 marks
Let G=(V,E) be any connected undirected edge-weighted graph. The weights of the edges in E are positive and distinct. Consider the following statements:
I. Minimum Spanning Tree of G is always unique.
II. Shortest path between any two vertices of G is always unique.
Which of the above statements is/are necessarily true?
(A)
I only
(B)
II only
(C)
both I and II
(D)
neither I nor II
Answer (official key): A
Worked solution: in your report after you take this paper.
Q53 · Databases · Numerical · 2 marks
Consider a database table COURSES_REGISTERED with schema:
CR(StudentName, CourseName)
The instance of CR is given below:
StudentName
CourseName
SA
CA
SA
CB
SA
CC
SB
CB
SB
CC
SC
CA
SC
CB
SC
CC
SD
CA
SD
CB
SD
CC
SD
CD
SE
CD
SE
CA
SE
CB
SF
CA
SF
CB
SF
CC
Consider the following relational algebra query:
T1←ΠCourseName(σStudentName=′SA′(CR))T2←CR÷T1
The number of rows in T2 is __________.
Answer (official key): 4
Worked solution: in your report after you take this paper.
Q54 · Compiler Design · Numerical · 2 marks
Consider the following grammar:
stmt -> if expr then expr else expr; stmt | ε
expr -> term relop term | term
term -> id | number
id -> a | b | c
number -> [0-9]
where relop is a relational operator, for example <, >, and so on, ε refers to the empty statement, and if, then, else are terminals.
Consider a program P following the above grammar containing ten if terminals. The number of control flow paths in P is __________.
For example, the program
if e1 then e2 else e3
has 2 control flow paths:
e1 -> e2
e1 -> e3
Answer (official key): 1024
Worked solution: in your report after you take this paper.
Q55 · Computer Networks · Numerical · 2 marks
In an RSA cryptosystem, a participant A uses two prime numbers
p=13
and
q=17
to generate her public and private keys. If the public key of A is 35, then the private key of A is __________.
Answer (official key): 11
Worked solution: in your report after you take this paper.
Q56 · Programming and Data Structures · Numerical · 2 marks
Consider the following C program:
#include <stdio.h>
#include <string.h>
void printlength(char *s, char *t) {
unsigned int c = 0;
int len = ((strlen(s) - strlen(t)) > c) ? strlen(s) : strlen(t);
printf("%d\n", len);
}
void main() {
char *x = "abc";
char *y = "defgh";
printlength(x, y);
}
Recall that strlen is defined in string.h as returning a value of type size_t, which is an unsigned integer type.
The output of the program is __________.
Answer (official key): 3
Worked solution: in your report after you take this paper.
Q57 · Computer Organization and Architecture · Numerical · 2 marks
Instruction execution in a processor is divided into 5 stages:
Instruction Fetch (IF)
Instruction Decode (ID)
Operand Fetch (OF)
Execute (EX)
Write Back (WB)
These stages take 5 ns, 4 ns, 20 ns, 10 ns, and 3 ns respectively.
A pipelined implementation of the processor requires buffering between each pair of consecutive stages with a delay of 2 ns.
Two pipelined implementations of the processor are contemplated:
A naive pipeline implementation (NP) with 5 stages.
An efficient pipeline implementation (EP), where the OF stage is divided into stages OF1 and OF2 with execution times of 12 ns and 8 ns respectively.
The speedup, correct to two decimal places, achieved by EP over NP in executing 20 independent instructions with no hazards is __________.
Answer (official key): 1.49 to 1.52
Worked solution: in your report after you take this paper.
Q58 · Computer Organization and Architecture · Numerical · 2 marks
Consider a RISC machine where each instruction is exactly 4 bytes long. Conditional and unconditional branch instructions use PC-relative addressing mode with Offset specified in bytes to the target location of the branch instruction.
Further, the Offset is always with respect to the address of the next instruction in the program sequence.
If the target of the branch instruction is instruction i, then the decimal value of Offset is __________.
Answer (official key): -16
Worked solution: in your report after you take this paper.
Q59 · Computer Networks · Numerical · 2 marks
The values of parameters for the Stop-and-Wait ARQ protocol are as given below:
Parameter
Value
Bit rate of the transmission channel
1 Mbps
Propagation delay from sender to receiver
0.75 ms
Time to process a frame
0.25 ms
Number of bytes in the information frame
1980
Number of bytes in the acknowledgement frame
20
Number of overhead bytes in the information frame
20
Assume that there are no transmission errors.
The transmission efficiency, expressed in percentage and correct to 2 decimal places, of the Stop-and-Wait ARQ protocol for the above parameters is __________.
Answer (official key): 86.5 to 89.5
Worked solution: in your report after you take this paper.
Q60 · Discrete Mathematics · Numerical · 2 marks
The number of integers between 1 and 500, both inclusive, that are divisible by 3 or 5 or 7 is __________.
Answer (official key): 271
Worked solution: in your report after you take this paper.
Q61 · Programming and Data Structures · Numerical · 2 marks
The output of executing the following C program is __________.
#include <stdio.h>
int total(int v) {
static int count = 0;
while (v) {
count += v & 1;
v >>= 1;
}
return count;
}
void main() {
static int x = 0;
int i = 5;
for (; i > 0; i--) {
x = x + total(i);
}
printf("%d\n", x);
}
Let A be an array of 31 numbers consisting of a sequence of 0's followed by a sequence of 1's.
The problem is to find the smallest index i such that A[i] is 1 by probing the minimum number of locations in A.
The worst-case number of probes performed by an optimal algorithm is __________.
Answer (official key): 5
Worked solution: in your report after you take this paper.
Q64 · Compiler Design · Numerical · 2 marks
Consider the expression:
(a−1)×((3b+c)+d)
Let X be the minimum number of registers required by an optimal code generation algorithm, without any register spill, for a load/store architecture in which:
only load and store instructions can have memory operands, and
arithmetic instructions can have only register or immediate operands.
The value of X is __________.
Answer (official key): 2
Worked solution: in your report after you take this paper.
Q65 · Computer Organization and Architecture · Numerical · 2 marks
Consider a 2-way set associative cache with 256 blocks and LRU replacement. Initially the cache is empty.
Conflict misses are those misses which occur due to contention of multiple blocks for the same cache set. Compulsory misses occur due to first-time access to the block.
The following sequence of accesses to memory blocks: