GATE 2026 Computer Science (CS1) Question Paper with Solutions
Welcome to our GATE 2026 Computer Science and Information Technology (CS1) question paper solution series. In this post, you will find all 65 questions from the GATE 2026 CS1 examination along with their answers and detailed explanations. This resource is designed to help students understand important concepts, practise exam-level questions and improve their preparation for the GATE Computer Science examination.
The GATE Computer Science examination covers several important subjects, including Programming and Data Structures, Algorithms, Operating Systems, Computer Networks, Database Management Systems, Computer Organization and Architecture, Theory of Computation, Compiler Design, Digital Logic and Engineering Mathematics. Practising questions from these subjects can help students strengthen their fundamentals and develop better problem-solving skills.
What You Will Get in This Post
- All 65 questions from the GATE 2026 CS1 question paper.
- Multiple Choice Questions (MCQs) with answer checking.
- Multiple Select Questions (MSQs) with correct options.
- Numerical Answer Type (NAT) questions with answer checking.
- Step-by-step explanations to understand the solutions.
- Interactive practice so you can attempt questions before viewing solutions.
Why Practise GATE 2026 Questions?
Solving the complete question paper is a useful way to test your knowledge and identify topics that need more attention. Instead of simply memorising answers, try to solve each question yourself first. After attempting it, check the correct answer and read the explanation carefully. This approach can help you understand concepts, improve accuracy and manage your time more effectively.
Start Your Practice
Whether you are preparing for GATE 2027 or revising for another Computer Science examination, these GATE 2026 CS1 questions can be useful for practice. Attempt the questions one by one, review your mistakes and keep revising the concepts regularly.
Best of Luck!
Keep practising, stay consistent and work towards your GATE preparation goals.
The antonym of the word protagonist is ________.
A protagonist is the main character or leading figure, while an antagonist opposes the protagonist. Therefore, “antagonist” is the correct antonym.
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?
Each available pattern contains 4 tiles. Therefore, any pattern constructed from these pieces must contain a total number of tiles divisible by 4.
Option C contains 15 tiles, and 15 is not divisible by 4. Hence, option C cannot be constructed using only the given 4-tile patterns.
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?
Initially, there are 64 players. Each game eliminates exactly one player. To declare one winner, 63 players must be eliminated.
Therefore,
Total games = 64 − 1
Answer = 63
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 ______
Maximum total credits = 70
Required core credits = 15
Required project credits = 20
Minimum specialization credits = 10
Maximum elective credits = 70 − 15 − 20 − 10 = 25.
Therefore, the correct option is (D) 25.
‘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?
The given statement says that if the teacher is in the room, all students stand silently.
This does not mean that if all students are standing, the teacher must be in the room. Students could be standing even when the teacher is absent.
Therefore, option (C) is not necessarily true.
Consider the following statements:
Based on the passage above, what can be inferred about statements P and Q?
Statement P is False: The passage says combinatorial counting is “sometimes” used in modeling physical phenomena, not that it is always used.
Statement Q is True: The passage explicitly states that some models assign probabilities to combinatorial possibilities to compute average physical quantities.
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?
max(a, b) = a, when a > b
max(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 _____.
H10(S) = max(S − 10, 0) and H20(S) = max(S − 20, 0).
For S ≤ 10, both terms are zero, so N(S) = 0. Between S = 10 and S = 20, the function rises as S − 10. For S ≥ 20, the difference is (S − 10) − (S − 20) = 10.
This matches the given graph. Therefore, N(S) = H10(S) − H20(S).
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?
Step 1: From observation (i), Vesely's best throw was not in the first or second round.
Step 2: From observation (ii), his sixth-round throw was a foul, so it cannot be his best throw.
Step 3: From observation (iii), Vesely could not improve his best throw in rounds five and six. Therefore, his best throw occurred by the end of round four.
Step 4: Observation (iv) says Jakub had the best throw in round four. Since Vesely was in second position after four rounds, Vesely's best throw must have occurred before round four.
Rounds one, two, four, five and six are eliminated. Hence, Vesely's best throw was in the third round (Option A).
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 __________.
Two dice rolls produce 6 × 6 = 36 equally likely ordered outcomes.
Count the valid second-roll values for each first-roll value:
First roll = 1: second roll can be 1, 2, 3, 4, 5, 6 → 6 outcomes.
First roll = 2: second roll can be 2, 4, 6 → 3 outcomes.
First roll = 3: second roll can be 3, 6 → 2 outcomes.
First roll = 4: second roll can be 4 → 1 outcome.
First roll = 5: second roll can be 5 → 1 outcome.
First roll = 6: second roll can be 6 → 1 outcome.
Total favourable outcomes = 6 + 3 + 2 + 1 + 1 + 1 = 14.
Probability = 14/36 = 7/18.
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
Initially, there is 1 red ball and 1 blue ball.
Step 1: After the first draw, either red or blue is added to the urn. The counts become either (2 red, 1 blue) or (1 red, 2 blue).
Step 2: To have equal numbers after two steps, the second draw must be the opposite color from the first draw.
If red was drawn first, the probability of drawing blue next is 1/3. If blue was drawn first, the probability of drawing red next is also 1/3.
Therefore, total probability = (1/2 × 1/3) + (1/2 × 1/3) = 1/3.
Consider 4 × 4 matrices with their elements from {0, 1}. The number of such matrices with even number of 1s in every row and every column is
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 0 | 0 | 0 | 0 |
A 4 × 4 binary matrix has 16 entries. Choose the entries in the first 3 rows and first 3 columns freely. There are 9 such entries, each with 2 possible values.
Therefore, the number of choices is \(2^9 = 512\).
The even-parity condition for each of the first 3 rows determines the last entry in that row. Similarly, the condition for each of the first 3 columns determines the last entry in that column. The bottom-right entry is then fixed, and its row and column parity conditions are automatically satisfied.
Hence, the total number of matrices is 512.
For n > 1, the maximum multiplicity of any eigenvalue of an n × n matrix with elements from ℝ is
The maximum possible algebraic multiplicity of an eigenvalue of an n × n matrix is n.
For example, consider the identity matrix multiplied by a constant: A = λIn.
Its characteristic polynomial is det(xI − A) = (x − λ)n.
Therefore, the eigenvalue λ has algebraic multiplicity n, which is the maximum possible. Hence, the answer is (A) n.
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:
P. Immediate → 4. Constant
Immediate addressing uses the value itself as a constant operand.
Q. Indirect → 2. Pointer
Indirect addressing uses a pointer or address to locate the operand.
R. Base with index → 1. Element of an array
An array element can be accessed using a base address and an index.
S. Base with offset/displacement → 3. Element of a record
A record field can be located using a base address and its fixed offset.
Therefore, the correct matching is P–4, Q–2, R–1, S–3 (Option B).
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 Z = X + Y?
Step 1: LOAD R0, X
Memory operand X ki value register R0 mein load hoti hai.
Step 2: LOAD R1, Y
Memory operand Y ki value register R1 mein load hoti hai.
Step 3: ADD R2, R0, R1
R0 aur R1 ki values add hoti hain aur result R2 mein store hota hai. Pehla operand destination hai.
Step 4: STORE Z, R2
Result ko register R2 se memory location Z mein store kiya jata hai.
Load-store architecture mein arithmetic operation registers par hota hai; memory operands ko pehle registers mein load karna padta hai. Isliye Option (D) sahi hai.
Which one of the following dependencies among the register operands of different instructions can cause a data hazard in a pipelined processor?
Correct Answer: (B) Read-after-write
Explanation: Read-after-write (RAW) hazard occurs when a later instruction tries to read a register before an earlier instruction has finished writing its result to that register.
Example:
I1: R1 = R2 + R3
I2: R4 = R1 + R5
Instruction I2 needs the new value of R1 produced by I1. If that value is not ready when I2 reads it, a data hazard occurs.
Consider the following recurrence relations:
T1(n) = 4T1(n/2) + T2(n)
T2(n) = 5T2(n/4) + Θ(log2 n)
Assume that for all n ≤ 1, T1(n) = 1 and
T2(n) = 1.
Which one of the following options is correct?
First, solve:
T2(n) = 5T2(n/4) + Θ(log n)
By the Master Theorem, T2(n) = Θ(nlog4 5).
Now substitute into the first recurrence:
T1(n) = 4T1(n/2) + Θ(nlog4 5)
Since log4 5 is less than 2, the additional term grows more slowly than n2.
Applying the Master Theorem again gives T1(n) = Θ(n2).
With respect to a TCP connection between a client and a server, which one of the following statements is true?
TCP supports simultaneous connection termination. Both the client and the server can independently initiate closing the connection at approximately the same time.
(A) is incorrect because TCP establishes a connection using a three-way handshake. (B) is incorrect because either side can initiate closing. (C) is incorrect because TCP is full-duplex, allowing data transmission in both directions.
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) True: HTTP/1.1 supports persistent TCP connections, allowing multiple objects from the same server to use one connection.
(B) False: Objects hosted on different servers do not generally share the same TCP connection.
(C) True: HTTP/1.1 supports pipelining, which allows multiple requests to be sent without waiting for each earlier response to finish.
(D) True: A persistent connection can be reused to request multiple webpages from the same server.
Let n > 1. Consider an n × n matrix M with its elements from ℝ. Let the vector (0, 1, 0, 0, …, 0) ∈ ℝⁿ be in the null space of M.
Which of the following options is/are always correct?
(B) A non-zero vector is in the null space, so M is singular and det(M) = 0.
(D) If v = (0, 1, 0, …, 0) is in the null space, then 2v is also in the null space. Both are non-zero vectors.
(A) Incorrect because the determinant is zero.
(C) Incorrect because the rank is not necessarily 1.
Consider the following Boolean expression of a function F:
Which of the following expressions is/are equivalent to F?
Given:
F(P,Q) = (P̅ + Q) ⊕ (P̅Q)
Using the Boolean identity:
(X + Y) ⊕ (XY) = X ⊕ Y
Put X = P̅ and Y = Q:
F = P̅ ⊕ Q
This is also equivalent to the complement of P ⊕ Q.
Therefore, options A and C are correct.
Consider the 8-bit signed integers X, Y and Z represented using the sign-magnitude form. The binary representations of X and Y are as follows:
Y : 01001100
Which of the following operations to compute Z result(s) in an arithmetic overflow?
Step 1: Convert X and Y into decimal.
X = 10110100 = −52 (sign bit 1 means negative).
Y = 01001100 = +76 (sign bit 0 means positive).
8-bit sign-magnitude range: −127 to +127.
(A) X + Y: −52 + 76 = 24. No overflow.
(B) X − Y: −52 − 76 = −128. Overflow.
(C) −X + Y: 52 + 76 = 128. Overflow.
(D) −X − Y: 52 − 76 = −24. No overflow.
Therefore, options B and C result in arithmetic overflow.
Let n be an odd number greater than 100. Consider a binary minheap with n elements stored in an array P whose index starts from 1.
Which of the following indices of P do/does NOT correspond to any leaf node of the minheap?
For a 1-indexed binary heap:
Internal nodes have indices from 1 to ⌊n/2⌋.
Leaf nodes have indices from ⌊n/2⌋ + 1 to n.
Since n is odd, let n = 2k + 1.
(A) (n + 1)/2 = k + 1 → Leaf node.
(B) (n − 1)/2 = k → Internal node, not a leaf.
(C) (n − 3)/2 = k − 1 → Internal node, not a leaf.
(D) n = last array index → Leaf node.
Therefore, options B and C do not correspond to leaf nodes.
Using the hash function h(x) = (x + 7) mod 11:
- 1 → 8
- 13 → 9
- 22 → 7
- 15 → 0
- 11 → 7 (collision), so linear probing places it at 10.
- 24 → 9 (collision), then 10, 0 are occupied, so it is placed at 1.
Occupied positions: 0, 1, 7, 8, 9, 10.
Empty positions: 2, 3, 4, 5, 6.
Therefore, among the given options, only position 2 is empty.Option (A) – True: The grammar is ambiguous because the same string can have two different derivations.
Option (B) – True: The string abb has two distinct derivations:
S → aSbS → abS → abbS → abb
Derivation 2:
S → aSbS → abSbS → abbS → abb
Thus, the same string abb can be generated in two different ways.
Option (C) – True: The string abab has only one rightmost derivation. Its rightmost derivation is:
→ aSbaSbS
→ aSbaSb
→ aSbab
→ abab
Option (D) – False: The grammar is context-free, and every context-free language is decidable.
Which of the following options CANNOT be the number of states in the minimal deterministic finite automaton (DFA) that is equivalent to M?
Given that the NFA has 6 states.
Using subset construction, the maximum number of states in the equivalent DFA is:
Therefore, the equivalent DFA can have at most 64 states. The minimal DFA cannot have more than 64 states either.
- (A) 32: Possible, because it is less than or equal to 64.
- (B) 65: Not possible, because it exceeds 64.
- (C) 1: Possible, because a DFA can have just one state.
- (D) 128: Not possible, because it exceeds 64.
Hence, the correct answers are (B) and (D).
char *str1 = "Hello; /* Statement S1 */ char *str2 = "Hello;"; /* Statement S2 */ int *str3 = "Hello"; /* Statement S3 */
Statement S1 – Lexical Error:
The string literal starts with a double quotation mark but does not
have a closing double quotation mark. Therefore, it has an
unterminated string literal (lexical error).
Statement S2 – Correct:
The string literal "Hello;" is properly enclosed
in double quotation marks. The semicolon is part of the string.
Statement S3 – Semantic Error:
The string literal is of character-array type, but the pointer
str3 is declared as int *.
These pointer types are incompatible, resulting in a semantic
constraint violation in C.
Hence, option (C) is correct.
(A) False: LL(1) parser is a predictive parser and does not use backtracking.
(B) False: An LL(1) grammar cannot be left-recursive. Left recursion must be eliminated.
(C) True: Left factoring helps make a grammar suitable for predictive parsing by removing common prefixes.
(D) False: SLR parsers are more powerful than LL(1) parsers in terms of the class of grammars they can handle.
Hence, option (C) is correct.
(A) False: Banker's algorithm is used for deadlock avoidance, not deadlock prevention.
(B) True: If the hold and wait condition is eliminated, deadlock can be prevented.
(C) False: An assignment edge in a resource allocation graph is directed from a resource to a process, not from a process to a resource.
(D) True: A safe state means there exists a safe sequence in which all processes can complete without deadlock.
Hence, the false statements are (A) and (C).
(A) False: From P → R and PQ → R, we cannot conclude that Q → R. The dependency P → R already determines R using P alone.
(B) False: PQ → R does not imply that either P → R or Q → R individually. Both attributes together may be needed to determine R.
(C) True: Given P → R and Q → S, by the union rule: PQ → RS.
(D) True: By the augmentation rule, if P → R, then adding Q to both sides gives PQ → RQ. By the decomposition rule, PQ → R.
Hence, options (C) and (D) are always true.
(A) True: The 3NF synthesis algorithm can always produce a dependency-preserving 3NF decomposition.
(B) True: A relation in 1NF can be retained as it is; therefore, a dependency-preserving 1NF decomposition is possible.
(C) True: BCNF decomposition is possible, but it is not always possible to preserve all functional dependencies.
(D) False: A dependency-preserving 2NF decomposition can be obtained by decomposing relations to remove partial dependencies while retaining the relevant dependencies.
Hence, options (A), (B) and (C) are true.
3, otherwise
(Answer in integer)
For continuity at x = 0:
limx→0⁺ f(x) = f(0) = 3
Therefore,
limx→0⁺ [c₁ex − c₂ ln(1/x)] = 3
As x → 0⁺:
- ex → 1
- ln(1/x) → ∞
For the limit to be finite, we must have:
c₂ = 0
Then:
c₁ × 1 = 3, so c₁ = 3
Hence,
c₁ + c₂ = 3 + 0 = 3
#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 minimum value of k for the system to be deadlock-free is _________. (answer in integer)
Y : 34A00000
| input P | current state Q₁ | current state Q₀ | next state Q₁⁺ | next state Q₀⁺ |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 |
Which one of the following options is true?
struct node{
int elt;
struct node *next;
};
int getListSize (struct node *head)
{
if( E1 ) return 1;
return E2;
}
Which one of the following elements can NEVER be the third element that is inserted?
Let s ∈ V be a vertex in G. For every u ∈ V and for every k ≥ 0, let dk(u) denote the weight of a shortest path (in terms of weight) from s to u of length at most k. If there is no path from s to u of length at most k, then dk(u) = ∞.
Consider the statements:
S2: For every (u, v) ∈ E, if (u, v) is part of a shortest path (in terms of weight) from s to v, then for every k ≥ 0, dk(u) ≤ dk(v).
Consider a relational database schema with two relations R(P, Q) and S(X, Y).
Which one of the following relational algebraic expressions is equivalent to E?
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?
Consider the implementation of sliding window protocol over a lossless link, with a window size of W frames, where each frame is of size 1000 bits (including header). The bandwidth of the link is 100 kbps (1k = 10³) 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 W (in number of frames) required to achieve 100% link utilization?
Let f : ℝ → ℝ be defined as follows:
Which of the following statements is/are true?
Let G(V, E) be a simple, undirected graph. A vertex cover of G is a subset V′ ⊆ V such that for every (u, v) ∈ E, u ∈ V′ or v ∈ V′. Let the size of the smallest vertex cover in G be k. Let S be any vertex cover of size k.
For a vertex v ∈ V, which of the following constraints will always ensure that v ∈ S?
Consider a Boolean function F with the following minterm expression:
Which of the following options is/are the minimal sum-of-products expression(s) of F?
Let G(V, E) be a simple, undirected, edge-weighted graph with unique edge weights.
Which of the following statements about the minimum spanning trees (MST) of G is/are true?
Consider the following pseudocode for depth-first search (DFS) algorithm which takes a directed graph G(V, E) as input, where d[v] and f[v] are the discovery time and finishing time, respectively, of the vertex v ∈ V.
unmark all v ∈ V
t ← 0
for each v ∈ V
if v is unmarked
t ← Explore(G,v,t)
end if
end for
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 t
Suppose that the input directed graph G(V, E) is a directed acyclic graph (DAG).
For an edge (u, v) ∈ E, which of the following options will NEVER be correct?
Let L1 and L2 be two languages over a finite alphabet, such that L1 ∩ L2 and L2 are regular languages.
Which of the following statements is/are always true?
Consider the following context-free grammar G.
A → aaBBAb | bB abaa
B → aBb | ab
In the above grammar, S is the start symbol, a and b are terminal symbols, and A and B are non-terminal symbols.
Let L(G) be the language generated by the grammar G. For a string s ∈ L(G), let n1(s) be the number of a's in s and n2(s) be the number of b's in s.
Which of the following statements is/are true?
Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations.
T → int
T → float
V → V1 id
V → id
V.type = T.type
T.type = int
T.type = float
V1.type = V.type
put(id.entry, V.type)
D → T id
T → int
T → float
put(id.entry, D1.type)
D.type = T.type
put(id.entry, T.type)
T.type = int
T.type = float
D is the start symbol, and int, float and id are the three terminals. The non-terminal V1 is the same as V and the non-terminal D1 is the same as D. 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?
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?
An undirected, unweighted, simple graph G(V, E) is said to be 2-colorable if there exists a function c: V → {0, 1} such that for every (u, v) ∈ E, c(u) ≠ c(v).
Which of the following statements about 2-colorable graphs is/are true?
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?
Let G be an undirected graph, which is a path on 8 vertices. The number of matchings in G is ______.
(Answer in integer)
Let X be a random variable which takes values in the set {1, 2, 3, 4, 5, 6, 7, 8}.
Further,
Pr(X = 3) = Pr(X = 4) = Pr(X = 6) = Pr(X = 8) = 1/12
The expected value of X, denoted by E[X], is equal to ___________.
(Rounded off to two decimal places)
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)
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 tEX denote the time taken by the EX stage to perform the operation for an instruction. For each instruction type, the values of tEX and M (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 | tEX (ns) | M |
|---|---|---|
| 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)
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.
The following sequence corresponds to the preorder traversal of a binary search tree T:
The position of the element 60 in the postorder traversal of T is ______. (answer in integer)
Note: The position begins with 1.
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 printf statement gets executed is ________. (answer in integer)
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 t = 10, 20, 30, 40, and 50 (in seconds). Similarly, a new process of type C arrives at time t = 11, 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 t = 10 seconds.
The average waiting time (in seconds) for the 10 processes is ___________. (rounded off to one decimal place)
Consider a relational database schema with a relation R(A, B, C, D). If {A, B} and {A, C} are the only two candidate keys of the relation R, then the number of superkeys of relation R is ______. (answer in integer)
.png)




0 Comments