GATE CSE
Consider the following three functions.
f1 = 10n, f2 = nlogn, f3 = n√n
Which one of the following options arranges the functions in the increasing order of asymptotic growth rate?
Consider the following array.
23 |
32 |
45 |
69 |
72 |
73 |
89 |
97 |
Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort above array in ascending order?
Consider the following recurrence relation.
$$T(n) = \left\{ {\begin{array}{*{20}{c}} {T(n/2) + T(2n/5) + 7n \ \ \ if\ n > 0}\\ {1\ \ \ \ \ \ \ if\ n = 0} \end{array}} \right.$$
Which one of the following option is correct?
Define Rn to be the maximum amount earned by cutting a rod of length n meters into one or more pieces of integer length and selling them. For i > 0, let p[i] denotes the selling price of a rod whose length is i meters. Consider the array of prices:
p[1] = 1, p[2] = 5, p[3] = 8, p[4] = 9, p[5] = 10, p[6] = 17, p[7] = 18
Which of the following statements is/are correct about R7?
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 option is correct?
Consider the following context-free grammar where the set of terminals is {a, b, c, d, f}.
S → d a T | R f
T → a S | b a T | ϵ
R → c a T R | ϵ
The following is a partially-filled LL(1) parsing table.
Which one of the following choices represents the correct combination for the numbered cells in the parsing table ("blank" denotes that the corresponding cell is empty)?
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:
P → D* E*
D → int ID {record that ID.lexeme is of type int}
D → bool ID { record that ID.lexeme is of type bool}
E → E1 + E2 {check that E1.type = E2.type = int; set E.type := int}
E → !E1 {check that E1.type = bool; set E.type := bool}
E → ID {set E.type := int}
With respect to the above grammar; which one of the following choices is correct?
Consider the following C code segment:
a = b + c;
e = a + 1;
d = b + c;
f = d + 1;
g = e + f;
In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of nodes of nodes in the DAG is ______
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 |
c8 |
c4 |
c2 |
c1 |
Y |
0 |
1 |
0 |
Which one of the following choices gives the correct values of x and y?
Consider two hosts P and Q connected through a router R. The maximum transfer unit (MTU) value of the link between P and R is 1500 bytes, and between R and Q is 820 bytes.
A TCP segment of size 1400 bytes was transferred from P to Q through R, with IP identification value as 0 × 1234. Assume that the IP header size is 20 bytes. Further, the packet is allowed to be fragmented i. e, Don't Fragment (DF) flag in the IP header is not set by P.
Which of the following statements is/are correct?
Consider the sliding window flow-control protocol operating between a sender and a receiver over a full-duplex error-free link. Assume the following:
1. The time taken for processing the data frame by the receiver is negligible.
2. The time taken for processing the acknowledgement frame by the sender is negligible.
3. The sender has infinite number of frames available for transmission.
4. The size of the data frame is 2,000 bits and the size of the acknowledgment frame is 10 bits.
5. The link data rate in each direction is 1 Mbps (= 106 bits per second).
6. One way propagation delay of the link is 100 milliseconds.
The minimum value of the sender's window size in terms of the number of frames, (rounded to the nearest integer) needed to achieve a link utilization of 50% is ______
A TCP server application is programmed to listen on port number P on host S. A TCP client connected to the TCP server over the network.
Consider that while the TCP connection was active, the server machine S crashed are rebooted. Assume that the client does not use the TCP keepalive timer.
Which of the following behaviours is/are possible?
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 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.
Consider the following instruction sequence where register R1, R2 and R3 are general purpose and MEMORY[X] denotes the content at the memory location X.
Instruction |
Semantics |
Instruction Size (bytes) |
MOV R1, (5000) |
R1 ← MEMORY[5000] |
4 |
MOV R2, (R3) |
R2 ← MEMORY[R3] |
4 |
ADD R2, R1 |
R2 ← R1 + R2 |
2 |
MOV (R3), R2 |
MEMORY[R3] ← R2 |
4 |
INC R3 |
R3 ← R3 + 1 |
2 |
DEC R1 |
R1 ← R1 – 1 |
2 |
BNZ 1004 |
Branch if not zero to the given absolute address |
2 |
HALT |
Stop |
1 |
Assume that the content of the memory location 5000 is 10, and the content of the register R3 is 3000. The content of each of the memory locations from 3000 to 3010 is 50. The instruction sequence starts from the memory location 1000. All the numbers are in decimal format. Assume that the memory is byte addressable.
After the execution of the program, the content of memory location 3010 is ______
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.
Consider the following undirected graph with edge weights as shown:
The number of minimum-weight spanning trees of the graph is ______
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.
enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q = dequeue();
The value of s + q is ______
Consider a dynamic hashing approach for 4-bit integer keys:
1. There is a main hash table of size 4.
2. The 2 least significant bits of a key is used to index into the main hash table.
3. Initially, the main hash table entries are empty.
4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a main hash table entry is organized as a binary tree that grows on demand.
5. First, the 3rd least significant bit is used to divide the keys into left and right subtrees.
6. to resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees based on 4th least significant bit.
7. A split is done only if it is needed, i. e. only when there is a collision.
Consider the following state of the hash table.
Which of the following sequence of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?
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?
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?
Consider a linear list based 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 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 ______
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) ρempNo 1, age1(empAge))
What does the above expression generate?
Consider the relation R(P, Q, S, T, X, Y, Z, W) with the following functional dependencies.
PQ → X; P → YX; Q → Y; Y → ZW
Consider the decomposition of the relation R into the constituent relations according to the following two decomposition schemes.
D1 : R = [(P, Q, S, T); (P, T, X); (Q, Y); (Y, Z, W)]
D2 : R = [(P, Q, S); (T, X); (Q, Y); (Y, Z, W)]
Which one of the following options is correct?
Let ri(z) and wi(z) denote read and write operations respectively on a data item z by a transaction Ti. Consider the following two schedules.
S1 : r1(x) r1(y) r2(x) r2(y) w2(y) w1(x)
S2 : r1(x) r2(x) r2(y) w2(y) r1(y) w1(x)
Which one of the following options is correct?
Consider the following Boolean expression.
$$F = (X + Y + Z)(\overline X + Y)(\overline Y + Z)$$
Which of the following Boolean expressions is/are equivalent to $$\overline F$$ (complement of F)?
Consider a 3-bit counter, designed using T flip-flop, as shown below:
Assuming the initial state of the counter given by PQR as 000, what are the next three states?
Consider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127.
S: 1 E: 10000001 F : 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 ______
Let p and q be two propositions. Consider the following two formulae in propositional logic.
S1 : (¬p ∧ (p ∨ q)) → q
S2 : q → (¬p ∧ (p ∨ q))
Which one of the following choices is correct?
There are 6 jobs with distinct difficulty levels, and 3 computers with distinct processing speeds. Each job is assigned to a computer such that:
- The fastest computer gets the toughest job and the slowest computer gets the easiest job.
- Every computer gets at least one job.
The number of ways in which this can be done is ______
Consider the two statements.
S1 : There exist random variables X and Y such that
(E[X - E(X)) (Y - E(Y))])2 > Var[X] Var[Y]
S2 : For all random variables X and Y,
Cov[X, Y] = E [|X - E[X]| |Y - E[Y]|]
Which one of the following choices is correct?
An articulation point in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components.
Let T be a DFS tree obtained by doing DFS in a connected undirected graph G. Which of the following option is/are correct?
A sender (S) transmits a signal, which can be one of the two kinds: H and L with probabilities 0.1 and 0.9 respectively, to a receiver (R).
In the graph below, the weight of edge (u, v) is the probability of receiving v when u is transmitted, where u, v ∈ {H, L}. For example, the probability that the received signal is L given the transmitted signal was H, is 0.7.
If the received signal is H, the probability that the transmitted signal was H (rounded to 2 decimal places) is ______
Consider the following expression
$$\mathop {\lim }\limits_{x \to -3} \frac{{\sqrt {2x + 22} - 4}}{{x + 3}}$$
The value of the above expression (rounded to 2 decimal places) is ______
Let G = (V, E) be an undirected unweighted connected graph. The diameter of G is defined as:
diam(G) = $$\displaystyle\max_{u, x\in V}$$ {the length of shortest path between u and v}
Let M be the adjacency matrix of G.
Define graph G2 on the same set of vertices with adjacency matrix N, where
$$N_{ij} =\left\{ {\begin{array}{*{20}{c}} {1 \ \ \text{if} \ \ {M_{ij}} > 0 \ \ \text{or} \ \ P_{ij} > 0, \ \text{where} \ \ P = {M^2}}\\ {0, \ \ \ \ \ \text{otherwise}} \end{array}} \right.$$
Which one of the following statements is true?
Consider the following matrix.
$$\left( {\begin{array}{*{20}{c}} 0&1&1&1\\ 1&0&1&1\\ 1&1&0&1\\ 1&1&1&0 \end{array}} \right)$$
The largest eigenvalue of the above matrix is ______
Consider the following pseudocode, where S is a semaphore intialized to 5 in line#2 an counter is a shared variable intialized to 0 in line#1. Assume that the increment operation in line#7 is not atomic.
1. int counter = 0;
2. Semaphore S = init(5);
3. void parop(void)
4. {
5. wait (S);
6. wait (S);
7. counter++;
8. signal (S);
9. signal (S);
10. }
If five threads execute the function parop concurrently, which of the following program behavior (s) is/are possible?
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?
Consider the following ANSI C function:
int SimpleFunction (int y[], int n, int x)
{
int total = y[0], loopIndex;
for (loopIndex = 1; loopIndex <= n - 1; loopIndex++)
total = x * total + y[loopIndex];
return total :
}
Let Z be an array of 10 elements with Z[i] = 1, for all i such that 0 ≤ i ≤ 9. The value returned by SimpleFunction (Z, 10, 2) is ______
For a Turing machine M, {M} denotes an encoding of M. Consider the following two languages.
L1 = {(M) | M takes more than 2021 steps on all inputs}
L2 = {(M) | M takes more than 2021 steps on some input}
Which one of the following options is correct?
In a pushdown automaton P = (Q, ∑, Γ, δ, q0, F), a transition of the form,
where p, q ∈ Q, a ∈ Σ ∪ {ϵ}, and X, Y ∈ Γ ∪ {ϵ}, represents
(q, Y) ∈ δ(p, a, X).
Consider the following pushdown automaton over the input alphabet ∑ = {a, b} and stack alphabet Γ = {#, A}.
The number of strings of length 100 accepted by the above pushdown automaton is ______
Consider the following language.
L = { w ∈ {0, 1}* | w ends with the substring 011}
Which one of the following deterministic finite automata accepts L?
General Aptitude
Statement :
I. All bacteria are microorganisms.
II. All pathogens are microorganisms.
Conclusions :
I. Some pathogens are bacteria.
II. All pathogens are not bacteria
Based on the above statements and conclusions, which one of the following options is logically CORRECT?
The probability that at least two chocolates are identical is ________.
A circular sheet of paper is folded along the lines in the directions shown. The paper, after being punched in the filial folded state as shown and unfolded in the reverse order of folding, will look like _________.
(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?
Which one of the following statements summarizes the passage?
Which one of the following options maintains a similar logical relation in the above sentence?
Which one of the following is NOT a convex polygon?
Items | Cost | Profit% | Marked price |
---|---|---|---|
P | 5400 | - | 5860 |
Q | - | 25 | 10000 |
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% = $${{Selling\,price - Cost} \over {Cost}} \times 100$$).
The discount on item Q, as a percentage of its marked price, is ________.
Among the options below, an acceptable value for the total number of students in the class is :