Free course English + हिंदी
GATE Computer Science and IT (CS) courseThe official syllabus, line by line, with the chapters that teach it
Pick any line of the GATE Computer Science and IT (CS) syllabus and open the chapters under it. Each chapter starts from the basics and climbs to exam level, with practice questions at the end.
How complete is this course?
✓ Ready to studyWhat GATE Computer Science and IT (CS) asks most
777 questions · 2019–2026From 777 past GATE Computer Science and IT (CS) questions. Start where the bars are longest.
Computer Science and IT 72%Aptitude (CSAT) 11%Engineering Mathematics 8%Electronics and Communication Engineering 5%English 4%
GATE Computer Science and IT (CS) study plan
32 modules · 137 chapter · ~31 hGo subject by subject, top to bottom: foundations first, current-affairs-heavy topics last. Tap a subject to see its modules.
Engineering Mathematics2 modules3 ch33 min62 PYQ
01Algebra and calculus for engineers2 ch · 23 min38 PYQ
- Linear algebra: matrices, equations and eigenvalues 12′
- Calculus: limits, derivatives, integrals and series 11′
See the 38 questions GATE Computer Science and IT (CS) asked from this module
For , the maximum multiplicity of any eigenvalue of an matrix with elements from is
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
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
Show answer
()
For a real number , let . Which of the following statements is/are true?
- (a) The value of is independent of the value of
- (b) The value of can vary with the value of
- (c) There exists such that is a positive real number
- (d) There exists such that is a negative real number
Show answer
()
Consider the system of linear equations given below.
Suppose the values of a and b are chosen such that the system of linear equations produce multiple solutions. Then the product of a and b is __________. (answer in integer)Consider the function defined as follows:
where .
If is continuous at , then = _________. (*answer in integer*)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
Show answer
()
The determinant of a matrix A is 3. The value of the determinant of 2A is ____________. (answer in integer)
Consider a function defined as follows.
For a real number , if the second digit after the decimal point in is one of the four digits 2, 3, 6 and 7. Otherwise, is equal to 0.
The number of points in (0,1) at which is discontinuous is ___________. (answer in integer)If , then which ONE of the following is ?
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
The value of such that , satisfying the equation is
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Let , , and be non-singular matrices of order 3 satisfying the equations
, and .
Which ONE of the following is the value of the determinant of ?- (a) 0
- (b) 1
- (c) 2
- (d) 3
Show answer
(a) 0
Consider the given system of linear equations for variables and , where is a real-valued constant. Which of the following option(s) is/are CORRECT?
- (a) There is exactly one value of for which the above system of equations has no solution.
- (b) There exist an infinite number of values of for which the system of equations has no solution.
- (c) There exists exactly one value of for which the system of equations has exactly one solution.
- (d) There exists exactly one value of for which the system of equations has an infinite number of solutions.
Show answer
()
Consider the given function .
If the function is differentiable everywhere, the value of must be ________. (rounded off to one decimal place)Let be a matrix as given.
What are the eigenvalues of the matrix ?- (a)
- (b)
- (c)
- (d)
Show answer
(d)
Consider a system of linear equations where and . Suppose has an LU decomposition, , where
Which of the following statement(s) is/are TRUE?- (a) The system can be solved by first solving and then .
- (b) If is invertible, then both and are invertible.
- (c) If is singular, then at least one of the diagonal elements of is zero.
- (d) If is symmetric, then both and are symmetric.
Show answer
()
Let be a function such that , , where is the set of all real numbers. The set of all points where is NOT differentiable is
- (a)
- (b)
- (c)
- (d)
Show answer
(d)
The product of all eigenvalues of the matrix is
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Let be a continuous function from to such that
Which one of the following options is the CORRECT value of ?- (a) 0
- (b) 1
- (c) 2
- (d)
Show answer
(b) 1
Let be an matrix over the set of all real numbers . Let be a matrix obtained from by swapping two rows. Which of the following statements is/are TRUE?
- (a) The determinant of is the negative of the determinant of
- (b) If is invertible, then is also invertible
- (c) If is symmetric, then is also symmetric
- (d) If the trace of is zero, then the trace of is also zero
Show answer
()
Let be any matrix, where . Which of the following statements is/are TRUE about the system of linear equations ?
- (a) There exist at least linearly independent solutions to this system
- (b) There exist linearly independent vectors such that every solution is a linear combination of these vectors
- (c) There exists a non-zero solution in which at least variables are 0
- (d) There exists a solution in which at least variables are non-zero
Show answer
(a) There exist at least linearly independent solutions to this system
Let
and
Let and denote the determinants of the matrices and , respectively.
Which one of the options given below is TRUE?- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Let
be a real-valued function.
Which of the following statements is/are TRUE?- (a) does not have a local maximum.
- (b) has a local maximum.
- (c) does not have a local minimum.
- (d) has a local minimum.
Show answer
()
Let be the adjacency matrix of the graph with vertices .
The graph has edges 1–2, 2–3, 2–4, 3–5, 4–5, a self-loop at vertex 3 and a self-loop at vertex 4.
Let and be the five eigenvalues of . Note that these eigenvalues need not be distinct.
The value of ____________.The value of the definite integral
is ____________ . (Rounded off to the nearest integer)Consider the following two statements with respect to the matrices , , and .
Statement 1:
Statement 2:
where represents the trace of a matrix. Which one of the following holds?- (a) Statement 1 is correct and Statement 2 is wrong.
- (b) Statement 1 is wrong and Statement 2 is correct.
- (c) Both Statement 1 and Statement 2 are correct.
- (d) Both Statement 1 and Statement 2 are wrong.
Show answer
(c) Both Statement 1 and Statement 2 are correct.
The value of the following limit is _____________.
Consider solving the following system of simultaneous equations using LU decomposition.
where and are denoted as
Which one of the following is the correct combination of values for , , and ?- (a) , ,
- (b) , ,
- (c) , ,
- (d) , ,
Show answer
(d) , ,
Which of the following is/are the eigenvector(s) for the matrix given below?
- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider the following expression.
The value of the above expression (rounded to 2 decimal places) is ______.Suppose that is a matrix such that every solution of the equation is a scalar multiple of . The rank of is __________.
Suppose that is a continuous function on the interval and a differentiable function in the interval such that for every in the interval, . If , then is at most __________.
For two -dimensional real vectors and , the operation is defined as follows:
Let be a set of 10-dimensional non-zero real vectors such that for every pair of distinct vectors , . What is the maximum cardinality possible for the set ?- (a) 9
- (b) 10
- (c) 11
- (d) 100
Show answer
(b) 10
Consider the following matrix.
The largest eigenvalue of the above matrix is ______.Consider the functions
I.
II.
III.
Which of the above functions is/are increasing everywhere in ?- (a) III only
- (b) II only
- (c) II and III only
- (d) I and III only
Show answer
(a) III only
Let and be two matrices over real numbers. Let and denote the rank and determinant of a matrix , respectively. Consider the following statements.
I.
II.
III.
IV.
Which of the above statements are TRUE?- (a) I and II only
- (b) I and IV only
- (c) II and III only
- (d) III and IV only
Show answer
(c) II and III only
Let be a square matrix. Consider the following two statements on .
I. is invertible.
II. Determinant of is non-zero.
Which one of the following is TRUE?- (a) I implies II; II does not imply I.
- (b) II implies I; I does not imply II.
- (c) I does not imply II; II does not imply I.
- (d) I and II are equivalent statements.
Show answer
(d) I and II are equivalent statements.
Compute
- (a) 1
- (b) 53/12
- (c) 108/7
- (d) Limit does not exist
Show answer
(c) 108/7
Consider the following matrix:
The absolute value of the product of Eigen values of is ________.
02Equations, probability and numerical methods1 ch · 10 min24 PYQ
See the 24 questions GATE Computer Science and IT (CS) asked from this module
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
Show answer
(b) 1/3
The probability density function of a random variable which takes real values is
Which one of the following statements is correct about the random variable ?- (a) is an exponential random variable
- (b) is a normal random variable
- (c) is a Poisson random variable
- (d) is a uniform random variable
Show answer
(b) is a normal random variable
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*)Suppose an unbiased coin is tossed 6 times. Each coin toss is independent of all previous coin tosses. Let be the event that among the second, fourth, and sixth coin tosses, there are at least two heads. Let be the event that among the first, second, third, and fifth coin tosses, there are equal number of heads and tails.
The conditional probability is equal to ____________. (rounded off to one decimal place)A box contains 5 coins: 4 regular coins and 1 fake coin. When a regular coin is tossed, the probability and for a fake coin, . You pick a coin at random and toss it twice, and get two heads. The probability that the coin you have chosen is the fake coin is _______. (rounded off to two decimal places)
Suppose a 5-bit message is transmitted from a source to a destination through a noisy channel. The probability that a bit of the message gets flipped during transmission is 0.01. Flipping of each bit is independent of one another. The probability that the message is delivered error-free to the destination is ______ . (rounded off to three decimal places)
Consider a probability distribution given by the density function .
The probability that lies between 2 and 3, i.e., is __________. (rounded off to three decimal places)A quadratic polynomial over complex numbers is said to be square invariant if . Suppose from the set of all square invariant quadratic polynomials we choose one at random.
The probability that the roots of the chosen polynomial are equal is __________. (rounded off to one decimal place)The unit interval is divided at a point chosen uniformly distributed over in into two disjoint subintervals.
The expected length of the subinterval that contains 0.4 is ___________. (rounded off to two decimal places)Consider a permutation sampled uniformly at random from the set of all permutations of for some . Let be the event that 1 occurs before 2 in the permutation, and the event that 3 occurs before 4. Which one of the following statements is TRUE?
- (a) The events and are mutually exclusive
- (b) The events and are independent
- (c) Either event or must occur
- (d) Event is more likely than event
Show answer
(b) The events and are independent
When six unbiased dice are rolled simultaneously, the probability of getting all distinct numbers (i.e., 1, 2, 3, 4, 5, and 6) is
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Let and be two events in a probability space with , , and . Which of the following statements is/are TRUE?
- (a) The two events and are independent
- (b)
- (c) , where is the complement of the event
- (d) , where and are the complements of the events and , respectively
Show answer
()
Let and be random variables, not necessarily independent, that take real values in the interval . Let and let the mean values of be , respectively. Which one of the following statements is TRUE?
- (a)
- (b)
- (c)
- (d)
Show answer
(d)
A bag contains 10 red balls and 15 blue balls. Two balls are drawn randomly without replacement. Given that the first ball drawn is red, the probability (*rounded off to 3 decimal places*) that both balls drawn are red is _________
Consider a random experiment where two fair coins are tossed. Let be the event that denotes HEAD on both the throws, be the event that denotes HEAD on the first throw, and be the event that denotes HEAD on the second throw.
Which of the following statements is/are TRUE?- (a) and are independent.
- (b) and are independent.
- (c) and are independent.
- (d)
Show answer
()
The lifetime of a component of a certain type is a random variable whose probability density function is exponentially distributed with parameter 2. For a randomly picked component of this type, the probability that its lifetime exceeds the expected lifetime (rounded to 2 decimal places) is ______.
For a given biased coin, the probability that the outcome of a toss is a head is 0.4. This coin is tossed 1,000 times. Let X denote the random variable whose value is the number of times that head appeared in these 1,000 tosses. The standard deviation of X (rounded to 2 decimal places) is __________.
In an examination, a student can choose the order in which two questions (QuesA and QuesB) must be attempted. - If the first question is answered wrong, the student gets zero marks. - If the first question is answered correctly and the second question is not answered correctly, the student gets the marks only for the first question. - If both the questions are answered correctly, the student gets the sum of the marks of the two questions. The following table shows the probability of correctly answering a question and the marks of the question respectively. | question | probability of answering correctly | marks | |---|---|---| | QuesA | 0.8 | 10 | | QuesB | 0.5 | 20 | Assuming that the student always wants to maximize her expected marks in the examination, in which order should she attempt the questions and what is the expected marks for that order (assume that the questions are independent)?
- (a) First QuesA and then QuesB. Expected marks 14.
- (b) First QuesB and then QuesA. Expected marks 14.
- (c) First QuesB and then QuesA. Expected marks 22.
- (d) First QuesA and then QuesB. Expected marks 16.
Show answer
(d) First QuesA and then QuesB. Expected marks 16.
Consider the two statements.
: There exist random variables and such that
: For all random variables and ,
Which one of the following choices is correct?- (a) Both and are true.
- (b) is true, but is false.
- (c) is false, but is true.
- (d) Both and are false.
Show answer
(d) Both and are false.
A sender (S) transmits a signal, which can be one of the two kinds: and with probabilities 0.1 and 0.9 respectively, to a receiver (R).
In the graph below, the weight of edge is the probability of receiving when is transmitted, where . For example, the probability that the received signal is given the transmitted signal was , is 0.7.
[Edges from S to R: weight 0.3, weight 0.7, weight 0.8, weight 0.2.]
If the received signal is , the probability that the transmitted signal was (rounded to 2 decimal places) is ______.For , let be a non-zero vector. Suppose that is chosen uniformly at random from . Then, the probability that is an odd number is \_\_\_\_\_\_\_.
Two numbers are chosen independently and uniformly at random from the set . The probability (rounded off to 3 decimal places) that their 4-bit (unsigned) binary representations have the same most significant bit is ________.
Let be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves and of are chosen uniformly and independently at random. The expected value of the distance between and in (i.e., the number of edges in the unique path between and ) is (rounded off to 2 decimal places) ___________.
Suppose is distributed uniformly in the open interval (1,6). The probability that the polynomial has only real roots is (rounded off to 1 decimal place) ________.
Electronics and Communication Engineering1 module4 ch50 min36 PYQ
03Digital circuits4 ch · 50 min36 PYQ
- Number systems, Boolean algebra and K-maps 13′
- Logic gates, CMOS logic and combinational circuits 12′
- Latches, flip-flops, counters and state machines 13′
- Data converters and semiconductor memories 12′
See the 36 questions GATE Computer Science and IT (CS) asked from this module
Which one of the following options is not a property of Boolean Algebra? Note: + is OR operation, . is AND operation, and ′ is NOT operation
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Consider the following Boolean expression of a function F :
Which of the following expressions is/are equivalent to F ?- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider a 2-bit saturating up/down counter that performs the saturating up count when the input is 0, and the saturating down count when 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.
| Input | Current State | Current State | Next State | Next State |
|---|---|---|---|---|
| 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 corresponds to the expressions for the inputs of the D flip-flops, and ?- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Consider the following 4-variable Boolean function
Consider as MSB, as LSB. Which one of the following options represents the minimal sum of products form for the above function?
Note: + is OR operation, . is AND operation, ′ is NOT operation- (a)
- (b)
- (c)
- (d)
Show answer
(b)
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)
Show answer
()
Consider the digital circuit shown below with two input lines A and B, two select lines S0 and S1, and an output line Y. The blocks Q and M represent active high 2:4 decoder and 4-to-1 multiplexer, respectively. Out of 16 possible input combinations, the number of combinations that produce Y=1 is ____________. (answer in integer) Note: One input combination is an instance of [A B S1 S0]. Circuit: A and B are the inputs of decoder Q, whose outputs are D0, D1, D2, D3. Multiplexer M (select lines S1, S0) has input 0 connected to D0, input 1 connected to constant 0, input 2 connected to constant 1 and input 3 connected to D3; its output is Y.
Let be a 3-variable Boolean function that produces output as ‘1’ when at least two of the input variables are ‘1’. Which of the following statement(s) is/are CORRECT, where are Boolean variables?
- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider the following logic circuit diagram.
Which is/are the CORRECT option(s) for the output function ?- (a)
- (b)
- (c)
- (d)
Show answer
()
In a 4-bit ripple counter, if the period of the waveform at the last flip-flop is 64 microseconds, then the frequency of the ripple counter in kHz is ________. (Answer in integer)
Consider the following four variable Boolean function in sum-of-product form
where the value of the function is computed by considering as a 4-bit binary number, where denotes the most significant bit and denotes the least significant bit. Note that there are no don’t care terms. Which ONE of the following options is the CORRECT minimized Boolean expression for ?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Given the following Karnaugh Map for a Boolean function :
| \ | | | | |
|---|---|---|---|---|
| | 1 | 0 | 0 | 1 |
| | 0 | 1 | 1 | 0 |
| | 0 | 1 | 1 | 0 |
| | 1 | 0 | 0 | 1 |
Which one or more of the following Boolean expression(s) represent(s) ?- (a)
- (b)
- (c)
- (d)
Show answer
()
Which of the following Boolean algebraic equation(s) is/are CORRECT?
- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider a finite state machine (FSM) with one input and one output , represented by the given state transition table. The minimum number of states required to realize this FSM is ________. (Answer in integer)
| Present state | Next state | Next state | Output | Output |
|---|---|---|---|---|
| A | F | B | 0 | 0 |
| B | D | C | 0 | 0 |
| C | F | E | 0 | 0 |
| D | G | A | 1 | 0 |
| E | D | C | 0 | 0 |
| F | F | B | 1 | 1 |
| G | G | H | 0 | 1 |
| H | G | A | 1 | 0 |Consider the given sequential circuit designed using D-Flip-flops. The circuit is initialized with some value (initial state). The number of distinct states the circuit will go through before returning back to the initial state is _________ . (Answer in integer)
Consider the circuit shown below where the gates may have propagation delays. Assume that all signal transitions occur instantaneously and that wires have no delays. Which of the following statements about the circuit is/are CORRECT?
- (a) With no propagation delays, the output is always logic Zero
- (b) With no propagation delays, the output is always logic One
- (c) With propagation delays, the output can have a transient logic One after transitions from logic Zero to logic One
- (d) With propagation delays, the output can have a transient logic Zero after transitions from logic One to logic Zero
Show answer
()
For a Boolean variable , which of the following statements is/are FALSE?
- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider a Boolean expression given by .
Which of the following statements is/are CORRECT?- (a)
- (b)
- (c) is independent of input
- (d) is independent of input
Show answer
()
Consider 4-variable functions f1, f2, f3, f4 expressed in sum-of-minterms form as given below.
Circuit: f1 and f2 feed a two-input AND gate; f3 and f4 feed a two-input OR gate; the outputs of the AND gate and the OR gate feed a two-input XOR gate whose output is .
With respect to the circuit given above, which of the following options is/are CORRECT?- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider a digital logic circuit consisting of three 2-to-1 multiplexers M1, M2, and M3 as shown below. X1 and X2 are inputs of M1. X3 and X4 are inputs of M2. A, B, and C are select lines of M1, M2, and M3, respectively. For an instance of inputs **X1=1, X2=1, X3=0**, and **X4=0**, the number of combinations of A, B, C that give the output **Y=1** is _________
The output of a 2-input multiplexer is connected back to one of its inputs as shown in the figure. Match the functional equivalence of this circuit to one of the following options.
- (a) D Flip-flop
- (b) D Latch
- (c) Half-adder
- (d) Demultiplexer
Show answer
(b) D Latch
A 4 kilobyte (KB) byte-addressable memory is realized using four 1 KB memory blocks. Two input address lines (IA4 and IA3) are connected to the chip select (CS) port of these memory blocks through a decoder as shown in the figure. The remaining ten input address lines from IA11–IA0 are connected to the address port of these blocks. The chip select (CS) is active high. The input memory addresses (IA11–IA0), in decimal, for the starting locations (Addr=0) of each block (indicated as X1, X2, X3, X4 in the figure) are among the options given below. Which one of the following options is CORRECT?
- (a) (0, 1, 2, 3)
- (b) (0, 1024, 2048, 3072)
- (c) (0, 8, 16, 24)
- (d) (0, 0, 0, 0)
Show answer
(c) (0, 8, 16, 24)
Consider a sequential digital circuit consisting of T flip-flops and D flip-flops as shown in the figure. CLKIN is the clock input to the circuit. At the beginning, Q1, Q2 and Q3 have values 0, 1 and 1, respectively. Which one of the given values of (Q1, Q2, Q3) can NEVER be obtained with this digital circuit?
- (a) (0, 0, 1)
- (b) (1, 0, 0)
- (c) (1, 0, 1)
- (d) (1, 1, 1)
Show answer
(a) (0, 0, 1)
A Boolean digital circuit is composed using two 4-input multiplexers (M1 and M2) and one 2-input multiplexer (M3) as shown in the figure. X0–X7 are the inputs of the multiplexers M1 and M2 and could be connected to either 0 or 1. The select lines of the multiplexers are connected to Boolean variables A, B and C as shown.
Which one of the following set of values of (X0, X1, X2, X3, X4, X5, X6, X7) will realise the Boolean function ?- (a) (1, 1, 0, 0, 1, 1, 1, 0)
- (b) (1, 1, 0, 0, 1, 1, 0, 1)
- (c) (1, 1, 0, 1, 1, 1, 0, 0)
- (d) (0, 0, 1, 1, 0, 1, 1, 1)
Show answer
(c) (1, 1, 0, 1, 1, 1, 0, 0)
Consider a digital display system (DDS) shown in the figure that displays the contents of register X. A 16-bit code word is used to load a word in X, either from S or from R. S is a 1024-word memory segment and R is a 32-word register file. Based on the value of mode bit M, T selects an input word to load in X. P and Q interface with the corresponding bits in the code word to choose the addressed word. Which one of the following represents the functionality of P, Q, and T?
- (a) P is 10:1 multiplexer; Q is 5:1 multiplexer; T is 2:1 multiplexer
- (b) P is 10: decoder; Q is 5: decoder; T is 2:1 encoder
- (c) P is 10: decoder; Q is 5: decoder; T is 2:1 multiplexer
- (d) P is 1:10 de-multiplexer; Q is 1:5 de-multiplexer; T is 2:1 multiplexer
Show answer
(c) P is 10: decoder; Q is 5: decoder; T is 2:1 multiplexer
Which one of the following circuits implements the Boolean function given below?
, where is the minterm.- (a) A multiplexer with select lines , and data inputs , , , ; output
- (b) A multiplexer with select lines , and data inputs , , , ; output
- (c) A multiplexer with select lines , and data inputs , , , ; output
- (d) A multiplexer with select lines , and data inputs , , , ; output
Show answer
(a) A multiplexer with select lines , and data inputs , , , ; output
Consider a 3-bit counter, designed using T flip-flops, as shown below: Assuming the initial state of the counter given by PQR as 000, what are the next three states?
- (a) 011, 101, 000
- (b) 001, 010, 111
- (c) 011, 101, 111
- (d) 001, 010, 000
Show answer
(a) 011, 101, 000
Suppose we want to design a synchronous circuit that processes a string of 0's and 1's. Given a string, it produces another string by replacing the first 1 in any subsequence of consecutive 1's by a 0. Consider the following example.
Input sequence: 00100011000011100
Output sequence: 00000001000001100
A *Mealy Machine* is a state machine where both the next state and the output are functions of the present state and the current input.
The above mentioned circuit can be designed as a two-state Mealy machine. The states in the Mealy machine can be represented using Boolean values 0 and 1. We denote the current state, the next state, the next incoming bit, and the output bit of the Mealy machine by the variables , , and respectively.
Assume the initial state of the Mealy machine is 0.
What are the Boolean expressions corresponding to and in terms of and ?- (a) ,
- (b) ,
- (c) ,
- (d) ,
Show answer
(b) ,
Consider the following Boolean expression.
Which of the following Boolean expressions is/are equivalent to (complement of )?- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider a Boolean function such that
The number of literals in the minimal sum-of-products expression of is __________.A multiplexer is placed between a group of 32 registers and an accumulator to regulate data movement such that at any given point in time the content of only one register will move to the accumulator. The minimum number of select lines needed for the multiplexer is \_\_\_\_\_\_\_.
If there are input lines and output lines for a decoder that is used to uniquely address a byte addressable 1 KB RAM, then the minimum value of is \_\_\_\_\_\_.
Consider the Boolean function .
Which one of the following minterm lists represents the circuit given above?- (a)
- (b)
- (c)
- (d)
Show answer
(b)
The chip select logic for a certain DRAM chip in a memory system design is shown below. Assume that the memory system has 16 address lines denoted by to . What is the range of addresses (in hexadecimal) of the memory system that can get enabled by the chip select (CS) signal?
- (a) C800 to CFFF
- (b) CA00 to CAFF
- (c) C800 to C8FF
- (d) DA00 to DFFF
Show answer
(a) C800 to CFFF
Which one of the following is NOT a valid identity?
- (a)
- (b)
- (c) , if
- (d)
Show answer
(b)
Consider three 4-variable functions , , and , which are expressed in sum-of-minterms as , , . For the following circuit with one AND gate and one XOR gate, the output function f can be expressed as:
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
What is the minimum number of 2-input NOR gates required to implement a 4-variable function expressed in sum-of-minterms form as ? Assume that all the inputs and their complements are available. Answer: _______________.
Computer Science and IT12 modules51 ch13 h 4 min561 PYQ
04Discrete mathematics5 ch · 1 h 22 min54 PYQ
- Propositional and first-order logic 17′
- Sets, relations, functions, posets and lattices 16′
- Combinatorics, recurrence relations and generating functions 16′
- Graph theory: connectivity, matching and colouring 17′
- Monoids and groups 16′
See the 54 questions GATE Computer Science and IT (CS) asked from this module
Figures (i) and (ii) represent intercity highway systems. The black dots represent cities and the line segments between them represent intercity highways.
A salesperson needs to make a trip. She needs to start from a city, visit each of the remaining cities exactly once, and finally return to the same city from which she started.
Which one of the following options is then true?
Figure (i): 16 cities arranged in a square grid, with a highway between every pair of horizontally or vertically adjacent cities.
Figure (ii): 5 cities U, V, W, X, Y with highways U–V, U–W, U–X, W–Y, X–Y and V–Y.- (a) Such a trip is possible for (i), but not for (ii).
- (b) Such a trip is possible for (ii), but not for (i).
- (c) Such a trip is possible for both (i) and (ii).
- (d) Such a trip is possible neither for (i) nor for (ii).
Show answer
(a) Such a trip is possible for (i), but not for (ii).
For two different persons and , the predicate denotes that x knows y.
Consider the following statement.
There is a person who does not know anyone else, but that person is known by everyone else.
Which one of the following expressions represents the above statement?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider matrices with their elements from . The number of such matrices with even number of $\mathbf{1}$s in every row and every column is
- (a) 512
- (b) 1025
- (c) 1023
- (d) 255
Show answer
(a) 512
Let be a binary relation on the set , where if the product of and is square of an integer. Which of the following properties is/are satisfied by ?
- (a) Reflexive
- (b) Symmetric
- (c) Transitive
- (d) Antisymmetric
Show answer
()
Consider a complete graph with vertices . Note that multiple spanning trees can be constructed over . Each of these spanning trees is represented as a set of edges. The Jaccard coefficient between any two sets is defined as the ratio of the size of the intersection of the two sets to the size of the union of the two sets.
Which one of the following options gives the lowest possible value for the Jaccard coefficient between any two spanning trees of ?- (a)
- (b)
- (c)
- (d)
Show answer
(c)
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
Show answer
(a) The degree of is at least
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
Show answer
()
Let be an undirected graph, which is a path on 8 vertices. The number of matchings in is ______. (*answer in integer*)
Let be an arbitrary predicate over the domain of natural numbers.
Which ONE of the following statements is TRUE?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
is a function from to , is a function from to , and their composition defined as is a mapping from to .
If and are onto (surjective) functions, which ONE of the following is TRUE about the function ?- (a) must be an onto (surjective) function.
- (b) must be a one-to-one (injective) function.
- (c) must be a bijective function, that is, both one-to-one and onto.
- (d) is not required to be a one-to-one or onto function.
Show answer
(d) is not required to be a one-to-one or onto function.
Let be the set of all ternary strings defined over the alphabet . Consider all strings in that contain at least one occurrence of two consecutive symbols, that is, “aa”, “bb” or “cc”. The number of such strings of length 5 that are possible is _______. (Answer in integer)
Let be the set of all functions from to . Define the binary relation on as follows:
, if and only if , , where .
Which of the following statement(s) is/are TRUE?- (a) is a symmetric relation
- (b) is a partial order
- (c) is a lattice
- (d) is an equivalence relation
Show answer
()
Which of the following predicate logic formulae/formula is/are CORRECT representation(s) of the statement: “Everyone has exactly one mother”?
The meanings of the predicates used are:
- : is the mother of
- : and are not equal- (a)
- (b)
- (c)
- (d)
Show answer
()
is the set of non-negative integers. Let F be the set of functions from to itself. For any two functions, , we define
for every number in . Which of the following is/are CORRECT about the mathematical structure ?- (a) is an Abelian group.
- (b) is an Abelian monoid.
- (c) is a non-Abelian group.
- (d) is a non-Abelian monoid.
Show answer
(b) is an Abelian monoid.
Let and be the following propositions:
: Fail grade can be given.
: Student scores more than 50% marks.
Consider the statement: “Fail grade cannot be given when student scores more than 50% marks.”
Which one of the following is the CORRECT representation of the above statement in propositional logic?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Let be the adjacency matrix of a simple undirected graph . Suppose is its own inverse. Which one of the following statements is always TRUE?
- (a) is a cycle
- (b) is a perfect matching
- (c) is a complete graph
- (d) There is no such graph
Show answer
(b) is a perfect matching
Let and be non-empty finite sets such that there exist one-to-one and onto functions (i) from to and (ii) from to . The number of possible values of is __________
Let be the partial order defined on the set as follows
The number of total orders on that contain is __________The chromatic number of a graph is the minimum number of colours used in a *proper* colouring of the graph. Let be any graph with vertices and chromatic number . Which of the following statements is/are always TRUE?
- (a) contains a complete subgraph with vertices
- (b) contains an independent set of size at least
- (c) contains at least edges
- (d) contains a vertex of degree at least
Show answer
()
Consider the operators and defined by , , for positive integers. Which of the following statements is/are TRUE?
- (a) Operator obeys the associative law
- (b) Operator obeys the associative law
- (c) Operator over the operator obeys the distributive law
- (d) Operator over the operator obeys the distributive law
Show answer
()
The chromatic number of a graph is the minimum number of colours used in a *proper* colouring of the graph. The chromatic number of the following graph is _________
Graph on 8 vertices placed on an octagon and numbered 1 to 8 clockwise; vertex is joined to and (mod 8). Edges: 1–2, 2–3, 3–4, 4–5, 5–6, 6–7, 7–8, 8–1, 1–4, 2–5, 3–6, 4–7, 5–8, 6–1, 7–2, 8–3.Let be the group of integers with addition modulo as the group operation. The number of elements in the group that are their own inverses is ________
The Lucas sequence is defined by the recurrence relation:
with and .
Which one of the options given is TRUE?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Geetha has a conjecture about integers, which is of the form
where is a statement about integers, and is a statement about pairs of integers. Which of the following (one or more) option(s) would *imply* Geetha’s conjecture?- (a)
- (b)
- (c)
- (d)
Show answer
()
Let , where is a large positive integer greater than 1000. Let be a positive integer less than . Let be subsets of with and . We say that a permutation of separates from if one of the following is true.
- All members of appear in the permutation before any of the members of .
- All members of appear in the permutation before any of the members of .
How many permutations of separate from ?- (a)
- (b)
- (c)
- (d)
Show answer
(d)
Let be an onto (or surjective) function, where and are nonempty sets. Define an equivalence relation on the set as
where . Let be the set of all the equivalence classes under . Define a new mapping as
Which of the following statements is/are TRUE?- (a) is NOT well-defined.
- (b) is an onto (or surjective) function.
- (c) is a one-to-one (or injective) function.
- (d) is a bijective function.
Show answer
()
Let be a set and denote the powerset of .
Define a binary operation on as follows:
Let . Which of the following statements about is/are correct?- (a) is a group.
- (b) Every element in has an inverse, but is NOT a group.
- (c) For every , the inverse of is the complement of .
- (d) For every , the inverse of is .
Show answer
()
Let be a simple, finite, undirected graph with vertex set . Let denote the maximum degree of and let denote the set of all possible colors. Color the vertices of using the following greedy strategy:
for
Which of the following statements is/are TRUE?- (a) This procedure results in a proper vertex coloring of .
- (b) The number of colors used is at most .
- (c) The number of colors used is at most .
- (d) The number of colors used is equal to the chromatic number of .
Show answer
()
Which of the following statements is/are TRUE for a group ?
- (a) If for all , , then is commutative.
- (b) If for all , , then is commutative. Here, 1 is the identity element of .
- (c) If the order of is , then is commutative.
- (d) If is commutative, then a subgroup of need not be commutative.
Show answer
()
Consider a simple undirected graph of 10 vertices. If the graph is disconnected, then the maximum number of edges it can have is ____________.
The number of arrangements of six identical balls in three identical bins is______.
Which one of the following is the closed form for the generating function of the sequence defined below?
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
The following simple undirected graph is referred to as the Peterson graph.
[Graph: an outer pentagon , an inner five-pointed star on with edges , , , , , and spokes for .]
Which of the following statements is/are TRUE?- (a) The chromatic number of the graph is 3.
- (b) The graph has a Hamiltonian path.
- (c) The following graph is isomorphic to the Peterson graph. [Graph: a 9-cycle (in order around the boundary) and a centre vertex , with extra edges , , , , , .]
- (d) The size of the largest independent set of the given graph is 3. (A subset of vertices of a graph form an independent set if no two vertices of the subset are adjacent.)
Show answer
()
Consider the following recurrence:
Then, which of the following statements is/are TRUE?- (a)
- (b)
- (c)
- (d)
Show answer
()
Let be a directed graph, where is the set of vertices and is the set of directed edges, as defined by the following adjacency matrix .
indicates a directed edge from node to node . A *directed spanning tree* of , rooted at , is defined as a subgraph of such that the undirected version of is a tree, and contains a directed path from to every other vertex in . The number of such directed spanning trees rooted at vertex 5 is_____________.Let and be two propositions. Consider the following two formulae in propositional logic.
:
:
Which one of the following choices is correct?- (a) Both and are tautologies.
- (b) is a tautology but is not a tautology.
- (c) is not a tautology but is a tautology.
- (d) Neither nor is a tautology.
Show answer
(b) is a tautology but is not a tautology.
Consider the following sets, where :
: Set of all matrices with entries from the set
: Set of all functions from the set to the set
Which of the following choice(s) is/are correct?- (a) There does not exist a bijection from to .
- (b) There exists a surjection from to .
- (c) There exists a bijection from to .
- (d) There does not exist an injection from to .
Show answer
()
Choose the correct choice(s) regarding the following propositional logic assertion :
- (a) is neither a tautology nor a contradiction.
- (b) is a tautology.
- (c) is a contradiction.
- (d) The antecedent of is logically equivalent to the consequent of .
Show answer
()
In an undirected connected planar graph , there are eight vertices and five faces. The number of edges in is ______.
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 ______.
Let be a group of order 6, and be a subgroup of such that . Which one of the following options is correct?
- (a) Both and are always cyclic.
- (b) may not be cyclic, but is always cyclic.
- (c) is always cyclic, but may not be cyclic.
- (d) Both and may not be cyclic.
Show answer
(b) may not be cyclic, but is always cyclic.
Let be an undirected unweighted connected graph. The *diameter* of is defined as:
Let be the adjacency matrix of .
Define graph on the same set of vertices with adjacency matrix , where
Which one of the following statements is true?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
A relation is said to be *circular* if and together imply .
Which of the following options is/are correct?- (a) If a relation is reflexive and symmetric, then is an equivalence relation.
- (b) If a relation is circular and symmetric, then is an equivalence relation.
- (c) If a relation is reflexive and circular, then is an equivalence relation.
- (d) If a relation is transitive and circular, then is an equivalence relation.
Show answer
(c) If a relation is reflexive and circular, then is an equivalence relation.
Let be a set consisting of 10 elements. The number of tuples of the form such that and are subsets of , and is __________.
Let be the set of all binary relations on the set . Suppose a relation is chosen from at random. The probability that the chosen relation is reflexive (round off to 3 decimal places) is \_\_\_\_\_\_\_.
Let be a group of 35 elements. Then the largest possible size of a subgroup of other than itself is \_\_\_\_\_\_\_.
Which one of the following predicate formulae is NOT logically valid?
Note that is a predicate formula without any free occurrence of .- (a)
- (b)
- (c)
- (d)
Show answer
(c)
The number of permutations of the characters in LILAC so that no character appears in its original position, if the two L's are indistinguishable, is \_\_\_\_\_\_\_.
Graph is obtained by adding vertex to and making adjacent to every vertex of . The minimum number of colours required to edge-colour is \_\_\_\_\_\_\_.
Let . Let . Consider the following two statements on .
I.
II.
Which of the above statements is/are TRUE?- (a) Only I
- (b) Only II
- (c) Both I and II
- (d) Neither I nor II
Show answer
(c) Both I and II
Let be an arbitrary group. Consider the following relations on :
: , if and only if such that
: , if and only if
Which of the above is/are equivalence relation/relations?- (a) and
- (b) only
- (c) only
- (d) Neither nor
Show answer
(b) only
Let be an undirected complete graph on vertices, where . Then, the number of different Hamiltonian cycles in is equal to
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
The value of is ________.
Consider the first order predicate formula :
Here '' denotes that ' divides ', where and are integers. Consider the following sets:
S1.
S2. Set of all positive integers
S3. Set of all integers
Which of the above sets satisfy ?- (a) S1 and S2
- (b) S1 and S3
- (c) S2 and S3
- (d) S1, S2 and S3
Show answer
(c) S2 and S3
05Digital logic1 ch · 18 min21 PYQ
See the 21 questions GATE Computer Science and IT (CS) asked from this module
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)
Show answer
()
In a system, numbers are represented using 4-bit two's complement form. Consider four numbers , , and in the system. Which of the following operations will result in arithmetic overflow?
- (a)
- (b)
- (c)
- (d)
Show answer
()
The 32-bit IEEE 754 single precision representation of a number is 0xC2710000. The number in decimal representation is ________. (rounded off to two decimal places)
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 .
Which one of the following is the binary representation of , in hexadecimal notation?- (a) 35C80000
- (b) 35CC0000
- (c) 35E80000
- (d) 35EC0000
Show answer
(c) 35E80000
The number can be represented as 1010 in 4-bit 2’s complement representation. Which of the following is/are CORRECT 2’s complement representation(s) of ?
- (a) 1000 1010 in 8-bits
- (b) 1111 1010 in 8-bits
- (c) 1000 0000 0000 1010 in 16-bits
- (d) 1111 1111 1111 1010 in 16-bits
Show answer
()
The following two signed 2’s complement numbers (multiplicand M and multiplier Q) are being multiplied using Booth’s algorithm: M: 1100 1101 1110 1101 and Q: 1010 0100 1010 1010 The total number of addition and subtraction operations to be performed is ___________. (Answer in integer)
Three floating point numbers , , and are stored in three registers R$_{X}$, R$_{Y}$, and R$_{Z}$, respectively in IEEE 754 single precision format as given below in hexadecimal:
R$_{X}$ = 0xC1100000, R$_{Y}$ = 0x40C00000, and R$_{Z}$ = 0x41400000
Which of the following option(s) is/are CORRECT?- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider a system that uses 5 bits for representing signed integers in 2’s complement format. In this system, two integers and are represented as and . Which one of the following operations will result in either an arithmetic overflow or an arithmetic underflow?
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
The format of a single-precision floating-point number as per the **IEEE 754** standard is: | Sign (1bit) | Exponent (8 bits) | Mantissa (23 bits) | |---|---|---| Choose the largest floating-point number among the following options.
- (a) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 0111 1111 | 1111 1111 1111 1111 1111 111 |
- (b) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 1111 1110 | 1111 1111 1111 1111 1111 111 |
- (c) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 1111 1111 | 1111 1111 1111 1111 1111 111 |
- (d) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 0111 1111 | 0000 0000 0000 0000 0000 000 |
Show answer
(b) | Sign | Exponent | Mantissa | |---|---|---| | 0 | 1111 1110 | 1111 1111 1111 1111 1111 111 |
Which of the following is/are EQUAL to 224 in radix-5 (i.e., base-5) notation?
- (a) 64 in radix-10
- (b) 100 in radix-8
- (c) 50 in radix-16
- (d) 121 in radix-7
Show answer
()
A particular number is written as 132 in radix-4 representation. The same number in radix-5 representation is ____________.
Consider the IEEE-754 single precision floating point numbers P=0xC1800000 and Q=0x3F5C2EF4. Which one of the following corresponds to the product of these numbers (i.e., P × Q), represented in the IEEE-754 single precision format?
- (a) 0x404C2EF4
- (b) 0x405C2EF4
- (c) 0xC15C2EF4
- (d) 0xC14C2EF4
Show answer
(c) 0xC15C2EF4
Let R1 and R2 be two 4-bit registers that store numbers in 2’s complement form. For the operation R1+R2, which one of the following values of R1 and R2 gives an arithmetic overflow?
- (a) R1 = 1011 and R2 = 1110
- (b) R1 = 1100 and R2 = 1010
- (c) R1 = 0011 and R2 = 0100
- (d) R1 = 1001 and R2 = 1111
Show answer
(b) R1 = 1100 and R2 = 1010
Consider three floating point numbers , and stored in registers RA, RB and RC, respectively as per IEEE-754 single precision floating point format. The 32-bit content stored in these registers (in hexadecimal form) are as follows.
| RA= 0xC1400000 | RB = 0x42100000 | RC = 0x41400000 |
|---|---|---|
Which one of the following is FALSE?- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Let the representation of a number in base 3 be 210. What is the hexadecimal representation of the number?
- (a) 15
- (b) 21
- (c) D2
- (d) 528
Show answer
(a) 15
If and are two decimal digits and , the decimal value of is __________.
Consider the following representation of a number in IEEE 754 single-precision floating point format with a bias of 127.
: 1 : 10000001 : 11110000000000000000000
Here , and 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 ______.If the numerical value of a 2-byte unsigned integer on a little endian computer is 255 more than that on a big endian computer, which of the following choices represent(s) the unsigned integer on a little endian computer?
- (a) 0x6665
- (b) 0x0001
- (c) 0x4243
- (d) 0x0100
Show answer
()
Consider three registers R1, R2, and R3 that store numbers in IEEE-754 single precision floating point format. Assume that R1 and R2 contain the values (in hexadecimal notation) 0x42200000 and 0xC1200000, respectively.
If , what is the value stored in R3?- (a) 0x40800000
- (b) 0xC0800000
- (c) 0x83400000
- (d) 0xC8500000
Show answer
(b) 0xC0800000
In 16-bit 2's complement representation, the decimal number is:
- (a) 1111 1111 0001 1100
- (b) 0000 0000 1110 0100
- (c) 1111 1111 1110 0100
- (d) 1000 0000 1110 0100
Show answer
(c) 1111 1111 1110 0100
Consider Z = X – Y, where X, Y and Z are all in sign-magnitude form. X and Y are each represented in bits. To avoid overflow, the representation of Z would require a minimum of:
- (a) bits
- (b) bits
- (c) bits
- (d) bits
Show answer
(c) bits
06Computer organisation and architecture5 ch · 1 h 5 min54 PYQ
- Machine instructions and addressing modes 13′
- ALU, data-path and control unit 14′
- Instruction pipelining and hazards 12′
- Memory hierarchy and cache 14′
- I/O interface: interrupts and DMA 12′
See the 54 questions GATE Computer Science and IT (CS) asked from this module
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 |
- (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
Show answer
(b) P–4, Q–2, R–1, S–3
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 ? 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
Show answer
(d) LOAD R0, X LOAD R1, Y ADD R2, R0, R1 STORE Z, R2
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
Show answer
(b) Read-after-write
Consider the following two statements about interrupt handling mechanisms in a CPU. S1: In non-vectored interrupt mechanism, it usually takes more time to start the Interrupt Service Routine (ISR) when compared to that in a vectored interrupt mechanism. S2: In daisy-chain interrupt mechanism, the CPU polls all the input devices individually to determine the source of the interrupt. Which one of the following options is correct with respect to S1 and S2 ?
- (a) Both S1 and S2 are true
- (b) Both S1 and S2 are false
- (c) S1 is true and S2 is false
- (d) S1 is false and S2 is true
Show answer
(c) S1 is true and S2 is false
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)
Show answer
(a)
Consider a processor that has 16 general purpose registers and it uses 2-byte instruction format for all its instructions. Variable-sized opcodes are permitted. There are three different types of instructions; M-type, R-type, and C-type. Each M-type instruction has 2 register operands and a 6-bit immediate operand. Each R-type instruction has 3 register operands. Each C-type instruction has a register operand and a 6-bit offset value. If there are 2 unique M-type opcodes and 7 unique R-type opcodes, which one of the following options gives the maximum number of unique opcodes possible for C-type instructions?
- (a) 8
- (b) 4
- (c) 64
- (d) 16
Show answer
(b) 4
Consider a system with a processor and a 4 KB direct mapped cache with block size of 16 bytes. The system has a 16 MB physical memory. Four words P, Q, R, and S are accessed by the processor in the same order 10 times. That is, there are a total of 40 memory references in the sequence P, Q, R, S, P, Q, R, S,…
Assume that the cache memory is initially empty. The physical addresses of the words are given below (1 word = 1 byte).
P: 0x845B32, Q: 0x845B26, R: 0x845B36, S: 0x846B32
Which of the following statements is/are true?
Note: and- (a) Every access to P results in a cache miss
- (b) Every access to R results in a cache hit
- (c) Every access to Q results in a cache miss
- (d) Except the first access to S, all subsequent accesses to S result in cache hits
Show answer
()
Consider a system with 1 MB physical memory and a word length of 1 byte. The system uses a direct mapped cache, with block numbers starting from 0. The word with physical address 0xA2C28 is mapped to the cache block number . The maximum possible size of the cache (in KB) for this configuration is ___________. (answer in integer)
Note: andA non-pipelined instruction execution unit that operates at 1.6 GHz clock takes an average of 5 clock cycles to complete the execution of an instruction. To improve the performance, the system was pipelined with a goal of achieving an average throughput of one instruction per clock cycle. However, it could operate only at 1.2 GHz due to pipeline overheads. While executing a program in the pipelined design, 30% of instructions encountered a stall of 2 cycles due to pipeline hazards. The speed-up obtained by the pipelined design over the non-pipelined one for this program is ___________. (rounded off to two decimal places)
Note: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 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 | 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*)Suppose a program is running on a non-pipelined single processor computer system. The computer is connected to an external device that can interrupt the processor asynchronously. The processor needs to execute the interrupt service routine (ISR) to serve this interrupt. The following steps (not necessarily in order) are taken by the processor when the interrupt arrives: (i) The processor saves the content of the program counter. (ii) The program counter is loaded with the start address of the ISR. (iii) The processor finishes the present instruction. Which ONE of the following is the CORRECT sequence of steps?
- (a) (iii), (i), (ii)
- (b) (i), (iii), (ii)
- (c) (i), (ii), (iii)
- (d) (iii), (ii), (i)
Show answer
(a) (iii), (i), (ii)
A partial data path of a processor is given in the figure, where RA, RB, and RZ are 32-bit registers. Which option(s) is/are CORRECT related to arithmetic operations using the data path as shown?
- (a) The data path can implement arithmetic operations involving two registers.
- (b) The data path can implement arithmetic operations involving one register and one immediate value.
- (c) The data path can implement arithmetic operations involving two immediate values.
- (d) The data path can only implement arithmetic operations involving one register and one immediate value.
Show answer
()
Which of the following is/are part of an Instruction Set Architecture of a processor?
- (a) The size of the cache memory
- (b) The clock frequency of the processor
- (c) The number of cache memory levels
- (d) The total number of registers
Show answer
(d) The total number of registers
Consider a memory system with 1M bytes of main memory and 16K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values? [Assume memory is byte addressable, , .]
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
A processor has 64 general-purpose registers and 50 distinct instruction types. An instruction is encoded in 32-bits. What is the maximum number of bits that can be used to store the immediate operand for the given instruction? ``` ADD R1, #25 // R1 = R1 + 25 ```
- (a) 16
- (b) 20
- (c) 22
- (d) 24
Show answer
(b) 20
For a direct-mapped cache, 4 bits are used for the tag field and 12 bits are used to index into a cache block. The size of each cache block is one byte. Assume that there is no other information stored for each cache block. Which ONE of the following is the CORRECT option for the sizes of the main memory and the cache memory in this system (byte addressable), respectively?
- (a) 64 KB and 4 KB
- (b) 128 KB and 16 KB
- (c) 64 KB and 8 KB
- (d) 128 KB and 6 KB
Show answer
(a) 64 KB and 4 KB
A computer has a memory hierarchy consisting of two-level cache (L1 and L2) and a main memory. If the processor needs to access data from memory, it first looks into L1 cache. If the data is not found in L1 cache, it goes to L2 cache. If it fails to get the data from L2 cache, it goes to main memory, where the data is definitely available. *Hit rates* and *access times* of various memory units are shown in the figure. The *average memory access time* in nanoseconds () is ________. (rounded off to two decimal places)
Processor → L1 cache (Hit rate=95%, Access time = 10 ns) → L2 cache (Hit rate=85%, Access time (including L1 cache miss penalty) = 20 ns) → Main Memory (Access time (including L1 and L2 cache miss penalty) = 200 ns)Given a computing system with two levels of cache (L1 and L2) and a main memory. The first level (L1) cache access time is 1 nanosecond (ns) and the “hit rate” for L1 cache is 90% while the processor is accessing the data from L1 cache. Whereas, for the second level (L2) cache, the “hit rate” is 80% and the “miss penalty” for transferring data from L2 cache to L1 cache is 10 ns. The “miss penalty” for the data to be transferred from main memory to L2 cache is 100 ns. Then the average memory access time in this system in nanoseconds is ___________ . (rounded off to one decimal place)
A 5-stage instruction pipeline has stage delays of 180, 250, 150, 170, and 250, respectively, in nanoseconds. The delay of an inter-stage latch is 10 nanoseconds. Assume that there are no pipeline stalls due to branches and other hazards. The time taken to process 1000 instructions in microseconds is __________ . (rounded off to two decimal places)
An application executes number of instructions in 6.3 seconds. There are four types of instructions, the details of which are given in the table. The duration of a clock cycle in nanoseconds is _________. (rounded off to one decimal place)
| Instruction type | Clock cycles required per instruction (CPI) | Number of instructions executed |
|---|---|---|
| Branch | 2 | |
| Load | 5 | |
| Store | 4 | |
| Arithmetic | 3 | |Consider a computer with a 4 MHz processor. Its DMA controller can transfer 8 bytes in 1 cycle from a device to main memory through cycle stealing at regular intervals. Which one of the following is the data transfer rate (in bits per second) of the DMA controller if 1% of the processor cycles are used for DMA?
- (a) 2,56,000
- (b) 3,200
- (c) 25,60,000
- (d) 32,000
Show answer
(c) 25,60,000
Which one of the following statements is FALSE?
- (a) In the cycle stealing mode of DMA, one word of data is transferred between an I/O device and main memory in a stolen cycle
- (b) For bulk data transfer, the burst mode of DMA has a higher throughput than the cycle stealing mode
- (c) Programmed I/O mechanism has a better CPU utilization than the interrupt driven I/O mechanism
- (d) The CPU can start executing an interrupt service routine faster with vectored interrupts than with non-vectored interrupts
Show answer
(c) Programmed I/O mechanism has a better CPU utilization than the interrupt driven I/O mechanism
Consider a 5-stage pipelined processor with Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MEM), and Register Writeback (WB) stages. Which of the following statements about forwarding is/are CORRECT?
- (a) In a pipelined execution, forwarding means the result from a source stage of an earlier instruction is passed on to the destination stage of a later instruction
- (b) In forwarding, data from the output of the MEM stage can be passed on to the input of the EX stage of the next instruction
- (c) Forwarding cannot prevent all pipeline stalls
- (d) Forwarding does not require any extra hardware to retrieve the data from the pipeline stages
Show answer
()
An instruction format has the following structure: Instruction Number: Opcode destination reg, source reg-1, source reg-2 Consider the following sequence of instructions to be executed in a pipelined processor: ``` I1: DIV R3, R1, R2 I2: SUB R5, R3, R4 I3: ADD R3, R5, R6 I4: MUL R7, R3, R8 ``` Which of the following statements is/are TRUE?
- (a) There is a RAW dependency on R3 between I1 and I2
- (b) There is a WAR dependency on R3 between I1 and I3
- (c) There is a RAW dependency on R3 between I2 and I3
- (d) There is a WAW dependency on R3 between I3 and I4
Show answer
(a) There is a RAW dependency on R3 between I1 and I2
Consider two set-associative cache memory architectures: WBC, which uses the write back policy, and WTC, which uses the write through policy. Both of them use the LRU (Least Recently Used) block replacement policy. The cache memory is connected to the main memory. Which of the following statements is/are TRUE?
- (a) A read miss in WBC never evicts a dirty block
- (b) A read miss in WTC never triggers a write back operation of a cache block to main memory
- (c) A write hit in WBC can modify the value of the dirty bit of a cache block
- (d) A write miss in WTC always writes the victim cache block to main memory before loading the missed block to the cache
Show answer
()
The baseline execution time of a program on a 2 GHz single core machine is 100 nanoseconds (ns). The code corresponding to 90% of the execution time can be fully parallelized. The overhead for using an additional core is 10 ns when running on a multicore system. Assume that all cores in the multicore system run their share of the parallelized code for an equal amount of time. The number of cores that minimize the execution time of the program is ________
A given program has 25% load/store instructions. Suppose the ideal CPI (cycles per instruction) without any memory stalls is 2. The program exhibits 2% miss rate on instruction cache and 8% miss rate on data cache. The miss penalty is 100 cycles. The speedup (rounded off to two decimal places) achieved with a perfect cache (i.e., with NO data or instruction cache misses) is _________
A processor with 16 general purpose registers uses a 32-bit instruction format. The instruction format consists of an opcode field, an addressing mode field, two register operand fields, and a 16-bit scalar field. If 8 addressing modes are to be supported, the maximum number of unique opcodes possible for every addressing mode is _________
A non-pipelined instruction execution unit operating at 2 GHz takes an average of 6 cycles to execute an instruction of a program P. The unit is then redesigned to operate on a 5-stage pipeline at 2 GHz. Assume that the ideal throughput of the pipelined unit is 1 instruction per cycle. In the execution of program P, 20% instructions incur an average of 2 cycles stall due to data hazards and 20% instructions incur an average of 3 cycles stall due to control hazards. The speedup (*rounded off to one decimal place*) obtained by the pipelined design over the non-pipelined design is _________
A processor uses a 32-bit instruction format and supports byte-addressable memory access. The ISA of the processor has 150 distinct instructions. The instructions are equally divided into two types, namely R-type and I-type, whose formats are shown below.
R-type Instruction Format:
| OPCODE | UNUSED | DST Register | SRC Register1 | SRC Register 2 |
|---|---|---|---|---|
I-type Instruction Format:
| OPCODE | DST Register | SRC Register | # Immediate value/address |
|---|---|---|---|
In the OPCODE, 1 bit is used to distinguish between I-type and R-type instructions and the remaining bits indicate the operation. The processor has 50 architectural registers, and all register fields in the instructions are of equal size.
Let be the number of bits used to encode the UNUSED field, be the number of bits used to encode the OPCODE field, and be the number of bits used to encode the immediate value/address field. The value of is ________Consider a 3-stage pipelined processor having a delay of 10 ns (nanoseconds), 20 ns, and 14 ns, for the first, second, and the third stages, respectively. Assume that there is no other delay and the processor does not suffer from any pipeline hazards. Also assume that one instruction is fetched every cycle. The total execution time for executing 100 instructions on this processor is ____________ ns.
A keyboard connected to a computer is used at a rate of 1 keystroke per second. The computer system polls the keyboard every 10 ms (milli seconds) to check for a keystroke and consumes 100 $\mu$s (micro seconds) for each poll. If it is determined after polling that a key has been pressed, the system consumes an additional 200 $\mu$s to process the keystroke. Let denote the fraction of a second spent in polling and processing a keystroke.
In an alternative implementation, the system uses interrupts instead of polling. An interrupt is raised for every keystroke. It takes a total of 1 ms for servicing an interrupt and processing a keystroke. Let denote the fraction of a second spent in servicing the interrupt and processing a keystroke.
The ratio is ____________. (Rounded off to one decimal place)Consider the given C-code and its corresponding assembly code, with a few operands U1–U4 being unknown. Some useful information as well as the semantics of each unique assembly instruction is annotated as inline comments in the code. The memory is byte-addressable. ```c //C-code int a[10], b[10], i; // int is 32-bit for (i=0; i<10;i++) a[i] = b[i] * 8; ``` ``` ;assembly-code (; indicates comments) ;r1-r5 are 32-bit integer registers ;initialize r1=0, r2=10 ;initialize r3, r4 with base address of a, b L01: jeq r1, r2, end ;if(r1==r2) goto end L02: lw r5, 0(r4) ;r5 <- Memory[r4+0] L03: shl r5, r5, U1 ;r5 <- r5 << U1 L04: sw r5, 0(r3) ;Memory[r3+0] <- r5 L05: add r3, r3, U2 ;r3 <- r3+U2 L06: add r4, r4, U3 L07: add r1, r1, 1 L08: jmp U4 ;goto U4 L09: end ``` Which one of the following options is a CORRECT replacement for operands in the position (U1, U2, U3, U4) in the above assembly code?
- (a) (8, 4, 1, L02)
- (b) (3, 4, 4, L01)
- (c) (8, 1, 1, L02)
- (d) (3, 1, 1, L01)
Show answer
(b) (3, 4, 4, L01)
An 8-way set associative cache of size 64 KB (1 KB = 1024 bytes) is used in a system with 32-bit address. The address is sub-divided into TAG, INDEX, and BLOCK OFFSET. The number of bits in the TAG is ____________.
Which one of the following facilitates transfer of bulk data from hard disk to main memory with the highest throughput?
- (a) DMA based I/O transfer
- (b) Interrupt driven I/O transfer
- (c) Polling based I/O transfer
- (d) Programmed I/O transfer
Show answer
(a) DMA based I/O transfer
Let WB and WT be two set associative cache organizations that use LRU algorithm for cache block replacement. WB is a write back cache and WT is a write through cache. Which of the following statements is/are FALSE?
- (a) Each cache block in WB and WT has a dirty bit.
- (b) Every write hit in WB leads to a data transfer from cache to main memory.
- (c) Eviction of a block from WT will not lead to data transfer from cache to main memory.
- (d) A read miss in WB will never lead to eviction of a dirty block from WB.
Show answer
()
A cache memory that has a hit rate of 0.8 has an access latency 10 ns and miss penalty 100 ns. An optimization is done on the cache to reduce the miss rate. However, the optimization results in an increase of cache access latency to 15 ns, whereas the miss penalty is not affected. The minimum hit rate (*rounded off to two decimal places*) needed after the optimization such that it should not increase the average memory access time is _____________.
Consider a system with 2 KB direct mapped data cache with a block size of 64 bytes. The system has a physical address space of 64 KB and a word length of 16 bits. During the execution of a program, four data words P, Q, R, and S are accessed in that order 10 times (*i.e.,* PQRSPQRS…). Hence, there are 40 accesses to data cache altogether. Assume that the data cache is initially empty and no other data words are accessed by the program. The addresses of the first bytes of P, Q, R, and S are 0xA248, 0xC28A, 0xCA8A, and 0xA262, respectively. For the execution of the above program, which of the following statements is/are TRUE with respect to the data cache?
- (a) Every access to S is a hit.
- (b) Once P is brought to the cache it is never evicted.
- (c) At the end of the execution only R and S reside in the cache.
- (d) Every access to R evicts Q from the cache.
Show answer
()
A processor operating at 2 GHz has a standard 5-stage RISC instruction pipeline having a base CPI (cycles per instruction) of one without any pipeline hazards. For a given program P that has 30% branch instructions, control hazards incur 2 cycles stall for every branch. A new version of the processor operating at same clock frequency has an additional branch predictor unit (BPU) that completely eliminates stalls for correctly predicted branches. There is neither any savings nor any additional stalls for wrong predictions. There are no structural hazards and data hazards for and . If the BPU has a prediction accuracy of 80%, the speed up (*rounded off to two decimal places*) obtained by over in executing P is____________.
Consider a set-associative cache of size 2KB (1KB bytes) with cache block size of 64 bytes. Assume that the cache is byte-addressable and a 32-bit address is used for accessing the cache. If the width of the tag field is 22 bits, the associativity of the cache is __________.
Consider a computer system with DMA support. The DMA module is transferring one 8-bit character in one CPU cycle from a device to memory through *cycle stealing* at regular intervals. Consider a 2 MHz processor. If 0.5% processor cycles are used for DMA, the data transfer rate of the device is __________ bits per second.
Consider a computer system with a byte-addressable primary memory of size bytes. Assume the computer system has a direct-mapped cache of size 32 KB (1 KB bytes), and each cache block is of size 64 bytes.
The size of the tag field is ______ bits.Assume a two-level inclusive cache hierarchy, L1 and L2, where L2 is the larger of the two. Consider the following statements.
: Read misses in a write through L1 cache do not result in writebacks of dirty lines to the L2.
: Write allocate policy *must* be used in conjunction with write through caches and no-write allocate policy is used with writeback caches.
Which of the following statements is correct?- (a) is true and is false
- (b) is false and is true
- (c) is true and is true
- (d) is false and is false
Show answer
(a) is true and is false
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 a pipelined processor with 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MEM), and Write Back (WB). Each stage of the pipeline, except the EX stage, takes one cycle. Assume that the ID stage merely decodes the instruction and the register read is performed in the EX stage. The EX stage takes one cycle for ADD instruction and two cycles for MUL instruction. Ignore pipeline register latencies.
Consider the following sequence of 8 instructions:
ADD, MUL, ADD, MUL, ADD, MUL, ADD, MUL
Assume that every MUL instruction is data-dependent on the ADD instruction just before it and every ADD instruction (except the first ADD) is data-dependent on the MUL instruction just before it. The *Speedup* is defined as follows:
The *Speedup* achieved in executing the given instruction sequence on the pipelined processor (rounded to 2 decimal places) is __________.Consider the following instruction sequence where registers 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 the following statements. I. Daisy chaining is used to assign priorities in attending interrupts. II. When a device raises a vectored interrupt, the CPU does polling to identify the source of interrupt. III. In polling, the CPU periodically checks the status bits to know if any device needs its attention. IV. During DMA, both the CPU and DMA controller can be bus masters at the same time. Which of the above statements is/are TRUE?
- (a) I and II only
- (b) I and IV only
- (c) I and III only
- (d) III only
Show answer
(c) I and III only
Consider the following data path diagram.
Consider an instruction: R0 R1 + R2. The following steps are used to execute it over the given data path. Assume that PC is incremented appropriately. The subscripts r and w indicate read and write operations, respectively.
1. , , ,
2. ,
3. , ,
4. ,
5. ,
Which one of the following is the correct order of execution of the above steps?- (a) 2, 1, 4, 5, 3
- (b) 1, 2, 4, 3, 5
- (c) 3, 5, 2, 1, 4
- (d) 3, 5, 1, 2, 4
Show answer
(c) 3, 5, 2, 1, 4
A direct mapped cache memory of 1 MB has a block size of 256 bytes. The cache has an access time of 3 ns and a hit rate of 94%. During a cache miss, it takes 20 ns to bring the first word of a block from the main memory, while each subsequent word takes 5 ns. The word size is 64 bits. The average memory access time in ns (round off to 1 decimal place) is \_\_\_\_\_\_\_.
A computer system with a word length of 32 bits has a 16 MB byte-addressable main memory and a 64 KB, 4-way set associative cache memory with a block size of 256 bytes. Consider the following four physical addresses represented in hexadecimal notation. A1 = 0x42C8A4, A2 = 0x546888, A3 = 0x6A289C, A4 = 0x5E4880 Which one of the following is TRUE?
- (a) A1 and A4 are mapped to different cache sets.
- (b) A2 and A3 are mapped to the same cache set.
- (c) A3 and A4 are mapped to the same cache set.
- (d) A1 and A3 are mapped to the same cache set.
Show answer
(b) A2 and A3 are mapped to the same cache set.
Consider a non-pipelined processor operating at 2.5 GHz. It takes 5 clock cycles to complete an instruction. You are going to make a 5-stage pipeline out of this processor. Overheads associated with pipelining force you to operate the pipelined processor at 2 GHz. In a given program, assume that 30% are memory instructions, 60% are ALU instructions and the rest are branch instructions. 5% of the memory instructions cause stalls of 50 clock cycles each due to cache misses and 50% of the branch instructions cause stalls of 2 cycles each. Assume that there are no stalls associated with the execution of ALU instructions. For this program, the speedup achieved by the pipelined processor over the non-pipelined processor (round off to 2 decimal places) is \_\_\_\_\_\_.
A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions: I-type and R-type. Each I-type instruction contains an opcode, a register name, and a 4-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type opcodes, then the maximum number of distinct R-type opcodes is \_\_\_\_\_\_\_.
A certain processor uses a fully associative cache of size 16 kB. The cache block size is 16 bytes. Assume that the main memory is byte addressable and uses a 32-bit address. How many bits are required for the *Tag* and the *Index* fields respectively in the addresses generated by the processor?
- (a) 24 bits and 0 bits
- (b) 28 bits and 4 bits
- (c) 24 bits and 4 bits
- (d) 28 bits and 0 bits
Show answer
(d) 28 bits and 0 bits
A certain processor deploys a single-level cache. The cache block size is 8 words and the word size is 4 bytes. The memory system uses a 60-MHz clock. To service a cache miss, the memory controller first takes 1 cycle to accept the starting address of the block, it then takes 3 cycles to fetch all the eight words of the block, and finally transmits the words of the requested block at the rate of 1 word per cycle. The maximum bandwidth for the memory system when the program running on the processor issues a series of read operations is _________ bytes/sec.
07Programming in C4 ch · 1 h 1 min38 PYQ
- Basics, data types and operators 16′
- Control flow, functions and recursion 14′
- Arrays, strings and pointers 16′
- Structures, unions, files and memory 15′
See the 38 questions GATE Computer Science and IT (CS) asked from this module
Consider the following three ANSI-C programs, P1, P2, and P3. P1 ```c #include <stdio.h> int a=5; int main(){ int a=7; return(0); } ``` P2 ```c #include <stdio.h> int main(){ int a=5; int a=7; return(0); } ``` P3 ```c #include <stdio.h> int main(){ int a=5; float a=7; return(0); } ``` Which one of the following statements is true?
- (a) Only P1 will compile without any error
- (b) Only P2 will compile without any error
- (c) Only P3 will compile without any error
- (d) All three programs P1, P2, and P3 will compile without any error
Show answer
(a) Only P1 will compile without any error
Consider the following program in C: ```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.
Consider the following ANSI-C program. ```c #include <stdio.h> int main(){ int *ptr, a, b, c; a=5; b=11; c=20; ptr=&a; *ptr=c; ptr=&c; a=*(&b); c=*ptr-a; printf("%d",c); return(0); } ``` The output of this program is ____________. (answer in integer) Note: Assume that the program compiles and runs successfully.
Consider the recursive functions represented by the following code segment: ```c 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.
Consider the following ANSI-C function. ```c int func(int start, int end){ int length=end+1-start; if((length<1)||(start<0)||(end<0)){ return(0); } if(length%3==0){ return(func(start+1, end)); } else if(length%3==1){ return(1+func(start, end-1)); } else { return(func(start+2, end)); } } ``` The maximum possible value that can be returned from this function is ____________. (answer in integer) Note: Ignore syntax errors (if any) in the function.
Consider the following C program: ```c #include <stdio.h> void stringcopy(char *, char *); int main(){ char a[30] = "@#Hello World!"; stringcopy(a, a + 2); printf("%s\n", a); return 0; } void stringcopy(char *s, char *t) { while(*t) *s++ = *t++; } ``` Which ONE of the following will be the output of the program?
- (a) `@#Hello World!`
- (b) `Hello World!`
- (c) `ello World!`
- (d) `Hello World!d!`
Show answer
(d) `Hello World!d!`
```c int x=126,y=105; do { if(x>y) x=x-y; else y=y-x; } while(x!=y); printf("%d",x); ``` The output of the given C code segment is ________. (Answer in integer)
``` #include <stdio.h> void foo(int *p, int x){ *p=x; } int main(){ int *z; int a = 20, b = 25; z = &a; foo(z,b); printf("%d",a); return 0; } ``` The output of the given C program is __________. (Answer in integer)
``` #include <stdio.h> int foo(int S[],int size){ if(size == 0) return 0; if(size == 1) return 1; if(S[0] != S[1]) return 1+foo(S+1,size-1); return foo(S+1,size-1); } int main(){ int A[]={0,1,2,2,2,0,0,1,1}; printf("%d",foo(A,9)); return 0; } ``` The value printed by the given C program is _______ . (Answer in integer)
Consider the following C program: ```c #include <stdio.h> int main(){ int a; int arr[5] = {30,50,10}; int *ptr; ptr = &arr[0] + 1; a = *ptr; (*ptr)++; ptr++; printf("%d", a + (*ptr) + arr[1]); return 0; } ``` The output of the above program is ___________. (Answer in integer)
Consider the following C program: ``` #include <stdio.h> int gate (int n) { int d, t, newnum, turn; newnum = turn = 0; t=1; while (n>=t) t *= 10; t /=10; while (t>0) { d = n/t; n = n%t; t /= 10; if (turn) newnum = 10*newnum + d; turn = (turn + 1) % 2; } return newnum; } int main () { printf ("%d", gate(14362)); return 0; } ``` The value printed by the given C program is _______ . (Answer in integer)
Consider the following C program: ```c #include <stdio.h> int g(int n) { return (n+10); } int f(int n) { return g(n*2); } int main() { int sum, n; sum=0; for (n=1; n<3; n++) sum += g(f(n)); printf ("%d", sum); return 0; } ``` The output of the given C program is ________. (Answer in integer)
Consider the following C program. Assume parameters to a function are evaluated from right to left. ``` #include <stdio.h> int g(int p) { printf("%d", p); return p; } int h(int q) { printf("%d", q); return q; } void f(int x, int y) { g(x); h(y); } int main() { f(g(10),h(20)); } ``` Which one of the following options is the CORRECT output of the above C program?
- (a) 20101020
- (b) 10202010
- (c) 20102010
- (d) 10201020
Show answer
(a) 20101020
Consider the following C program: ``` #include <stdio.h> int main(){ int a = 6; int b = 0; while(a < 10) { a = a / 12 + 1; a += b;} printf(”%d”, a); return 0;} ``` Which one of the following statements is CORRECT?
- (a) The program prints 9 as output
- (b) The program prints 10 as output
- (c) The program gets stuck in an infinite loop
- (d) The program prints 6 as output
Show answer
(c) The program gets stuck in an infinite loop
Consider the following C program: ``` #include <stdio.h> void fX(); int main(){ fX(); return 0;} void fX(){ char a; if((a=getchar()) != ’\n’) fX(); if(a != ’\n’) putchar(a);} ``` Assume that the input to the program from the command line is 1234 followed by a newline character. Which one of the following statements is CORRECT?
- (a) The program will not terminate
- (b) The program will terminate with no output
- (c) The program will terminate with 4321 as output
- (d) The program will terminate with 1234 as output
Show answer
(c) The program will terminate with 4321 as output
Consider the operator precedence and associativity rules for the *integer* arithmetic operators given in the table below.
| Operator | Precedence | Associativity |
|---|---|---|
| | Highest | Left |
| | High | Right |
| | Medium | Right |
| | Low | Right |
The value of the expression as per the above rules is __________Consider the following C function definition. ``` int fX(char *a){ char *b = a; while(*b) b++; return b - a;} ``` Which of the following statements is/are TRUE?
- (a) The function call fX(”abcd”) will always return a value
- (b) Assuming a character array c is declared as char c[] = ”abcd” in main(), the function call fX(c)will always return a value
- (c) The code of the function will not compile
- (d) Assuming a character pointer c is declared as char *c = ”abcd” in main(), the function call fX(c)will always return a value
Show answer
()
What is the output of the following C program? ``` #include <stdio.h> int main() { double a[2]={20.0, 25.0}, *p, *q; p = a; q = p + 1; printf(”%d,%d”, (int)(q – p), (int)(*q – *p)); return 0;} ```
- (a) 4,8
- (b) 1,5
- (c) 8,5
- (d) 1,8
Show answer
(b) 1,5
Consider the following C function definition. ``` int f(int x, int y) { for (int i=0; i<y; i++) { x=x+x+y; } return x; } ``` Which of the following statements is/are TRUE about the above function?
- (a) If the inputs are x=20, y=10, then the return value is greater than
- (b) If the inputs are x=20, y=20, then the return value is greater than
- (c) If the inputs are x=20, y=10, then the return value is less than
- (d) If the inputs are x=10, y=20, then the return value is greater than
Show answer
()
The integer value printed by the ANSI-C program given below is ____________. ```c #include<stdio.h> int funcp(){ static int x = 1; x++; return x; } int main(){ int x,y; x = funcp(); y = funcp()+x; printf("%d\n", (x+y)); return 0; } ```
What is printed by the following ANSI C program? ```c #include<stdio.h> int main(int argc, char *argv[]) { int x = 1, z[2] = {10, 11}; int *p = NULL; p = &x; *p = 10; p = &z[1]; *(&z[0] + 1) += 3; printf("%d, %d, %d\n", x, z[0], z[1]); return 0; } ```
- (a) 1, 10, 11
- (b) 1, 10, 14
- (c) 10, 14, 11
- (d) 10, 10, 14
Show answer
(d) 10, 10, 14
What is printed by the following ANSI C program? ```c #include<stdio.h> int main(int argc, char *argv[]) { int a[3][3][3] = {{1, 2, 3, 4, 5, 6, 7, 8, 9}, {10, 11, 12, 13, 14, 15, 16, 17, 18}, {19, 20, 21, 22, 23, 24, 25, 26, 27}}; int i = 0, j = 0, k = 0; for( i = 0; i < 3; i++ ){ for(k = 0; k < 3; k++ ) printf("%d ", a[i][j][k]); printf("\n"); } return 0; } ```
- (a) ``` 1 2 3 10 11 12 19 20 21 ```
- (b) ``` 1 4 7 10 13 16 19 22 25 ```
- (c) ``` 1 2 3 4 5 6 7 8 9 ```
- (d) ``` 1 2 3 13 14 15 25 26 27 ```
Show answer
(a) ``` 1 2 3 10 11 12 19 20 21 ```
What is printed by the following ANSI C program? ```c #include<stdio.h> int main(int argc, char *argv[]){ char a = 'P'; char b = 'x'; char c = (a & b) + '*'; char d = (a | b) - '-'; char e = (a ^ b) + '+'; printf("%c %c %c\n", c, d, e); return 0; } ``` ASCII encoding for relevant characters is given below | A | B | C | ... | Z | |---|---|---|---|---| | 65 | 66 | 67 | ... | 90 | | a | b | c | ... | z | |---|---|---|---|---| | 97 | 98 | 99 | ... | 122 | | * | + | − | |---|---|---| | 42 | 43 | 45 |
- (a) z K S
- (b) 122 75 83
- (c) * - +
- (d) P x +
Show answer
(a) z K S
Consider the following ANSI C program. ``` #include <stdio.h> int main(){ int arr[4][5]; int i, j; for (i=0; i<4; i++){ for (j=0; j<5; j++){ arr[i][j] = 10*i + j; } } printf("%d", *(arr[1] + 9)); return 0; } ``` What is the output of the above program?
- (a) 14
- (b) 20
- (c) 24
- (d) 30
Show answer
(c) 24
Consider the following ANSI C function: ``` int SomeFunction(int x, int y) { if ((x == 1) || (y == 1)) return 1; if (x == y) return x; if (x > y) return SomeFunction(x - y, y); if (y > x) return SomeFunction(x, y - x); } ``` The value returned by SomeFunction(15, 255) is __________.
Consider the following ANSI C program: ``` #include <stdio.h> #include <stdlib.h> struct Node{ int value; struct Node *next;}; int main(){ struct Node *boxE, *head, *boxN; int index = 0; boxE = head = (struct Node *) malloc(sizeof(struct Node)); head->value = index; for (index = 1; index <= 3; index++){ boxN = (struct Node *) malloc(sizeof(struct Node)); boxE->next = boxN; boxN->value = index; boxE = boxN; } for (index = 0; index <= 3; index++) { printf("Value at index %d is %d\n", index, head->value); head = head->next; printf("Value at index %d is %d\n", index+1, head->value); } } ``` Which one of the statements below is correct about the program?
- (a) Upon execution, the program creates a linked-list of five nodes.
- (b) Upon execution, the program goes into an infinite loop.
- (c) It has a missing return which will be reported as an error by the compiler.
- (d) It dereferences an uninitialized pointer that may result in a run-time error.
Show answer
(d) It dereferences an uninitialized pointer that may result in a run-time error.
Consider the following ANSI C program. ```c #include <stdio.h> int main() { int i, j, count; count = 0; i = 0; for (j = -3; j <= 3; j++) { if ((j >= 0) && (i++)) count = count + j; } count = count + i; printf("%d", count); return 0; } ``` Which one of the following options is correct?
- (a) The program will not compile successfully.
- (b) The program will compile successfully and output 10 when executed.
- (c) The program will compile successfully and output 8 when executed.
- (d) The program will compile successfully and output 13 when executed.
Show answer
(b) The program will compile successfully and output 10 when executed.
Consider the following ANSI C function:
```c
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[]=1, for all such that . The value returned by SimpleFunction(Z, 10, 2) is ______.Consider the following ANSI C program. ``` #include <stdio.h> int foo(int x, int y, int q) { if ((x <= 0) && (y <= 0)) return q; if (x <= 0) return foo(x, y-q, q); if (y <= 0) return foo(x-q, y, q); return foo(x, y-q, q) + foo(x-q, y, q); } int main() { int r = foo(15,15,10); printf("%d", r); return 0; } ``` The output of the program upon execution is __________.
Consider the following C program. ```c #include <stdio.h> int main() { int a[4][5]={{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17, 18 , 19, 20}}; printf("%d\n", *(*(a+**a+2)+3)); return(0); } ``` The output of the program is \_\_\_\_\_\_\_.
Consider the following C functions. ```c int fun1(int n) { static int i = 0; if (n > 0) { ++i; fun1(n-1); } return(i); } ``` ```c int fun2(int n) { static int i = 0; if (n > 0) { i = i + fun1(n); fun2(n-1); } return(i); } ``` The return value of `fun2(5)` is \_\_\_\_\_\_\_\_.
Consider the following C functions. ```c int tob(int b, int* arr){ int i; for(i=0; b>0; i++){ if(b%2) arr[i]=1; else arr[i]=0; b = b/2; } return(i); } ``` ```c int pp(int a,int b) { int arr[20]; int i, tot = 1, ex, len; ex = a; len = tob(b,arr); for(i=0; i<len; i++){ if(arr[i]==1) tot = tot * ex; ex = ex * ex; } return(tot); } ``` The value returned by `pp(3,4)` is \_\_\_\_\_\_\_\_\_\_.
Consider the following C program: ```c #include <stdio.h> int jumble(int x, int y){ x=2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n", x); return 0; } ``` The value printed by the program is ________.
Consider the following C program: ```c #include <stdio.h> int main(){ int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5}, *ip=arr+4; printf("%d\n", ip[1]); return 0; } ``` The number that will be displayed on execution of the program is__________ .
Consider the following C function. ```c void convert(int n){ if(n<0) printf("%d",n); else { convert(n/2); printf("%d",n%2); } } ``` Which one of the following will happen when the function `convert` is called with any positive integer `n` as argument?
- (a) It will print the binary representation of `n` and terminate
- (b) It will print the binary representation of `n` in the reverse order and terminate
- (c) It will print the binary representation of `n` but will not terminate
- (d) It will not print anything and will not terminate
Show answer
(d) It will not print anything and will not terminate
Consider the following C program: ```c #include <stdio.h> int r(){ static int num=7; return num--; } int main(){ for (r();r();r()) printf("%d",r()); return 0; } ``` Which one of the following values will be displayed on execution of the programs?
- (a) 41
- (b) 52
- (c) 63
- (d) 630
Show answer
(b) 52
Consider the following C program: ```c #include <stdio.h> int main(){ float sum = 0.0, j = 1.0, i = 2.0; while (i/j > 0.0625){ j = j + j; sum = sum + i/j; printf("%f\n", sum); } return 0; } ``` The number of times the variable `sum` will be printed, when the above program is executed, is _______________.
Consider the following C program: ```c #include <stdio.h> int main() { int a[] = {2, 4, 6, 8, 10}; int i, sum = 0, *b = a + 4; for (i = 0; i < 5; i++) sum = sum + (*b - i) - *(b - i); printf ("%d\n", sum); return 0; } ``` The output of the above C program is __________.
08Data structures5 ch · 1 h 22 min47 PYQ
- Arrays, stacks and queues 18′
- Linked lists 15′
- Trees, binary search trees and binary heaps 18′
- Hashing 14′
- Graphs and their representation 17′
See the 47 questions GATE Computer Science and IT (CS) asked from this module
The set T represents various traversals over binary tree. The set S represents the order of visiting nodes during a traversal. | T | S | |---|---| | I: Inorder | L: left subtree, node, right subtree | | II: Preorder | M: node, left subtree, right subtree | | III: Postorder | N: left subtree, right subtree, node | Which one of the following is the correct match from T to S ?
- (a) I – L, II – M, III – N
- (b) I – M, II – L, III – N
- (c) I – N, II – M, III – L
- (d) I – L, II – N, III – M
Show answer
(a) I – L, II – M, III – N
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)
Show answer
()
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 :
1, 13, 22, 15, 11, 24
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
Show answer
(c) 2
The keys 5, 28, 19, 15, 26, 33, 12, 17, 10 are inserted into a hash table using the hash function . The collisions are resolved by chaining. After all the keys are inserted, the length of the longest chain is __________. (answer in integer)
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*)
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`. ```c 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)`
Show answer
(b) **E1**: `head->next == NULL` **E2**: `1 + getListSize(head->next)`
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
Show answer
(d) 5
Consider a binary search tree (BST) with leaf nodes . Given any node , the key present in the node is denoted as . All the keys present in the given BST are distinct. The keys belong to the set of real numbers.
For a node , let denote the node that is its inorder successor. If a node does not have an inorder successor, then is . As there are no duplicates, if is not , then .
Corresponding to every leaf node that has a non-NULL , a new key with the following property is to be inserted into the BST.
Let represent the list of all such new keys to be inserted into the BST.
Which of the following statements is/are true?- (a) cannot have any duplicates
- (b) will have at least one element
- (c) After inserting all keys from , the height of the BST can increase at most by one
- (d) Number of nodes in the BST will double after inserting all keys from
Show answer
()
Consider a stack and a queue . Both of them are initially empty and have the capacity to store ten elements each. The elements 1, 2, 3, 4, and 5 arrive one by one, in that order. When an element arrives, it is assigned either to (pushed on ) or to (enqueued to ). Once all the five elements are stored, the output is generated in two steps. First, stack S is emptied by popping all elements. Then queue is emptied by dequeueing all elements. The output obtained by following this process is 4 3 1 2 5 .
Given the output, the objective is to predict whether an element was assigned to or .
Which of the following options is/are possible valid assignment(s) of the elements?
Note: In the options, the notation denotes that element was assigned to and denotes that element was assigned to .- (a)
- (b)
- (c)
- (d)
Show answer
()
The following sequence corresponds to the preorder traversal of a binary search tree :
50, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77
The position of the element 60 in the postorder traversal of is ______. (*answer in integer*)
*Note:* The position begins with 1.Consider a binary tree in which every node has either zero or two children. Let be the number of nodes in .
Which ONE of the following is the number of nodes in that have exactly two children?- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Which of the following statement(s) is/are TRUE for any binary search tree (BST) having distinct integers?
- (a) The maximum length of a path from the root node to any other node is .
- (b) An inorder traversal will always produce a sorted sequence of elements.
- (c) Finding an element takes time in the worst case.
- (d) Every BST is also a Min-Heap.
Show answer
()
The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node.
Suppose a Min-Heap stores 32 keys. The height of is _____________. (Answer in integer)Suppose the values are inserted in that order into an initially empty binary search tree. Let be the resulting binary search tree. The number of edges in the path from the node containing 19 to the root node of is ___________. (Answer in integer)
A meld operation on two instances of a data structure combines them into one single instance of the same data structure. Consider the following data structures:
P: Unsorted doubly linked list with pointers to the head node and tail node of the list.
Q: Min-heap implemented using an array.
R: Binary Search Tree.
Which ONE of the following options gives the worst-case time complexities for meld operation on instances of size of these data structures?- (a) P: , Q: , R:
- (b) P: , Q: , R:
- (c) P: , Q: , R:
- (d) P: , Q: , R:
Show answer
(a) P: , Q: , R:
Consider a stack data structure into which we can PUSH and POP records. Assume that each record pushed in the stack has a positive integer key and that all keys are distinct.
We wish to augment the stack data structure with an time MIN operation that returns a pointer to the record with smallest key present in the stack
1) without deleting the corresponding record, and
2) without increasing the complexities of the standard stack operations.
Which one or more of the following approach(es) can achieve it?- (a) Keep with every record in the stack, a pointer to the record with the smallest key below it.
- (b) Keep a pointer to the record with the smallest key in the stack.
- (c) Keep an auxiliary array in which the key values of the records in the stack are maintained in sorted order.
- (d) Keep a Min-Heap in which the key values of the records in the stack are maintained.
Show answer
(a) Keep with every record in the stack, a pointer to the record with the smallest key below it.
Let **LIST** be a datatype for an implementation of linked list defined as follows: ``` typedef struct list { int data; struct list *next; } LIST; ``` Suppose a program has created two linked lists, L1 and L2, whose contents are given in the figure below (code for creating L1 and L2 is not provided here). L1 contains 9 nodes, and L2 contains 7 nodes. L1: 1 → 7 → 12 → 3 → 9 → 5 → 11 → 15 → 8 → NULL L2: 1 → 11 → 6 → 9 → 15 → 12 → 4 → NULL Consider the following C program segment that modifies the list L1. The number of nodes that will be there in L1 after the execution of the code segment is ________ . (Answer in integer) ``` int find (int query, LIST *list) { while (list != NULL){ if(list->data == query) return 1; list = list->next; } return 0; } int main () { … … … ptr1=L1; ptr2=L2; while (ptr1->next != NULL){ query = ptr1->next->data; if (find (query, L2)) ptr1->next = ptr1->next->next; else ptr1 = ptr1->next; } … … … return 0; } ```
In a double hashing scheme, and are the auxiliary hash functions. The size of the hash table is 11. The hash function for the -th probe in the open address table is . The following keys are inserted in the given order: 63, 50, 25, 79, 67, 24.
The slot at which key 24 gets stored is ___________. (Answer in integer)You are given a set of distinct integers. A binary search tree is created by inserting all elements of one by one, starting with an empty tree. The tree follows the convention that, at each node, all values stored in the left subtree of the node are smaller than the value stored at the node. You are not aware of the sequence in which these values were inserted into , and you do not have access to .
Which one of the following statements is TRUE?- (a) Inorder traversal of can be determined from
- (b) Root node of can be determined from
- (c) Preorder traversal of can be determined from
- (d) Postorder traversal of can be determined from
Show answer
(a) Inorder traversal of can be determined from
An array [82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified. Which one of the following options represents the first three elements in the heapified array?
- (a) 82, 90, 101
- (b) 82, 11, 93
- (c) 131, 11, 93
- (d) 131, 111, 90
Show answer
(d) 131, 111, 90
Consider an array X that contains n positive integers. A subarray of X is defined to be a sequence of array locations with consecutive indices.
The C code snippet given below has been written to compute the length of the longest subarray of X that contains at most two distinct integers. The code has two missing expressions labelled and .
```
int first=0, second=0, len1=0, len2=0, maxlen=0;
for (int i=0; i < n; i++) {
if (X[i] == first) {
len2++; len1++;
} else if (X[i] == second) {
len2++;
len1 = (P);
second = first;
} else {
len2 = (Q);
len1 = 1; second = first;
}
if (len2 > maxlen) {
maxlen = len2;
}
first = X[i];
}
```
Which one of the following options gives the CORRECT missing expressions?
(Hint: At the end of the i-th iteration, the value of len1 is the length of the longest subarray ending with X[i] that contains all equal values, and len2 is the length of the longest subarray ending with X[i] that contains at most two distinct values.)- (a) (P) len1+1 (Q) len2+1
- (b) (P) 1 (Q) len1+1
- (c) (P) 1 (Q) len2+1
- (d) (P) len2+1 (Q) len1+1
Show answer
(b) (P) 1 (Q) len1+1
Consider a binary min-heap containing 105 distinct elements. Let be the index (in the underlying array) of the maximum element stored in the heap. The number of possible values of is
- (a) 53
- (b) 52
- (c) 27
- (d) 1
Show answer
(a) 53
Let S1 and S2 be two stacks. S1 has capacity of 4 elements. S2 has capacity of 2 elements. S1 already has 4 elements: 100, 200, 300, and 400, whereas S2 is empty, as shown below. Stack S1 (top to bottom): 400 (Top), 300, 200, 100. Stack S2: empty. Only the following three operations are available: PushToS2: Pop the top element from S1 and push it on S2. PushToS1: Pop the top element from S2 and push it on S1. GenerateOutput: Pop the top element from S1 and output it to the user. Note that the pop operation is not allowed on an empty stack and the push operation is not allowed on a full stack. Which of the following output sequences can be generated by using the above operations?
- (a) 100, 200, 400, 300
- (b) 200, 300, 400, 100
- (c) 400, 200, 100, 300
- (d) 300, 200, 400, 100
Show answer
()
Which one of the following sequences when stored in an array at locations forms a max-heap?
- (a) 23, 17, 10, 6, 13, 14, 1, 5, 7, 12
- (b) 23, 17, 14, 7, 13, 10, 1, 5, 6, 12
- (c) 23, 17, 14, 6, 13, 10, 1, 5, 7, 15
- (d) 23, 14, 17, 1, 10, 13, 16, 12, 7, 5
Show answer
(b) 23, 17, 14, 7, 13, 10, 1, 5, 6, 12
Let SLLdel be a function that deletes a node in a singly-linked list given a pointer to the node and a pointer to the head of the list. Similarly, let DLLdel be another function that deletes a node in a doubly-linked list given a pointer to the node and a pointer to the head of the list.
Let denote the number of nodes in each of the linked lists. Which one of the following choices is TRUE about the worst-case time complexity of SLLdel and DLLdel?- (a) SLLdel is and DLLdel is
- (b) Both SLLdel and DLLdel are
- (c) Both SLLdel and DLLdel are
- (d) SLLdel is and DLLdel is
Show answer
(d) SLLdel is and DLLdel is
An algorithm has to store several keys generated by an adversary in a hash table. The adversary is malicious who tries to maximize the number of collisions. Let be the number of keys, be the number of slots in the hash table, and .
Which one of the following is the best hashing strategy to counteract the adversary?- (a) Division method, i.e., use the hash function .
- (b) Multiplication method, i.e., use the hash function , where is a carefully chosen constant.
- (c) Universal hashing method.
- (d) If is a prime number, use Division method. Otherwise, use Multiplication method.
Show answer
(c) Universal hashing method.
Let A be a priority queue for maintaining a set of elements. Suppose A is implemented using a max-heap data structure. The operation Extract-Max(A) extracts and deletes the maximum element from A. The operation Insert(A,key) inserts a new element key in A. The properties of a max-heap are preserved at the end of each of these operations.
When A contains elements, which one of the following statements about the worst case running time of these two operations is TRUE?- (a) Both Extract-Max(A) and Insert(A,key) run in .
- (b) Both Extract-Max(A) and Insert(A,key) run in .
- (c) Extract-Max(A) runs in whereas Insert(A,key) runs in .
- (d) Extract-Max(A) runs in whereas Insert(A,key) runs in .
Show answer
(b) Both Extract-Max(A) and Insert(A,key) run in .
Consider the C function foo and the binary tree shown. ```c typedef struct node { int val; struct node *left, *right; } node; int foo(node *p) { int retval; if (p == NULL) return 0; else { retval = p->val + foo(p->left) + foo(p->right); printf("%d ", retval); return retval; } } ``` The binary tree: root 10; 10 has left child 5 and right child 11; 5 has left child 3 and right child 8; 11 has only a right child 13. When foo is called with a pointer to the root node of the given binary tree, what will it print?
- (a) 3 8 5 13 11 10
- (b) 3 5 8 10 11 13
- (c) 3 8 16 13 24 50
- (d) 3 16 8 50 24 13
Show answer
(c) 3 8 16 13 24 50
Consider a sequence of elements and . The following operations are performed on a stack and a queue , both of which are initially empty.
I: push the elements of from to in that order into .
II: enqueue the elements of from to in that order into .
III: pop an element from .
IV: dequeue an element from .
V: pop an element from .
VI: dequeue an element from .
VII: dequeue an element from and push the same element into .
VIII: Repeat operation VII three times.
IX: pop an element from .
X: pop an element from .
The top element of after executing the above operations is ____________.Consider the problem of reversing a singly linked list. To take an example, given the linked list below,
head → a → b → c → d → e → NULL
the reversed linked list should look like
head → e → d → c → b → a → NULL
Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in space?- (a) The best algorithm for the problem takes time in the worst case.
- (b) The best algorithm for the problem takes time in the worst case.
- (c) The best algorithm for the problem takes time in the worst case.
- (d) It is not possible to reverse a singly linked list in space.
Show answer
(a) The best algorithm for the problem takes time in the worst case.
Suppose we are given keys, hash table slots, and two simple uniform hash functions and . Further suppose our hashing scheme uses for the odd keys and for the even keys. What is the expected number of keys in a slot?
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Suppose a binary search tree with 1000 distinct elements is also a complete binary tree. The tree is stored using the array representation of binary heap trees. Assuming that the array indices start with 0, the 3rd largest element of the tree is stored at index_____________.
Consider a simple undirected unweighted graph with at least three vertices. If is the adjacency matrix of the graph, then the number of 3-cycles in the graph is given by the trace of
- (a)
- (b) divided by
- (c) divided by
- (d) divided by
Show answer
(d) divided by
Which of the properties hold for the adjacency matrix of a simple undirected unweighted graph having vertices?
- (a) The diagonal entries of are the degrees of the vertices of the graph.
- (b) If the graph is connected, then none of the entries of can be zero.
- (c) If the sum of all the elements of is at most , then the graph must be acyclic.
- (d) If there is at least a 1 in each of ’s rows and columns, then the graph must be connected.
Show answer
(a) The diagonal entries of are the degrees of the vertices of the graph.
Consider the queues containing four elements and containing none (shown as the Initial State in the figure). The only operations allowed on these two queues are `Enqueue(Q,element)` and `Dequeue(Q)`. The minimum number of `Enqueue` operations on required to place the elements of in in reverse order (shown as the Final State in the figure) without using any additional storage is___________.
Initial State: Q1 = [1, 2, 3, 4] (head at 1), Q2 empty.
Final State: Q1 empty, Q2 = [4, 3, 2, 1] (head at 4).Let be a binary min-heap consisting of elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in ?
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
A binary search tree contains distinct elements. What is the time complexity of picking an element in that is smaller than the maximum element in ?
- (a)
- (b)
- (c)
- (d)
Show answer
(d)
Consider a complete binary tree with 7 nodes. Let denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root.
The value of 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 the 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. [Entry 00: empty. Entry 01: a node split on the 3rd bit, whose 0-branch is a single key and whose 1-branch is a node split on the 4th bit with a single key on each of its 0- and 1-branches. Entry 10: a node split on the 3rd bit with a single key on each of its 0- and 1-branches. Entry 11: a single key.] Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?
- (a) 5, 9, 4, 13, 10, 7
- (b) 9, 5, 10, 6, 7, 1
- (c) 10, 9, 6, 7, 5, 13
- (d) 9, 5, 13, 6, 10, 14
Show answer
(c) 10, 9, 6, 7, 5, 13
The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the postorder traversal of the tree?
- (a) 10, 11, 12, 15, 16, 18, 19, 20
- (b) 11, 12, 10, 16, 19, 18, 20, 15
- (c) 20, 19, 18, 16, 15, 12, 11, 10
- (d) 19, 16, 18, 20, 11, 12, 10, 15
Show answer
(b) 11, 12, 10, 16, 19, 18, 20, 15
What is the worst case time complexity of inserting elements into an AVL-tree with elements initially?
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
What is the worst case time complexity of inserting elements into an empty linked list, if the linked list needs to be maintained in sorted order?
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
Consider a double hashing scheme in which the primary hash function is , and the secondary hash function is . Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value is \_\_\_\_\_\_\_.
In a balanced binary search tree with elements, what is the worst case time complexity of reporting all elements in range ? Assume that the number of reported elements is .
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is \_\_\_\_\_\_\_.
Consider the following statements:
I. The smallest element in a max-heap is always at a leaf node
II. The second largest element in a max-heap is always a child of the root node
III. A max-heap can be constructed from a binary search tree in time
IV. A binary search tree can be constructed from a max-heap in time
Which of the above statements are TRUE?- (a) I, II and III
- (b) I, II and IV
- (c) I, III and IV
- (d) II, III and IV
Show answer
(a) I, II and III
09Algorithms6 ch · 1 h 34 min55 PYQ
- Asymptotic analysis and recurrences 18′
- Searching and sorting 16′
- Divide and conquer 15′
- Greedy algorithms and minimum spanning trees 15′
- Dynamic programming 15′
- Graph traversal, shortest paths and NP-completeness basics 15′
See the 55 questions GATE Computer Science and IT (CS) asked from this module
Consider the following recurrence relations:
For all ,
Assume that for all , and .
Which one of the following options is correct?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider the following functions, where is a positive integer.
Which one of the following options lists the functions in increasing order of asymptotic growth rate?
Note: Assume the base of log to be 2.- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Which of the following can be recurrence relation(s) corresponding to an algorithm with time complexity ?
- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider an array . Suppose the merge sort algorithm is executed on array to sort it in increasing order. The merge sort algorithm will carry out a total of 7 merge operations.
A merge operation on sorted left array and sorted right array is said to be void if the output of the merge operation is the elements of array followed by the elements of array .
The number of void merge operations among these 7 merge operations is __________. (answer in integer)Let be a weighted directed acyclic graph with edges and vertices. Given and a source vertex in , which one of the following options gives the worst case time complexity of the fastest algorithm to find the lengths of shortest paths from to all vertices that are reachable from in ?
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider an array of integers of size . The indices of run from 1 to . An algorithm is to be designed to check whether satisfies the condition given below.
Which one of the following gives the worst case time complexity of the fastest algorithm that can be designed for the problem?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider a table , where the elements , , represent the cost of the optimal solutions of different subproblems of a problem that is being solved using a dynamic programming algorithm. The recursive formulation to compute the table entries is as follows:
Consider the following two algorithms to compute entries of . Assume that for both the algorithms, for all , has been initialized to 1.
```
Algorithm B1: For i = 1, 2, …, n
For j = 1, 2, …, n
T[i][j] = 2T[i − 1][j] + 3T[i][j − 1]
Algorithm B2: For s = 2, 3, …, 2n
For i = 1, 2, …, n
For j = 1, 2, …, n
If (i + j == s)
T[i][j] = 2T[i − 1][j] + 3T[i][j − 1]
```
Algorithm , is said to be correct if and only if it calculates the correct values of , for all , (as per the recursive formulation) at the end of the execution of the algorithm .
Which one of the following statements is true?- (a) Both algorithms and are correct
- (b) Algorithm is correct, but algorithm is incorrect
- (c) Algorithm is correct, but algorithm is incorrect
- (d) Both algorithms and are incorrect
Show answer
(a) Both algorithms and are correct
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
Show answer
(a) Only S1 is true
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
Show answer
()
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): Explore(G, v, t):
unmark all v ∈ V mark v
t ← 0 t ← t + 1
for each v ∈ V d[v] ← t
if v is unmarked for each (v, w) ∈ E
t ← Explore(G, v, t) if w is unmarked
end if t ← Explore(G, w, t)
end for end if
end for
t ← t + 1
f[v] ← t
return t
```
Suppose that the input directed graph is a directed acyclic graph (DAG).
For an edge , which of the following options will NEVER be correct?- (a)
- (b)
- (c)
- (d)
Show answer
()
Let be any undirected graph with positive edge weights, and be a minimum spanning tree of . For any two vertices, and , let and be the shortest distances between and in and , respectively. Which ONE of the options is CORRECT for all possible , , and ?
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Consider the following recurrence relation:
Which ONE of the following options is CORRECT?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider an unordered list of distinct integers.
What is the minimum number of element comparisons required to find an integer in the list that is NOT the largest in the list?- (a) 1
- (b)
- (c)
- (d)
Show answer
(a) 1
Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph G is/are TRUE?
- (a) A DFS tree of is a Shortest Path tree of .
- (b) Every non-tree edge of G with respect to a DFS tree is a forward/back edge.
- (c) If is a non-tree edge of G with respect to a BFS tree, then the distances from the source vertex to and in the BFS tree are within of each other.
- (d) Both BFS and DFS can be used to find the connected components of G.
Show answer
()
The pseudocode of a function fun() is given below:
```
fun(int A[0,…,n-1]){
for i=0 to n-2
for j=0 to n-i-2
if (A[j]>A[j+1])
then swap A[j] and A[j+1]
}
```
Let be an array storing 30 distinct integers in descending order. The number of swap operations that will be performed, if the function fun() is called with as argument, is __________. (Answer in integer)Let be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant is added to the weight of every edge.
Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in before and after the edge weight update?- (a) Every MST remains an MST, and every SP remains an SP.
- (b) MSTs need not remain MSTs, and every SP remains an SP.
- (c) Every MST remains an MST, and SPs need not remain SPs.
- (d) MSTs need not remain MSTs, and SPs need not remain SPs.
Show answer
(c) Every MST remains an MST, and SPs need not remain SPs.
An array of length with distinct elements is said to be bitonic if there is an index such that is sorted in the non-decreasing order and is sorted in the non-increasing order.
Which ONE of the following represents the best possible asymptotic bound for the worst-case number of comparisons by an algorithm that searches for an element in a bitonic array ?- (a)
- (b)
- (c)
- (d)
Show answer
(d)
Let be an undirected and unweighted graph with 100 vertices. Let denote the number of edges in a shortest path between vertices and in . Let the maximum value of , such that , be 30. Let be any breadth-first-search tree of . Which ONE of the given options is CORRECT for every such graph ?
- (a) The height of is exactly 15.
- (b) The height of is exactly 30.
- (c) The height of is at least 15.
- (d) The height of is at least 30.
Show answer
(c) The height of is at least 15.
Consider the following algorithm someAlgo that takes an undirected graph as input.
```
someAlgo(G)
1. Let v be any vertex in G. Run BFS on G starting at
v. Let u be a vertex in G at maximum distance from
v as given by the BFS.
2. Run BFS on G again with u as the starting vertex.
Let z be the vertex at maximum distance from u as
given by the BFS.
3. Output the distance between u and z in G.
```
The output of someAlgo() for the tree shown in the given figure is ___________. (Answer in integer)The maximum value of such that the edge between the nodes B and C is included in every minimum spanning tree of the given graph is _________ . (answer in integer)
Undirected graph on vertices A, B, C, D with edges: A–B weight 7, A–D weight 6, D–C weight 8, B–C weight , B–D weight 1, A–C weight 3.Let be the recurrence relation defined as follows:
Which one of the following statements is TRUE?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Given an integer array of size N, we want to check if the array is sorted (in either ascending or descending order). An algorithm solves this problem by making a single pass through the array and comparing each element of the array only with its adjacent elements. The worst-case time complexity of this algorithm is
- (a) both and
- (b) but not
- (c) but not
- (d) neither nor
Show answer
(a) both and
The number of spanning trees in a *complete* graph of 4 vertices labelled A, B, C, and D is _________
Let be an array containing integer values. The distance of is defined as the minimum number of elements in that must be replaced with another integer so that the resulting array is sorted in non-decreasing order. The distance of the array [2, 5, 3, 1, 4, 2, 6] is ___________
Consider the following recurrence relation:
Which one of the following options is CORRECT?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Let be a directed graph and a depth first search (DFS) spanning tree in that is rooted at a vertex . Suppose is also a breadth first search (BFS) tree in , rooted at . Which of the following statements is/are TRUE for every such graph and tree ?
- (a) There are no back-edges in with respect to the tree
- (b) There are no cross-edges in with respect to the tree
- (c) There are no forward-edges in with respect to the tree
- (d) The only edges in are the edges in
Show answer
(c) There are no forward-edges in with respect to the tree
Let be an undirected connected graph in which every edge has a positive integer weight. Suppose that every spanning tree in has even weight. Which of the following statements is/are TRUE for every such graph ?
- (a) All edges in have even weight
- (b) All edges in have even weight OR all edges in have odd weight
- (c) In each cycle in , all edges in have even weight
- (d) In each cycle in , either all edges in have even weight OR all edges in have odd weight
Show answer
(d) In each cycle in , either all edges in have even weight OR all edges in have odd weight
The number of distinct minimum-weight spanning trees of the following graph is _________ Undirected weighted graph on vertices a, b, c, d, e, f, g with edges: a–b 1, a–f 1, a–g 2, b–g 2, b–c 3, f–g 2, f–e 3, c–g 2, g–d 2, g–e 2, c–d 1, d–e 1.
The number of edges present in the forest generated by the DFS traversal of an undirected graph with 100 vertices is 40. The number of connected components in is _________
Let and be functions of natural numbers given by and .
Which of the following statements is/are TRUE?- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider functions Function_1 and Function_2 expressed in pseudocode as follows:
```
Function_1
while n > 1 do
for i = 1 to n do
x = x + 1;
end for
n = ⌊n/2⌋;
end while
Function_2
for i = 1 to 100 ∗ n do
x = x + 1;
end for
```
Let and denote the number of times the statement “” is executed in Function_1 and Function_2, respectively.
Which of the following statements is/are TRUE?- (a)
- (b)
- (c)
- (d)
Show answer
()
Let . Let denote the powerset of . Consider an undirected graph whose vertex set is . For any , is an edge in if and only if (i) , and (ii) either or . For any vertex in , the set of all possible orderings in which the vertices of can be visited in a Breadth First Search (BFS) starting from is denoted by .
If denotes the empty set, then the cardinality of is ____________.Which one of the following statements is TRUE for all positive functions ?
- (a) , when is a polynomial
- (b)
- (c) , when is an exponential function
- (d)
Show answer
(a) , when is a polynomial
Consider a simple undirected weighted graph , all of whose edge weights are distinct. Which of the following statements about the minimum spanning trees of is/are TRUE?
- (a) The edge with the second smallest weight is always part of any minimum spanning tree of .
- (b) One or both of the edges with the third smallest and the fourth smallest weights are part of any minimum spanning tree of .
- (c) Suppose be such that and . Consider the edge with the minimum weight such that one of its vertices is in and the other in . Such an edge will always be part of any minimum spanning tree of .
- (d) can have multiple minimum spanning trees.
Show answer
()
Let be a connected undirected weighted graph. Consider the following two statements.
: There exists a minimum weight edge in which is present in every minimum spanning tree of .
: If every edge in has distinct weight, then has a unique minimum spanning tree.
Which one of the following options is correct?- (a) Both and are true.
- (b) is true and is false.
- (c) is false and is true.
- (d) Both and are false.
Show answer
(c) is false and is true.
Let P be an array containing integers. Let be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum values in an arbitrary array of elements. Which one of the following choices is correct?
- (a)
- (b) and
- (c) and
- (d) and
Show answer
(c) and
Consider the following three functions.
Which one of the following options arranges the functions in the increasing order of asymptotic growth rate?- (a)
- (b)
- (c)
- (d)
Show answer
(d)
What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size ?
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
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 the above array in ascending order?
- (a) Selection sort
- (b) Mergesort
- (c) Insertion sort
- (d) Quicksort using the last element as pivot
Show answer
(c) Insertion sort
Consider the following undirected graph with edge weights as shown: [The graph is a 3 × 3 grid of vertices. Top row (left to right): edges of weight 0.1 and 0.1. Middle row: edges of weight 0.1 and 0.9. Bottom row: edges of weight 0.9 and 0.1. Vertical edges between the top and middle rows (left, centre, right): 0.9, 0.9, 0.9. Vertical edges between the middle and bottom rows (left, centre, right): 0.1, 0.1, 0.1.] The number of minimum-weight spanning trees of the graph is ______.
Consider the string **abbccddeee**. Each letter in the string must be assigned a binary code satisfying the following properties: 1. For any two letters, the code assigned to one letter must not be a prefix of the code assigned to the other letter. 2. For any two letters of the same frequency, the letter which occurs earlier in the dictionary order is assigned a code whose length is at most the length of the code assigned to the other letter. Among the set of all binary code assignments which satisfy the above two properties, what is the minimum length of the encoded string?
- (a) 21
- (b) 23
- (c) 25
- (d) 30
Show answer
(b) 23
Consider the following recurrence relation.
Which one of the following options is correct?- (a)
- (b)
- (c)
- (d)
Show answer
(c)
For constants and , consider the following recurrence defined on the non-negative integers:
Which one of the following options is correct about the recurrence ?- (a) If is , then is .
- (b) If is , then is .
- (c) If is for some , then is .
- (d) If is , then is .
Show answer
(c) If is for some , then is .
Define to be the maximum amount earned by cutting a rod of length meters into one or more pieces of integer length and selling them. For , let denote the selling price of a rod whose length is 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 ?- (a)
- (b)
- (c) is achieved by three different solutions.
- (d) cannot be achieved by a solution consisting of three pieces.
Show answer
()
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 be a DFS tree obtained by doing DFS in a connected undirected graph .
Which of the following options is/are correct?- (a) Root of can never be an articulation point in .
- (b) Root of is an articulation point in if and only if it has 2 or more children.
- (c) A leaf of can be an articulation point in .
- (d) If is an articulation point in such that is an ancestor of in and is a descendent of in , then all paths from to in must pass through .
Show answer
(b) Root of is an articulation point in if and only if it has 2 or more children.
Consider the following directed graph: Which of the following is/are correct about the graph?
- (a) The graph does not have a topological order.
- (b) A depth-first traversal starting at vertex S classifies three directed edges as back edges.
- (c) The graph does not have a strongly connected component.
- (d) For each pair of vertices and , there is a directed path from to .
Show answer
()
In a directed acyclic graph with a source vertex s, the *quality-score* of a directed path is defined to be the product of the weights of the edges on the path. Further, for a vertex other than s, the quality-score of is defined to be the maximum among the quality-scores of all the paths from s to . The quality-score of s is assumed to be 1.
The sum of the quality-scores of all the vertices in the graph shown above is __________.For parameters and , both of which are , , and . Then is
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Let be a weighted undirected graph and let be a Minimum Spanning Tree (MST) of maintained using adjacency lists. Suppose a new weighted edge is added to . The worst case time complexity of determining if is still an MST of the resultant graph is
- (a)
- (b)
- (c)
- (d)
Show answer
(d)
Let be a directed, weighted graph with weight function . For some function , for each edge , define as .
Which one of the options completes the following sentence so that it is TRUE?
"The shortest paths in under are shortest paths under too, \_\_\_\_\_\_\_\_".- (a) for every
- (b) if and only if , is positive
- (c) if and only if , is negative
- (d) if and only if is the distance from to in the graph obtained by adding a new vertex to and edges of zero weight from to every vertex of
Show answer
(a) for every
Consider a graph , where , , and weight of the edge is . The weight of minimum spanning tree of is \_\_\_\_\_\_\_\_.
An array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is ________.
Consider a sequence of 14 elements: A = [−5, −10, 6, 3, −1, −2, 13, 4, −9, −1, 4, 12, −3, 0]. The subsequence sum . Determine the maximum of , where . (Divide and conquer approach may be used.)
Answer: ________.There are unsorted arrays: . Assume that is odd. Each of contains distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of is
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
Let be any connected, weighted, undirected graph.
I. has a unique minimum spanning tree, if no two edges of have the same weight.
II. has a unique minimum spanning tree, if, for every cut of , there is a unique minimum-weight edge crossing the cut.
Which of the above two statements is/are TRUE?- (a) I only
- (b) II only
- (c) Both I and II
- (d) Neither I nor II
Show answer
(c) Both I and II
10Theory of computation4 ch · 1 h 1 min58 PYQ
- Regular expressions and finite automata 17′
- Regular languages and the pumping lemma 14′
- Context-free grammars and pushdown automata 15′
- Turing machines and undecidability 15′
See the 58 questions GATE Computer Science and IT (CS) asked from this module
Which one of the following statements is equivalent to the following assertion?
- (a) Turing machine halts on all input strings in
- (b) Turing machine accepts all input strings in
- (c) Turing machine rejects all input strings in
- (d) Turing machine accepts all input strings in and rejects all input strings in
Show answer
(d) Turing machine accepts all input strings in and rejects all input strings in
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
Show answer
()
Let M 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
Show answer
()
Which of the following grammars is/are ambiguous?
- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider the following two finite automata and .
: states ; is the start state and the only accepting state. Transitions: , , , , , , , , .
: states ; is the start state and the only accepting state. Transitions: , , , , , , , .
Which of the following statements is/are true?- (a)
- (b) is a proper subset of
- (c)
- (d) consists of all strings in whose length is divisible by 3
Show answer
()
Let and let .
Which of the following constraints ensure(s) that the language is context-free?- (a)
- (b)
- (c)
- (d)
Show answer
()
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
Show answer
(c) is context-free
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 ,
Show answer
()
Consider the following context-free grammar , where , , and are the variables (non-terminals), and are the terminal symbols, is the start variable, and the rules of are described as:
Which ONE of the languages is accepted by ?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Which ONE of the following languages is accepted by a deterministic pushdown automaton?
- (a) Any regular language.
- (b) Any context-free language.
- (c) Any language accepted by a non-deterministic pushdown automaton.
- (d) Any decidable language.
Show answer
(a) Any regular language.
Let , be Context Free Grammars (CFGs) and be a regular expression. For a grammar , let denote the language generated by .
Which ONE among the following questions is decidable?- (a) Is ?
- (b) Is ?
- (c) Is ?
- (d) Is ?
Show answer
(d) Is ?
A regular language is accepted by a non-deterministic finite automaton (NFA) with states. Which of the following statement(s) is/are FALSE?
- (a) may have an accepting NFA with states.
- (b) may have an accepting DFA with states.
- (c) There exists a DFA with states that accepts .
- (d) Every DFA that accepts has states.
Show answer
(d) Every DFA that accepts has states.
Consider the two lists List I and List II given below: | List I | List II | |---|---| | (i) Context free languages | (a) Closed under union | | (ii) Recursive languages | (b) Not closed under complementation | | (iii) Regular languages | (c) Closed under intersection | For matching of items in List I with those in List II, which of the following option(s) is/are CORRECT?
- (a) (i) – (a), (ii) – (b), and (iii) – (c)
- (b) (i) – (b), (ii) – (a), and (iii) – (c)
- (c) (i) – (b), (ii) – (c), and (iii) – (a)
- (d) (i) – (a), (ii) – (c), and (iii) – (b)
Show answer
()
Consider the following two languages over the alphabet :
Which ONE of the following statements is CORRECT?- (a) Both and are regular languages.
- (b) is a regular language but is not a regular language.
- (c) is not a regular language but is a regular language.
- (d) Neither nor is a regular language.
Show answer
(c) is not a regular language but is a regular language.
Consider the following two languages over the alphabet , where and are natural numbers.
Which ONE of the following statements is CORRECT?- (a) Both and are context-free languages.
- (b) is a context-free language but is not a context-free language.
- (c) is not a context-free language but is a context-free language.
- (d) Neither nor are context-free languages.
Show answer
(c) is not a context-free language but is a context-free language.
Consider the following deterministic finite automaton (DFA) defined over the alphabet, . Identify which of the following language(s) is/are accepted by the given DFA.
DFA with four states drawn left to right (numbered here to ); is the start state and is the only accepting state:
| State | | |
|---|---|---|
| | | |
| | | |
| | | |
| | | |- (a) The set of all strings containing an even number of ’s.
- (b) The set of all strings containing the pattern .
- (c) The set of all strings ending with the pattern .
- (d) The set of all strings not containing the pattern .
Show answer
(c) The set of all strings ending with the pattern .
Let . For , and , let denote the number of occurrences of in .
Which one or more of the following option(s) define(s) regular language(s)?- (a)
- (b)
- (c)
- (d)
Show answer
()
Let . For , let be the product of symbols in modulo 7. We take , where is the null string.
For example, .
Define .
The number of states in a minimum state DFA for is ___________. (Answer in integer)Which one of the following regular expressions is equivalent to the language accepted by the DFA given below?
DFA with two states: the start state (non-accepting) and the accepting state .
| State | on 0 | on 1 |
|---|---|---|
| | | |
| | | |- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Let be two regular languages and a language which is not regular. Which of the following statements is/are *always* TRUE?
- (a) if and only if
- (b) is not regular
- (c) is not regular
- (d) is regular
Show answer
()
Let be the 5-state NFA with -transitions shown in the diagram below.
States 1 to 5; state 1 is the start state; states 2 and 5 are accepting. Transitions: , , , , , , .
Which one of the following regular expressions represents the language accepted by ?- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Consider the 5-state DFA accepting the language shown below. For any string let be the number of in and be the number of in .
Transition table of (state 1 is the start state and the only accepting state):
| State | on 0 | on 1 |
|---|---|---|
| →*1 | 2 | 4 |
| 2 | 3 | 1 |
| 3 | 1 | 2 |
| 4 | 1 | 5 |
| 5 | 4 | 1 |
Which of the following statements is/are FALSE?- (a) States 2 and 4 are distinguishable in
- (b) States 3 and 4 are distinguishable in
- (c) States 2 and 5 are distinguishable in
- (d) Any string with is in
Show answer
()
Consider a context-free grammar with the following 3 rules.
Let . Let denote the number of times occur in , respectively. Which of the following statements is/are TRUE?- (a)
- (b)
- (c)
- (d)
Show answer
()
Let be a context-free grammar in Chomsky Normal Form with and containing 10 variable symbols including the start symbol . The string is derivable from . The number of steps (application of rules) in the derivation is _________
Consider the following two regular expressions over the alphabet :
The total number of strings of length less than or equal to 5, which are neither in nor in , is _________Let be the language represented by the regular expression and , where denotes the length of string . The number of strings in which are also in is ___________
Consider the Deterministic Finite-state Automaton (DFA) shown below. The DFA runs on the alphabet , and has the set of states , with being the start state and being the only final state.
| State | on 0 | on 1 |
|---|---|---|
| | | |
| (final) | | |
| | | |
| | | |
Which one of the following regular expressions correctly describes the language accepted by ?- (a)
- (b)
- (c)
- (d)
Show answer
(c)
Which of the following statements is/are CORRECT?
- (a) The intersection of two regular languages is regular.
- (b) The intersection of two context-free languages is context-free.
- (c) The intersection of two recursive languages is recursive.
- (d) The intersection of two recursively enumerable languages is recursively enumerable.
Show answer
()
Consider the context-free grammar below
where and are non-terminals, and and are terminal symbols. The starting non-terminal is .
Which one of the following statements is CORRECT?- (a) The language generated by is
- (b) The language generated by is
- (c) The language generated by is
- (d) The language generated by is not a regular language
Show answer
(b) The language generated by is
Consider the pushdown automaton (PDA) below, which runs on the input alphabet , has stack alphabet , and has three states , with being the start state. A transition from state to state , labelled , where is an input symbol or , is a stack symbol, and is a string of stack symbols, represents the fact that in state , the PDA can read from the input, with on the top of its stack, pop from the stack, push in the string on the stack, and go to state . In the initial configuration, the stack has only the symbol in it. The PDA accepts by empty stack.
The transitions of are:
- : and
- :
- :
- :
- :
- : and
Which one of the following options correctly describes the language accepted by ?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider the language over the alphabet , given below:
The minimum number of states in a Deterministic Finite-State Automaton (DFA) for is ____________.Which one of the following regular expressions correctly represents the language of the finite automaton given below?
The automaton has three states: the start state (not accepting) and two accepting states and . Transitions: , (self-loop), ; , (self-loop), .- (a)
- (b)
- (c)
- (d)
Show answer
(d)
Which of the following statements is/are TRUE?
- (a) Every subset of a recursively enumerable language is recursive.
- (b) If a language and its complement are both recursively enumerable, then must be recursive.
- (c) Complement of a context-free language must be recursive.
- (d) If and are regular, then must be deterministic context-free.
Show answer
()
Which of the following is/are undecidable?
- (a) Given two Turing machines and , decide if .
- (b) Given a Turing machine , decide if is regular.
- (c) Given a Turing machine , decide if accepts all strings.
- (d) Given a Turing machine , decide if takes more than 1073 steps on every string.
Show answer
()
Consider the following languages:
Note that is the reversal of the string . Which of the following is/are TRUE?- (a) and are regular.
- (b) and are context-free.
- (c) is regular and is context-free.
- (d) and are context-free but not regular.
Show answer
()
Consider the following languages:
Which of the following statements is/are FALSE?- (a) is not context-free but and are deterministic context-free.
- (b) Neither nor is context-free.
- (c) , and all are context-free.
- (d) Neither nor its complement is context-free.
Show answer
()
Suppose that is a regular language and is a context-free language. Which one of the following languages is NOT necessarily context-free?
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
Let be an arbitrary regular language accepted by a minimal DFA with states. Which one of the following languages must necessarily be accepted by a minimal DFA with states?
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
Let denote an encoding of an automaton . Suppose that . Which of the following languages is/are NOT recursive?
- (a)
- (b)
- (c)
- (d)
Show answer
(d)
Let be a regular language and be a context-free language. Which of the following languages is/are context-free?
- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider the following deterministic finite automaton (DFA). The number of strings of length 8 accepted by the above automaton is __________.
Consider the following two statements about regular languages:
: Every infinite regular language contains an undecidable language as a subset.
: Every finite language is regular.
Which one of the following choices is correct?- (a) Only is true.
- (b) Only is true.
- (c) Both and are true.
- (d) Neither nor is true.
Show answer
(c) Both and are true.
Consider the following language.
Which one of the following deterministic finite automata accepts ?
[In every option the DFA has four states drawn left to right, here called (start), , and (the only accepting state). In all four, , , , , and . The options differ only in the transitions out of .]- (a) ,
- (b)
- (c) ,
- (d) ,
Show answer
(d) ,
For a Turing machine , denotes an encoding of . Consider the following two languages.
Which one of the following options is correct?- (a) Both and are decidable.
- (b) is decidable and is undecidable.
- (c) is undecidable and is decidable.
- (d) Both and are undecidable.
Show answer
(a) Both and are decidable.
For a string , we define to be the reverse of . For example, if then .
Which of the following languages is/are context-free?- (a)
- (b)
- (c)
- (d)
Show answer
()
Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string is divisible by three.
- (a)
- (b)
- (c)
- (d)
Show answer
()
In a pushdown automaton , a transition of the form,
where , , and , represents
Consider the following pushdown automaton over the input alphabet and stack alphabet .
[States (start), , , (accepting). Transitions: ; loop on labelled ; ; loop on labelled ; .]
The number of strings of length 100 accepted by the above pushdown automaton is ______.Which one of the following regular expressions represents the set of all binary strings with an odd number of 1's?
- (a)
- (b)
- (c)
- (d)
Consider the following statements.
I. If is regular, then both and must be regular.
II. The class of regular languages is closed under infinite union.
Which of the above statements is/are TRUE?- (a) I only
- (b) II only
- (c) Both I and II
- (d) Neither I nor II
Show answer
(d) Neither I nor II
Consider the language and the following statements.
I. is deterministic context-free.
II. is context-free but not deterministic context-free.
III. is not LL() for any .
Which of the above statements is/are TRUE?- (a) I only
- (b) II only
- (c) I and III only
- (d) III only
Show answer
(c) I and III only
Which of the following languages are undecidable? Note that indicates encoding of the Turing machine M.
- (a) , , and only
- (b) and only
- (c) and only
- (d) , , and only
Show answer
(a) , , and only
Consider the following languages.
Which one of the following is TRUE?- (a) is regular and is context-free.
- (b) is context-free but not regular and is context-free.
- (c) Neither nor is context-free.
- (d) is context-free but is not context-free.
Show answer
(a) is regular and is context-free.
Consider the following language.
The minimum number of states in a DFA that accepts is \_\_\_\_\_\_.If is a regular language over , which one of the following languages is NOT regular ?
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
For , let us consider the regular language . Which one of the following can be a pumping length (the constant guaranteed by the pumping lemma) for ?
- (a) 3
- (b) 5
- (c) 9
- (d) 24
Show answer
(d) 24
Which one of the following languages over is NOT context-free?
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
Consider the following sets: S1. Set of all recursively enumerable languages over the alphabet {0,1} S2. Set of all syntactically valid C programs S3. Set of all languages over the alphabet {0,1} S4. Set of all non-regular languages over the alphabet {0,1} Which of the above sets are uncountable?
- (a) S1 and S2
- (b) S3 and S4
- (c) S2 and S3
- (d) S1 and S4
Show answer
(b) S3 and S4
Let be the set of all bijections from to , where denotes the identity function, i.e. . Let denote composition on functions. For a string , , let . Consider the language . The minimum number of states in any DFA accepting is ________.
11Compiler design4 ch · 1 h 7 min50 PYQ
- Lexical analysis 16′
- Parsing: top-down and bottom-up 18′
- Syntax-directed translation and intermediate code 15′
- Runtime environments and optimisation 18′
See the 50 questions GATE Computer Science and IT (CS) asked from this module
In C runtime environment, which one of the following is stored in heap?
- (a) A static variable declared inside a function
- (b) An array of integers declared inside a function
- (c) A dynamically allocated array of integers created using malloc() function call
- (d) Return address of a function
Show answer
(c) A dynamically allocated array of integers created using malloc() function call
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
Show answer
(c) S1 has a lexical error and S3 has a semantic error
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
Show answer
(c) For a grammar to be LL(1), it must be left-factored
A lexical analyzer uses the following token definitions
For the string given below,
the number of tokens (excluding ) that will be produced by the lexical analyzer is __________. (answer in integer)Consider the canonical parsing of the grammar below using terminals and non-terminals with as the start symbol.
Which one of the following options gives the number of shift-reduce conflicts that will occur in the ACTION table?- (a) 2
- (b) 3
- (c) 4
- (d) 5
Show answer
(d) 5
Consider the control flow graph shown in the figure.
(ENTRY → B1; B1 → B2 and B1 → B3; B2 → B4 and B3 → B4; B4 → B5; B5 → EXIT)
| Block | Statements |
|---|---|
| B1 | |
| B2 | ; ; |
| B3 | ; |
| B4 | ; |
| B5 | |
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.- (a) B4:
B5: - (b) B4:
B5: - (c) B4:
B5: - (d) B4:
B5:
Show answer
(d) B4:
B5:- (a) B4:
Consider the control flow graph given below. Control flow graph: ENTRY → B1; B1: a = b + c; B1 → B2 and B1 → B3; B2: d = a + e; B2 → B4; B3: e = a + f; B3 → B1; B4: g = d + e; B4 → EXIT. Which one of the following options is the set of live variables at the exit point of each basic block?
- (a) B1:{a, b, c, e, f}, B2:{d, e}, B3:{b, c, e, f}, B4:∅
- (b) B1:∅, B2:{d, e}, B3:{a, c, f}, B4:∅
- (c) B1:{a, b, c, e, f}, B2:{d, e}, B3:{c, e, f}, B4:∅
- (d) B1:∅, B2:{d, e, f}, B3:{a, b, c, e, f}, B4:∅
Show answer
(a) B1:{a, b, c, e, f}, B2:{d, e}, B3:{b, c, e, f}, B4:∅
Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations.
SDD1
| Grammar (G1) | Semantic Rules |
|---|---|
| | ; |
| | |
| | |
| | ; |
| | |
SDD2
| Grammar (G2) | Semantic Rules |
|---|---|
| | ; |
| | ; |
| | |
| | |
is the start symbol, and , and 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 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?- (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
Show answer
()
Which ONE of the following statements is FALSE regarding the symbol table?
- (a) Symbol table is responsible for keeping track of the scope of variables.
- (b) Symbol table can be implemented using a binary search tree.
- (c) Symbol table is not required after the parsing phase.
- (d) Symbol table is created during the lexical analysis phase.
Show answer
(c) Symbol table is not required after the parsing phase.
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
- (a) Run-time function call management
- (b) Register assignment to variables
- (c) Strength reduction
- (d) Constant folding
Show answer
(b) Register assignment to variables
Consider the following statements about the use of backpatching in a compiler for intermediate code generation: (I) Backpatching can be used to generate code for Boolean expression in one pass. (II) Backpatching can be used to generate code for flow-of-control statements in one pass. Which ONE of the following options is CORRECT?
- (a) Only (I) is correct.
- (b) Only (II) is correct.
- (c) Both (I) and (II) are correct.
- (d) Neither (I) nor (II) is correct.
Show answer
(c) Both (I) and (II) are correct.
Given the following syntax directed translation rules:
Rule 1:
Rule 2:
Rule 3:
Which ONE is the CORRECT option among the following?- (a) Rule 1 is S-attributed and L-attributed; Rule 2 is S-attributed and not L-attributed; Rule 3 is neither S-attributed nor L-attributed
- (b) Rule 1 is neither S-attributed nor L-attributed; Rule 2 is S-attributed and L-attributed; Rule 3 is S-attributed and L-attributed
- (c) Rule 1 is neither S-attributed nor L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed
- (d) Rule 1 is S-attributed and not L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed
Show answer
(c) Rule 1 is neither S-attributed nor L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed
Given a Context-Free Grammar as follows:
Which ONE of the following statements is TRUE?- (a) is neither LALR(1) nor SLR(1)
- (b) is CLR(1), not LALR(1)
- (c) is LALR(1), not SLR(1)
- (d) is LALR(1), also SLR(1)
Show answer
(c) is LALR(1), not SLR(1)
Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
- (a) For a production , will be added to .
- (b) If there is any input right end marker, it will be added to , where is the start symbol.
- (c) For a production , will be added to .
- (d) If there is any input right end marker, it will be added to , where is the start symbol.
Show answer
()
Consider two grammars and with the production rules given below:
:
:
where , , , , , are the terminals.
Which of the following option(s) is/are CORRECT?- (a) is not and is .
- (b) is and is not .
- (c) and are not .
- (d) and are ambiguous.
Show answer
()
Refer to the given 3-address code sequence. This code sequence is split into basic blocks. The number of basic blocks is ________. (Answer in integer) ``` 1001: i = 1 1002: j = 1 1003: t1 = 10*i 1004: t2 = t1+j 1005: t3 = 8*t2 1006: t4 = t3-88 1007: a[t4] = 0.0 1008: j = j+1 1009: if j <= 10 goto 1003 1010: i = i+1 1011: if i <= 10 goto 1002 1012: i = 1 1013: t5 = i-1 1014: t6 = 88*t5 1015: a[t6] = 1.0 1016: i = i+1 1017: if i <= 10 goto 1013 ```
Consider the following two sets: | Set X | Set Y | |---|---| | P. Lexical Analyzer | 1. Abstract Syntax Tree | | Q. Syntax Analyzer | 2. Token | | R. Intermediate Code Generator | 3. Parse Tree | | S. Code Optimizer | 4. Constant Folding | Which one of the following options is the CORRECT match from Set X to Set Y ?
- (a) P – 4; Q – 1; R – 3; S – 2
- (b) P – 2; Q – 3; R – 1; S – 4
- (c) P – 2; Q – 1; R – 3; S – 4
- (d) P – 4; Q – 3; R – 2; S – 1
Show answer
(b) P – 2; Q – 3; R – 1; S – 4
Which of the following is/are Bottom-Up Parser(s)?
- (a) Shift-reduce Parser
- (b) Predictive Parser
- (c) LL(1) Parser
- (d) LR Parser
Show answer
()
Which of the following statements is/are FALSE?
- (a) An attribute grammar is a syntax-directed definition (SDD) in which the functions in the semantic rules have no side effects
- (b) The attributes in a L-attributed definition cannot always be evaluated in a depth-first order
- (c) Synthesized attributes can be evaluated by a bottom-up parser as the input is parsed
- (d) All L-attributed definitions based on LR(1) grammar can be evaluated using a bottom-up parsing strategy
Show answer
()
Consider the following syntax-directed definition (SDD).
| Production | Semantic rule |
|---|---|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
Given "MMLK" as the input, which one of the following options is the CORRECT value computed by the SDD (in the attribute )?- (a) 45
- (b) 50
- (c) 55
- (d) 65
Show answer
(a) 45
Consider the following grammar , with as the start symbol. The grammar has three incomplete productions denoted by (1), (2), and (3).
The set of terminals is . The FIRST and FOLLOW sets of the different non-terminals are as follows.
FIRST$(S) = \{c, d, f\}(T) = \{a, b, \epsilon\}(R) = \{c, \epsilon\}$
FOLLOW$(S)$ = FOLLOW$(T) = \{c, f, \$\}(R) = \{f\}$
Which one of the following options CORRECTLY fills in the incomplete productions?- (a) (1) (2) (3)
- (b) (1) (2) (3)
- (c) (1) (2) (3)
- (d) (1) (2) (3)
Show answer
(a) (1) (2) (3)
Consider the following pseudo-code. ``` L1: t1 = -1 L2: t2 = 0 L3: t3 = 0 L4: t4 = 4 * t3 L5: t5 = 4 * t2 L6: t6 = t5 * M L7: t7 = t4 + t6 L8: t8 = a[t7] L9: if t8 <= max goto L11 L10: t1 = t8 L11: t3 = t3 + 1 L12: if t3 < M goto L4 L13: t2 = t2 + 1 L14: if t2 < N goto L3 L15: max = t1 ``` Which one of the following options CORRECTLY specifies the number of basic blocks and the number of instructions in the largest basic block, respectively ?
- (a) 6 and 6
- (b) 6 and 7
- (c) 7 and 7
- (d) 7 and 6
Show answer
(d) 7 and 6
Consider the following context-free grammar where the start symbol is and the set of terminals is .
The following is a partially-filled LL(1) parsing table.
| | | | | | |
|---|---|---|---|---|---|
| | | | (1) | (2) | |
| | | (3) | | | |
| | (4) | | | | |
Which one of the following options represents the CORRECT combination for the numbered cells in the parsing table?
Note: In the options, “blank” denotes that the corresponding cell is empty.- (a) (1) (2) (3) (4)
- (b) (1) (2) (3) (4)
- (c) (1) (2) (3) blank (4) blank
- (d) (1) (2) (3) blank (4) blank
Show answer
(a) (1) (2) (3) (4)
Consider the following expression: . The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6).
| | op | arg1 | arg2 |
|---|---|---|---|
| (0) | + | | |
| (1) | | | |
| (2) | uminus | (1) | |
| (3) | | | |
| (4) | / | | |
| (5) | + | (3) | (4) |
| (6) | | | |
| (7) | = | (6) | (5) |
Which one of the following options fills in the missing entries CORRECTLY?- (a) (1) =[] (3) * (0) (2) (6) []=
- (b) (1) []= (3) – (0) (2) (6) =[] (5)
- (c) (1) =[] (3) * (0) (2) (6) []= (5)
- (d) (1) []= (3) – (0) (2) (6) =[]
Show answer
(a) (1) =[] (3) * (0) (2) (6) []=
Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is
Let . The number of items in the set is ___________Consider the following statements regarding the front-end and back-end of a compiler. **S1**: The front-end includes phases that are independent of the target hardware. **S2**: The back-end includes phases that are specific to the target hardware. **S3**: The back-end includes phases that are specific to the programming language used in the source code. Identify the CORRECT option.
- (a) Only **S1** is TRUE.
- (b) Only **S1** and **S2** are TRUE.
- (c) **S1**, **S2**, and **S3** are all TRUE.
- (d) Only **S1** and **S3** are TRUE.
Show answer
(b) Only **S1** and **S2** are TRUE.
Consider the following definition of a lexical token id for an identifier in a programming language, using extended regular expressions:
Which one of the following Non-deterministic Finite-state Automata with -transitions accepts the set of valid identifiers? (A double-circle denotes a final state)- (a) NFA: start final state ; also start ; has a self-loop on letter, digit.
- (b) NFA: start final state ; final state with a self-loop on letter; final state with a self-loop on digit.
- (c) NFA: start final state ; ; ; .
- (d) NFA: start final state ; ; .
Show answer
(c) NFA: start final state ; ; ; .
Consider the following program: ```c int main() { f1(); f2(2); f3(); return(0); } int f1() { return(1); } int f2(int X) { f3(); if (X==1) return f1(); else return (X*f2(X-1)); } int f3() { return(5); } ``` Which one of the following options represents the activation tree corresponding to the main function?
- (a) main has children f1, f2, f3; that f2 has children f3, f2; the inner f2 has children f3, f1
- (b) main has children f1, f2, f3; that f2 has children f3, f1
- (c) main has child f1; f1 has child f2; f2 has children f3, f1
- (d) main has children f1, f2, f3; that f2 has children f3, f2, f1
Show answer
(a) main has children f1, f2, f3; that f2 has children f3, f2; the inner f2 has children f3, f1
Consider the control flow graph shown. The graph has basic blocks: - B1: `i = m - 1`, `j = n`, `a = 10` - B2: `i = i + 1`, `j = j - 1` - B3: `a = 20` - B4: `i = a + 1` Edges: ENTRY → B1, B1 → B2, B2 → B3, B2 → B4, B3 → B4, B4 → B2, B4 → EXIT. Which one of the following choices correctly lists the set of *live* variables at the exit point of each basic block?
- (a) B1: {}, B2: {a}, B3: {a}, B4: {a}
- (b) B1: {i, j}, B2: {a}, B3: {a}, B4: {i}
- (c) B1: {a, i, j}, B2: {a, i, j}, B3: {a, i}, B4: {a}
- (d) B1: {a, i, j}, B2: {a, j}, B3: {a, j}, B4: {a, i, j}
Show answer
(d) B1: {a, i, j}, B2: {a, j}, B3: {a, j}, B4: {a, i, j}
Consider the syntax directed translation given by the following grammar and semantic rules. Here , , and are non-terminals. is the starting non-terminal, and #, 0 and 1 are lexical tokens corresponding to input letters “#”, “0” and “1”, respectively. denotes the synthesized attribute (a numeric value) associated with a non-terminal . and denote occurrences of and on the right hand side of a production, respectively. For the tokens 0 and 1, and .
| Production | Semantic rule |
|---|---|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
The value computed by the translation scheme for the input string
is ____________. (Rounded off to three decimal places)Which one of the following statements is TRUE?
- (a) The parser for a grammar cannot have reduce-reduce conflict if the parser for does not have reduce-reduce conflict.
- (b) Symbol table is accessed only during the lexical analysis phase.
- (c) Data flow analysis is necessary for run-time memory management.
- (d) parsing is sufficient for deterministic context-free languages.
Show answer
(d) parsing is sufficient for deterministic context-free languages.
Consider the augmented grammar with as the set of terminals.
If is the set of two items , then contains exactly __________ items.Consider the following grammar along with translation rules.
Here and are operators and is a token that represents an integer and represents the corresponding integer value. The set of non-terminals is and a subscripted non-terminal indicates an instance of the non-terminal.
Using this translation scheme, the computed value of for root of the parse tree for the expression is _____________.Consider the following ANSI C program: ``` int main() { Integer x; return 0; } ``` Which one of the following phases in a seven-phase C compiler will throw an error?
- (a) Lexical analyzer
- (b) Syntax analyzer
- (c) Semantic analyzer
- (d) Machine dependent optimizer
Show answer
(c) Semantic analyzer
Consider the following statements.
: The sequence of procedure calls corresponds to a preorder traversal of the activation tree.
: The sequence of procedure returns corresponds to a postorder traversal of the activation tree.
Which one of the following options is correct?- (a) is true and is false
- (b) is false and is true
- (c) is true and is true
- (d) is false and is false
Show answer
(c) is true and is true
Consider the following statements.
: Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1).
: For any context-free grammar, there is a parser that takes at most time to parse a string of length .
Which one of the following options is correct?- (a) is true and is false
- (b) is false and is true
- (c) is true and is true
- (d) is false and is false
Show answer
(c) is true and is true
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?
- (a) Three address code
- (b) Abstract Syntax Tree (AST)
- (c) Control Flow Graph (CFG)
- (d) Symbol table
Show answer
(d) Symbol table
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:
`int ID` {record that ID.lexeme is of type `int`}
`bool ID` {record that ID.lexeme is of type `bool`}
{check that .type .type `int`; set .type := `int`}
{check that .type `bool`; set .type := `bool`}
`ID` {set .type := `int`}
With respect to the above grammar, which one of the following choices is correct?- (a) The actions can be used to correctly type-check any syntactically correct program.
- (b) The actions can be used to type-check syntactically correct integer variable declarations and integer expressions.
- (c) The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions.
- (d) The actions will lead to an infinite loop.
Show answer
(b) The actions can be used to type-check syntactically correct integer variable declarations and integer expressions.
Consider the following ANSI C code segment: ``` z = x + 3 + y->f1 + y->f2; for (i = 0; i < 200; i = i + 2){ if (z > i) { p = p + x + 3; q = q + y->f1; } else { p = p + y->f2; q = q + x + 3; } } ``` Assume that the variable y points to a struct (allocated on the heap) containing two fields f1 and f2, and the local variables x, y, z, p, q, and i are allotted registers. Common sub-expression elimination (CSE) optimization is applied on the code. The number of addition and dereference operations (of the form y->f1 or y->f2 ) in the optimized code, respectively, are:
- (a) 403 and 102
- (b) 203 and 2
- (c) 303 and 102
- (d) 303 and 2
Show answer
(d) 303 and 2
Consider the following context-free grammar where the set of terminals is .
The following is a partially-filled LL(1) parsing table.
| | | | | | | \$ |
|---|---|---|---|---|---|---|
| S | | | ① | | ② | |
| T | | | ③ | | | ④ |
| R | | | | | | |
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)?- (a) ① ② ③ ④
- (b) ① blank ② ③ ④
- (c) ① ② blank ③ blank ④
- (d) ① blank ② ③ blank ④ blank
Show answer
(a) ① ② ③ ④
For a statement in a program, in the context of liveness analysis, the following sets are defined:
: the set of variables used in
: the set of variables that are live at the entry of
: the set of variables that are live at the exit of
Consider a basic block that consists of two statements, followed by . Which one of the following statements is correct?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider the following C code segment: ```c 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 in the DAG is ______.
Consider the following augmented grammar with as the set of terminals.
Let . The number of items in the set is __________.Consider the following statements. I. Symbol table is accessed only during lexical analysis and syntax analysis. II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment. III. Errors violating the condition *'any variable must be declared before its use'* are detected during syntax analysis. Which of the above statements is/are TRUE?
- (a) I only
- (b) I and III only
- (c) II only
- (d) None of I, II, and III
Show answer
(d) None of I, II, and III
Consider the following grammar.
The number of reduction steps taken by a bottom-up parser while accepting the string is \_\_\_\_\_\_\_.Consider the productions A PQ and A XY. Each of the five non-terminals A, P, Q, X, and Y has two attributes: is a synthesized attribute, and is an inherited attribute. Consider the following rules.
Rule 1: P. = A. + 2, Q. = P. + A., and A. = P. + Q.
Rule 2: X. = A. + Y. and Y. = X. + A.
Which one of the following is TRUE?- (a) Both Rule 1 and Rule 2 are L-attributed.
- (b) Only Rule 1 is L-attributed.
- (c) Only Rule 2 is L-attributed.
- (d) Neither Rule 1 nor Rule 2 is L-attributed.
Show answer
(b) Only Rule 1 is L-attributed.
Which one of the following kinds of derivation is used by LR parsers?
- (a) Leftmost
- (b) Leftmost in reverse
- (c) Rightmost
- (d) Rightmost in reverse
Show answer
(d) Rightmost in reverse
Consider the grammar given below:
Let a, b, d, and \$ be indexed as follows:
| a | b | d | \$ |
|---|---|---|---|
| 3 | 2 | 1 | 0 |
Compute the FOLLOW set of the non-terminal B and write the index values for the symbols in the FOLLOW set in the descending order. (For example, if the FOLLOW set is {a, b, d, \$}, then the answer should be 3210)
Answer: ________.Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let , , , , , and be the placeholders for the non-terminals D, T, L or in the following table:
| Production rule | Semantic action |
|---|---|
| | .type = .type |
| | T.type = int |
| | T.type = float |
| | .type = .type <br> addType(id.entry, .type) |
| | addType(id.entry, .type) |
Which one of the following are the appropriate choices for , , and ?- (a) , , ,
- (b) , , ,
- (c) , , ,
- (d) , , ,
Show answer
(a) , , ,
Consider the augmented grammar given below:
Let . The number of items in the set is: ________.
12Operating systems6 ch · 1 h 28 min65 PYQ
- System calls, processes and threads 13′
- CPU scheduling 14′
- Synchronisation and inter-process communication 14′
- Deadlock 14′
- Memory management and virtual memory 17′
- File systems and disk scheduling 16′
See the 65 questions GATE Computer Science and IT (CS) asked from this module
Which one of the following CPU scheduling algorithms cannot be preemptive?
- (a) Shortest Remaining Time First (SRTF) Scheduling
- (b) First Come First Serve (FCFS) Scheduling
- (c) Round Robin Scheduling
- (d) Priority Scheduling
Show answer
(b) First Come First Serve (FCFS) Scheduling
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
Show answer
()
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*)Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A and B are two binary semaphores initialized to 1 and 0, respectively. X is a shared variable initialized to 0. Each line in the pseudocode is executed atomically. Pseudocode of P1, P2, and P3 ``` Wait(A); Print(*); X = X+1; If (X == 2) { Print($); Signal(B); } Signal(A); Wait(B); Print(#); Signal(B); ``` Assume that any of the three processes can start to execute first and context switching can happen between these processes at any arbitrary time and in any arbitrary order. Which of the following patterns is/are possible to be generated as an outcome of the execution of these three processes?
- (a) **$*###
- (b) **$#*##
- (c) **$##*#
- (d) ***$###
Show answer
()
To keep track of free blocks in a file system, one of the two approaches is generally used – using bitmaps (bit vectors) or using linked lists. Consider that the linked list approach is used to keep track of free blocks in a file system. Assume that the disk size is 16 GB, block size is 2 KB, and block numbers used are 32-bit long. A single pointer of size 4 bytes is used in each block of the list to point to the next block of the list. The number of blocks required to hold the free disk block numbers is ____________. (answer in integer)
Note: andConsider 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
Show answer
()
A system has a Translation Lookaside Buffer (TLB) that has a reach of 1 MB. TLB reach is defined as the total amount of physical memory that can be accessed through the TLB entries. The paging system uses pages of size 4 KB. The virtual address space is 64 GB and physical address space is 1 GB. If each TLB entry stores a 4-bit process id, page number, frame number, and a 2-bit control field, then the size of the TLB (in bytes) is ___________. (answer in integer)
Note: , ,Consider contiguous allocation of physical memory to processes using variable partitioning scheme. Suppose there are 8 holes in the memory of sizes 20 KB, 4 KB, 25 KB, 18 KB, 7 KB, 9 KB, 15 KB, and 12 KB. Assume that no two holes are adjacent. Two processes P1 of size 16 KB and P2 of size 9 KB arrive in that order, and they are allocated memory using the best-fit technique. After allocating space to P1 and P2, the number of holes of size less than 8 KB is ____________. (answer in integer)
Note: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*)
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. ```c 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 = 10, 20, 30, 40, and 50 (in seconds). Similarly, a new process of type C arrives at time = 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 seconds. The average waiting time (in seconds) for the 10 processes is ___________. (*rounded off to one decimal place*)
Consider a demand paging memory management system with 32-bit logical address, 20-bit physical address, and page size of 2048 bytes. Assuming that the memory is byte addressable, what is the maximum number of entries in the page table?
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Processes , , , arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.
Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?- (a) 22
- (b) 15
- (c) 37
- (d) 19
Show answer
(d) 19
Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests for an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is _______. (Answer in integer) ``` int main() { int x=0,i=0; scanf("%d",&x); for(i=0; i<20; i++) { x = x+20; printf("%d\n",x); } return 0; } ```
A computer has two processors, and . Four processes with CPU bursts of 20, 16, 25, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:
- uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.
- uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.
A process is scheduled to a processor , if the processor is free and no other process is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?- (a) 9.00
- (b) 8.75
- (c) 6.50
- (d) 7.50
Show answer
(a) 9.00
Consider a demand paging system with three frames, and the following page reference string: 1 2 3 4 5 4 1 6 4 5 1 3 2. The contents of the frames are as follows initially and after each reference (from left to right): | *initially* | *after* | | | | | | | | | | | | | |---|---|---|---|---|---|---|---|---|---|---|---|---|---| | - | 1* | 2* | 3* | 4* | 5* | 4 | 1 | 6* | 4 | 5 | 1* | 3* | 2* | | - | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 6 | 6 | 6 | 6 | 6 | 2 | | - | - | 2 | 2 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 1 | 1 | 1 | | - | - | - | 3 | 3 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 3 | 3 | The *-marked references cause page replacements. Which one or more of the following could be the page replacement policy/policies in use?
- (a) Least Recently Used page replacement policy
- (b) Least Frequently Used page replacement policy
- (c) Most Frequently Used page replacement policy
- (d) Optimal page replacement policy
Show answer
(d) Optimal page replacement policy
consists of all active processes in an operating system. consists of single instances of distinct types of resources in the system.
The resource allocation graph has the following assignment and claim edges.
Assignment edges: , , , (the assignment edge means resource is assigned to process , and so on for others)
Claim edges: , , , , (the claim edge means process is waiting for resource , and so on for others)
Which of the following statement(s) is/are CORRECT?- (a) Aborting makes the system deadlock free.
- (b) Aborting makes the system deadlock free.
- (c) Aborting makes the system deadlock free.
- (d) Aborting and makes the system deadlock free.
Show answer
()
A disk of size 512M bytes is divided into blocks of 64K bytes. A file is stored in the disk using linked allocation. In linked allocation, each data block reserves 4 bytes to store the pointer to the next data block. The link part of the last data block contains a NULL pointer (also of 4 bytes). Suppose a file of 1M bytes needs to be stored in the disk. Assume, and . The amount of space in bytes that will be wasted due to internal fragmentation is ______. (Answer in integer)
In optimal page replacement algorithm, information about all future page references is available to the operating system (OS). A modification of the optimal page replacement algorithm is as follows: The OS correctly predicts only up to next 4 page references (including the current page) at the time of allocating a frame to a page. A process accesses the pages in the following order of page numbers: 1, 3, 2, 4, 2, 3, 1, 2, 4, 3, 1, 4. If the system has three memory frames that are initially empty, the number of page faults that will occur during execution of the process is ________ . (Answer in integer)
A computer system supports a logical address space of bytes. It uses two-level hierarchical paging with a page size of 4096 bytes. A logical address is divided into a -bit index to the outer page table, an offset within the page of the inner page table, and an offset within the desired page. Each entry of the inner page table uses eight bytes. All the pages in the system have the same size.
The value of is ___________ . (Answer in integer)Which of the following statements about threads is/are TRUE?
- (a) Threads can only be implemented in kernel space
- (b) Each thread has its own file descriptor table for open files
- (c) All the threads belonging to a process share a common stack
- (d) Threads belonging to a process are by default not protected from each other
Show answer
(d) Threads belonging to a process are by default not protected from each other
Which of the following tasks is/are the responsibility/responsibilities of the memory management unit (MMU) in a system with paging-based memory management?
- (a) Allocate a new page table for a newly created process
- (b) Translate a virtual address to a physical address using the page table
- (c) Raise a trap when a virtual address is not found in the page table
- (d) Raise a trap when a process tries to write to a page marked with read-only permission in the page table
Show answer
()
Which of the following process state transitions is/are NOT possible?
- (a) Running to Ready
- (b) Waiting to Running
- (c) Ready to Waiting
- (d) Running to Terminated
Show answer
()
Consider a process P running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process P moving to a non-running state (e.g., ready, blocked)?
- (a) P makes a blocking system call to read a block of data from the disk
- (b) P tries to access a page that is in the swap space, triggering a page fault
- (c) An interrupt is raised by the disk to deliver data requested by some other process
- (d) A timer interrupt is raised by the hardware
Show answer
()
Consider a single processor system with four processes A, B, C, and D, represented as given below, where for each process the first value is its arrival time, and the second value is its CPU burst time. A (0, 10), B (2, 6), C (4, 3), and D (6, 7). Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?
- (a) SRTF = 6, NP-SJF = 7
- (b) SRTF = 6, NP-SJF = 7.5
- (c) SRTF = 7, NP-SJF = 7.5
- (d) SRTF = 7, NP-SJF = 8.5
Show answer
(b) SRTF = 6, NP-SJF = 7.5
Consider the following two threads T1 and T2 that update two shared variables a and b. Assume that initially a = b = 1. Though context switching between threads can happen at any time, each statement of T1 or T2 is executed atomically without interruption. | T1 | T2 | |---|---| | `a = a + 1;` | `b = 2 * b;` | | `b = b + 1;` | `a = 2 * a;` | Which one of the following options lists all the possible combinations of values of a and b after both T1 and T2 finish execution?
- (a) (a = 4, b = 4); (a = 3, b = 3); (a = 4, b = 3)
- (b) (a = 3, b = 4); (a = 4, b = 3); (a = 3, b = 3)
- (c) (a = 4, b = 4); (a = 4, b = 3); (a = 3, b = 4)
- (d) (a = 2, b = 2); (a = 2, b = 3); (a = 3, b = 4)
Show answer
(a) (a = 4, b = 4); (a = 3, b = 3); (a = 4, b = 3)
Consider a multi-threaded program with two threads T1 and T2. The threads share two semaphores: s1 (initialized to 1) and s2 (initialized to 0). The threads also share a global variable x (initialized to 0). The threads execute the code shown below. ``` // code of T1 // code of T2 wait(s1); wait(s1); x = x+1; x = x+1; print(x); print(x); wait(s2); signal(s2); signal(s1); signal(s1); ``` Which of the following outcomes is/are possible when threads T1 and T2 execute concurrently?
- (a) T1 runs first and prints 1, T2 runs next and prints 2
- (b) T2 runs first and prints 1, T1 runs next and prints 2
- (c) T1 runs first and prints 1, T2 does not print anything (deadlock)
- (d) T2 runs first and prints 1, T1 does not print anything (deadlock)
Show answer
()
Consider a disk with the following specifications: rotation speed of 6000 RPM, average seek time of 5 milliseconds, 500 sectors/track, 512-byte sectors. A file has content stored in 3000 sectors located *randomly* on the disk. Assuming average rotational latency, the total time (*in seconds, rounded off to 2 decimal places*) to read the entire file from the disk is _________
Consider a 512 GB hard disk with 32 storage surfaces. There are 4096 sectors per track and each sector holds 1024 bytes of data. The number of cylinders in the hard disk is _________
Consider the following code snippet using the fork() and wait() system calls. Assume that the code compiles and runs correctly, and that the system calls run successfully without any errors. ``` int x = 3; while(x > 0) { fork(); printf("hello"); wait(NULL); x--; } ``` The total number of times the printf statement is executed is _______
Consider a memory management system that uses a page size of 2 KB. Assume that both the physical and virtual addresses start from 0. Assume that the pages 0, 1, 2, and 3 are stored in the page frames 1, 3, 2, and 0, respectively. The physical address (*in decimal format*) corresponding to the virtual address 2500 (*in decimal format*) is _________
Consider a 32-bit system with 4 KB page size and page table entries of size 4 bytes each. Assume 1 KB = bytes. The OS uses a 2-level page table for memory management, with the page table containing an outer page directory and an inner page table. The OS allocates a page for the outer page directory upon process creation. The OS uses demand paging when allocating memory for the inner page table, i.e., a page of the inner page table is allocated only if it contains at least one valid page table entry.
An active process in this system accesses 2000 unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let X denote the minimum and Y denote the maximum number of pages across the two levels of the page table of the process.
The value of X+Y is ________Which one or more of the following need to be saved on a context switch from one thread (T1) of a process to another thread (T2) of the same process?
- (a) Page table base register
- (b) Stack pointer
- (c) Program counter
- (d) General purpose registers
Show answer
()
Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?
- (a) Function Call
- (b) malloc Call
- (c) Page Fault
- (d) System Call
Show answer
()
Which one or more of the following CPU scheduling algorithms can potentially cause starvation?
- (a) First-in First-Out
- (b) Round Robin
- (c) Priority Scheduling
- (d) Shortest Job First
Show answer
()
Consider the two functions incr and decr shown below. ``` incr(){ decr(){ wait(s); wait(s); X = X+1; X = X-1; signal(s); signal(s); } } ``` There are 5 threads each invoking incr once, and 3 threads each invoking decr once, on the same shared variable X. The initial value of X is 10. Suppose there are two implementations of the semaphore s, as follows: I-1: s is a binary semaphore initialized to 1. I-2: s is a counting semaphore initialized to 2. Let V1, V2 be the values of X at the end of execution of all the threads with implementations I-1, I-2, respectively. Which one of the following choices corresponds to the minimum possible values of V1, V2, respectively?
- (a) 15, 7
- (b) 7, 7
- (c) 12, 7
- (d) 12, 8
Show answer
(c) 12, 7
Consider the following two-dimensional array D in the C programming language, which is stored in row-major order: ```c int D[128][128]; ``` Demand paging is used for allocating memory and each physical page frame holds 512 elements of the array D. The Least Recently Used (LRU) page-replacement policy is used by the operating system. A total of 30 physical page frames are allocated to a process which executes the following code snippet: ```c for (int i = 0; i < 128; i++) for (int j = 0; j < 128; j++) D[j][i] *= 10; ``` The number of page faults generated during the execution of this code snippet is ____________.
Consider a computer system with 57-bit virtual addressing using multi-level tree-structured page tables with levels for virtual to physical address translation. The page size is 4 KB (1 KB = 1024 B) and a page table entry at any of the levels occupies 8 bytes.
The value of is ____________.Consider the following threads, , , and executing on a single processor, synchronized using three binary semaphore variables, , , and , operated upon using standard `wait()` and `signal()`. The threads can be context switched in any order and at any time.
| | | |
|---|---|---|
| `while(true){` | `while(true){` | `while(true){` |
| `wait(S3);` | `wait(S1);` | `wait(S2);` |
| `print(“C”);` | `print(“B”);` | `print(“A”);` |
| `signal(S2); }` | `signal(S3); }` | `signal(S1); }` |
Which initialization of the semaphores would print the sequence BCABCABCA….?- (a) ; ;
- (b) ; ;
- (c) ; ;
- (d) ; ;
Show answer
(c) ; ;
Which of the following statements is/are TRUE with respect to deadlocks?
- (a) Circular wait is a necessary condition for the formation of deadlock.
- (b) In a system where each resource has more than one instance, a cycle in its wait-for graph indicates the presence of a deadlock.
- (c) If the current allocation of resources to processes leads the system to unsafe state, then deadlock will necessarily occur.
- (d) In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.
Show answer
()
Which one of the following statements is FALSE?
- (a) The TLB performs an associative search in parallel on all its valid entries using page number of incoming virtual address.
- (b) If the virtual address of a word given by CPU has a TLB hit, but the subsequent search for the word results in a cache miss, then the word will always be present in the main memory.
- (c) The memory access time using a given inverted page table is always same for all incoming virtual addresses.
- (d) In a system that uses hashed page tables, if two distinct virtual addresses V1 and V2 map to the same value while hashing, then the memory access time of these addresses will not be the same.
Show answer
(c) The memory access time using a given inverted page table is always same for all incoming virtual addresses.
Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time t = 0. There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to P. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT possible as CPU burst time (in time units) of these processes?
- (a) P = 4, Q = 10, R = 6, S = 2
- (b) P = 2, Q = 9, R = 5, S = 1
- (c) P = 4, Q = 12, R = 5, S = 4
- (d) P = 3, Q = 7, R = 7, S = 3
Show answer
(d) P = 3, Q = 7, R = 7, S = 3
Consider two files systems and , that use contiguous allocation and linked allocation, respectively. A file of size 100 blocks is already stored in and also in . Now, consider inserting a new block in the middle of the file (between 50th and 51st block), whose data is already available in the memory. Assume that there are enough free blocks at the end of the file and that the file control blocks are already in memory. Let the number of disk accesses required to insert a block in the middle of the file in and are and , respectively, then the value of is_________.
Consider a demand paging system with four page frames (initially empty) and LRU page replacement policy. For the following page reference string
the page fault rate, defined as the ratio of number of page faults to the number of memory accesses (*rounded off to one decimal place*) is_________.In the context of operating systems, which of the following statements is/are correct with respect to paging?
- (a) Paging helps solve the issue of external fragmentation.
- (b) Page size has no impact on internal fragmentation.
- (c) Paging incurs memory overheads.
- (d) Multi-level paging is necessary to support pages of different sizes.
Show answer
()
Which of the following standard C library functions will *always* invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system?
- (a) `exit`
- (b) `malloc`
- (c) `sleep`
- (d) `strlen`
Show answer
()
Which of the following statement(s) is/are correct in the context of CPU scheduling?
- (a) Turnaround time includes waiting time.
- (b) The goal is to only maximize CPU utilization and minimize throughput.
- (c) Round-robin policy can be used even when the CPU time required by each of the processes is not known apriori.
- (d) Implementing preemptive scheduling needs hardware support.
Show answer
()
Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory `foo`. Which of the following operations will necessarily require a full scan of `foo` for successful completion?
- (a) Creation of a new file in `foo`
- (b) Deletion of an existing file from `foo`
- (c) Renaming of an existing file in `foo`
- (d) Opening of an existing file in `foo`
Show answer
()
Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is ______ milliseconds.
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2: ``` int x = 0; // global Lock L1; // global main() { create a thread to execute foo(); // Thread T1 create a thread to execute foo(); // Thread T2 wait for the two threads to finish execution; print (x);} foo() { int y = 0; Acquire L1; x = x + 1; y = y + 1; Release L1; print (y);} ``` Which of the following statement(s) is/are correct?
- (a) Both P1 and P2 will print the value of x as 2.
- (b) At least one of P1 and P2 will print the value of x as 4.
- (c) At least one of the threads will print the value of y as 2.
- (d) Both T1 and T2, in both the processes, will print the value of y as 1.
Show answer
()
Consider a computer system with multiple shared resource types, with one instance per resource type. Each instance can be owned by only one process at a time. Owning and freeing of resources are done by holding a global lock (L). The following scheme is used to own a resource instance: ``` function OwnResource(Resource R) Acquire lock L // a global lock if R is available then Acquire R Release lock L else if R is owned by another process P then Terminate P, after releasing all resources owned by P Acquire R Restart P Release lock L end if end if end function ``` Which of the following choice(s) about the above scheme is/are correct?
- (a) The scheme ensures that deadlocks will not occur.
- (b) The scheme may lead to live-lock.
- (c) The scheme may lead to starvation.
- (d) The scheme violates the mutual exclusion property.
Show answer
()
Consider the following pseudocode, where `S` is a semaphore initialized to 5 in line#2 and `counter` is a shared variable initialized 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?
- (a) The value of `counter` is 5 after all the threads successfully complete the execution of `parop`.
- (b) The value of `counter` is 1 after all the threads successfully complete the execution of `parop`.
- (c) The value of `counter` is 0 after all the threads successfully complete the execution of `parop`.
- (d) There is a deadlock involving all the threads.
Show answer
()
Consider a three-level page table to translate a 39-bit virtual address to a physical address as shown below.
| Level 1 offset | Level 2 offset | Level 3 offset | Page offset |
|---|---|---|---|
| 9 bits | 9 bits | 9 bits | 12 bits |
The page size is 4KB (1KB bytes) and page table entry size at every level is 8 bytes. A process is currently using 2GB (1GB bytes) virtual memory which is mapped to 2GB of physical memory. The minimum amount of memory required for the page table of across all levels is __________ KB.Consider allocation of memory to a new process. Assume that none of the existing holes in the memory will exactly fit the process's memory requirement. Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes. Which one of the following statements is TRUE?
- (a) The hole created by first fit is always larger than the hole created by next fit.
- (b) The hole created by worst fit is always larger than the hole created by first fit.
- (c) The hole created by best fit is never larger than the hole created by first fit.
- (d) The hole created by next fit is never larger than the hole created by best fit.
Show answer
(c) The hole created by best fit is never larger than the hole created by first fit.
Consider the following statements about process state transitions for a system using preemptive scheduling. I. A running process can move to ready state. II. A ready process can move to running state. III. A blocked process can move to running state. IV. A blocked process can move to ready state. Which of the above statements are TRUE?
- (a) I, II, and III only
- (b) II and III only
- (c) I, II, and IV only
- (d) I, II, III, and IV
Show answer
(c) I, II, and IV only
Each of a set of processes executes the following code using two semaphores `a` and `b` initialized to 1 and 0, respectively. Assume that `count` is a shared variable initialized to 0 and not used in CODE SECTION P.
```
CODE SECTION P
wait(a); count=count+1;
if (count==n) signal(b);
signal(a); wait(b); signal(b);
CODE SECTION Q
```
What does the code achieve?- (a) It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P.
- (b) It ensures that at most two processes are in CODE SECTION Q at any time.
- (c) It ensures that all processes execute CODE SECTION P mutually exclusively.
- (d) It ensures that at most processes are in CODE SECTION P at any time.
Show answer
(a) It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P.
Consider the following five disk access requests of the form (request id, cylinder number) that are present in the disk scheduler queue at a given time. (P, 155), (Q, 85), (R, 110), (S, 30), (T, 115) Assume the head is positioned at cylinder 100. The scheduler follows Shortest Seek Time First scheduling to service the requests. Which one of the following statements is FALSE?
- (a) T is serviced before P.
- (b) Q is serviced after S, but before T.
- (c) The head reverses its direction of movement between servicing of Q and P.
- (d) R is serviced before P.
Show answer
(b) Q is serviced after S, but before T.
Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order .
| Processes | | | | |
|---|---|---|---|---|
| Burst time (in ms) | 8 | 7 | 2 | 4 |
If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is \_\_\_\_\_\_\_\_.Consider a paging system that uses 1-level page table residing in main memory and a TLB for address translation. Each main memory access takes 100 ns and TLB lookup takes 20 ns. Each page transfer to/from the disk takes 5000 ns. Assume that the TLB hit ratio is 95%, page fault rate is 10%. Assume that for 20% of the total page faults, a dirty page has to be written back to disk before the required page is read in from disk. TLB update time is negligible. The average memory access time in ns (round off to 1 decimal places) is \_\_\_\_\_\_.
The following C program is executed on a Unix/Linux system: ```c #include <unistd.h> int main() { int i; for (i=0; i<10; i++) if (i%2 == 0) fork(); return 0; } ``` The total number of child processes created is ________.
Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100. | P1 | P2 | P3 | |---|---|---| | : | : | : | | : | : | : | | D = D + 20 | D = D – 50 | D = D + 10 | | : | : | : | | : | : | : | The processes are executed on a uniprocessor system running a time-shared operating system. If the minimum and maximum possible values of D after the three processes have completed execution are X and Y respectively, then the value of Y – X is ____________.
Assume that in a certain computer, the virtual addresses are 64 bits long and the physical addresses are 48 bits long. The memory is word addressible. The page size is 8 kB and the word size is 4 bytes. The Translation Look-aside Buffer (TLB) in the address translation path has 128 valid entries. At most how many distinct virtual addresses can be translated without any TLB miss?
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Consider the following snapshot of a system running concurrent processes. Process is holding instances of a resource R, . Assume that all instances of R are currently in use. Further, for all , process can place a request for at most additional instances of R while holding the instances it already has. Of the processes, there are exactly two processes and such that . Which one of the following conditions guarantees that no other process apart from and can complete execution?
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider the following four processes with arrival times (in milliseconds) and their length of CPU bursts (in milliseconds) as shown below: | Process | P1 | P2 | P3 | P4 | |---|---|---|---|---| | Arrival time | 0 | 1 | 3 | 4 | | CPU burst time | 3 | 1 | 3 | Z | These processes are run on a single processor using preemptive Shortest Remaining Time First scheduling algorithm. If the average waiting time of the processes is 1 millisecond, then the value of Z is________.
The index node (inode) of a Unix-like file system has 12 direct, one single-indirect and one double-indirect pointers. The disk block size is 4 kB, and the disk block address is 32-bits long. The maximum possible file size is (rounded off to 1 decimal place) _________ GB.
13Databases5 ch · 1 h 16 min58 PYQ
- ER model and relational model 15′
- Relational algebra, tuple calculus and SQL 15′
- Integrity constraints and normal forms 15′
- File organisation and indexing 15′
- Transactions and concurrency control 16′
See the 58 questions GATE Computer Science and IT (CS) asked from this module
In the context of DBMS, consider the two sets T and S given below. | T | S | |---|---| | I: Logical schema | L: Views | | II: Physical schema | M: File organization and indexes | | III: External schema | N: Relations | Which one of the following is the correct match from T to S ?
- (a) I – L, II – M, III – N
- (b) I – M, II – L, III – N
- (c) I – N, II – M, III – L
- (d) I – N, II – L, III – M
Show answer
(c) I – N, II – M, III – L
Consider concurrent execution of two transactions and in a DBMS, both of which access a data object . For these two transactions to not conflict on , which one of the following statements must be true?
- (a) Both and only read
- (b) reads and writes
- (c) writes and reads
- (d) Both and write
Show answer
(a) Both and only read
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
Show answer
()
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
Show answer
()
In the context of schema normalization in relational DBMS, consider a set F of functional dependencies. The set of all functional dependencies implied by F is called the closure of F. To compute the closure of F, Armstrong's Axioms can be applied. Consider , , and as sets of attributes over a relational schema. The three rules of Armstrong's Axioms are described as follows.
Reflexivity: If , then
Augmentation: If , then for any Z
Transitivity: If and , then
The additional rule of Union is defined as follows.
Union: If and , then
It can be proved that the additional rule of Union is also implied by the three rules of Armstrong's Axioms. Listed below are four combinations of these three rules. Which one of these combinations is both necessary and sufficient for the proof ?- (a) Reflexivity, Augmentation, and Transitivity
- (b) Reflexivity and Augmentation
- (c) Transitivity
- (d) Augmentation and Transitivity
Show answer
(d) Augmentation and Transitivity
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)
Show answer
(b)
An index in a DBMS is said to be dense if an index entry appears for every search-key value in the indexed file. Otherwise it is called a sparse index. Consider the following two statements.
S1: A hash index must be a dense index
S2: A tree index can be a sparse index
Which one of the following options is correct?- (a) Both S1 and S2 are true
- (b) Both S1 and S2 are false
- (c) S1 is true and S2 is false
- (d) S1 is false and S2 is true
Show answer
(a) Both S1 and S2 are true
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*)
A schedule of three database transactions , , and is shown. and denote read and write of data item by transaction , . The transaction aborts at the end. Which other transaction(s) will be required to be rolled back?
- (a) Only
- (b) Only
- (c) Both and
- (d) Neither nor
Show answer
(c) Both and
Consider the following tree with 5 nodes, in which a node can store at most 3 key values. The value 23 is now inserted in the tree. Which of the following options(s) is/are CORRECT?
Root node: [6 | 12 | 19], with four children (leaf nodes), from left to right: [1 | 4 | 3], [7 | 9 | 10], [13 | 15 | 17], [20 | 21 | 22].- (a) None of the nodes will split.
- (b) At least one node will split and redistribute.
- (c) The total number of nodes will remain same.
- (d) The height of the tree will increase.
Show answer
()
An audit of a banking transactions system has found that on an earlier occasion, two joint holders of account attempted simultaneous transfers of Rs. 10000 each from account to account . Both transactions read the same value, Rs. 11000, as the initial balance in and were allowed to go through. was credited Rs. 10000 twice. was debited only once and ended up with a balance of Rs. 1000.
Which of the following properties is/are certain to have been violated by the system?- (a) Atomicity
- (b) Consistency
- (c) Isolation
- (d) Durability
Show answer
()
Consider two relations describing and in a sports league:
- : , are team-id and team-name, respectively
- : , , and denote player-id, player-name and the team-id of the player, respectively
Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having as 'MI'?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider the following relational schema along with all the functional dependencies that hold on them.
R1(A, B, C, D, E):
R2(A, B, C, D):
Which of the following statement(s) is/are TRUE?- (a) R1 is in 3NF
- (b) R2 is in 3NF
- (c) R1 is NOT in 3NF
- (d) R2 is NOT in 3NF
Show answer
()
Consider a relational schema , with functional dependencies .
The relation is decomposed into two relations, and . Which of the following statement(s) is/are TRUE?- (a) The relation is NOT in BCNF.
- (b) The relations and are in BCNF.
- (c) The decomposition constitutes a lossless join.
- (d) The relation is NOT in 3NF.
Show answer
()
Consider the database transactions T1 and T2, and data items X and Y. Which of the schedule(s) is/are conflict serializable? | Transaction T1 | Transaction T2 | |---|---| | R1(X) | W2(X) | | W1(Y) | W2(Y) | | R1(X) | COMMIT(T2) | | W1(X) | | | COMMIT(T1) | |
- (a) R1(X), W2(X), W1(Y), W2(Y), R1(X), W1(X), COMMIT(T2), COMMIT(T1)
- (b) W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)
- (c) R1(X), W1(Y), W2(X), W2(Y), R1(X), W1(X), COMMIT(T1), COMMIT(T2)
- (d) W2(X), R1(X), W1(Y), W2(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)
Show answer
(b) W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)
Consider the following relational schema: Students (rollno: integer, name: string, age: integer, cgpa: real) Courses (courseno: integer, cname: string, credits: integer) Enrolled (rollno: integer, courseno: integer, grade: string) Which of the following options is/are correct SQL query/queries to retrieve the names of the students enrolled in course number (i.e., courseno) 1470?
- (a) ```sql SELECT S.name FROM Students S WHERE EXISTS (SELECT * FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno); ```
- (b) ```sql SELECT S.name FROM Students S WHERE SIZEOF (SELECT * FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno) > 0; ```
- (c) ```sql SELECT S.name FROM Students S WHERE 0 < (SELECT COUNT(*) FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno); ```
- (d) ```sql SELECT S.name FROM Students S NATURAL JOIN Enrolled E WHERE E.courseno = 1470; ```
Show answer
()
Consider the following database tables of a sports league. ``` player(pid,pname,age) team(tid,tname,city,cid) coach(cid,cname) members(pid,tid) ``` An instance of the table and an SQL query are given. player | pid | pname | age | |---|---|---| | 1 | Jasprit | 31 | | 2 | Atharva | 24 | | 3 | Ishan | 26 | | 4 | Axar | 30 | coach | cid | cname | |---|---| | 101 | Ricky | | 102 | Mark | | 103 | Trevor | team | tid | tname | city | cid | |---|---|---|---| | 10 | MI | Mumbai | 102 | | 20 | DC | Delhi | 101 | | 30 | PK | Mohali | 103 | members | pid | tid | |---|---| | 1 | 10 | | 2 | 30 | | 3 | 10 | | 4 | 20 | ``` SELECT MIN(P.age) FROM player P WHERE P.pid IN ( SELECT M.pid FROM team T, coach C, members M WHERE C.cname = 'Mark' AND T.cid = C.cid AND M.tid = T.tid ) ``` The value returned by the given SQL query is ______ . (Answer in integer)
In a B$^{+}$- tree where each node can hold at most four key values, a root to leaf path consists of the following nodes:
A = (49, 77, 83, -), B = (7, 19, 33, 44), C = (20*, 22*, 25*, 26*)
The *-marked keys signify that these are data entries in a leaf.
Assume that a pointer between keys and points to a subtree containing keys in , and that when a leaf is created, the smallest key in it is copied up into its parent.
A record with key value 23 is inserted into the B$^{+}$- tree.
The smallest key value in the parent of the leaf that contains 25* is __________. (Answer in integer)Once the DBMS informs the user that a transaction has been successfully completed, its effect should persist even if the system crashes before all its changes are reflected on disk. This property is called
- (a) durability
- (b) atomicity
- (c) consistency
- (d) isolation
Show answer
(a) durability
Let S be the specification: "Instructors teach courses. Students register for courses. Courses are allocated classrooms. Instructors guide students." Which one of the following ER diagrams CORRECTLY represents S?
- (a) (i)
- (b) (ii)
- (c) (iii)
- (d) (iv)
Show answer
(d) (iv)
In the context of owner and weak entity sets in the ER (Entity-Relationship) data model, which one of the following statements is TRUE?
- (a) The weak entity set MUST have total participation in the identifying relationship
- (b) The owner entity set MUST have total participation in the identifying relationship
- (c) Both weak and owner entity sets MUST have total participation in the identifying relationship
- (d) Neither weak entity set nor owner entity set MUST have total participation in the identifying relationship
Show answer
(a) The weak entity set MUST have total participation in the identifying relationship
In a B+ tree, the requirement of at least half-full (50%) node occupancy is relaxed for which one of the following cases?
- (a) Only the root node
- (b) All leaf nodes
- (c) All internal nodes
- (d) Only the leftmost leaf node
Show answer
(a) Only the root node
Which of the following statements about a relation R in first normal form (1NF) is/are TRUE ?
- (a) R can have a multi-attribute key
- (b) R cannot have a foreign key
- (c) R cannot have a composite attribute
- (d) R cannot have more than one candidate key
Show answer
()
Which of the following file organizations is/are I/O efficient for the scan operation in DBMS?
- (a) Sorted
- (b) Heap
- (c) Unclustered tree index
- (d) Unclustered hash index
Show answer
()
Which of the following statements about the Two Phase Locking (2PL) protocol is/are TRUE?
- (a) 2PL permits only serializable schedules
- (b) With 2PL, a transaction always locks the data item being read or written just before every operation and always releases the lock just after the operation
- (c) With 2PL, once a lock is released on any data item inside a transaction, no more locks on any data item can be obtained inside that transaction
- (d) A deadlock is possible with 2PL
Show answer
()
Consider the following two relations, and :
R:
| A | B |
|---|---|
| 10 | 20 |
| 20 | 30 |
| 30 | 40 |
| 30 | 50 |
| 50 | 95 |
S:
| A | C |
|---|---|
| 10 | 90 |
| 30 | 45 |
| 40 | 80 |
The total number of tuples obtained by evaluating the following expression
is _________The symbol → indicates functional dependency in the context of a relational database. Which of the following options is/are TRUE?
- (a) implies
- (b) implies
- (c) and implies
- (d) and implies
Show answer
()
The relation schema, Person(pid,city), describes the city of residence for every person uniquely identified by pid. The following relational algebra operators are available: selection, projection, cross product, and rename. To find the list of cities where at least 3 persons reside, using the above operators, the minimum number of cross product operations that must be used is
- (a) 1
- (b) 2
- (c) 3
- (d) 4
Show answer
(b) 2
Consider the following read-write schedule over three transactions , , and , where the subscripts in the schedule indicate transaction IDs:
Which of the following transaction schedules is/are conflict equivalent to ?- (a)
- (b)
- (c)
- (d)
Show answer
()
A functional dependency is termed as a *useful functional dependency* if and only if it satisfies all the following three conditions:
- is not the empty set.
- is not the empty set.
- Intersection of and is the empty set.
For a relation with 4 attributes, the total number of possible useful functional dependencies is ________Which one of the options given below refers to the degree (or arity) of a relation in relational database systems?
- (a) Number of attributes of its relation schema.
- (b) Number of tuples stored in the relation.
- (c) Number of entries in the relation.
- (d) Number of distinct domains of its relation schema.
Show answer
(a) Number of attributes of its relation schema.
Consider the following table named Student in a relational database. The primary key of this table is rollNum. Student | rollNum | name | gender | marks | |---|---|---|---| | 1 | Naman | M | 62 | | 2 | Aliya | F | 70 | | 3 | Aliya | F | 80 | | 4 | James | M | 82 | | 5 | Swati | F | 65 | The SQL query below is executed on this database. ```sql SELECT * FROM Student WHERE gender = ‘F’ AND marks > 65; ``` The number of rows returned by the query is ____________.
Consider a database of fixed-length records, stored as an ordered file. The database has 25,000 records, with each record being 100 bytes, of which the primary key occupies 15 bytes. The data file is block-aligned in that each data record is fully contained within a block. The database is indexed by a primary index file, which is also stored as a block-aligned ordered file. The figure below depicts this indexing scheme.
Suppose the block size of the file system is 1024 bytes, and a pointer to a block occupies 5 bytes. The system uses binary search on the index file to search for a record with a given key. You may assume that a binary search on an index file of blocks takes block accesses in the worst case.
Given a key, the number of block accesses required to identify the block in the data file that may contain a record with the key, in the worst case, is ____________.In a relational data model, which one of the following statements is TRUE?
- (a) A relation with only two attributes is always in BCNF.
- (b) If all attributes of a relation are prime attributes, then the relation is in BCNF.
- (c) Every relation has at least one non-prime attribute.
- (d) BCNF decompositions preserve functional dependencies.
Show answer
(a) A relation with only two attributes is always in BCNF.
Consider the following three relations in a relational database.
, ,
Which of the following relational algebra expressions return the set of $\mathit{eId}$s who own all the brands?- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider a relation with the following three functional dependencies.
; ; ;
The number of superkeys in the relation R is _____________.Let and denote read and write operations on a data element by a transaction , respectively. Consider the schedule with four transactions.
:
Which one of the following serial schedules is conflict equivalent to ?- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider the relational database with the following four schemas and their respective instances. Student(<u>sNo</u>, sName, dNo) Dept(<u>dNo</u>, dName) Course(<u>cNo</u>, cName, dNo) Register(<u>sNo</u>, <u>cNo</u>) **Student** | sNo | sName | dNo | |---|---|---| | S01 | James | D01 | | S02 | Rocky | D01 | | S03 | Jackson | D02 | | S04 | Jane | D01 | | S05 | Milli | D02 | **Dept** | dNo | dName | |---|---| | D01 | CSE | | D02 | EEE | **Course** | cNo | cName | dNo | |---|---|---| | C11 | DS | D01 | | C12 | OS | D01 | | C21 | DE | D02 | | C22 | PT | D02 | | C23 | CV | D03 | **Register** | sNo | cNo | |---|---| | S01 | C11 | | S01 | C12 | | S02 | C11 | | S03 | C21 | | S03 | C22 | | S03 | C23 | | S04 | C11 | | S04 | C12 | | S05 | C11 | | S05 | C21 | **SQL Query:** ```sql SELECT * FROM Student AS S WHERE NOT EXIST (SELECT cNo FROM Course WHERE dNo = “D01” EXCEPT SELECT cNo FROM Register WHERE sNo = S.sNo) ``` The number of rows returned by the above SQL query is___________.
Consider the following statements S1 and S2 about the relational data model: S1: A relation scheme can have at most one foreign key. S2: A foreign key in a relation scheme R cannot be used to refer to tuples of R. Which one of the following choices is correct?
- (a) Both S1 and S2 are true.
- (b) S1 is true and S2 is false.
- (c) S1 is false and S2 is true.
- (d) Both S1 and S2 are false.
Show answer
(d) Both S1 and S2 are false.
Suppose a database system crashes again while recovering from a previous crash. Assume checkpointing is not done by the database either during the transactions or during recovery. Which of the following statements is/are correct?
- (a) The same undo and redo list will be used while recovering again.
- (b) The system cannot recover any further.
- (c) All the transactions that are already undone and redone will not be recovered again.
- (d) The database will become inconsistent.
Show answer
(a) The same undo and redo list will be used while recovering again.
A data file consisting of 1,50,000 student-records is stored on a hard disk with block size of 4096 bytes. The data file is sorted on the primary key RollNo. The size of a record pointer for this disk is 7 bytes. Each student-record has a candidate key attribute called ANum of size 12 bytes. Suppose an index file with records consisting of two fields, ANum value and the record pointer to the corresponding student record, is built and stored on the same disk. Assume that the records of data file and index file are not split across disk blocks. The number of blocks in the index file is __________.
A relation in a relational database has 1200 tuples. The attribute has integer values ranging from 6 to 20, and the attribute has integer values ranging from 1 to 20. Assume that the attributes and are independently distributed.
The estimated number of tuples in the output of is ______.The following relation records the age of 500 employees of a company, where *empNo* (indicating the employee number) is the key:
Consider the following relational algebra expression:
What does the above expression generate?- (a) Employee numbers of only those employees whose age is the maximum.
- (b) Employee numbers of only those employees whose age is more than the age of exactly one other employee.
- (c) Employee numbers of all employees whose age is not the minimum.
- (d) Employee numbers of all employees whose age is the minimum.
Show answer
(c) Employee numbers of all employees whose age is not the minimum.
The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department. emp(<u>empId</u>, name, gender, salary, deptId) Consider the following SQL query: ``` select deptId, count(*) from emp where gender = "female" and salary > (select avg(salary) from emp) group by deptId; ``` The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of
- (a) employees in the department.
- (b) employees in the company.
- (c) female employees in the department.
- (d) female employees in the company.
Show answer
(b) employees in the company.
Let and denote read and write operations respectively on a data item by a transaction . Consider the following two schedules.
:
:
Which one of the following options is correct?- (a) is conflict serializable, and is not conflict serializable.
- (b) is not conflict serializable, and is conflict serializable.
- (c) Both and are conflict serializable.
- (d) Neither nor is conflict serializable.
Show answer
(b) is not conflict serializable, and is conflict serializable.
Let S be the following schedule of operations of three transactions , and in a relational database system:
Consider the statements P and Q below:
P: S is conflict-serializable.
Q: If commits before finishes, then S is recoverable.
Which one of the following choices is correct?- (a) Both P and Q are true.
- (b) P is true and Q is false.
- (c) P is false and Q is true.
- (d) Both P and Q are false.
Show answer
(b) P is true and Q is false.
Consider the relation with the following functional dependencies.
Consider the decomposition of the relation into the constituent relations according to the following two decomposition schemes.
:
:
Which one of the following options is correct?- (a) is a lossless decomposition, but is a lossy decomposition.
- (b) is a lossy decomposition, but is a lossless decomposition.
- (c) Both and are lossless decompositions.
- (d) Both and are lossy decompositions.
Show answer
(a) is a lossless decomposition, but is a lossy decomposition.
Suppose the following functional dependencies hold on a relation U with attributes , , , , and :
Which of the following functional dependencies can be inferred from the above functional dependencies?- (a)
- (b)
- (c)
- (d)
Show answer
()
Consider a relational database containing the following schemas.
Catalogue
| | | cost |
|---|---|---|
| S1 | P1 | 150 |
| S1 | P2 | 50 |
| S1 | P3 | 100 |
| S2 | P4 | 200 |
| S2 | P5 | 250 |
| S3 | P1 | 250 |
| S3 | P2 | 150 |
| S3 | P5 | 300 |
| S3 | P4 | 250 |
Suppliers
| | sname | location |
|---|---|---|
| S1 | M/s Royal furniture | Delhi |
| S2 | M/s Balaji furniture | Bangalore |
| S3 | M/s Premium furniture | Chennai |
Parts
| | pname | part_spec |
|---|---|---|
| P1 | Table | Wood |
| P2 | Chair | Wood |
| P3 | Table | Steel |
| P4 | Almirah | Steel |
| P5 | Almirah | Wood |
The primary key of each table is indicated by underlining the constituent fields.
```
SELECT s.sno, s.sname
FROM Suppliers s, Catalogue c
WHERE s.sno = c.sno AND
cost > (SELECT AVG (cost)
FROM Catalogue
WHERE pno = 'P4'
GROUP BY pno);
```
The number of rows returned by the above SQL query is- (a) 4
- (b) 5
- (c) 0
- (d) 2
Show answer
(a) 4
Which one of the following is used to represent the supporting many-one relationships of a weak entity set in an entity-relationship diagram?
- (a) Diamonds with double/bold border
- (b) Rectangles with double/bold border
- (c) Ovals with double/bold border
- (d) Ovals that contain underlined identifiers
Show answer
(a) Diamonds with double/bold border
Consider a relational table that is in 3NF, but not in BCNF. Which one of the following statements is TRUE?
- (a) has a nontrivial functional dependency , where is not a superkey and is a prime attribute.
- (b) has a nontrivial functional dependency , where is not a superkey and is a non-prime attribute and is not a proper subset of any key.
- (c) has a nontrivial functional dependency , where is not a superkey and is a non-prime attribute and is a proper subset of some key.
- (d) A cell in holds a set instead of an atomic value.
Show answer
(a) has a nontrivial functional dependency , where is not a superkey and is a prime attribute.
Consider a schedule of transactions and :
| | RA | | | RC | | WD | | WB | Commit | |
|---|---|---|---|---|---|---|---|---|---|---|
| | | RB | WB | | RD | | WC | | | Commit |
Here, RX stands for "Read(X)" and WX stands for "Write(X)". Which one of the following schedules is conflict equivalent to the above schedule?- (a) | | | | | RA | RC | WD | WB | | Commit | |
|---|---|---|---|---|---|---|---|---|---|---|
| | RB | WB | RD | | | | | WC | | Commit | - (b) | | RA | RC | WD | WB | | | | | Commit | |
|---|---|---|---|---|---|---|---|---|---|---|
| | | | | | RB | WB | RD | WC | | Commit | - (c) | | RA | RC | WD | | | | WB | | Commit | |
|---|---|---|---|---|---|---|---|---|---|---|
| | | | | RB | WB | RD | | WC | | Commit | - (d) | | | | | | RA | RC | WD | WB | Commit | |
|---|---|---|---|---|---|---|---|---|---|---|
| | RB | WB | RD | WC | | | | | | Commit |
Show answer
(a) | | | | | RA | RC | WD | WB | | Commit | |
|---|---|---|---|---|---|---|---|---|---|---|
| | RB | WB | RD | | | | | WC | | Commit |- (a) | | | | | RA | RC | WD | WB | | Commit | |
Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required to retrieve any record in the database is \_\_\_\_\_\_\_.
Consider the following two statements about database transaction schedules: I. Strict two-phase locking protocol generates conflict serializable schedules that are also recoverable. II. Timestamp-ordering concurrency control protocol with Thomas' Write Rule can generate view serializable schedules that are not conflict serializable. Which of the above statements is/are TRUE?
- (a) I only
- (b) II only
- (c) Both I and II
- (d) Neither I nor II
Show answer
(c) Both I and II
Which one of the following statements is NOT correct about the B+ tree data structure used for creating an index of a relational database table?
- (a) B+ Tree is a height-balanced tree
- (b) Non-leaf nodes have pointers to data records
- (c) Key values in each node are kept in sorted order
- (d) Each leaf node has a pointer to the next leaf node
Show answer
(b) Non-leaf nodes have pointers to data records
Let the set of functional dependencies F = {QR → S, R → P, S → Q} hold on a relation schema X = (PQRS). X is not in BCNF. Suppose X is decomposed into two schemas Y and Z, where Y = (PR) and Z = (QRS). Consider the two statements given below. I. Both Y and Z are in BCNF II. Decomposition of X into Y and Z is dependency preserving and lossless Which of the above statements is/are correct?
- (a) Both I and II
- (b) I only
- (c) II only
- (d) Neither I nor II
Show answer
(c) II only
A relational database contains two tables Student and Performance as shown below: **Student** | Roll_no. | Student_name | |---|---| | 1 | Amit | | 2 | Priya | | 3 | Vinit | | 4 | Rohan | | 5 | Smita | **Performance** | Roll_no. | Subject_code | Marks | |---|---|---| | 1 | A | 86 | | 1 | B | 95 | | 1 | C | 90 | | 2 | A | 89 | | 2 | C | 92 | | 3 | C | 80 | The primary key of the Student table is Roll_no. For the Performance table, the columns Roll_no. and Subject_code together form the primary key. Consider the SQL query given below: ```sql SELECT S.Student_name, sum(P.Marks) FROM Student S, Performance P WHERE P.Marks > 84 GROUP BY S.Student_name; ``` The number of rows returned by the above SQL query is ________.
Consider the following relations P(X,Y,Z), Q(X,Y,T) and R(Y,V).
P
| X | Y | Z |
|---|---|---|
| X1 | Y1 | Z1 |
| X1 | Y1 | Z2 |
| X2 | Y2 | Z2 |
| X2 | Y4 | Z4 |
Q
| X | Y | T |
|---|---|---|
| X2 | Y1 | 2 |
| X1 | Y2 | 5 |
| X1 | Y1 | 6 |
| X3 | Y3 | 1 |
R
| Y | V |
|---|---|
| Y1 | V1 |
| Y3 | V2 |
| Y2 | V3 |
| Y2 | V2 |
How many tuples will be returned by the following relational algebra query?
Answer: _________.
14Computer networks5 ch · 1 h 13 min60 PYQ
- Layering, OSI and TCP/IP, and switching 14′
- Data link layer: framing, error detection, MAC and Ethernet 16′
- IP addressing, CIDR, ARP, DHCP, ICMP, NAT and routing 17′
- Transport layer: UDP, TCP, flow and congestion control 13′
- Application layer: DNS, HTTP, SMTP, FTP and email 13′
See the 60 questions GATE Computer Science and IT (CS) asked from this module
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
Show answer
(d) The client and server can initiate closing of the connection at the same time
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
Show answer
()
Consider a file of size 4 million bytes being transferred between two hosts connected via a path consisting of three consecutive links of bandwidth 2 Mbps, 500 kbps, and 1 Mbps, respectively. All processing delays and propagation delays are negligible. Assume that there is no other background traffic over the path and no other additional overhead to transfer the file.
Which one of the following is the total time (in seconds) to transfer the file?
Note: ,- (a) 731
- (b) 64
- (c) 8
- (d) 16
Show answer
(b) 64
Which one of the following protocols may need to broadcast some of its messages?
- (a) SMTP
- (b) FTP
- (c) DHCP
- (d) HTTP
Show answer
(c) DHCP
If an IP network uses a subnet mask of 255.255.240.0, the maximum number of IP addresses that can be assigned to network interfaces is __________. (answer in integer)
Consider the transmission of data bits 110001011 over a link that uses Cyclic Redundancy Check (CRC) code for error detection. If the generator bit pattern is given to be 1001, which one of the following options shows the remainder bit pattern appended to the data bits before transmission?
- (a) 011
- (b) 101
- (c) 000
- (d) 100
Show answer
(d) 100
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 denote the time (in milliseconds) at which the transmission of segment number 2000 starts.
Which one of the following options is correct?- (a)
- (b)
- (c)
- (d)
Show answer
(b)
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 () 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
Show answer
(b) 21
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
Show answer
()
Consider a new TCP connection between a sender and a receiver. The receiver advertised window is constant at 48 KB, the maximum segment size (MSS) is 2 KB, and the slow start threshold for TCP congestion control is 16 KB. Assume that there are no timeouts or duplicate acknowledgements. The number of rounds of transmission required for the congestion control algorithm of the TCP connection to reach the congestion avoidance phase is ___________. (answer in integer)
Note:It is necessary to design a link-layer protocol between two hosts that are directly connected over a lossless link of length 3000 kilometers. Assume that the link bandwidth is bits per second and that the propagation delay in the link is 5 nanoseconds per meter. Every transmitted data byte is assigned a unique sequence number.
Let be the minimum number of bits needed for the sequence number field in the protocol header such that
i. the sequence numbers do not wrap around before 60 seconds, and
ii. the maximum utilization of the link is achieved.
The value of is ______. (answer in integer)Identify the ONE CORRECT matching between the OSI layers and their corresponding functionalities as shown. | OSI Layers | Functionalities | |---|---| | (a) Network layer | (I) Packet routing | | (b) Transport layer | (II) Framing and error handling | | (c) Datalink layer | (III) Host to host communication |
- (a) (a)-(I), (b)-(II), (c)-(III)
- (b) (a)-(I), (b)-(III), (c)-(II)
- (c) (a)-(II), (b)-(I), (c)-(III)
- (d) (a)-(III), (b)-(II), (c)-(I)
Show answer
(b) (a)-(I), (b)-(III), (c)-(II)
Consider the following statements: (i) Address Resolution Protocol (ARP) provides a mapping from an IP address to the corresponding hardware (link-layer) address. (ii) A single TCP segment from a sender S to a receiver R cannot carry both data from S to R and acknowledgement for a segment from R to S. Which ONE of the following is CORRECT?
- (a) Both (i) and (ii) are TRUE
- (b) (i) is TRUE and (ii) is FALSE
- (c) (i) is FALSE and (ii) is TRUE
- (d) Both (i) and (ii) are FALSE
Show answer
(b) (i) is TRUE and (ii) is FALSE
Consider the routing protocols given in List I and the names given in List II: | List I | List II | |---|---| | (i) Distance vector routing | (a) Bellman-Ford | | (ii) Link state routing | (b) Dijkstra | For matching of items in List I with those in List II, which ONE of the following options is CORRECT?
- (a) (i) – (a) and (ii) – (b)
- (b) (i) – (a) and (ii) – (a)
- (c) (i) – (b) and (ii) – (a)
- (d) (i) – (b) and (ii) – (b)
Show answer
(a) (i) – (a) and (ii) – (b)
A machine receives an IPv4 datagram. The protocol field of the IPv4 header has the protocol number of a protocol X. Which ONE of the following is NOT a possible candidate for X?
- (a) Internet Control Message Protocol (ICMP)
- (b) Internet Group Management Protocol (IGMP)
- (c) Open Shortest Path First (OSPF)
- (d) Routing Information Protocol (RIP)
Show answer
(d) Routing Information Protocol (RIP)
Consider the 3-way handshaking protocol for TCP connection establishment. Let the three packets exchanged during the connection establishment be denoted as P1, P2, and P3, in order. Which of the following option(s) is/are TRUE with respect to TCP header flags that are set in the packets?
- (a) P3: SYN = 1, ACK = 1
- (b) P2: SYN = 1, ACK = 1
- (c) P2: SYN = 0, ACK = 1
- (d) P1: SYN = 1
Show answer
()
Consider a network that uses Ethernet and IPv4. Assume that IPv4 headers do not use any options field. Each Ethernet frame can carry a maximum of 1500 bytes in its data field. A UDP segment is transmitted. The payload (data) in the UDP segment is 7488 bytes. Which ONE of the following choices has the CORRECT total number of fragments transmitted and the size of the last fragment including IPv4 header?
- (a) 5 fragments, 1488 bytes
- (b) 6 fragments, 88 bytes
- (c) 6 fragments, 108 bytes
- (d) 6 fragments, 116 bytes
Show answer
(d) 6 fragments, 116 bytes
Suppose we are transmitting frames between two nodes using Stop-and-Wait protocol. The frame size is 3000 bits. The transmission rate of the channel is 2000 bps (bits/second) and the propagation delay between the two nodes is 100 milliseconds. Assume that the processing times at the source and destination are negligible. Also, assume that the size of the acknowledgement packet is negligible. Which ONE of the following most accurately gives the channel utilization for the above scenario in percentage?
- (a) 88.23
- (b) 93.75
- (c) 85.44
- (d) 66.67
Show answer
(a) 88.23
A packet with the destination IP address 145.36.109.70 arrives at a router whose routing table is shown. Which interface will the packet be forwarded to? | Subnet Address | Subnet Mask (in CIDR notation) | Interface | |---|---|---| | 145.36.0.0 | /16 | E1 | | 145.36.128.0 | /17 | E2 | | 145.36.64.0 | /18 | E3 | | 145.36.255.0 | /24 | E4 | | Default | -- | E5 |
- (a) E3
- (b) E1
- (c) E2
- (d) E5
Show answer
(a) E3
Suppose a message of size 15000 bytes is transmitted from a source to a destination using IPv4 protocol via two routers as shown in the figure. Each router has a defined maximum transmission unit (MTU) as shown in the figure, including IP header. The number of fragments that will be delivered to the destination is ________ . (Answer in integer) Source → Router-1 (MTU=5000 bytes) → Router-2 (MTU=3000 bytes) → Destination
A user starts browsing a webpage hosted at a remote server. The browser opens a single TCP connection to fetch the entire webpage from the server. The webpage consists of a top-level index page with multiple embedded image objects. Assume that all caches (e.g., DNS cache, browser cache) are all initially empty. The following packets leave the user’s computer in some order. (i) HTTP GET request for the index page (ii) DNS request to resolve the web server’s name to its IP address (iii) HTTP GET request for an image object (iv) TCP SYN to open a connection to the web server Which one of the following is the CORRECT chronological order (earliest in time to latest) of the packets leaving the computer ?
- (a) (iv), (ii), (iii), (i)
- (b) (ii), (iv), (iii), (i)
- (c) (ii), (iv), (i), (iii)
- (d) (iv), (ii), (i), (iii)
Show answer
(c) (ii), (iv), (i), (iii)
Node X has a TCP connection open to node Y. The packets from X to Y go through an intermediate IP router R. Ethernet switch S is the first switch on the network path between X and R. Consider a packet sent from X to Y over this connection. Which of the following statements is/are TRUE about the destination IP and MAC addresses on this packet at the time it leaves X?
- (a) The destination IP address is the IP address of R
- (b) The destination IP address is the IP address of Y
- (c) The destination MAC address is the MAC address of S
- (d) The destination MAC address is the MAC address of Y
Show answer
(b) The destination IP address is the IP address of Y
Which of the following statements about IPv4 fragmentation is/are TRUE?
- (a) The fragmentation of an IP datagram is performed only at the source of the datagram
- (b) The fragmentation of an IP datagram is performed at any IP router which finds that the size of the datagram to be transmitted exceeds the MTU
- (c) The reassembly of fragments is performed only at the destination of the datagram
- (d) The reassembly of fragments is performed at all intermediate routers along the path from the source to the destination
Show answer
()
TCP client P successfully establishes a connection to TCP server Q. Let denote the sequence number in the SYN sent from P to Q. Let denote the acknowledgement number in the SYN ACK from Q to P. Which of the following statements is/are CORRECT?
- (a) The sequence number is chosen randomly by P
- (b) The sequence number is always 0 for a new connection
- (c) The acknowledgement number is equal to
- (d) The acknowledgement number is equal to
Show answer
()
Which of the following fields is/are modified in the IP header of a packet going out of a network address translation (NAT) device from an internal network to an external network?
- (a) Source IP
- (b) Destination IP
- (c) Header Checksum
- (d) Total Length
Show answer
()
Which of the following fields of an IP header is/are always modified by any router before it forwards the IP packet?
- (a) Source IP Address
- (b) Protocol
- (c) Time to Live (TTL)
- (d) Header Checksum
Show answer
()
Consider a network path P—Q—R between nodes P and R via router Q. Node P sends a file of size bytes to R via this path by splitting the file into chunks of bytes each. Node P sends these chunks one after the other without any wait time between the successive chunk transmissions. Assume that the size of extra headers added to these chunks is negligible, and that the chunk size is less than the MTU.
Each of the links P—Q and Q—R has a bandwidth of bits/sec, and negligible propagation latency. Router Q immediately transmits every packet it receives from P to R, with negligible processing and queueing delays. Router Q can simultaneously receive on link P—Q and transmit on link Q—R.
Assume P starts transmitting the chunks at time . Which one of the following options gives the time (*in seconds, rounded off to 3 decimal places*) at which R receives all the chunks of the file?- (a) 8.000
- (b) 8.008
- (c) 15.992
- (d) 16.000
Show answer
(b) 8.008
Which one of the following CIDR prefixes exactly represents the range of IP addresses 10.12.2.0 to 10.12.3.255?
- (a) 10.12.2.0/23
- (b) 10.12.2.0/24
- (c) 10.12.0.0/22
- (d) 10.12.2.0/22
Show answer
(a) 10.12.2.0/23
Consider a TCP connection operating at a point of time with the congestion window of size 12 MSS (Maximum Segment Size), when a timeout occurs due to packet loss. Assuming that all the segments transmitted in the next two RTTs (Round Trip Time) are acknowledged correctly, the congestion window size (*in MSS*) during the third RTT will be _________
Consider an Ethernet segment with a transmission speed of bits/sec and a maximum segment length of 500 meters. If the speed of propagation of the signal in the medium is meters/sec, then the minimum frame size (*in bits*) required for collision detection is _________
Consider the entries shown below in the forwarding table of an IP router. Each entry consists of an IP prefix and the corresponding next hop router for packets whose destination IP address matches the prefix. The notation “/N” in a prefix indicates a subnet mask with the most significant N bits set to 1. | Prefix | Next hop router | |---|---| | 10.1.1.0/24 | R1 | | 10.1.1.128/25 | R2 | | 10.1.1.64/26 | R3 | | 10.1.1.192/26 | R4 | This router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, and 10.1.1.205 . The number of packets forwarded via the next hop router R2 is _______
Consider sending an IP datagram of size 1420 bytes (including 20 bytes of IP header) from a sender to a receiver over a path of two links with a router between them. The first link (sender to router) has an MTU (Maximum Transmission Unit) size of 542 bytes, while the second link (router to receiver) has an MTU size of 360 bytes. The number of fragments that would be delivered at the receiver is ________
Suppose two hosts are connected by a point-to-point link and they are configured to use Stop-and-Wait protocol for reliable data transfer. Identify in which one of the following scenarios, the utilization of the link is the lowest.
- (a) Longer link length and lower transmission rate
- (b) Longer link length and higher transmission rate
- (c) Shorter link length and lower transmission rate
- (d) Shorter link length and higher transmission rate
Show answer
(b) Longer link length and higher transmission rate
Which of the following statements is/are INCORRECT about the OSPF (Open Shortest Path First) routing protocol used in the Internet?
- (a) OSPF implements Bellman-Ford algorithm to find shortest paths.
- (b) OSPF uses Dijkstra’s shortest path algorithm to implement least-cost path routing.
- (c) OSPF is used as an inter-domain routing protocol.
- (d) OSPF implements hierarchical routing.
Show answer
()
Suppose you are asked to design a new reliable byte-stream transport protocol like TCP. This protocol, named myTCP, runs over a 100 Mbps network with Round Trip Time of 150 milliseconds and the maximum segment lifetime of 2 minutes. Which of the following is/are valid lengths of the Sequence Number field in the myTCP header?
- (a) 30 bits
- (b) 32 bits
- (c) 34 bits
- (d) 36 bits
Show answer
()
Suppose in a web browser, you click on the www.gate-2023.in URL. The browser cache is empty. The IP address for this URL is not cached in your local host, so a DNS lookup is triggered (by the local DNS server deployed on your local host) over the 3-tier DNS hierarchy in an iterative mode. No resource records are cached anywhere across all DNS servers. Let RTT denote the round trip time between your local host and DNS servers in the DNS hierarchy. The round trip time between the local host and the web server hosting www.gate-2023.in is also equal to RTT. The HTML file associated with the URL is small enough to have negligible transmission time and negligible rendering time by your web browser, which references 10 equally small objects on the same web server. Which of the following statements is/are CORRECT about the minimum elapsed time between clicking on the URL and your browser fully rendering it?
- (a) 7 RTTs, in case of non-persistent HTTP with 5 parallel TCP connections.
- (b) 5 RTTs, in case of persistent HTTP with pipelining.
- (c) 9 RTTs, in case of non-persistent HTTP with 5 parallel TCP connections.
- (d) 6 RTTs, in case of persistent HTTP with pipelining.
Show answer
()
The forwarding table of a router is shown below. | Subnet Number | Subnet Mask | Interface ID | |---|---|---| | 200.150.0.0 | 255.255.0.0 | 1 | | 200.150.64.0 | 255.255.224.0 | 2 | | 200.150.68.0 | 255.255.255.0 | 3 | | 200.150.68.64 | 255.255.255.224 | 4 | | Default | | 0 | A packet addressed to a destination address 200.150.68.118 arrives at the router. It will be forwarded to the interface with ID ____________.
Consider an enterprise network with two Ethernet segments, a web server and a firewall, connected via three routers as shown below. What is the number of subnets inside the enterprise network?
- (a) 3
- (b) 12
- (c) 6
- (d) 8
Show answer
(c) 6
Consider the resolution of the domain name `www.gate.org.in` by a DNS resolver. Assume that no resource records are cached anywhere across the DNS servers and that iterative query mechanism is used in the resolution. The number of DNS query-response pairs involved in completely resolving the domain name is_____________.
Consider routing table of an organization’s router shown below: | Subnet Number | Subnet Mask | Next Hop | |---|---|---| | 12.20.164.0 | 255.255.252.0 | R1 | | 12.20.170.0 | 255.255.254.0 | R2 | | 12.20.168.0 | 255.255.254.0 | Interface 0 | | 12.20.166.0 | 255.255.254.0 | Interface 1 | | default | | R3 | Which of the following prefixes in CIDR notation can be collectively used to correctly aggregate all of the subnets in the routing table?
- (a) 12.20.164.0/20
- (b) 12.20.164.0/22
- (c) 12.20.164.0/21
- (d) 12.20.168.0/22
Show answer
()
Consider a network with three routers P, Q, R shown in the figure below. All the links have cost of unity. P — Q — R The routers exchange distance vector routing information and have converged on the routing tables, after which the link Q−R fails. Assume that P and Q send out routing updates at random times, each at the same average rate. The probability of a routing loop formation (*rounded off to one decimal place*) between P and Q, leading to count-to-infinity problem, is___________.
Consider a 100 Mbps link between an earth station (sender) and a satellite (receiver) at an altitude of 2100 km. The signal propagates at a speed of m/s. The time taken (in milliseconds, *rounded off to two decimal places*) for the receiver to completely receive a packet of 1000 bytes transmitted by the sender is_________.
Consider the data transfer using TCP over a 1 Gbps link. Assuming that the maximum segment lifetime (MSL) is set to 60 seconds, the minimum number of bits required for the sequence number field of the TCP header, to prevent the sequence number space from wrapping around during the MSL is____________.
Consider the three-way handshake mechanism followed during TCP connection establishment between hosts P and Q. Let X and Y be two random 32-bit starting sequence numbers chosen by P and Q respectively. Suppose P sends a TCP connection request message to Q with a TCP segment having SYN bit = 1, SEQ number = X, and ACK bit = 0. Suppose Q accepts the connection request. Which one of the following choices represents the information present in the TCP segment header that is sent by Q to P?
- (a) SYN bit = 1, SEQ number = X+1, ACK bit = 0, ACK number = Y, FIN bit = 0
- (b) SYN bit = 0, SEQ number = X+1, ACK bit = 0, ACK number = Y, FIN bit = 1
- (c) SYN bit = 1, SEQ number = Y, ACK bit = 1, ACK number = X+1, FIN bit = 0
- (d) SYN bit = 1, SEQ number = Y, ACK bit = 1, ACK number = X, FIN bit = 0
Show answer
(c) SYN bit = 1, SEQ number = Y, ACK bit = 1, ACK number = X+1, FIN bit = 0
Consider the following two statements.
: Destination MAC address of an ARP reply is a broadcast address.
: Destination MAC address of an ARP request is a broadcast address.
Which one of the following choices is correct?- (a) Both and are true.
- (b) is true and is false.
- (c) is false and is true.
- (d) Both and are false.
Show answer
(c) is false and is true.
Assume that a 12-bit Hamming codeword consisting of 8-bit data and 4 check bits is , where the data bits and the check bits are given in the following tables:
Data bits:
| | | | | | | | |
|---|---|---|---|---|---|---|---|
| 1 | 1 | 0 | | 0 | 1 | 0 | 1 |
Check bits:
| | | | |
|---|---|---|---|
| | 0 | 1 | 0 |
Which one of the following choices gives the correct values of and ?- (a) is 0 and is 0.
- (b) is 0 and is 1.
- (c) is 1 and is 0.
- (d) is 1 and is 1.
Show answer
(a) is 0 and is 0.
Consider the cyclic redundancy check (CRC) based error detecting scheme having the generator polynomial . Suppose the message is to be transmitted. Check bits are appended at the end of the message by the transmitter using the above CRC scheme. The transmitted bit string is denoted by . The value of the checkbit sequence is
- (a) 101
- (b) 110
- (c) 100
- (d) 111
Show answer
(c) 100
A TCP server application is programmed to listen on port number on host . A TCP client is connected to the TCP server over the network.
Consider that while the TCP connection was active, the server machine crashed and rebooted. Assume that the client does not use the TCP keepalive timer.
Which of the following behaviors is/are possible?- (a) If the client was waiting to receive a packet, it may wait indefinitely.
- (b) The TCP server application on can listen on after reboot.
- (c) If the client sends a packet after the server reboot, it will receive a RST segment.
- (d) If the client sends a packet after the server reboot, it will receive a FIN segment.
Show answer
()
Consider two hosts and connected through a router . The maximum transfer unit (MTU) value of the link between and is 1500 bytes, and between and is 820 bytes.
A TCP segment of size 1400 bytes was transferred from to through , with IP identification value as 0x1234. 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 .
Which of the following statements is/are correct?- (a) Two fragments are created at and the IP datagram size carrying the second fragment is 620 bytes.
- (b) If the second fragment is lost, will resend the fragment with the IP identification value 0x1234.
- (c) If the second fragment is lost, is required to resend the whole TCP segment.
- (d) TCP destination port can be determined by analysing *only* the second fragment.
Show answer
()
Consider a computer network using the distance vector routing algorithm in its network layer. The partial topology of the network is as shown below.
The objective is to find the shortest-cost path from the router to routers and . Assume that does not initially know the shortest routes to and . Assume that has three neighbouring routers denoted as , , and . During one iteration, measures its distance to its neighbours , , and as 3, 2, and 5, respectively. Router gets routing vectors from its neighbours that indicate that the distance to router from routers , , and are 7, 6, and 5, respectively. The routing vector also indicates that the distance to router from routers , , and are 4, 6, and 8, respectively. Which of the following statement(s) is/are correct with respect to the new routing table of , after updation during this iteration?- (a) The distance from to will be stored as 10.
- (b) The distance from to will be stored as 7.
- (c) The next hop router for a packet from to is .
- (d) The next hop router for a packet from to is .
Show answer
()
Consider the sliding window flow-control protocol operating between a sender and a receiver over a full-duplex error-free link. Assume the following:
- The time taken for processing the data frame by the receiver is negligible.
- The time taken for processing the acknowledgement frame by the sender is negligible.
- The sender has infinite number of frames available for transmission.
- The size of the data frame is 2,000 bits and the size of the acknowledgement frame is 10 bits.
- The link data rate in each direction is 1 Mbps ( bits per second).
- 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 ______.Consider a network using the pure ALOHA medium access control protocol, where each frame is of length 1,000 bits. The channel transmission rate is 1 Mbps ( bits per second). The aggregate number of transmissions across all the nodes (including new frame transmissions and retransmitted frames due to collisions) is modelled as a Poisson process with a rate of 1,000 frames per second. Throughput is defined as the average number of frames successfully transmitted per second. The throughput of the network (rounded to the nearest integer) is __________.
Consider the following statements about the functionality of an IP based router. I. A router does not modify the IP packets during forwarding. II. It is not necessary for a router to implement any routing protocol. III. A router should reassemble IP fragments if the MTU of the outgoing link is larger than the size of the incoming IP packet. Which of the above statements is/are TRUE?
- (a) I and II only
- (b) I only
- (c) II and III only
- (d) II only
Show answer
(d) II only
Assume that you have made a request for a web page through your web browser to a web server. Initially the browser cache is empty. Further, the browser is configured to send HTTP requests in non-persistent mode. The web page contains text and five very small images. The minimum number of TCP connections required to display the web page completely in your browser is \_\_\_\_\_\_\_.
An organization requires a range of IP addresses to assign one to each of its 1500 computers. The organization has approached an Internet Service Provider (ISP) for this task. The ISP uses CIDR and serves the requests from the available IP address space 202.61.0.0/17. The ISP wants to assign an address space to the organization which will minimize the number of routing entries in the ISP's router using route aggregation. Which of the following address spaces are potential candidates from which the ISP can allot any one to the organization? I. 202.61.84.0/21 II. 202.61.104.0/21 III. 202.61.64.0/21 IV. 202.61.144.0/21
- (a) I and II only
- (b) II and III only
- (c) III and IV only
- (d) I and IV only
Show answer
(b) II and III only
Consider a TCP connection between a client and a server with the following specifications: the round trip time is 6 ms, the size of the receiver advertised window is 50 KB, slow-start threshold at the client is 32 KB, and the maximum segment size is 2 KB. The connection is established at time . Assume that there are no timeouts and errors during transmission. Then the size of the congestion window (in KB) at time ms after all acknowledgements are processed is \_\_\_\_\_\_\_\_.
Which of the following protocol pairs can be used to send and retrieve e-mails (in that order)?
- (a) IMAP, POP3
- (b) SMTP, POP3
- (c) SMTP, MIME
- (d) IMAP, SMTP
Show answer
(b) SMTP, POP3
Consider three machines M, N, and P with IP addresses 100.10.5.2, 100.10.5.5, and 100.10.5.6 respectively. The subnet mask is set to 255.255.255.252 for all the three machines. Which one of the following is true?
- (a) M, N, and P all belong to the same subnet
- (b) Only M and N belong to the same subnet
- (c) Only N and P belong to the same subnet
- (d) M, N, and P belong to three different subnets
Show answer
(c) Only N and P belong to the same subnet
Suppose that in an IP-over-Ethernet network, a machine X wishes to find the MAC address of another machine Y in its subnet. Which one of the following techniques can be used for this?
- (a) X sends an ARP request packet to the local gateway's IP address which then finds the MAC address of Y and sends to X
- (b) X sends an ARP request packet to the local gateway's MAC address which then finds the MAC address of Y and sends to X
- (c) X sends an ARP request packet with broadcast MAC address in its local subnet
- (d) X sends an ARP request packet with broadcast IP address in its local subnet
Show answer
(c) X sends an ARP request packet with broadcast MAC address in its local subnet
Consider that 15 machines need to be connected in a LAN using 8-port Ethernet switches. Assume that these switches do not have any separate uplink ports. The minimum number of switches needed is_________.
15IT fundamentals, security and law1 ch · 17 min1 PYQ
See the 1 question GATE Computer Science and IT (CS) asked from this module
In an RSA cryptosystem, the value of the public modulus parameter is 3007. If it is also known that , where denotes Euler's Totient Function, then the prime factor of which is greater than 50 is ________________.
Aptitude (CSAT)10 modules47 ch10 h 17 min87 PYQ
16Number sense5 ch · 1 h 11 min2 PYQ
- Numbers and their relations: place value, kinds of numbers and orders of magnitude 15′
- Divisibility, factors, HCF and LCM 16′
- Fractions, decimals and simplification 14′
- Powers, roots and surds 13′
- Unit digits, remainders and number puzzles 13′
See the 2 questions GATE Computer Science and IT (CS) asked from this module
Let and denote two arbitrary prime numbers. Which one of the following statements is correct for all values of and ?
- (a) is not a prime number.
- (b) is not a prime number.
- (c) is a prime number.
- (d) is a prime number.
Show answer
(b) is not a prime number.
For positive non-zero real variables and , if
then, the value of is- (a) 79
- (b) 81
- (c) 9
- (d) 83
Show answer
(a) 79
17Percentages and their family6 ch · 1 h 23 min8 PYQ
- Percentage 16′
- Profit, loss and discount 13′
- Simple and compound interest 14′
- Ratio, proportion and partnership 14′
- Averages 13′
- Mixtures and alligation 13′
See the 8 questions GATE Computer Science and IT (CS) asked from this module
The values of Stock A and Stock B on a particular day are Rs. 50 and Rs. 80, respectively. An investor invests Rs. 100 in Stock A and Rs. 80 in Stock B. He sells all the stocks the next day when the value of Stock A is Rs. 55 and Stock B is Rs. 70. The profit made by the investor is Rs. ________
- (a) 0
- (b) 5
- (c) 10
- (d) 20
Show answer
(a) 0
The average marks obtained by a class in an examination were calculated as 30.8. However, while checking the marks entered, the teacher found that the marks of one student were entered incorrectly as 24 instead of 42. After correcting the marks, the average becomes 31.4. How many students does the class have?
- (a) 25
- (b) 28
- (c) 30
- (d) 32
Show answer
(c) 30
If two distinct non-zero real variables and are such that is proportional to then the value of
- (a) depends on
- (b) depends only on and not on
- (c) depends only on and not on
- (d) is a constant
Show answer
(d) is a constant
The number of coins of ₹1, ₹5, and ₹10 denominations that a person has are in the ratio 5:3:13. Of the total amount, the percentage of money in ₹5 coins is
- (a) 21%
- (b) %
- (c) 10%
- (d) 30%
Show answer
(c) 10%
A person sold two different items at the same price. He made 10% profit in one item, and 10% loss in the other item. In selling these two items, the person made a total of
- (a) 1% profit
- (b) 2% profit
- (c) 1% loss
- (d) 2% loss
Show answer
(c) 1% loss
The ratio of boys to girls in a class is 7 to 3. Among the options below, an acceptable value for the total number of students in the class is:
- (a) 21
- (b) 37
- (c) 50
- (d) 73
Show answer
(c) 50
| Items | Cost (₹) | Profit % | Marked Price (₹) |
|---|---|---|---|
| P | 5,400 | --- | 5,860 |
| Q | --- | 25 | 10,000 |
Details of prices of two items P and Q are presented in the above table. The ratio of cost of item P to cost of item Q is 3:4. Discount is calculated as the difference between the marked price and the selling price. The profit percentage is calculated as the ratio of the difference between selling price and cost, to the cost .
The discount on item Q, as a percentage of its marked price, is ______- (a) 25
- (b) 12.5
- (c) 10
- (d) 5
Show answer
(c) 10
The number of students in three classes is in the ratio 3:13:6. If 18 students are added to each class, the ratio changes to 15:35:21. The total number of students in all the three classes in the beginning was:
- (a) 22
- (b) 66
- (c) 88
- (d) 110
Show answer
(c) 88
18Time, work and motion4 ch · 54 min1 PYQ
- Time and work, pipes and cisterns 15′
- Speed, time and distance 13′
- Trains, boats and streams, races 13′
- Ages and word problems 13′
See the 1 question GATE Computer Science and IT (CS) asked from this module
Two cars start at the same time from the same location and go in the same direction. The speed of the first car is 50 km/h and the speed of the second car is 60 km/h. The number of hours it takes for the distance between the two cars to be 20 km is ___.
- (a) 1
- (b) 2
- (c) 3
- (d) 6
Show answer
(b) 2
19Algebra, geometry and counting6 ch · 1 h 13 min29 PYQ
- Linear and quadratic equations, inequalities 13′
- Arithmetic and geometric progressions 12′
- Geometry: lines, triangles, polygons and circles 12′
- Mensuration: areas, surfaces and volumes 12′
- Counting: permutations and combinations 12′
- Probability 12′
See the 29 questions GATE Computer Science and IT (CS) asked from this module
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
Show answer
(c) 63
A day can only be cloudy or sunny. The probability of a day being cloudy is 0.5, independent of the condition on other days. What is the probability that in any given four days, there will be three cloudy days and one sunny day?
- (a) 1/4
- (b) 3/4
- (c) 2/3
- (d) 3/8
Show answer
(a) 1/4
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
Show answer
(d) 25
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)
Show answer
(c)
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 sum of the two recorded numbers is a prime number is ________
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
If for all real values of , which one of the following statements is true?
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
In the diagram, the lines QR and ST are parallel to each other. The shortest distance between these two lines is half the shortest distance between the point P and line QR. What is the ratio of the area of the triangle PST to the area of the trapezium SQRT? Note: The figure shown is representative.
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
A fair six-faced dice, with the faces labelled ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, and ‘6’, is rolled thrice. What is the probability of rolling ‘6’ exactly once?
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
In the given figure, PQRS is a square of side 2 cm and PLMN is a rectangle. The corner L of the rectangle is on the side QR. Side MN of the rectangle passes through the corner S of the square. What is the area (in cm$^{2}$) of the rectangle PLMN? Note: The figure shown is representative.
- (a)
- (b)
- (c)
- (d)
Show answer
(d)
A shop has 4 distinct flavors of ice-cream. One can purchase any number of scoops of any flavor. The order in which the scoops are purchased is inconsequential. If one wants to purchase 3 scoops of ice-cream, in how many ways can one make that purchase?
- (a) 4
- (b) 20
- (c) 24
- (d) 48
Show answer
(b) 20
Two wizards try to create a spell using all the four elements, water, air, fire, and earth. For this, they decide to mix all these elements in all possible orders. They also decide to work independently. After trying all possible combination of elements, they conclude that the spell does not work. How many attempts does each wizard make before coming to this conclusion, independently?
- (a) 24
- (b) 48
- (c) 16
- (d) 12
Show answer
(a) 24
For positive non-zero real variables and , if
then, the value of is- (a) 1
- (b) 1/2
- (c) 2
- (d) 4
Show answer
(c) 2
A rectangular paper sheet of dimensions 54 cm × 4 cm is taken. The two longer edges of the sheet are joined together to create a cylindrical tube. A cube whose surface area is equal to the area of the sheet is also taken. Then, the ratio of the volume of the cylindrical tube to the volume of the cube is
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
A rectangular paper of 20 cm × 8 cm is folded 3 times. Each fold is made along the line of symmetry, which is perpendicular to its long edge. The perimeter of the final folded sheet (in cm) is
- (a) 18
- (b) 24
- (c) 20
- (d) 21
Show answer
(a) 18
Looking at the surface of a smooth 3-dimensional object from the outside, which one of the following options is TRUE?
- (a) The surface of the object must be concave everywhere.
- (b) The surface of the object must be convex everywhere.
- (c) The surface of the object may be concave in some places and convex in other places.
- (d) The object can have edges, but no corners.
Show answer
(c) The surface of the object may be concave in some places and convex in other places.
Consider two functions of time (),
where .
Now consider the following two statements:
(i) For some , .
(ii) There exists a , such that for all .
Which one of the following options is TRUE?- (a) only (i) is correct
- (b) only (ii) is correct
- (c) both (i) and (ii) are correct
- (d) neither (i) nor (ii) is correct
Show answer
(c) both (i) and (ii) are correct
and are functions of and , respectively, and for all real values of and . Which one of the following options is *necessarily* TRUE for all and ?
- (a) and
- (b) constant
- (c) constant and constant
- (d)
Show answer
(b) constant
A function is defined in the interval on the -axis as
Which one of the following is the area under the curve for the interval on the -axis?- (a)
- (b)
- (c)
- (d)
Show answer
(c)
Let be a root of the equation .
Then the value of the expression is- (a)
- (b)
- (c)
- (d)
Show answer
(d)
A box contains five balls of same size and shape. Three of them are green coloured balls and two of them are orange coloured balls. Balls are drawn from the box one at a time. If a green ball is drawn, it is not replaced. If an orange ball is drawn, it is replaced with another orange ball. First ball is drawn. What is the probability of getting an orange ball in the next draw?
- (a)
- (b)
- (c)
- (d)
Show answer
(d)
The corners and mid-points of the sides of a triangle are named using the distinct letters P, Q, R, S, T and U, but not necessarily in the same order. Consider the following statements: - The line joining P and R is parallel to the line joining Q and S. - P is placed on the side opposite to the corner T. - S and U cannot be placed on the same side. Which one of the following statements is correct based on the above information?
- (a) P cannot be placed at a corner
- (b) S cannot be placed at a corner
- (c) U cannot be placed at a mid-point
- (d) R cannot be placed at a corner
Show answer
(b) S cannot be placed at a corner
A polygon is convex if, for every pair of points, P and Q belonging to the polygon, the line segment PQ lies completely inside or on the polygon. Which one of the following is NOT a convex polygon?
- (a) [Figure: a chevron (arrow-head) shaped hexagon pointing right, with a notch cut into its left side]
- (b) [Figure: a triangle]
- (c) [Figure: a square]
- (d) [Figure: a trapezium with the shorter parallel side on top]
Show answer
(a) [Figure: a chevron (arrow-head) shaped hexagon pointing right, with a notch cut into its left side]
If is the angle, in degrees, between the longest diagonal of the cube and any one of the edges of the cube, then,
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
If , then the value of is:
- (a) 2
- (b) 4
- (c) 6
- (d) 8
Show answer
(b) 4
We have 2 rectangular sheets of paper, M and N, of dimensions 6 cm x 1 cm each. Sheet M is rolled to form an open cylinder by bringing the short edges of the sheet together. Sheet N is cut into equal square patches and assembled to form the largest possible closed cube. Assuming the ends of the cylinder are closed, the ratio of the volume of the cylinder to that of the cube is __________
- (a)
- (b)
- (c)
- (d)
Show answer
(c)
There are five bags each containing identical sets of ten distinct chocolates. One chocolate is picked from each bag. The probability that at least two chocolates are identical is ___________
- (a) 0.3024
- (b) 0.4235
- (c) 0.6976
- (d) 0.8125
Show answer
(c) 0.6976
The figure below shows an annular ring with outer and inner radii as and , respectively. The annular space has been painted in the form of blue colour circles touching the outer and inner periphery of annular space. If maximum number of circles can be painted, then the unpainted area available in annular space is \_\_\_\_\_.
- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Two straight lines are drawn perpendicular to each other in X-Y plane. If and are the acute angles the straight lines make with the X-axis, then is \_\_\_\_\_.
- (a)
- (b)
- (c)
- (d)
Show answer
(b)
Ten friends planned to share equally the cost of buying a gift for their teacher. When two of them decided not to contribute, each of the other friends had to pay Rs 150 more. The cost of the gift was Rs. ____.
- (a) 666
- (b) 3000
- (c) 6000
- (d) 12000
Show answer
(c) 6000
20Data interpretation and statistics6 ch · 1 h 12 min6 PYQ
- Reading tables 12′
- Bar graphs and line graphs 12′
- Pie charts and mixed graphs 12′
- Data sufficiency 12′
- Basic statistics: mean, median, mode and range 12′
- Statistical analysis, graphs and diagrams for Mains 12′
See the 6 questions GATE Computer Science and IT (CS) asked from this module
For positive real numbers and , the function is defined as: . The max function is defined as:
The graph below shows the plot of a function versus .
can be expressed as _____.- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Which one of the following options is correct for the given data in the table?
| Iteration () | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| Input () | 20 | | 10 | 15 |
| Output () | 20 | 16 | 26 | 41 |
| Output () | 20 | | | |- (a)
- (b)
- (c)
- (d)
Show answer
(a)
Consider the following sample of numbers: 9, 18, 11, 14, 15, 17, 10, 69, 11, 13 The median of the sample is
- (a) 13.5
- (b) 14
- (c) 11
- (d) 18.7
Show answer
(a) 13.5
The pie chart presents the percentage contribution of different macronutrients to a typical 2,000 kcal diet of a person. Macronutrient energy contribution (pie chart): Carbohydrates 35%, Proteins 20%, Unsaturated fat 20%, Saturated fat 20%, Trans fat 5%. The typical energy density (kcal/g) of these macronutrients is given in the table. | Macronutrient | Energy density (kcal/g) | |---|---| | Carbohydrates | 4 | | Proteins | 4 | | Unsaturated fat | 9 | | Saturated fat | 9 | | Trans fat | 9 | The total fat (all three types), in grams, this person consumes is
- (a) 44.4
- (b) 77.8
- (c) 100
- (d) 3,600
Show answer
(c) 100
The pie charts depict the shares of various power generation technologies in the total electricity generation of a country for the years 2007 and 2023. | Source | Year 2007 | Year 2023 | |---|---|---| | Coal | 35% | 20% | | Gas | 25% | 15% | | Hydro | 30% | 35% | | Solar | 5% | 20% | | Wind | 5% | 10% | The renewable sources of electricity generation consist of Hydro, Solar and Wind. Assuming that the total electricity generated remains the same from 2007 to 2023, what is the percentage increase in the share of the renewable sources of electricity generation over this period?
- (a) 25%
- (b) 50%
- (c) 77.5%
- (d) 62.5%
Show answer
(d) 62.5%
The total revenue of a company during 2014-2018 is shown in the bar graph. If the total expenditure of the company in each year is 500 million rupees, then the aggregate profit or loss (in percentage) on the total expenditure of the company during 2014-2018 is \_\_\_\_.\n\n| Year | 2014 | 2015 | 2016 | 2017 | 2018 |\n|---|---|---|---|---|---|\n| Revenue (In million rupees) | 500 | 700 | 800 | 600 | 400 |
- (a) 16.67 % profit
- (b) 16.67 % loss
- (c) 20 % profit
- (d) 20 % loss
Show answer
(c) 20 % profit
21Verbal reasoning6 ch · 1 h 12 min8 PYQ
- Number and letter series 12′
- Coding and decoding 12′
- Blood relations 12′
- Direction sense 12′
- Ranking, order and comparison 12′
- Clocks and calendars 12′
See the 8 questions GATE Computer Science and IT (CS) asked from this module
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
Show answer
(a) Third
Consider the relationships among P, Q, R, S, and T: - P is the brother of Q. - S is the daughter of Q. - T is the sister of S. - R is the mother of Q. The following statements are made based on the relationships given above. (1) R is the grandmother of S. (2) P is the uncle of S and T. (3) R has only one son. (4) Q has only one daughter. Which one of the following options is correct?
- (a) Both (1) and (2) are true.
- (b) Both (1) and (3) are true.
- (c) Only (3) is true.
- (d) Only (4) is true.
Show answer
(a) Both (1) and (2) are true.
According to the map shown in the figure, which one of the following statements is correct? Note: The figure shown is representative.
- (a) The library is located to the northwest of the canteen.
- (b) The hospital is located to the east of the chemistry lab.
- (c) The chemistry lab is to the southeast of physics lab.
- (d) The classrooms and canteen are next to each other.
Show answer
(c) The chemistry lab is to the southeast of physics lab.
If IMAGE and FIELD are coded as FHBNJ and EMFJG respectively then, which one among the given options is the most appropriate code for BEACH ?
- (a) CEADP
- (b) IDBFC
- (c) JGIBC
- (d) IBCEC
Show answer
(b) IDBFC
In the sequence 6, 9, 14, , 30, 41, a possible value of is
- (a) 25
- (b) 21
- (c) 18
- (d) 20
Show answer
(b) 21
A series of natural numbers obeys for all integers .
If , and , then what is ?- (a) 4
- (b) 5
- (c) 8
- (d) 9
Show answer
(a) 4
Six students P, Q, R, S, T and U, with distinct heights, compare their heights and make the following observations. Observation I: S is taller than R. Observation II. Q is the shortest of all. Observation III: U is taller than only one student. Observation IV: T is taller than S but is not the tallest. The number of students that are taller than R is the same as the number of students shorter than ______.
- (a) T
- (b) R
- (c) S
- (d) P
Show answer
(c) S
If P = 3, R = 27, T = 243, then Q + S = \_\_\_\_\_\_.
- (a) 40
- (b) 80
- (c) 90
- (d) 110
Show answer
(c) 90
22Puzzles and visual reasoning6 ch · 1 h 29 min22 PYQ
- Linear seating arrangement 18′
- Circular and table seating 16′
- Scheduling, floors and grid puzzles 16′
- Venn diagrams and set counting 12′
- Cubes and dice 14′
- Non-verbal reasoning: figure counting, mirror images and pattern series 13′
See the 22 questions GATE Computer Science and IT (CS) asked from this module
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?
- (a) A rectangle of tiles
- (b) A rectangle of tiles
- (c) A rectangle of tiles
- (d) A rectangle of tiles
Show answer
(c) A rectangle of tiles
A black square PQRS has been cut into two parts. One part of it is shown in Panel I. Which one of the shapes in Panel II is the other part?
- (a) (i)
- (b) (ii)
- (c) (iii)
- (d) (iv)
Show answer
(c) (iii)
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?
- (a) (i)
- (b) (ii)
- (c) (iii)
- (d) (iv)
Show answer
(d) (iv)
Two tiles are missing in Panel I. Which one of the options in Panel II is the appropriate choice for the missing tiles?
Panel I is a arrangement of tiles; each tile is a pattern of dots, written below row by row (● black dot, ○ white dot). The two missing tiles are in the third column, second and third rows (marked ?).
| | Column 1 | Column 2 | Column 3 |
|---|---|---|---|
| Row 1 | ○●● / ●●● / ●●● | ○○○ / ○○○ / ○○● | ○●● / ○●● / ○●● |
| Row 2 | ○○● / ○○● / ○○● | ○○● / ○●● / ○●● | ? |
| Row 3 | ○○● / ○○● / ○●● | ●●● / ●●● / ●●● | ? |
Panel II (each option gives the upper missing tile, then the lower missing tile):
| Option | Upper tile | Lower tile |
|---|---|---|
| (i) | ○●● / ○●● / ●●● | ○○○ / ○○● / ○○● |
| (ii) | ○●● / ○●● / ○●● | ○○○ / ○○● / ○○● |
| (iii) | ○●● / ○●● / ●●● | ○○● / ○○● / ○○● |
| (iv) | ○●● / ○●● / ○●● | ○○● / ○○● / ○●● |- (a) (i)
- (b) (ii)
- (c) (iii)
- (d) (iv)
Show answer
(a) (i)
The figure in Panel I below is a grid of cells with four rows and four columns. The numbers on the top and on the left represent the number of cells that are to be shaded in that column and row, respectively. Which one of the options shown in Panel II below represents the grid shaded correctly? Panel I: column numbers (left to right) 2, 2, 2, 2; row numbers (top to bottom) 3, 1, 2, 2. Panel II (■ shaded, □ unshaded, rows from top to bottom): | Option | Row 1 | Row 2 | Row 3 | Row 4 | |---|---|---|---|---| | (i) | ■□■■ | □■□■ | □□■□ | ■■□□ | | (ii) | ■□■■ | □■□□ | □□■■ | ■■□□ | | (iii) | ■□■■ | □■■□ | □□■□ | ■■□□ | | (iv) | ■□■■ | □■□□ | □□■□ | ■■□■ |
- (a) (i)
- (b) (ii)
- (c) (iii)
- (d) (iv)
Show answer
(b) (ii)
The paper as shown in the figure is folded to make a cube where each square corresponds to a particular face of the cube. Which one of the following options correctly represents the cube? Note: The figures shown are representative.
- (a) Cube showing an open triangle on the front face, a filled circle on the top face and a blank right face
- (b) Cube showing an open triangle on the front face, a blank top face and a filled triangle on the right face
- (c) Cube showing an open triangle on the front face, a blank top face and a blank right face
- (d) Cube showing an open triangle on the front face, a filled triangle on the top face and a filled circle on the right face
Show answer
(a) Cube showing an open triangle on the front face, a filled circle on the top face and a blank right face
A square paper, shown in figure (I), is folded along the dotted lines as shown in the figures (II) and (III). Then a few cuts are made as shown in figure (IV). Which one of the following patterns will be obtained when the paper is unfolded? Note: The figures shown are representative.
- (a) [Figure] Unfolded square with triangular notches at the middle of all four edges (pointing inward from top and bottom edges and outward along left and right), small filled squares near the top-left and bottom-right corners, and small L-shaped cuts near the top-right and bottom-left corners.
- (b) [Figure] Same as the first pattern but with small diamonds (instead of squares) near the top-left and bottom-right corners.
- (c) [Figure] Unfolded square with filled squares near the top-left and bottom-right corners, L-shaped cuts near the top-right and bottom-left corners, triangular notches at the middle of the left and right edges, and the triangles at the top and bottom edges pointing the opposite way (top one pointing down, bottom one pointing up).
- (d) [Figure] Unfolded square with triangular notches at the middle of all four edges, L-shaped cuts near the top-right and bottom-left corners, and a single filled square at the centre (no corner squares).
Show answer
(a) [Figure] Unfolded square with triangular notches at the middle of all four edges (pointing inward from top and bottom edges and outward along left and right), small filled squares near the top-left and bottom-right corners, and small L-shaped cuts near the top-right and bottom-left corners.
The diagram below shows a river system consisting of 7 segments, marked P, Q, R, S, T, U, and V. It splits the land into 5 zones, marked Z1, Z2, Z3, Z4, and Z5. We need to connect these zones using the least number of bridges. Out of the following options, which one is correct? Note: The figure shown is representative.
- (a) Bridges on P, Q, and T
- (b) Bridges on P, Q, S, and T
- (c) Bridges on Q, R, T, and V
- (d) Bridges on P, Q, S, U, and V
Show answer
(c) Bridges on Q, R, T, and V
In an engineering college of 10,000 students, 1,500 like neither their core branches nor other branches. The number of students who like their core branches is 1/4th of the number of students who like other branches. The number of students who like both their core and other branches is 500. The number of students who like their core branches is
- (a) 1,800
- (b) 3,500
- (c) 1,600
- (d) 1,500
Show answer
(a) 1,800
A cube is to be cut into 8 pieces of equal size and shape. Here, each cut should be straight and it should not stop till it reaches the other end of the cube. The minimum number of such cuts required is
- (a) 3
- (b) 4
- (c) 7
- (d) 8
Show answer
(a) 3
The least number of squares to be added in the figure to make AB a line of symmetry is
- (a) 6
- (b) 4
- (c) 5
- (d) 7
Show answer
(a) 6
In the 4 × 4 array shown below, each cell of the first three rows has either a cross (X) or a number. | | | | | |---|---|---|---| | 1 | X | 4 | 3 | | X | 5 | 5 | 4 | | 3 | X | 6 | X | | | | | | The number in a cell represents the count of the immediate neighboring cells (left, right, top, bottom, diagonals) NOT having a cross (X). Given that the last row has no crosses (X), the sum of the four numbers to be filled in the last row is
- (a) 11
- (b) 10
- (c) 12
- (d) 9
Show answer
(a) 11
Which one of the options best describes the transformation of the 2-dimensional figure **P** to **Q**, and then to **R**, as shown?
- (a) *Operation 1*: A clockwise rotation by 90º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a horizontal line
- (b) *Operation 1*: A counter clockwise rotation by 90º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a horizontal line
- (c) *Operation 1*: A clockwise rotation by 90º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a vertical line
- (d) *Operation 1*: A counter clockwise rotation by 180º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a vertical line
Show answer
(a) *Operation 1*: A clockwise rotation by 90º about an axis perpendicular to the plane of the figure *Operation 2*: A reflection along a horizontal line
A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. [Plates: A, D] From the additional plates given in the options, which one of the combinations of additional plates would allow the player to construct a five-letter palindrome. The player should use all the five plates exactly once. The plates can be rotated in their plane.
- (a) [Plates: D, D rotated, J]
- (b) [Plates: R, A upside down, R rotated]
- (c) [Plates: Z, E rotated, D]
- (d) [Plates: I, L rotated, Y]
Show answer
(b) [Plates: R, A upside down, R rotated]
A plot of land must be divided between four families. They want their individual plots to be similar in shape, not necessarily equal in area. The land has equally spaced poles, marked as dots in the below figure. Two ropes, R1 and R2, are already present and cannot be moved. What is the least number of **additional** straight ropes needed to create the desired plots? A single rope can pass through three poles that are aligned in a straight line.
- (a) 2
- (b) 4
- (c) 5
- (d) 3
Show answer
(d) 3
A transparent square sheet shown above is folded along the dotted line. The folded sheet will look like ________.
- (a) Right half of the sheet showing one curve rising from the middle of the left (fold) edge to the top-right with two short vertical ticks on it, and another curve falling from the same point to the bottom-right corner with two short horizontal dashes on it
- (b) Right half of the sheet showing a lens shape made by two curves joining the left (fold) edge to the bottom-right corner, with two short vertical ticks and two short horizontal dashes inside the lens forming a stepped mark
- (c) Right half of the sheet showing a lens shape made by two curves joining the left (fold) edge to the bottom-right corner, with two horizontal dashes inside the lens and no vertical ticks
- (d) Right half of the sheet showing a lens shape made by two curves joining the left (fold) edge to the bottom-right corner, with a small zigzag of short strokes inside the lens
Show answer
(b) Right half of the sheet showing a lens shape made by two curves joining the left (fold) edge to the bottom-right corner, with two short vertical ticks and two short horizontal dashes inside the lens forming a stepped mark
A circular sheet of paper is folded along the lines in the directions shown. The paper, after being punched in the final folded state as shown and unfolded in the reverse order of folding, will look like _______.
- (a) [Figure: circle with a central circular hole, long horizontal slots above and below it, and short vertical slots to its left and right]
- (b) [Figure: circle with a central circular hole, long horizontal slots above and below it, and short horizontal slots to its left and right]
- (c) [Figure: circle with a central circular hole, short horizontal slots above and below it, and long vertical slots to its left and right]
- (d) [Figure: circle with a central circular hole, short vertical slots above and below it, and long vertical slots to its left and right]
Show answer
(a) [Figure: circle with a central circular hole, long horizontal slots above and below it, and short vertical slots to its left and right]
A jigsaw puzzle has 2 pieces. One of the pieces is shown above. Which one of the given options for the missing piece when assembled will form a rectangle? The piece can be moved, rotated or flipped to assemble with the above piece.
- (a) Piece (A) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, matching the given piece's slots and teeth in sizes and positions
- (b) Piece (B) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, differing from (A) in the depth of the slots
- (c) Piece (C) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, differing from (A) in the shapes of the middle teeth
- (d) Piece (D) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, with a different sequence of tooth heights
Show answer
(a) Piece (A) as drawn: a straight bottom edge with a row of rectangular teeth and slots along the top, matching the given piece's slots and teeth in sizes and positions
The police arrested four criminals – P, Q, R and S. The criminals knew each other. They made the following statements: P says “Q committed the crime.” Q says “S committed the crime.” R says “I did not do it.” S says “What Q said about me is false.” Assume only one of the arrested four committed the crime and only one of the statements made above is true. Who committed the crime?
- (a) P
- (b) R
- (c) S
- (d) Q
Show answer
(b) R
In the given diagram, teachers are represented in the triangle, researchers in the circle and administrators in the rectangle. Out of the total number of the people, the percentage of administrators shall be in the range of ___________.
- (a) 0 to 15
- (b) 16 to 30
- (c) 31 to 45
- (d) 46 to 60
Show answer
(c) 31 to 45
In a college, there are three student clubs. Sixty students are only in the Drama club, 80 students are only in the Dance club, 30 students are only in the Maths club, 40 students are in both Drama and Dance clubs, 12 students are in both Dance and Maths clubs, 7 students are in both Drama and Maths clubs, and 2 students are in all the clubs. If 75% of the students in the college are not in any of these clubs, then the total number of students in the college is _____.
- (a) 1000
- (b) 975
- (c) 900
- (d) 225
Show answer
(c) 900
Three of the five students allocated to a hostel put in special requests to the warden. Given the floor plan of the vacant rooms, select the allocation plan that will accommodate all their requests. Request by X: Due to pollen allergy, I want to avoid a wing next to the garden. Request by Y: I want to live as far from the washrooms as possible, since I am very sensitive to smell. Request by Z: I believe in Vaastu and so want to stay in the South-west wing. The shaded rooms are already occupied. WR is washroom.
- (a) Plan (A): Z in the North-west wing (left side); X in the South-west wing next to the washroom; Y in the South-west wing (bottom row)
- (b) Plan (B): X in the top-right corner room next to the garden; Z in the North-west wing (left side); Y in the South-east wing next to the garden
- (c) Plan (C): Z in the top-right corner room next to the garden; Y in the South-east wing next to the garden; X in the South-west wing next to the washroom
- (d) Plan (D): X in the South-west wing next to the washroom; Z in the South-west wing (bottom row); Y in the South-east wing below the entrance, far from both washrooms
Show answer
(d) Plan (D): X in the South-west wing next to the washroom; Z in the South-west wing (bottom row); Y in the South-east wing below the entrance, far from both washrooms
23Logical reasoning6 ch · 1 h 13 min6 PYQ
- Syllogisms 12′
- Statements: conclusions and assumptions 12′
- Arguments and courses of action 12′
- Cause and effect, assertion and reason 12′
- Logical connectives: if–then, only if, unless, either–or 12′
- Critical reasoning: strengthen, weaken, assumption, flaw 13′
See the 6 questions GATE Computer Science and IT (CS) asked from this module
‘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.
Show answer
(c) If all students are standing, then the teacher is in the room.
'When it is raining, peacocks dance.' Based only on this sentence, which one of the following options is necessarily true?
- (a) Peacocks dance only when it is raining.
- (b) When peacocks dance, it is raining.
- (c) When peacocks are not dancing, it is not raining.
- (d) When it is not raining, peacocks do not dance.
Show answer
(c) When peacocks are not dancing, it is not raining.
A survey for a certain year found that 90% of pregnant women received medical care at least once before giving birth. Of these women, 60% received medical care from doctors, while 40% received medical care from other healthcare providers. Given this information, which one of the following statements can be inferred with certainty?
- (a) More than half of the pregnant women received medical care at least once from a doctor.
- (b) Less than half of the pregnant women received medical care at least once from a doctor.
- (c) More than half of the pregnant women received medical care at most once from a doctor.
- (d) Less than half of the pregnant women received medical care at most once from a doctor.
Show answer
(a) More than half of the pregnant women received medical care at least once from a doctor.
The country of Zombieland is in distress since more than 75% of its working population is suffering from serious health issues. Studies conducted by competent health experts concluded that a complete lack of physical exercise among its working population was one of the leading causes of their health issues. As one of the measures to address the problem, the Government of Zombieland has decided to provide monetary incentives to those who ride bicycles to work. Based only on the information provided above, which one of the following statements can be logically inferred with certainty?
- (a) All the working population of Zombieland will henceforth ride bicycles to work.
- (b) Riding bicycles will ensure that all of the working population of Zombieland is free of health issues.
- (c) The health experts suggested to the Government of Zombieland to declare riding bicycles as mandatory.
- (d) The Government of Zombieland believes that riding bicycles is a form of physical exercise.
Show answer
(d) The Government of Zombieland believes that riding bicycles is a form of physical exercise.
Given below are four statements. Statement 1: All students are inquisitive. Statement 2: Some students are inquisitive. Statement 3: No student is inquisitive. Statement 4: Some students are not inquisitive. From the given four statements, find the two statements that CANNOT BE TRUE simultaneously, assuming that there is at least one student in the class.
- (a) Statement 1 and Statement 3
- (b) Statement 1 and Statement 2
- (c) Statement 2 and Statement 4
- (d) Statement 3 and Statement 4
Show answer
(a) Statement 1 and Statement 3
Given below are two statements 1 and 2, and two conclusions I and II. Statement 1: All bacteria are microorganisms. Statement 2: All pathogens are microorganisms. Conclusion I: Some pathogens are bacteria. Conclusion II: All pathogens are not bacteria. Based on the above statements and conclusions, which one of the following options is logically CORRECT?
- (a) Only conclusion I is correct
- (b) Only conclusion II is correct
- (c) Either conclusion I or II is correct.
- (d) Neither conclusion I nor II is correct.
Show answer
(c) Either conclusion I or II is correct.
24Reading comprehension1 ch · 16 min4 PYQ
See the 4 questions GATE Computer Science and IT (CS) asked from this module
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
Show answer
(b) P is False and Q is True
Some people believe that “what gets measured, improves”. Some others believe that “what gets measured, gets gamed”. One possible reason for the difference in the beliefs is the work culture in organizations. In organizations with good work culture, metrics help improve outcomes. However, the same metrics are counterproductive in organizations with poor work culture. Which one of the following is the CORRECT logical inference based on the information in the above passage?
- (a) Metrics are useful in organizations with poor work culture
- (b) Metrics are useful in organizations with good work culture
- (c) Metrics are always counterproductive in organizations with good work culture
- (d) Metrics are never useful in organizations with good work culture
Show answer
(b) Metrics are useful in organizations with good work culture
In a recently conducted national entrance test, boys constituted 65% of those who appeared for the test. Girls constituted the remaining candidates and they accounted for 60% of the qualified candidates. Which one of the following is the correct logical inference based on the information provided in the above passage?
- (a) Equal number of boys and girls qualified
- (b) Equal number of boys and girls appeared for the test
- (c) The number of boys who appeared for the test is less than the number of girls who appeared
- (d) The number of boys who qualified the test is less than the number of girls who qualified
Show answer
(d) The number of boys who qualified the test is less than the number of girls who qualified
Listening to music during exercise improves exercise performance and reduces discomfort. Scientists researched whether listening to music while studying can help students learn better and the results were inconclusive. Students who needed external stimulation for studying fared worse while students who did not need any external stimulation benefited from music. Which one of the following statements is the CORRECT inference of the above passage?
- (a) Listening to music has no effect on learning and a positive effect on physical exercise.
- (b) Listening to music has a clear positive effect both on physical exercise and on learning.
- (c) Listening to music has a clear positive effect on physical exercise. Music has a positive effect on learning only in some students.
- (d) Listening to music has a clear positive effect on learning in all students. Music has a positive effect only in some students who exercise.
Show answer
(c) Listening to music has a clear positive effect on physical exercise. Music has a positive effect on learning only in some students.
25Decision making and interpersonal skills1 ch · 14 min1 PYQ
See the 1 question GATE Computer Science and IT (CS) asked from this module
There are multiple routes to reach from node 1 to node 2, as shown in the network. (Network edges with travel cost in rupees: 1→a 200, a→c 100, c→2 100, a→2 200, 1→b 300, b→2 200, b→d 0, d→e 100, e→2 200, 1→f 100, f→b 0, f→e 100.) The cost of travel on an edge between two nodes is given in rupees. Nodes 'a', 'b', 'c', 'd', 'e', and 'f' are toll booths. The toll price at toll booths marked 'a' and 'e' is Rs. 200, and is Rs. 100 for the other toll booths. Which is the cheapest route from node 1 to node 2?
- (a) 1-a-c-2
- (b) 1-f-b-2
- (c) 1-b-2
- (d) 1-f-e-2
Show answer
(b) 1-f-b-2
English7 modules32 ch6 h 14 min31 PYQ
26Verbs and tenses6 ch · 1 h 11 min1 PYQ
- Present tenses: simple, continuous, perfect and perfect continuous 12′
- Past tenses and 'used to / would' 13′
- Talking about the future; sequence of tenses 11′
- Subject-verb agreement 12′
- Modals: can, may, must, should, ought to, need and dare 12′
- Non-finites: infinitive, gerund and participle 11′
See the 1 question GATE Computer Science and IT (CS) asked from this module
The expenditure on the project _____ as follows: equipment Rs.20 lakhs, salaries Rs.12 lakhs, and contingency Rs.3 lakhs.
- (a) break down
- (b) break
- (c) breaks down
- (d) breaks
Show answer
(c) breaks down
27Voice, speech and conditions1 ch · 12 min1 PYQ
See the 1 question GATE Computer Science and IT (CS) asked from this module
Based only on the conversation below, identify the logically correct inference: “Even if I had known that you were in the hospital, I would not have gone there to see you”, Ramya told Josephine.
- (a) Ramya knew that Josephine was in the hospital.
- (b) Ramya did not know that Josephine was in the hospital.
- (c) Ramya and Josephine were once close friends; but now, they are not.
- (d) Josephine was in the hospital due to an injury to her leg.
Show answer
(b) Ramya did not know that Josephine was in the hospital.
28Nouns and their partners6 ch · 1 h 12 min4 PYQ
- Nouns: kinds, number, countability and possession 12′
- Pronouns: case, agreement, reflexives and relatives 12′
- Articles and determiners 12′
- Adjectives and adverbs: degrees, order and position 12′
- Prepositions: time, place and fixed pairs 12′
- Conjunctions and linking words 12′
See the 4 questions GATE Computer Science and IT (CS) asked from this module
Ravi had ______ younger brother who taught at ______ university. He was widely regarded as ______ honorable man. Select the option with the correct sequence of articles to fill in the blanks.
- (a) a; a; an
- (b) the; an; a
- (c) a; an; a
- (d) an; an; a
Show answer
(a) a; a; an
We reached the station late, and _______ missed the train.
- (a) near
- (b) nearly
- (c) utterly
- (d) mostly
Show answer
(b) nearly
Gauri said that she can play the keyboard __________ her sister
- (a) as well as
- (b) as better as
- (c) as nicest as
- (d) as worse as
Show answer
(a) as well as
Raman is confident of speaking English \_\_\_\_\_ six months as he has been practising regularly \_\_\_\_\_ the last three weeks.
- (a) during, for
- (b) for, since
- (c) for, in
- (d) within, for
Show answer
(d) within, for
29Error spotting and sentence improvement5 ch · 1 h 2 min1 PYQ
- A method for error spotting and sentence improvement 12′
- Error patterns: agreement and tense 12′
- Error patterns: pronouns, articles and prepositions 13′
- Error patterns: parallelism, modifiers and comparisons 13′
- Error patterns: redundancy, word choice and Indian English 12′
See the 1 question GATE Computer Science and IT (CS) asked from this module
Consider the following sentences: (i) Everybody in the class is prepared for the exam. (ii) Babu invited Danish to his home because he enjoys playing chess. Which of the following is the CORRECT observation about the above two sentences?
- (a) (i) is grammatically correct and (ii) is unambiguous
- (b) (i) is grammatically incorrect and (ii) is unambiguous
- (c) (i) is grammatically correct and (ii) is ambiguous
- (d) (i) is grammatically incorrect and (ii) is ambiguous
Show answer
(c) (i) is grammatically correct and (ii) is ambiguous
30Vocabulary6 ch · 1 h 7 min14 PYQ
- Word building: roots, prefixes and suffixes 11′
- Synonyms and antonyms: method, not memory 11′
- One-word substitution 11′
- Idioms and phrases 12′
- Phrasal verbs and collocations 11′
- Confusable words and spelling 11′
See the 14 questions GATE Computer Science and IT (CS) asked from this module
The antonym of the word protagonist is ________.
- (a) agnostic
- (b) antagonist
- (c) arsonist
- (d) anarchist
Show answer
(b) antagonist
Expedite, Hasten, Hurry, __________ Fill the blank by choosing a word with a meaning similar to that of the words given above.
- (a) Accelerate
- (b) Retard
- (c) Provide
- (d) Disable
Show answer
(a) Accelerate
Water : P :: Food : Q Choose the P and Q combination from the options below to form a meaningful analogy.
- (a) P = Thirst; Q = Hunger
- (b) P = Drink; Q = Hunger
- (c) P = Thirst; Q = Satiated
- (d) P = Wet; Q = Critic
Show answer
(a) P = Thirst; Q = Hunger
The CEO’s decision to downsize the workforce was considered myopic because it sacrificed long-term stability to accommodate short-term gains. Select the most appropriate option that can replace the word “myopic” without changing the meaning of the sentence.
- (a) visionary
- (b) shortsighted
- (c) progressive
- (d) innovative
Show answer
(b) shortsighted
Bird : Nest :: Bee : _______ Select the correct option to complete the analogy.
- (a) Kennel
- (b) Hammock
- (c) Hive
- (d) Lair
Show answer
(c) Hive
If ‘→’ denotes increasing order of intensity, then the meaning of the words [dry → arid → parched] is analogous to [diet → fast → ________ ]. Which one of the given options is appropriate to fill the blank?
- (a) starve
- (b) reject
- (c) feast
- (d) deny
Show answer
(a) starve
If ‘→’ denotes increasing order of intensity, then the meaning of the words [walk → jog → sprint] is analogous to [bothered → ________ → daunted]. Which one of the given options is appropriate to fill the blank?
- (a) phased
- (b) phrased
- (c) fazed
- (d) fused
Show answer
(c) fazed
In the given text, the blanks are numbered (i)−(iv). Select the best match for all the blanks. Steve was advised to keep his head __(i)__ before heading __(ii)__ to bat; for, while he had a head __(iii)__ batting, he could only do so with a cool head __(iv)__ his shoulders.
- (a) (i) down (ii) down (iii) on (iv) for
- (b) (i) on (ii) down (iii) for (iv) on
- (c) (i) down (ii) out (iii) for (iv) on
- (d) (i) on (ii) out (iii) on (iv) for
Show answer
(c) (i) down (ii) out (iii) for (iv) on
Kind : _______ : : Often : Frequently (By word meaning)
- (a) Mean
- (b) Type
- (c) Cruel
- (d) Kindly
The _________ is too high for it to be considered _________.
- (a) fair / fare
- (b) faer / fair
- (c) fare / fare
- (d) fare / fair
Show answer
(d) fare / fair
_____ is to *surgery* as *writer* is to ________ Which one of the following options maintains a similar logical relation in the above sentence?
- (a) Plan, outline
- (b) Hospital, library
- (c) Doctor, book
- (d) Medicine, grammar
Show answer
(c) Doctor, book
Pen : Write :: Knife : _________ Which one of the following options maintains a similar logical relation in the above?
- (a) Vegetables
- (b) Sharp
- (c) Cut
- (d) Blunt
Show answer
(c) Cut
Select the word that fits the analogy: Cook : Cook :: Fly : \_\_\_\_\_
- (a) Flyer
- (b) Flying
- (c) Flew
- (d) Flighter
Show answer
(a) Flyer
A court is to a judge as ____________ is to a teacher.
- (a) a student
- (b) a punishment
- (c) a syllabus
- (d) a school
Show answer
(d) a school
31Sentence and paragraph skills2 ch · 23 min5 PYQ
See the 5 questions GATE Computer Science and IT (CS) asked from this module
Despite his initial hesitation, Rehman’s _________ to contribute to the success of the project never wavered. Select the most appropriate option to complete the above sentence.
- (a) ambivalence
- (b) satisfaction
- (c) resolve
- (d) revolve
Show answer
(c) resolve
Sequence the following sentences in a coherent passage. P: This fortuitous geological event generated a colossal amount of energy and heat that resulted in the rocks rising to an average height of 4 km across the contact zone. Q: Thus, the geophysicists tend to think of the Himalayas as an active geological event rather than as a static geological feature. R: The natural process of the cooling of this massive edifice absorbed large quantities of atmospheric carbon dioxide, altering the earth’s atmosphere and making it better suited for life. S: Many millennia ago, a breakaway chunk of bedrock from the Antarctic Plate collided with the massive Eurasian Plate.
- (a) QPSR
- (b) QSPR
- (c) SPRQ
- (d) SRPQ
Show answer
(c) SPRQ
Which one of the following sentence sequences creates a coherent narrative? (i) Once on the terrace, on her way to her small room in the corner, she notices the man right away. (ii) She begins to pant by the time she has climbed all the stairs. (iii) Mina has bought vegetables and rice at the market, so her bags are heavy. (iv) He was leaning against the parapet, watching the traffic below.
- (a) (i), (ii), (iv), (iii)
- (b) (ii), (iii), (i), (iv)
- (c) (iv), (ii), (i), (iii)
- (d) (iii), (ii), (i), (iv)
Show answer
(d) (iii), (ii), (i), (iv)
His knowledge of the subject was excellent but his classroom performance was \_\_\_\_\_.
- (a) extremely poor
- (b) good
- (c) desirable
- (d) praiseworthy
Show answer
(a) extremely poor
The search engine's business model ___________ around the fulcrum of trust.
- (a) revolves
- (b) plays
- (c) sinks
- (d) bursts
Show answer
(a) revolves
32Reading comprehension6 ch · 1 h 7 min5 PYQ
- How to read serious prose: structure and the main idea 11′
- Main idea, title and author's purpose questions 11′
- Inference, assumption and implication 11′
- Tone, attitude and vocabulary in context 11′
- Option traps and timing strategy for CSAT 12′
- Practice passages with full solutions 11′
See the 5 questions GATE Computer Science and IT (CS) asked from this module
“I put the brown paper in my pocket along with the chalks, and possibly other things. I suppose every one must have reflected how primeval and how poetical are the things that one carries in one’s pocket: the pocket-knife, for instance the type of all human tools, the infant of the sword. Once I planned to write a book of poems entirely about the things in my pocket. But I found it would be too long: and the age of the great epics is past.” (From G.K. Chesterton’s “A Piece of Chalk”) Based only on the information provided in the above passage, which one of the following statements is true?
- (a) The author of the passage carries a mirror in his pocket to reflect upon things.
- (b) The author of the passage had decided to write a poem on epics.
- (c) The pocket-knife is described as the infant of the sword.
- (d) Epics are described as too inconvenient to write.
Show answer
(c) The pocket-knife is described as the infant of the sword.
Some people suggest anti-obesity measures (AOM) such as displaying calorie information in restaurant menus. Such measures sidestep addressing the core problems that cause obesity: poverty and income inequality. Which one of the following statements summarizes the passage?
- (a) The proposed AOM addresses the core problems that cause obesity.
- (b) If obesity reduces, poverty will naturally reduce, since obesity causes poverty.
- (c) AOM are addressing the core problems and are likely to succeed.
- (d) AOM are addressing the problem superficially.
Show answer
(d) AOM are addressing the problem superficially.
The dawn of the 21st century witnessed the melting glaciers oscillating between giving too much and too little to billions of people who depend on them for fresh water. The UN climate report estimates that without deep cuts to man-made emissions, at least 30% of the northern hemisphere's surface permafrost could melt by the end of the century. Given this situation of imminent global exodus of billions of people displaced by rising seas, nation-states need to rethink their carbon footprint for political concerns, if not for environmental ones. Which one of the following statements can be inferred from the given passage?
- (a) Nation-states do not have environmental concerns.
- (b) Nation-states are responsible for providing fresh water to billions of people.
- (c) Billions of people are responsible for man-made emissions.
- (d) Billions of people are affected by melting glaciers.
Show answer
(d) Billions of people are affected by melting glaciers.
Goods and Services Tax (GST) is an indirect tax introduced in India in 2017 that is imposed on the supply of goods and services, and it subsumes all indirect taxes except few. It is a destination-based tax imposed on goods and services used, and it is not imposed at the point of origin from where goods come. GST also has a few components specific to state governments, central government and Union Territories (UTs). Which one of the following statements can be inferred from the given passage?
- (a) GST is imposed on the production of goods and services.
- (b) GST includes all indirect taxes.
- (c) GST does not have a component specific to UT.
- (d) GST is imposed at the point of usage of goods and services.
Show answer
(d) GST is imposed at the point of usage of goods and services.
“A recent High Court judgement has sought to dispel the idea of begging as a disease — which leads to its stigmatization and criminalization — and to regard it as a symptom. The underlying disease is the failure of the state to protect citizens who fall through the social security net.” Which one of the following statements can be inferred from the given passage?
- (a) Beggars are lazy people who beg because they are unwilling to work
- (b) Beggars are created because of the lack of social welfare schemes
- (c) Begging is an offence that has to be dealt with firmly
- (d) Begging has to be banned because it adversely affects the welfare of the state
Show answer
(b) Beggars are created because of the lack of social welfare schemes
Official GATE Computer Science and IT (CS) syllabus
17/17 lines readyPick a paper. Green lines already have chapters; tap one to open them.
General Aptitude (GA, common to all papers, 15 marks)
15Verbal Aptitude: basic English grammar, vocabulary, reading and comprehension, narrative sequencing
📖 29 chapters
- Present tenses: simple, continuous, perfect and perfect continuous
- Past tenses and 'used to / would'
- Talking about the future; sequence of tenses
- Subject-verb agreement
- Modals: can, may, must, should, ought to, need and dare
- Non-finites: infinitive, gerund and participle
- Nouns: kinds, number, countability and possession
- Pronouns: case, agreement, reflexives and relatives
- Articles and determiners
- Adjectives and adverbs: degrees, order and position
- Prepositions: time, place and fixed pairs
- Conjunctions and linking words
- A method for error spotting and sentence improvement
- Error patterns: agreement and tense
- Error patterns: pronouns, articles and prepositions
- Error patterns: parallelism, modifiers and comparisons
- Error patterns: redundancy, word choice and Indian English
- Word building: roots, prefixes and suffixes
- Synonyms and antonyms: method, not memory
- One-word substitution
- Idioms and phrases
- Phrasal verbs and collocations
- Confusable words and spelling
- How to read serious prose: structure and the main idea
- Main idea, title and author's purpose questions
- Inference, assumption and implication
- Tone, attitude and vocabulary in context
- Option traps and timing strategy for CSAT
- Practice passages with full solutions
Quantitative Aptitude: data interpretation, numerical computation and estimation, elementary statistics and probability, mensuration and geometry
📖 27 chapters
- Numbers and their relations: place value, kinds of numbers and orders of magnitude
- Divisibility, factors, HCF and LCM
- Fractions, decimals and simplification
- Powers, roots and surds
- Unit digits, remainders and number puzzles
- Percentage
- Profit, loss and discount
- Simple and compound interest
- Ratio, proportion and partnership
- Averages
- Mixtures and alligation
- Time and work, pipes and cisterns
- Speed, time and distance
- Trains, boats and streams, races
- Ages and word problems
- Linear and quadratic equations, inequalities
- Arithmetic and geometric progressions
- Geometry: lines, triangles, polygons and circles
- Mensuration: areas, surfaces and volumes
- Counting: permutations and combinations
- Probability
- Reading tables
- Bar graphs and line graphs
- Pie charts and mixed graphs
- Data sufficiency
- Basic statistics: mean, median, mode and range
- Statistical analysis, graphs and diagrams for Mains
Analytical Aptitude: logic (deduction and induction), analogy, numerical relations and reasoning
📖 12 chapters
- Number and letter series
- Coding and decoding
- Blood relations
- Direction sense
- Ranking, order and comparison
- Clocks and calendars
- Syllogisms
- Statements: conclusions and assumptions
- Arguments and courses of action
- Cause and effect, assertion and reason
- Logical connectives: if–then, only if, unless, either–or
- Critical reasoning: strengthen, weaken, assumption, flaw
Spatial Aptitude: transformation of shapes, paper folding, cutting and patterns in 2 and 3 dimensions
Section 1: Engineering Mathematics
Discrete Mathematics: propositional and first order logic; sets, relations, functions, partial orders and lattices; monoids, groups; graphs: connectivity, matching, colouring; combinatorics: counting, recurrence relations, generating functions
Linear Algebra: matrices, determinants, systems of linear equations, eigenvalues and eigenvectors, LU decomposition
Calculus: limits, continuity and differentiability, maxima and minima, mean value theorem, integration
Probability and Statistics: random variables, uniform, normal, exponential, Poisson and binomial distributions; mean, median, mode, standard deviation; conditional probability and Bayes theorem
📖 1 chapter
Section 2: Digital Logic
Boolean algebra; combinational and sequential circuits; minimization; number representations and computer arithmetic (fixed and floating point)
Section 3: Computer Organization and Architecture
Machine instructions and addressing modes; ALU, data-path and control unit; instruction pipelining, hazards; memory hierarchy: cache, main memory and secondary storage; I/O interface (interrupt and DMA)
Section 4: Programming and Data Structures
Programming in C; recursion; arrays, stacks, queues, linked lists, trees, binary search trees, binary heaps, graphs
Section 5: Algorithms
Searching, sorting, hashing; asymptotic worst case time and space complexity; greedy, dynamic programming and divide-and-conquer; graph traversals, minimum spanning trees, shortest paths
Section 6: Theory of Computation
Regular expressions and finite automata; context-free grammars and push-down automata; regular and context-free languages, pumping lemma; Turing machines and undecidability
Section 7: Compiler Design
Lexical analysis, parsing, syntax-directed translation; runtime environments; intermediate code generation; local optimisation, data flow analyses: constant propagation, liveness, common sub-expression elimination
Section 8: Operating System
System calls, processes, threads, inter-process communication, concurrency and synchronization; deadlock; CPU and I/O scheduling; memory management and virtual memory; file systems
Section 9: Databases
ER model; relational model: relational algebra, tuple calculus, SQL; integrity constraints, normal forms; file organisation, indexing (B and B+ trees); transactions and concurrency control
Section 10: Computer Networks
Layering: OSI and TCP/IP; packet, circuit and virtual circuit switching; data link layer: framing, error detection, MAC, Ethernet bridging; routing: shortest path, flooding, distance vector, link state; fragmentation, IPv4, CIDR, ARP, DHCP, ICMP, NAT; transport: flow and congestion control, UDP, TCP, sockets; DNS, SMTP, HTTP, FTP, email
Exam pattern
Prelims
| Paper | Questions | Marks | Time | Counts for merit? |
|---|---|---|---|---|
| General Aptitude (common to all papers) | 10 | 15 | — | Yes |
| Subject paper (incl. engineering mathematics) | 55 | 85 | 3 hours (whole test) | Yes |
| Merit marks from this stage | 100 |
GATE Computer Science and IT (CS) previous year questions (PYQ)
777 GATE Computer Science and IT (CS) PYQs are already inside the study plan above, under the module each one tests. Open the study plan ↑
Topic-wise PYQs from the official question papers are being added next. Each question will sit under the syllabus line it tests, with the year and the answer explained.
GATE Computer Science and IT (CS) course: quick answers
Is this GATE Computer Science and IT (CS) course free?
Yes. Every chapter linked here is free to read in English and Hindi, with practice questions at the end.
Does this course follow the official GATE Computer Science and IT (CS) syllabus?
Yes. Each syllabus line is copied from the official notice (GATE 2026 syllabus, CS Computer Science and Information Technology (IIT Guwahati, organising institute)), and the chapters under it are mapped to that line.
How many chapters are ready for GATE Computer Science and IT (CS)?
130 chapters are mapped to the syllabus and 130 are open on the site now. 17 of 17 syllabus lines already have study material; the rest are being written.
Where are the GATE Computer Science and IT (CS) previous year questions?
777 GATE Computer Science and IT (CS) PYQs already sit inside the study plan, under the module they test, with the year and answer. More are added as the official papers are tagged.