GATE CSE 2026 Set 1 question paper with solutions
All 65 questions of the GATE 2026 Set 1 Computer Science and Information Technology paper, in order, with the official answer key from IIT Guwahati.
Download the solved paper (PDF, 2.3 MB)- questions · 100 marks
- 65questions · 100 marks
- official answer key
- IIT Guwahatiofficial answer key
- question types
- 28 MCQ · 24 MSQ · 13 NATquestion types
GATE CSE 2026 Set 1 answer key
| Question | Type | Marks | Answer |
|---|---|---|---|
| Q.1 | MCQ | 1 | B |
| Q.2 | MCQ | 1 | C |
| Q.3 | MCQ | 1 | C |
| Q.4 | MCQ | 1 | D |
| Q.5 | MCQ | 1 | C |
| Q.6 | MCQ | 2 | B |
| Q.7 | MCQ | 2 | D |
| Q.8 | MCQ | 2 | A |
| Q.9 | MCQ | 2 | A |
| Q.10 | MCQ | 2 | C |
| Q.11 | MCQ | 1 | B |
| Q.12 | MCQ | 1 | A |
| Q.13 | MCQ | 1 | A |
| Q.14 | MCQ | 1 | B |
| Q.15 | MCQ | 1 | D |
| Q.16 | MCQ | 1 | B |
| Q.17 | MCQ | 1 | A |
| Q.18 | MCQ | 1 | D |
| Q.19 | MSQ | 1 | A, C, D |
| Q.20 | MSQ | 1 | B, D |
| Q.21 | MSQ | 1 | A, C |
| Q.22 | MSQ | 1 | B, C |
| Q.23 | MSQ | 1 | B, C |
| Q.24 | MSQ | 1 | C |
| Q.25 | MSQ | 1 | A, B, C |
| Q.26 | MSQ | 1 | B, D |
| Q.27 | MSQ | 1 | C |
| Q.28 | MSQ | 1 | C |
| Q.29 | MSQ | 1 | A, C |
| Q.30 | MSQ | 1 | C, D |
| Q.31 | MSQ | 1 | A, B, C |
| Q.32 | NAT | 1 | 3 |
| Q.33 | NAT | 1 | 11 |
| Q.34 | NAT | 1 | 9 |
| Q.35 | NAT | 1 | 6 |
| Q.36 | MCQ | 2 | C |
| Q.37 | MCQ | 2 | B |
| Q.38 | MCQ | 2 | A |
| Q.39 | MCQ | 2 | B |
| Q.40 | MCQ | 2 | D |
| Q.41 | MCQ | 2 | A |
| Q.42 | MCQ | 2 | D |
| Q.43 | MCQ | 2 | B |
| Q.44 | MCQ | 2 | B |
| Q.45 | MCQ | 2 | B |
| Q.46 | MSQ | 2 | A, C, D |
| Q.47 | MSQ | 2 | A |
| Q.48 | MSQ | 2 | B, D |
| Q.49 | MSQ | 2 | A, D |
| Q.50 | MSQ | 2 | B, D |
| Q.51 | MSQ | 2 | C |
| Q.52 | MSQ | 2 | B, D |
| Q.53 | MSQ | 2 | A, B, D |
| Q.54 | MSQ | 2 | B, C |
| Q.55 | MSQ | 2 | B, C |
| Q.56 | MSQ | 2 | A, B, C |
| Q.57 | NAT | 2 | 34 |
| Q.58 | NAT | 2 | 4.24 to 4.26 |
| Q.59 | NAT | 2 | 77.3 |
| Q.60 | NAT | 2 | 95 |
| Q.61 | NAT | 2 | 65536 |
| Q.62 | NAT | 2 | 7 |
| Q.63 | NAT | 2 | 4 |
| Q.64 | NAT | 2 | 9.5 |
| Q.65 | NAT | 2 | 6 |
General Aptitude Q.1 to Q.10
- Q.1MCQ · 1 mark
The antonym of the word protagonist is ________.
- (A)
agnostic
- (B)
antagonist
- (C)
arsonist
- (D)
anarchist
Official answer: B
- (A)
- Q.2MCQ · 1 mark
The figure shows two 4-tile patterns.
Either one or both of the patterns can be used any number of times and in any orientation to construct a new pattern. Which one of the options below cannot be constructed by using only these two 4-tile patterns assuming there are no overlaps among them?
Tap to open full size- (A)
Figure: solid rectangle of black tiles, 2 rows by 4 columns (8 tiles)
- (B)
Figure: solid rectangle of black tiles, 3 rows by 4 columns (12 tiles)
- (C)
Figure: solid rectangle of black tiles, 3 rows by 5 columns (15 tiles)
- (D)
Figure: solid rectangle of black tiles, 4 rows by 5 columns (20 tiles)
Official answer: C
- (A)
- Q.3MCQ · 1 mark
Consider a knock-out women’s badminton singles tournament where there are no ties. The loser in each game is eliminated from the tournament. Every player plays until she is defeated or remains the last undefeated player. The last undefeated player is declared the winner of the tournament. If there are 64 players in the beginning of the tournament, how many games should be played in total to declare the winner of the tournament?
- (A)
127
- (B)
64
- (C)
63
- (D)
32
Official answer: C
- (A)
- Q.4MCQ · 1 mark
A student needs to enroll for a minimum of 60 credits. A student cannot enroll for more than 70 credits. The credits are divided amongst project and three distinct sets of courses namely, core courses, specialization courses, and elective courses. It is compulsory for a student to enroll for exactly 15 credits of core courses and exactly 20 credits of project. In addition, a student has to enroll for a minimum of 10 credits of specialization courses. The maximum credits of elective courses that a student can enroll for is ______
- (A)
10
- (B)
15
- (C)
20
- (D)
25
Official answer: D
- (A)
- Q.5MCQ · 1 mark
‘When the teacher is in the room, all students stand silently.’
If the above statement is true, which one of the following statements is not necessarily true?- (A)
If any student is not standing silently, then the teacher is not in the room.
- (B)
When the teacher is in the room, all students are silent.
- (C)
If all students are standing, then the teacher is in the room.
- (D)
When the teacher is in the room, all students are standing.
Official answer: C
- (A)
- Q.6MCQ · 2 marks
Combinatorics deals with problems involving counting. For example, “How many distinct arrangements of N distinct objects in M spaces on a circle are possible?” is a typical problem in combinatorics. This kind of counting is sometimes used in the modeling of several physical phenomena. Often, in such models, the different combinatorial possibilities are assigned probability values. Assigning probabilities enables the computation of the average values of physical quantities.
Consider the following statements:
P: Combinatorics is always invoked in the modeling of physical phenomena.
Q: Modeling some physical phenomena involves assigning probabilities to combinatorial possibilities in order to compute average values of physical quantities.
Based on the passage above, what can be inferred about statements P and Q?
- (A)
P is False and Q is False
- (B)
P is False and Q is True
- (C)
P is True and Q is False
- (D)
P is True and Q is True
Official answer: B
- (A)
- Q.7MCQ · 2 marks
In Panel I of the figure below, the front view and top view of a structure are shown. Which one of the 3D structures shown in Panel II possesses the views shown in Panel I?
Tap to open full size- (A)
(i)
- (B)
(ii)
- (C)
(iii)
- (D)
(iv)
Official answer: D
- (A)
- Q.8MCQ · 2 marks
For positive real numbers S and K, the function H_K(S) is defined as: H_K(S) = max(S − K, 0). The max function is defined as: max(a, b) = a, when a > b; b, when a ≤ b. The graph below shows the plot of a function N(S) versus S. N(S) can be expressed as ______.
Tap to open full size- (A)
H_10(S) − H_20(S)
- (B)
H_10(S) − 2H_20(S)
- (C)
−H_10(S) + H_20(S)
- (D)
H_15(S) − H_20(S)
Official answer: A
- (A)
- Q.9MCQ · 2 marks
In the 2020 summer Olympics’ Javelin throw finals, Neeraj Chopra exhibited a spectacular performance to win the gold medal. The silver medal was won by Jakub Vadlejch and the bronze medal was won by Vitezlav Vesely. There were six rounds of throws with each athlete having one throw per round. The best of all the throws of each athlete is considered for the medal. Following were the observations about the throws:
i. The first and second rounds were dominated by Neeraj Chopra with a gold medal performance in his second throw, while the other two athletes did not have any medal winning throws in these rounds.
ii. The throws in the last round by both Jakub Vadlejch and Vitezlav Vesely were fouls and were not considered for scoring.
iii. After four rounds, Vitezlav Vesely was in the second position and could not improve upon his best throw in the succeeding rounds.
iv. In the fourth round, the throw by Jakub Vadlejch was the best in that round.
In which round did Vitezlav Vesely have his best throw?
- (A)
Third
- (B)
Fourth
- (C)
Fifth
- (D)
Sixth
Official answer: A
- (A)
- Q.10MCQ · 2 marks
An unbiased six-faced dice whose faces are marked with numbers 1, 2, 3, 4, 5, and 6 is rolled twice in succession and the number on the top face is recorded each time. The probability that the number appearing in the second roll is an integer multiple of the number appearing in the first roll is __________
- (A)
- (B)
- (C)
- (D)
Official answer: C
- (A)
Computer Science and Information Technology Q.11 to Q.65
- Q.11MCQ · 1 mark
An urn contains one red ball and one blue ball. At each step, a ball is picked uniformly at random from the urn, and this ball together with another ball of the same color is put back in the urn. The probability that there are equal number of red and blue balls after two steps is
- (A)
1/4
- (B)
1/3
- (C)
1/2
- (D)
2/3
Official answer: B
- (A)
- Q.12MCQ · 1 mark
Consider matrices with their elements from . The number of such matrices with even number of s in every row and every column is
- (A)
512
- (B)
1025
- (C)
1023
- (D)
255
Official answer: A
- (A)
- Q.13MCQ · 1 mark
For , the maximum multiplicity of any eigenvalue of an matrix with elements from is
- (A)
- (B)
- (C)
- (D)
Official answer: A
- (A)
- Q.14MCQ · 1 mark
Match each addressing mode in List I with a data element or an element of a data structure (in a high-level language) in List II:
List I List II P. Immediate 1. Element of an array Q. Indirect 2. Pointer R. Base with index 3. Element of a record S. Base with offset/displacement 4. Constant
Tap to open full size- (A)
P–4, Q–3, R–1, S–2
- (B)
P–4, Q–2, R–1, S–3
- (C)
P–1, Q–4, R–3, S–2
- (D)
P–2, Q–3, R–1, S–4
Official answer: B
- (A)
- Q.15MCQ · 1 mark
Consider a processor P whose instruction set architecture is the load-store architecture. The instruction format is such that the first operand of any instruction is the destination operand.
Which one of the following sequences of instructions corresponds to the high-level language statement ?
Note: X, Y, and Z are memory operands. R0, R1, and R2 are registers.
- (A)
ADD Z, X, Y
- (B)
LOAD R0, X
ADD Z, R0, Y - (C)
ADD R0, X, Y
STORE Z, R0 - (D)
LOAD R0, X
LOAD R1, Y
ADD R2, R0, R1
STORE Z, R2
Official answer: D
- (A)
- Q.16MCQ · 1 mark
Which one of the following dependencies among the register operands of different instructions can cause a data hazard in a pipelined processor?
- (A)
Read-after-read
- (B)
Read-after-write
- (C)
Write-after-read
- (D)
Write-after-write
Official answer: B
- (A)
- Q.17MCQ · 1 mark
Consider the following recurrence relations:
For all ,
Assume that for all , and .
Which one of the following options is correct?
- (A)
- (B)
- (C)
- (D)
Official answer: A
- (A)
- Q.18MCQ · 1 mark
With respect to a TCP connection between a client and a server, which one of the following statements is true?
- (A)
The client and server use a two-way handshake mechanism before the start of data transmission
- (B)
The server cannot initiate closing of the connection before the client initiates closing of the connection
- (C)
The TCP connection is half-duplex
- (D)
The client and server can initiate closing of the connection at the same time
Official answer: D
- (A)
- Q.19MSQ · 1 mark
Which of the following statements is/are true with respect to the interaction of a web browser with a web server using HTTP 1.1?
- (A)
HTTP 1.1 facilitates downloading multiple objects of the same webpage over the same TCP connection, if the objects are stored in the same server
- (B)
HTTP 1.1 facilitates downloading multiple objects of the same webpage over the same TCP connection, even if they are stored in different servers
- (C)
HTTP 1.1 facilitates sending a request for downloading one object without waiting for a previously requested object to be downloaded completely
- (D)
HTTP 1.1 facilitates downloading multiple webpages on the same server to be downloaded over a single TCP connection
Official answer: A, C, D
- (A)
- Q.20MSQ · 1 mark
Let . Consider an matrix with its elements from . Let the vector be in the null space of .
Which of the following options is/are always correct?
- (A)
Determinant of is 1
- (B)
Determinant of is 0
- (C)
Rank of is 1
- (D)
There are at least two non-zero vectors in the null space of
Official answer: B, D
- (A)
- Q.21MSQ · 1 mark
Consider the following Boolean expression of a function :
Which of the following expressions is/are equivalent to ?
- (A)
- (B)
- (C)
- (D)
Official answer: A, C
- (A)
- Q.22MSQ · 1 mark
Consider the 8-bit signed integers , and represented using the sign-magnitude form. The binary representations of and are as follows:
: 10110100 : 01001100
Which of the following operations to compute result(s) in an arithmetic overflow?
- (A)
- (B)
- (C)
- (D)
Official answer: B, C
- (A)
- Q.23MSQ · 1 mark
Let be an odd number greater than 100. Consider a binary minheap with elements stored in an array whose index starts from 1.
Which of the following indices of do/does NOT correspond to any leaf node of the minheap?
- (A)
- (B)
- (C)
- (D)
Official answer: B, C
- (A)
- Q.24MSQ · 1 mark
Consider a hash table that is initially empty. The hash table is maintained using open addressing with linear probing. The hash function used is .
Consider the following sequence of insertions performed on :
Which of the following positions in the hash table is/are empty after these insertions are performed?
- (A)
0
- (B)
10
- (C)
2
- (D)
1
Official answer: C
- (A)
- Q.25MSQ · 1 mark
Consider the following grammar where is the start symbol, and and are terminal symbols.
Which of the following statements is/are true?
- (A)
The grammar is ambiguous
- (B)
The string has two distinct derivations in this grammar
- (C)
The string has only one rightmost derivation
- (D)
The language generated by the grammar is undecidable
Official answer: A, B, C
- (A)
- Q.26MSQ · 1 mark
Let be a nondeterministic finite automaton (NFA) with 6 states over a finite alphabet.
Which of the following options CANNOT be the number of states in the minimal deterministic finite automaton (DFA) that is equivalent to ?
- (A)
32
- (B)
65
- (C)
1
- (D)
128
Official answer: B, D
- (A)
- Q.27MSQ · 1 mark
Consider the following C statements:
char *str1 = "Hello; /* Statement S1 */ char *str2 = "Hello;"; /* Statement S2 */ int *str3 = "Hello"; /* Statement S3 */Which of the following options is/are correct?
- (A)
S1 and S2 have syntactic errors
- (B)
S2 has a lexical error and S3 has a syntactic error
- (C)
S1 has a lexical error and S3 has a semantic error
- (D)
S1 has a syntactic error and S3 has a semantic error
Official answer: C
- (A)
- Q.28MSQ · 1 mark
Which of the following statements is/are true?
- (A)
LL(1) parser uses backtracking
- (B)
For a grammar to be LL(1), it must be left-recursive
- (C)
For a grammar to be LL(1), it must be left-factored
- (D)
The LL(1) parsers are more powerful than the SLR parsers
Official answer: C
- (A)
- Q.29MSQ · 1 mark
With respect to deadlocks in an operating system, which of the following statements is/are FALSE?
- (A)
Banker's algorithm is used to prevent deadlocks
- (B)
Deadlock formation can be prevented by ensuring that the hold and wait condition is not allowed
- (C)
An assignment edge in a resource allocation graph is marked from a process to a resource
- (D)
A safe state guarantees that all processes can finish without formation of a deadlock
Official answer: A, C
- (A)
- Q.30MSQ · 1 mark
Let and be the attributes of a relation in a relational schema. Let indicate functional dependency in the context of a relational database, where .
Which of the following options is/are always true?
- (A)
If ( and ), then
- (B)
If , then ( or )
- (C)
If ( and ), then
- (D)
If , then
Official answer: C, D
- (A)
- Q.31MSQ · 1 mark
In the context of relational database normalization, which of the following statements is/are true?
- (A)
It is always possible to obtain a dependency-preserving 3NF decomposition of a relation
- (B)
It is always possible to obtain a dependency-preserving 1NF decomposition of a relation
- (C)
It is not always possible to obtain a dependency-preserving BCNF decomposition of a relation
- (D)
It is not always possible to obtain a dependency-preserving 2NF decomposition of a relation
Official answer: A, B, C
- (A)
- Q.32NAT · 1 mark
Consider the function defined as follows:
where .
If is continuous at , then ________. (answer in integer)
Official answer: 3
- Q.33NAT · 1 mark
The height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree. The maximum possible height of a full binary tree with 23 nodes is __________. (answer in integer)
Official answer: 11
- Q.34NAT · 1 mark
Consider the following program in C:
#include <stdio.h> void func(int i, int j) { if(i < j) { int i = 0; while (i < 10) { j += 2; i++; } } printf("%d", i); } int main() { int i = 9, j = 10; func(i, j); return 0; }The output of the program is _________. (answer in integer)
Note: Assume that the program compiles and runs successfully.
Official answer: 9
- Q.35NAT · 1 mark
Consider a system consisting of instances of a resource , being shared by 5 processes. Assume that each process requires a maximum of two instances of resource and a process can request or release only one instance at a time. Further, a process can request the second instance of the resource only after acquiring the first instance.
The minimum value of for the system to be deadlock-free is ________. (answer in integer)
Official answer: 6
- Q.36MCQ · 2 marks
Consider the real valued variables X, Y and Z represented using the IEEE 754 single-precision floating-point format. The binary representations of X and Y in hexadecimal notation are as follows:
X: 35C00000 Y: 34A00000
Let Z = X + Y.
Which one of the following is the binary representation of Z, in hexadecimal notation?
- (A)
35C80000
- (B)
35CC0000
- (C)
35E80000
- (D)
35EC0000
Official answer: C
- (A)
- Q.37MCQ · 2 marks
Consider a 2-bit saturating up/down counter that performs the saturating up count when the input P is 0, and the saturating down count when P is 1. The Next State table of the counter is as shown. The counter is built as a synchronous sequential circuit using D flip-flops. Which one of the following options corresponds to the expressions for the inputs of the D flip-flops, D1 and D0?
Tap to open full size- (A)
D1 = P Q1 + P̄ Q0 + Q1 Q0 ; D0 = P Q0 + P̄ Q1 + Q1 Q̄0
- (B)
D1 = P̄ Q1 + P̄ Q0 + Q1 Q0 ; D0 = P̄ Q̄0 + P̄ Q1 + Q1 Q̄0
- (C)
D1 = P̄ Q̄1 + P̄ Q0 + Q1 Q0 ; D0 = P̄ Q0 + P̄ Q1 + Q1 Q̄0
- (D)
D1 = P Q̄1 + P̄ Q0 + Q1 Q0 ; D0 = P Q̄0 + P̄ Q1 + Q1 Q̄0
Official answer: B
- (A)
- Q.38MCQ · 2 marks
The size of the physical address space of a processor is bytes. The capacity of a cache memory unit is bytes. The cache block size is 128 bytes. The cache memory unit can be built as a direct mapped cache or as a -way set-associative cache, where and . Let the length of the TAG field be bits for the direct mapped cache, and bits for the set-associative cache.
Which one of the following options is true?
- (A)
- (B)
- (C)
- (D)
Official answer: A
- (A)
- Q.39MCQ · 2 marks
Consider the following code snippet in C language that computes the number of nodes in a non-empty singly linked list pointed to by the pointer variable head.
struct node{ int elt; struct node *next; }; int getListSize (struct node *head) { if( E1 ) return 1; return E2; }Which one of the following options gives the correct replacements for the expressions E1 and E2?
- (A)
E1: head == NULL
E2: 1 + getListSize(head) - (B)
E1: head->next == NULL
E2: 1 + getListSize(head->next) - (C)
E1: head == NULL
E2: 1 + getListSize(head->next) - (D)
E1: head->next == NULL
E2: 1 + getListSize(head)
Official answer: B
- (A)
- Q.40MCQ · 2 marks
Let be the set of all integers from 1 to 15. Consider any order of insertion of the elements of into a binary search tree that creates a complete binary tree.
Which one of the following elements can NEVER be the third element that is inserted?
- (A)
4
- (B)
2
- (C)
10
- (D)
5
Official answer: D
- (A)
- Q.41MCQ · 2 marks
Let be an undirected, edge-weighted graph with integer weights. The weight of a path is the sum of the weights of the edges in that path. The length of a path is the number of edges in that path.
Let be a vertex in . For every and for every , let denote the weight of a shortest path (in terms of weight) from to of length at most . If there is no path from to of length at most , then .
Consider the statements:
S1: For every and , .
S2: For every , if is part of a shortest path (in terms of weight) from to , then for every , .
Which one of the following options is correct?
- (A)
Only S1 is true
- (B)
Only S2 is true
- (C)
Both S1 and S2 are true
- (D)
Neither S1 nor S2 is true
Official answer: A
- (A)
- Q.42MCQ · 2 marks
Consider the control flow graph shown in the figure.
Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B4 and B5?
Note: All the variables are integers.
Tap to open full size- (A)
B4: { b + i }; B5: { c + m }
- (B)
B4: { g * k }; B5: { c + m }
- (C)
B4: { g * k, b + i }; B5: { }
- (D)
B4: { g * k }; B5: { }
Official answer: D
- (A)
- Q.43MCQ · 2 marks
Consider a relational database schema with two relations and .
Let be a tuple relational calculus expression.
Which one of the following relational algebraic expressions is equivalent to ?
- (A)
- (B)
- (C)
- (D)
Official answer: B
- (A)
- Q.44MCQ · 2 marks
A TCP sender successfully establishes a connection with a TCP receiver and starts the transmission of segments. The TCP congestion control mechanism's slow-start threshold is set to 10000 segments. Assume that the round-trip time is fixed at 1 millisecond. Assume that the sender always has data to send, the segments are numbered from 1, and no segment is lost. Let t denote the time (in milliseconds) at which the transmission of segment number 2000 starts.
Which one of the following options is correct?
- (A)
9 \le t < 10
- (B)
10 \le t < 11
- (C)
11 \le t < 12
- (D)
12 \le t < 13
Official answer: B
- (A)
- Q.45MCQ · 2 marks
Consider the implementation of sliding window protocol over a lossless link, with a window size of frames, where each frame is of size 1000 bits (including header). The bandwidth of the link is 100 kbps (1k = ) and the one-way propagation delay is 100 milliseconds. Assume that processing times at the sender and receiver are zero and the transmission time of acknowledgements is also zero. Which one of the following options gives the minimum size of (in number of frames) required to achieve 100% link utilization?
- (A)
10
- (B)
21
- (C)
20
- (D)
11
Official answer: B
- (A)
- Q.46MSQ · 2 marks
Let be defined as follows:
Which of the following statements is/are true?- (A)
has a local maximum
- (B)
has a local minimum
- (C)
is continuous over
- (D)
is not differentiable over
Official answer: A, C, D
- (A)
- Q.47MSQ · 2 marks
Let be a simple, undirected graph. A vertex cover of is a subset such that for every , or . Let the size of the smallest vertex cover in be . Let be any vertex cover of size .
For a vertex , which of the following constraints will always ensure that ?
- (A)
The degree of is at least
- (B)
The vertex is on a path of length
- (C)
The vertex is on a cycle of length
- (D)
The vertex is a part of a clique of size
Official answer: A
- (A)
- Q.48MSQ · 2 marks
Consider a Boolean function with the following minterm expression: . Which of the following options is/are the minimal sum-of-products expression(s) of ?
- (A)
- (B)
- (C)
- (D)
Official answer: B, D
- (A)
- Q.49MSQ · 2 marks
Let be a simple, undirected, edge-weighted graph with unique edge weights.
Which of the following statements about the minimum spanning trees (MST) of is/are true?
- (A)
In every cycle of , the edge with the largest weight in is not in any MST
- (B)
In every cycle of , the edge with the smallest weight in is in every MST
- (C)
For every vertex , the edge with the largest weight incident on is not in any MST
- (D)
For every vertex , the edge with the smallest weight incident on is in every MST
Official answer: A, D
- (A)
- Q.50MSQ · 2 marks
Consider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graph as input, where and are the discovery time and finishing time, respectively, of the vertex .
DFS(G): unmark all v ∈ V t ← 0 for each v ∈ V if v is unmarked t ← Explore(G, v, t) end if end forExplore(G, v, t): mark v t ← t + 1 d[v] ← t for each (v, w) ∈ E if w is unmarked t ← Explore(G, w, t) end if end for t ← t + 1 f[v] ← t return tSuppose that the input directed graph is a directed acyclic graph (DAG).
For an edge , which of the following options will NEVER be correct?
Tap to open full size- (A)
- (B)
- (C)
- (D)
Official answer: B, D
- (A)
- Q.51MSQ · 2 marks
Let and be two languages over a finite alphabet, such that and are regular languages.
Which of the following statements is/are always true?
- (A)
is regular
- (B)
is regular
- (C)
is context-free
- (D)
is context-free
Official answer: C
- (A)
- Q.52MSQ · 2 marks
Consider the following context-free grammar .
In the above grammar, is the start symbol, and are terminal symbols, and and are non-terminal symbols.
Let be the language generated by the grammar . For a string , let be the number of 's in and be the number of 's in .
Which of the following statements is/are true?
- (A)
There is a string such that
- (B)
For every string ,
- (C)
There is a string such that
- (D)
For every string ,
Official answer: B, D
- (A)
- Q.53MSQ · 2 marks
Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations.
SDD1, grammar G1 and semantic rules:
- : ;
- :
- :
- : ;
- :SDD2, grammar G2 and semantic rules:
- : ;
- : ;
- :
- :is the start symbol, and int, float and id are the three terminals. The non-terminal is the same as and the non-terminal is the same as . Here, the subscript is used to differentiate the grammar symbols on the two sides of a production. The function put updates the symbol table with the type information for an identifier.
Let P and Q be the languages specified by grammars G1 and G2, respectively.
Which of the following statements is/are true?
Tap to open full size- (A)
The languages P and Q are the same
- (B)
SDD2 is S-attributed and contains only synthesized attributes
- (C)
SDD1 is L-attributed and contains only inherited attributes
- (D)
The specifications of SDD1 and SDD2 are such that the same entries get added to the symbol table
Official answer: A, B, D
- (A)
- Q.54MSQ · 2 marks
Consider a system that has a cache memory unit and a memory management unit (MMU). The address input to the cache memory is a physical address. The MMU has a translation lookaside buffer (TLB). Assume that when a page is evicted from the main memory, the corresponding blocks in the cache are marked as invalid.
For a given memory reference, which of the following sequences of events can NEVER happen?
- (A)
TLB miss, Page table hit, Cache hit
- (B)
TLB hit, Page table miss, Cache hit
- (C)
TLB miss, Page table miss, Cache hit
- (D)
TLB miss, Page table miss, Cache miss
Official answer: B, C
- (A)
- Q.55MSQ · 2 marks
An undirected, unweighted, simple graph is said to be 2-colorable if there exists a function such that for every , .
Which of the following statements about 2-colorable graphs is/are true?
- (A)
If is 2-colorable, then may contain cycles of odd length
- (B)
If is 2-colorable, then may contain cycles of even length
- (C)
An optimal algorithm for testing whether is 2-colorable runs in time , if is represented as an adjacency list
- (D)
An optimal algorithm for testing whether is 2-colorable runs in time , if is represented as an adjacency list
Official answer: B, C
- (A)
- Q.56MSQ · 2 marks
An ISP having an address block 202.16.0.0/15 assigns a block of 6000 IP addresses to a client, using the classless internet domain routing (CIDR) super-netting approach. Which of the following address blocks can be assigned by the ISP?
- (A)
202.16.0.0/19
- (B)
202.17.64.0/19
- (C)
202.16.32.0/19
- (D)
202.17.24.0/19
Official answer: A, B, C
- (A)
- Q.57NAT · 2 marks
Let be an undirected graph, which is a path on 8 vertices. The number of matchings in is ______. (answer in integer)
Official answer: 34
- Q.58NAT · 2 marks
Let be a random variable which takes values in the set . Further, and . The expected value of , denoted by , is equal to ___________. (rounded off to two decimal places)
Official answer: 4.24 to 4.26
- Q.59NAT · 2 marks
Consider a hard disk with a rotational speed of 15000 rpm. The time to move the read/write head from a track to its adjacent track is 1 millisecond. Initially, the head is on track 0. The number of sectors per track is 400. The sector size is 1024 bytes. It is necessary to transfer data from 10 randomly located sectors in each of the following tracks in the order: 5, 12 and 7.
The total time for the data transfer (in milliseconds) from the hard disk is _________. (rounded off to one decimal place)
Official answer: 77.3
- Q.60NAT · 2 marks
The EX stage of a pipelined processor performs the memory read operations for LOAD instructions, and the operations for the arithmetic and logic instructions. Let denote the time taken by the EX stage to perform the operation for an instruction. For each instruction type, the values of and (the number of instructions of that type in a sequence of 100 instructions for a program P), are given in the table below.
The duration of the pipeline clock cycle is 1 nanosecond. Assume that the latch time for the interstage buffers in the pipeline is negligible.
Instruction in nanoseconds LOAD 1.8 15 IMUL 1.5 10 IDIV 2.5 5 FADD 1.7 10 FSUB 1.7 5 FMUL 2.8 15 FDIV 3.2 5 All other instructions Less than 1.0 35 When program P is executed, the number of clock cycles for which the pipeline is stalled due to structural hazards in the EX stage is ______. (answer in integer)
Tap to open full sizeOfficial answer: 95
- Q.61NAT · 2 marks
Consider the recursive functions represented by the following code segment:
int bar(int n){ if (n == 1) return 0; else return 1 + bar(n/2); } int foo(int n){ if (n == 1) return 1; else return 1 + foo(bar(n)); }The smallest positive integer n for which foo(n) returns 5 is ______. (answer in integer)
Note: Ignore syntax errors (if any) in the function.
Official answer: 65536
- Q.62NAT · 2 marks
The following sequence corresponds to the preorder traversal of a binary search tree :
The position of the element 60 in the postorder traversal of is ______. (answer in integer)
Note: The position begins with 1.
Official answer: 7
- Q.63NAT · 2 marks
Consider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that the
fork()system call is always successful in creating a process.int main () { int i; for (i = 0; i < 3; i++){ if (fork() == 0){ continue; } break; } printf("Hello!"); return 0; }The total number of times that the
printfstatement gets executed is ________. (answer in integer)Official answer: 4
- Q.64NAT · 2 marks
Consider a CPU that has to execute two types of processes. The first type, Actuators (A), requires a CPU burst of 6 seconds. The second type, Controllers (C), requires a CPU burst of 8 seconds. A new process of type A arrives at time , 20, 30, 40, and 50 (in seconds). Similarly, a new process of type C arrives at time , 22, 33, 44, and 55 (in seconds). The CPU scheduling policy is First Come First Serve (FCFS). The first process of type A starts running at seconds. The average waiting time (in seconds) for the 10 processes is ________. (rounded off to one decimal place)
Official answer: 9.5
- Q.65NAT · 2 marks
Consider a relational database schema with a relation . If and are the only two candidate keys of the relation , then the number of superkeys of relation is ______. (answer in integer)
Official answer: 6