Gate Question Bank Cs
Gate Question Bank Cs
for
Computer Science
&
Information Technology
By
GATE QUESTION BANK Contents
Contents
Subject Name Topic Name Page No.
#1. Mathematics 1-112
1 Linear Algebra 1 – 28
2 Probability & Distribution 29 – 57
3 Numerical Methods 58 – 73
4 Calculus 74 – 112
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page I
GATE QUESTION BANK Contents
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page II
GATE QUESTION BANK Mathematics
Linear Algebra
ME – 2005 5. Match the items in columns I and II.
1. Which one of the following is an Column I Column II
P. Singular 1. Determinant is not
Eigenvector of the matrix[ ]? matrix defined
Q. Non-square 2. Determinant is
matrix always one
R. Real 3. Determinant is
(A) [ ] (C) [ ] symmetric zero
matrix
S. Orthogonal 4. Eigen values are
matrix always real
(B) [ ] (D) [ ] 5. Eigen values are
not defined
(A) P - 3 Q - 1 R - 4 S - 2
(B) P - 2 Q - 3 R - 4 S - 1
2. A is a 3 4 real matrix and Ax=B is an (C) P - 3 Q - 2 R - 5 S - 4
inconsistent system of equations. The (D) P - 3 Q - 4 R - 2 S - 1
highest possible rank of A is
(A) 1 (C) 3 ME – 2007
(B) 2 (D) 4 6. The number of linearly independent
Eigenvectors of 0 1 is
ME – 2006
3. Multiplication of matrices E and F is G. (A) 0 (C) 2
Matrices E and G are (B) 1 (D) Infinite
os sin 7. If a square matrix A is real and symmetric,
E [ sin os ] and
then the Eigenvalues
(A) are always real
G [ ]. What is the matrix F? (B) are always real and positive
(C) are always real and non-negative
os sin (D) occur in complex conjugate pairs
(A) [ sin os ]
ME – 2008
sin os
(B) [ os sin ] 8. The Eigenvectors of the matrix 0 1 are
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 2
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 3
GATE QUESTION BANK Mathematics
i i
8. The inverse of the m trix 0 1 is 14. The inverse of the matrix 0 1
i i
(A) 0 1 (C) 0 1 is
( ) i i
(B) 0 1 (D) 0 1 0 1
i i
i i
( ) 0 1
CE – 2008 i i
9. The product of matrices ( ) is ( ) i i
0 1
i i
(A) (C)
i i
(B) (D) PQ ( ) 0 1
i i
10. The Eigenvalue of the matrix
CE – 2012
[P] = 0 1 are
15. The Eigenvalues of matrix 0 1 are
(A) and 8 (C) n
(A) 2.42 and 6.86
(B) and 5 (D) n
(B) 3.48 and 13.53
11. The following simultaneous equation (C) 4.70 and 6.86
x+y+z=3 (D) 6.86 and 9.50
x + 2y + 3z = 4
x + 4y + kz = 6 CE – 2013
will NOT have a unique solution for k 16. There is no value of x that can
equal to simultaneously satisfy both the given
(A) 0 (C) 6 equations. Therefore, find the ‘le st
(B) 5 (D) 7 squares error’ solution to the two
equations, i.e., find the value of x that
CE – 2009 minimizes the sum of squares of the
12. A square matrix B is skew-symmetric if errors in the two equations.
(A) (C) 2x = 3 and 4x = 1
(B) (D)
17. What is the minimum number of
CE – 2011 multiplications involved in computing the
13. [A] is square matrix which is neither matrix product PQR? Matrix P has 4 rows
symmetric nor skew-symmetric and , - and 2 columns, matrix Q has 2 rows and
is its transpose. The sum and difference of 4 columns, and matrix R has 4 rows and 1
these matrices are defined as column. __________
[S] = [A] + , - and [D] = [A] , - ,
CE – 2014
respectively. Which of the following
statements is TRUE? 18. Given the matrices J = [ ] n
(A) Both [S] and [D] are symmetric
(B) Both [S] and [D] are skew-symmetric
(C) [S] is skew-symmetric and [D] is K [ ], the product K JK is
symmetric
(D) [S] is symmetric and [D] is skew
19. The sum of Eigenvalues of the matrix, [M]
symmetric
is, where [M] = [ ]
[ ] is ________________ CS – 2007
5. Consider the set of (column) vectors
defined by X={xR3 x1+x2+x3=0, where
CS – 2005
XT =[x1, x2, x3]T }. Which of the following is
1. Consider the following system of
TRUE?
equations in three real
(A) {[1, 1, 0]T, [1, 0, 1]T} is a basis for
variables x x n x
the subspace X.
x x x
(B) {[1, 1, 0]T, [1, 0, 1]T} is a linearly
x x x
independent set, but it does not span
x x x
X and therefore, is not a basis of X.
This system of equation has
(C) X is not the subspace for R3
(A) no solution
(D) None of the above
(B) a unique solution
(C) more than one but a finite number of
CS – 2008
solutions
6. The following system of
(D) an infinite number of solutions
x x x
x x x
2. What are the Eigenvalues of the following
x x x
2 2 matrix?
Has unique solution. The only possible
0 1 value (s) for is/ are
(A) n (C) n (A) 0
(B) n (D) n (B) either 0 or 1
(C) one of 0,1, 1
CS – 2006 (D) any real number except 5
3. F is an n x n real matrix. b is an n real
vector. Suppose there are two nx1
7. How many of the following matrices have
vectors, u and v such that u v , and
an Eigenvalue 1?
Fu=b, Fv=b. Which one of the following
statement is false? 0 1 0 1 0 1 n 0 1
(A) Determinant of F is zero (A) One (C) three
(B) There are infinite number of (B) two (D) four
solutions to Fx=b
CS – 2010
(C) There is an x 0 such that Fx=0
8. Consider the following matrix
(D) F must have two identical rows
A=[ ]
x y
If the Eigen values of A are 4 and 8, then
(A) x = 4, y = 10 (C) x = 3, y = 9
(B) x = 5, y = 8 (D) x = 4, y = 10
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 5
GATE QUESTION BANK Mathematics
⁄
⁄ 6. The rank of the matrix [ ]
(B) [ ]
⁄
⁄ (A) 0 (C) 2
(B) 1 (D) 3
(C) [ ]
ECE – 2007
7. It is given that X1 , X2 …… M are M non-
⁄
zero, orthogonal vectors. The dimension
⁄
(D) [ ] of the vector space spanned by the 2M
⁄
⁄ vector X1 , X2 … XM , X1 , X2 … XM is
(A) 2M
⁄ (B) M+1
2. Let, A=0 1 and = 0 1.
(C) M
Then (a + b)=
(D) dependent on the choice of X1 , X2 …
(A) ⁄ (C) ⁄
(B) ⁄ (D) ⁄ XM.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 7
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 8
GATE QUESTION BANK Mathematics
EE – 2005
5. The following vector is linearly
1. If R = [ ] , then top row of is dependent upon the solution to the
previous problem
(A) , - (C) , -
(B) , - (D) , - (A) [ ] (C) [ ]
EE – 2014 IN – 2006
21. Given a system of equations: Statement for Linked Answer Questions 3
x y z and 4
x y z A system of linear simultaneous
Which of the following is true regarding equations is given as Ax=B where
its solutions?
(A) The system has a unique solution for [ ] n [ ]
any given and
(B) The system will have infinitely many 3. The rank of matrix A is
solutions for any given and (A) 1 (C) 3
(C) Whether or not a solution exists (B) 2 (D) 4
depends on the given and
(D) The system would have no solution 4. Which of the following statements is true?
for any values of and (A) x is a null vector
(B) x is unique
22. Which one of the following statements is (C) x does not exist
true for all real symmetric matrices? (D) x has infinitely many values
(A) All the eigenvalues are real.
(B) All the eigenvalues are positive. 5. For a given matrix A, it is observed
(C) All the eigenvalues are distinct. that
(D) Sum of all the eigenvalues is zero.
0 1 0 1 n 0 1 0 1
Then matrix A is
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 11
GATE QUESTION BANK Mathematics
IN – 2014
16. For the matrix A satisfying the equation
given below, the eigenvalues are
, -[ ] [ ]
ME
1. [Ans. A] and G = [ ]
Now E × F = G
[ ] os sin
∴ ,E- [ sin os ]
h r teristi equ tions is | I|
( )( )( )
4. [Ans. A]
∴ Real eigenvalues are 5, 5 other two are
For S matrix, if Eigenvalues are
complex
… … … … … then for matrix,
Eigenvector corresponding to
the Eigenvalues will be , , ………
is ( I)
For S matrix, if Eigenvalues are 1 and 5
(or) →( )
then for matrix, the Eigenvalues are 1
Verify the options which satisfies relation
and 25.
(1)
Option (A) satisfies.
5. [Ans. A]
2. [Ans. B]
6. [Ans. B]
Given n in onsistent
0 1 Eigenv lues re 2, 2
No ( I) ( I) . /
( ⁄ ) No. of L.I Eigenvectors
( ) n ( ⁄ ) (no of v ri les) ( I)
( ( ) minimum of m n)
For inconsistence
( ) ( ⁄ ) 7. [Ans. A]
∴ he highest possi le r nk of is ( I) .
olving for , Let the symmetric and real
3. [Ans. C] matrix be A = 0 1
os sin
Given , E = [ sin os ] Now | |
Which gives ( )
⟹
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 13
GATE QUESTION BANK Mathematics
⟹
x
Hence real Eigen value. [ ][ ] 0 1
x
8. [Ans. B]
Equating the elements x ⁄
Let 0 1 eigenv lues re n
Eigen vector corresponding to 12. [Ans. A]
is ( I) 0 1 → Eigenv lues re
x
. / .y/ . / Eigenve tor is x x verify the options
By simplifying
K 13. [Ans. C]
. / . / y t king K
Eigen vector corresponding to =2 [ ] [ ]
is ( I)
x
. / .y/ . / → [ ]
K
By simplifying ( ) 4 5 by
K ⁄ → [ ]
taking K
( ) infinite m ny solutions
⁄
14. [Ans. B]
⁄
Eigenvalues of a real symmetric matrix
9. [Ans. C] are always real
Sum of the diagonal elements = Sum of 15. [Ans. B]
the Eigenvalues
⟹ 1 + 0 + p = 3+S 0 1 eigenv lues v lue
⟹ S= p 2 Eigen vector will be . /
10. [Ans. B] Norm lize ve tor
( ⁄ ) [ ] √( ) ( )
[ ] [√( ) ( ) ]
⁄
→ * √ +
[ ] ⁄
→
√
→ [ ] 16. [Ans. C]
The given system is
If system will h ve solution x y z
x y z
11. [Ans. A] x y z
iven M M → MM I Use Gauss elimination method as follows
Augmented matrix is
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 14
GATE QUESTION BANK Mathematics
, | - [ | ] So, | |
→ [ | ] | |
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 15
GATE QUESTION BANK Mathematics
[ | ]→ [ | ] 8. [Ans. A]
Inverse of 0 1 is
→ [ | ] 0 1 0 1
( )
( ⁄ ) ∴0 1 0 1
( ) ( )
( ) ( ⁄ ) 0 1
∴ olution is non – existent for above
system.
9. [Ans. B]
( ) P=( )P
5. [Ans. B]
( )( )
∑ = Trace (A)
=( ) (I) =
+ + = Trace (A)
= 2 + ( 1) + 0 = 1
10. [Ans. B]
Now = 3
∴3+ + =1 A=0 1
Characteristic equation of A is
Only choice (B) satisfies this condition.
| |=0
6. [Ans. B] (4 )( 5 ) 2 × 5 =0
∑ = Trace (A) + 30 = 0
+ + =1+5+1=7 6, 5
Now = 2, = 6
∴ 2+6+ =7 11. [Ans. D]
=3 The augmented matrix for given system is
x
7. [Ans. A] [ | ] 6y7 [ ]
k z
The augmented matrix for given system is
Using Gauss elimination we reduce this to
an upper triangular matrix to find its rank
[ | ]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 16
GATE QUESTION BANK Mathematics
15. [Ans. B] [ ]
0 1
Sum of the Eigenvalues = 17 Interchanging Column 1& Column 2 and
Product of the Eigenvalues = taking transpose
From options, 3.48 + 13.53 = 17
(3.48)(13.53) = 47 [ ]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 17
GATE QUESTION BANK Mathematics
* ( ) ( )+ ( )( )
= ( )
= 1, 6
21. [Ans. 2] ∴ The Eigenvalues of A are 1 and 6
[ ]
3. [Ans. D]
→ Given that Fu =b and Fv =b
If F is non singular, then it has a unique
[ inverse.
( ) ( ) ( )
Now, u = b and v= b
] Since is unique, u = v but it is given
( ) ( ) th t u v his is contradiction. So F
must be singular. This means that
[ ] (A) Determinant of F is zero is true. Also
(B) There are infinite number of
( ) no. of non zero rows = 2
solution to Fx= b is true since |F| = 0
CS (C) here is n su h the is
1. [Ans. B] also true, since X has infinite number
The augmented matrix for the given of solutions., including the X = 0
solution
system is [ | ] (D) F must have 2 identical rows is false,
since a determinant may become
Using elementary transformation on above zero, even if two identical columns
matrix we get, are present. It is not necessary that 2
identical rows must be present for
[ | ]
|F| to become zero.
4. [Ans. C]
→ [ ⁄ | ] It is given that Eigenvalues of A is
⁄ ⁄ 5, 2, 1, 4
I
→ Let P = 0 1
[ | ] I
Eigenvalues of P : | I|
Rank ([A B]) = 3 I
| |
I
Rank ([A]) = 3
( ) I
Since
I
Rank ([A B]) = Rank ([A]) = number of I
variables, the system has unique solution. Eigenvalue of P is
( 5 +1 ), ( 2+ 1), (1+ 1), (4+1 ),
2. [Ans. B] ( 5 1 ), ( 2 1 ),(1 1), (4 1)
0 1 = 4, 1, 2, 5, 6, 3,0,3
The characteristic equation of this matrix
5. [Ans. B]
is given by |x
X= {x x x +
| I|
= ,x x x - then,
| |
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 18
GATE QUESTION BANK Mathematics
=0 = 0, 0 ( )( )
( )( )
Eigenvalues of 0 1
| |= 0 √
( ) =0 Eigenvalues of A are √ n √
( ) respectively
= i or 1 So Eigenvalues of
= 1 –i or 1 + i (√ ) n ( √ )
Eigenvalues of 0 1 n
n
| | =0
√ n √
( )( ) =0
( ) =0
= –1, 1
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 19
GATE QUESTION BANK Mathematics
3. [Ans. C] 8. [Ans. B]
0 1 Approach 1:
Given 4x + 2y =7
(A I)=0 and 2x + y =6
( 4 ) (3 ) 2 4=0
4 2 x 7
2 + 20=0 = 5, 4 2 1y 6
x1
Putting = 5, 0 1 =0 0 0 x 5
x2 2 1y 6
x + 2x = 0 x = 2x
On comparing LHS and RHS
x x
1= 2 0= 5, which is irrelevant and so no
2 1 solution.
Hence, 0 1 is Eigenvector. Approach 2:
4x + 2y =7
4. [Ans. C] 7
or 2x y=
0 1 We know th t it is Eigenvalue 2
Then Eigenvector is x x 2x+y=6
Verify the options (C) Since both the linear equation represent
parallel set of straight lines, therefore no
5. [Ans. A] solution exists.
Approach 3:
or m trix 0 1 Rank (A)=1; rank (C)=2,
We know |I A|=0 As Rank (A) rank (C) therefore no
| | solution exists.
| | =0
[ ]
( )(( ) )=0
( )
, j j
12. [Ans. B]
Given equations are x y z et of , - et of [ ]
x y z and x y z
If and ,
then x y z have Infinite solution
16. [Ans. D]
If and , then
Matrix multiplication is not commutative
x y z ( ) no solution
in general.
x y z
If n
17. [Ans. *] Range 0.99 to 1.01
x y z will have solution
Let ‘ ’ e Eigenv lue of ‘ ’ hen ‘ ’ will
x y z
e Eigenv lue of ‘ ’
and will also give solution
A. =I=
13. [Ans. B] Using Cauchey Hamilton Theorem,
0 1
Characteristic Equations is
18. [Ans. *] Range 0.99 to 1.01
By Cayley Hamilton theorem I J I J
I I
∴
( I) | |
I
[ ]
14. [Ans. A]
I I [ ] → [ ]
( ) ( | ) no of v r les
Infinitely many solutions
Then AB = [4]; BA [ ]
21. [Ans. B]
Here m = 1, n = 4
And et(I ) et(I ) onsi er 0 1
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 22
GATE QUESTION BANK Mathematics
∴ (not positive)
2. [Ans. D]
( ) is not true
Since matrix is triangular, the Eigenvalues
(A), (C), (D) are true using properties of
are the diagonal elements themselves
Eigenvalues
namely = 3, 2 & 1.
Corresponding to Eigenvalue = 2, let
22. [Ans. *] Range 48.9 to 49.1
us find the Eigenvector
Real symmetric matrices are diagnosable
Let the matrix be [A - ] x̂ = 0
x x
0 1 s tr e is [ ][x ] [ ]
x
So determinant is product of diagonal x
entries Putting in above equation we get,
x
So | | x x
[ ][x ] [ ]
∴ M ximum v lue of etermin nt x
x x Which gives the equations,
∴| | 5x x x =0 . . . . . (i)
x =0 . . . . . (ii)
EE 3x = 0 . . . . . (iii)
1. [Ans. B] Since eqa (ii) and (iii) are same we have
5x x x =0 . . . . . (i)
R= [ ]
x =0 . . . . . (ii)
j( ) , of tor( )- Putting x = k, we get
x = 0, x = k and 5x k =0
| | | |
x = k
| |=| | ∴ Eigenvectorss are of the form
x k
= 1(2 + 3) – 0(4 + 2) – 1 (6 – 2) = 1
x
[ ] * k +
Since we need only the top row of , we x
need to find only first column of (R)
which after transpose will become first i.e. x x x = k : k : 0
row adj(A). = :1:0
cof. (1, 1) = + | |=2+3=5 =2:5:0
x
cof. (2, 1) = | |= 3 x
∴ [ ]=[ ] is an Eigenvector of matrix p.
x
cof. (2, 1) = + | |= +1
3. [Ans. A]
∴ cof. (A) = [ ] Rank [P|Q] = Rank [P] is necessary for
existence of at least one solution to
Adj (A) =, of ( )-
x q.
=[ ]
4. [Ans. A]
We need to find orthogonal vectors, verify ( )
the options. i i
Option (A) is orthogonal vectors
8. [Ans. B]
( )( ) xy xy xx x n xy yx
xx xy x xy
Option (B), (C), (D) are not orthogonal | yx y y | |y x y |
x y (x y)
5. [Ans. B]
The vector ( ) is linearly = Positive when x and y are linearly
dependent upon the solution obtained in independent.
Q. No. 4 namely , - and , - 9. [Ans. A]
We can easily verify the linearly
A=0 1
dependence as
|A – | = 0
| |
| | =0
A will satisfy this equation according to
6. [Ans. B] Cayley Hamilton theorem
hen n n m trix xx i.e. I=0
x x x x x x Multiplying by on oth si es we get
x x x x x x
* + I=0
x x x x x x I =0
Take x common from 1st row,
x common from 2nd row …… 10. [Ans. A]
x common from nth row. To calculate
It h s r nk ‘ ’ Start from I = 0 which has
derived above
7. [Ans. D] I
⃗
k
L(x) = | | ( I)( I)
x x x I
= (x ) ( ) ⃗(
k x ) ( I) I
x I
= x ⃗ =[
x k ]
x ( I)( I)
x
I
L(x) = M [x ]
x ( I) I
Comparing both , we get, I
M=[ ] ( I)
Hence Eigenvalue of M : | M | ( I)
I
| |
( ) ( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 24
GATE QUESTION BANK Mathematics
11. [Ans. A] x
If rank of (5 6 ) matrix is 4,then surely x
* + *x + * +
it must have exactly 4 linearly x
independent rows as well as 4 linearly
independent columns.
Argument matrix C =* +
12. [Ans. D]
If characteristic equation is
→ , * +
=0
Then by Cayley – Hamilton theorem,
I=0 nk ( ) nk( )
= Number of variables = 4
Multiplying by on both sides, Since, Rank (A) = Rank(C) < Number of
variables
= I = ( I)
Hence, system of equations are consistent
and there is multiple non-trivial solution
13. [Ans. D]
exists.
Choice (A) = A is correct
Since =A[( ) -A
17. [Ans. B]
= A[( ) -
Characteristic equation | I|
Put =P
Then A [ ] = A. = A | |
Choice (C) = is also correct since
=( ) (1 ) ( )( )
= I
Eigenve tors orrespon ing to is
14. [Ans. B] ( I)
Let orthogonal matrix be x
os in [ ] [x ] [ ]
P=0 1 x
in os
By Property of orthogonal matrix A 2x x x x
I At x x
x os x in x x x x
So, x⃗ = [ ]
x in x os At x ,x
|| x⃗ || =
Eigenvectors = c[ ]{Here c is a constant}
√(x os x in ) (x in x os )
|| x⃗ || = √x x 18. [Ans. D]
, - ,L-, - ⟹ Options D is correct
|| x⃗ || = || x̅|| for any vector x̅
19. [Ans. D]
15. [Ans. C] x x … (i)
Trace = Sum of Principle diagonal } (i) n (ii) re s me
x x … (ii)
elements. ∴x x
So it has multiple solutions.
16. [Ans. D]
On writing the equation in the form of
AX =B
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 25
GATE QUESTION BANK Mathematics
2. [Ans. B]
AX=0 and (A) = 2
Solving
n=3
0 1 0 1 No. of linearly independent solutions
= n r
21. [Ans. B] = 3
Since there are 2 equations and 3 variables =1
(unknowns), there will be infinitely many
solutions. If if then 3. [Ans. C]
x y z x y z x z y There are 3 non-zero rows and hence
For any x and z, there will be a value of y. rank (A) = 3
∴ Infinitely many solutions
4. [Ans. C]
22. [Ans. A] Rank (A) = 3 (This is Co-efficient matrix)
For all real symmetric matrices, the Rank (A:b) =4(This is Augmented matrix)
Eigenvalues are real (property), they may s r nk( ) r nk ( ) olution oes
be either ve or ve and also may be same. not exist.
The sum of Eigenvalues necessarily not be
zero.
5. [Ans. C]
We know Hen e from the given
23. [Ans. C]
p q problem, Eigenvalue & Eigenvector is
0 1 known.
r s
( pplying → p q 1 1
→r s element ry tr nsform tions) X1 , X2 2 , 1 1, 2 2
p q pr qs 1
[ ] We also know that , where
pr qs r s
∴ hey h ve s me r nk N 1 1
P X1 X2
1 2
IN
1 0 1 0
1. [Ans. B] & D=
0 2 0 2
Given: 0 1
Hence
Characteristic equation is,
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 26
GATE QUESTION BANK Mathematics
0 1 0 1 [ ]
0 10 1 0 1
→ [ ]
Now | I |
| |
→ [ ]
( )( )=0
∴ ( )
Approach 2: By rank – nullity theorem
Eigenvalues of ( I) is = 1, 1/2 Rank [A]+ nullity [A]= no. of columns[A]
Eigenvalues of (X+5I) is = 3, 2 Nullity [A]= 3
Eigenvalues of ( I) (X+5I) is = , ∴ Nullity , -
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 27
GATE QUESTION BANK Mathematics
j x
[ ] 0x 1 0 1
j
x
x j
j
j x
[ ] 0x 1 0 1
j
x j
x
16. [Ans. C]
A[ ]=[ ]
→| | | | | |
→| |
( | |
| |)
=Product of eigenvalues
Verify options
Options (C) correct answer
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 28
GATE QUESTION BANK Mathematics
ME - 2005 ME - 2008
1. A single die is thrown twice. What is the 6. A coin is tossed 4 times. What is the
probability that the sum is neither 8 nor probability of getting heads exactly 3
9? times?
(A) ⁄ (C) ⁄ (A) ⁄ (C) ⁄
(B) ⁄ (D) ⁄ (B) ⁄ (D) ⁄
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 30
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 31
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 32
GATE QUESTION BANK Mathematics
CS - 2006 CS - 2008
3. For each element in a set of size 2n, an 7. Let X be a random variable following
unbiased coin is tossed. The 2n coin normal distribution with mean +1 and
tosses are independent. An element is variance 4. Let Y be another normal
chosen if the corresponding coin toss variable with mean of 1 and variance
were head. The probability that exactly n unknown If (X ) (Y≥ ) the
elements are chosen is standard deviation of Y is
(A) ( n ⁄ ) (C) ( ⁄ n ) (A) 3 (C) √
(B) ( n ⁄ ) (D) ⁄ (B) 2 (D) 1
(A) pq+(1 – p)(1 – q) 15. If two fair coins flipped and at least one of
(B) (1 – q)p the outcomes is known to be a head, what
(C) (1 – p)q is the probability that both outcomes are
(D) pq heads?
(A) 1/3 (C) 1/4
11. What is the probability that a divisor of (B) 1/2 (D) 2/3
is a multiple of ?
(A) 1/625 (C) 12/625 CS - 2012
(B) 4/625 (D) 16/625 16. Suppose a fair six – sided die is rolled
once. If the value on the die is 1,2, or 3 the
12. If the difference between the expectation
die is rolled a second time. What is the
of the square if a random variable ( ,x -)
probability that the some total of value
and the square if the exopectation of the
that turn up is at least 6?
random variable ( ,x-) is denoted by R,
(A) 10/21 (C) 2/3
then (B) 5/12 (D) 1/6
(A) R = 0 (C) R≥
(B) R< 0 (D) R > 0 17. Consider a random variable X that takes
CS - 2011 values +1 and 1 with probability 0.5
13. A deck of 5 cards (each carrying a distinct each. The values of the cumulative
number from 1 to 5) is shuffled distribution function F(x) at x = and
thoroughly. Two cards are then removed +1 are
one at a time from the deck. What is the (A) 0 and 0.5 (C) 0.5 and 1
probability that the two cards are (B) 0 and 1 (D) 0.25 and 0.75
selected with the number on the first card
CS - 2013
being one higher than the number on the
18. Suppose p is the number of cars per
second card?
minute passing through a certain road
(A) ⁄ (C) ⁄
junction between 5 PM and 6 PM, and p
(B) ⁄ (D) ⁄
has a Poisson distribution with mean 3.
14. Consider a finite sequence of random What is the probability of observing
values X = [x1, x2 … xn].Let be the fewer than 3 cars during any given
me n nd σx be the standard deviation of minute in this interval?
X. Let another finite sequence Y of equal (A) ⁄ e (C) ⁄ e
length be derived from this as yi, a*xi+b, (B) ⁄ e (D) ⁄ e
where a and b are positive constants. Let
μy be the me n nd σy be the standard CS - 2014
deviation of this sequence. Which one of 19. Suppose you break a stick of unit length
the following statements is INCORRECT? at a point chosen uniformly at random.
(A) Index position of mode of X in X is Then the expected length of the shorter
the same as the index position of stick is ________ .
mode of Y in Y.
(B) Index position of median of X in X is 20. Four fair six – sided dice are rolled. The
the same as the index position of probability that the sum of the results
median of Y in Y. being 22 is x/1296. The value of x is
(C) μy μx + b ____________
(D) σy σx + b
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 34
GATE QUESTION BANK Mathematics
( ) ( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 35
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 36
GATE QUESTION BANK Mathematics
(A) Both the student and the teacher are (C) ( (x) (x)) x
right (D) ( (x) (x)) x ≥
(B) Both the student and the teacher are
wrong ECE - 2014
(C) The student is wrong but the teacher 17. In a housing society, half of the families
is right have a single child per family, while the
(D) The student is right but the teacher is remaining half have two children per
wrong family. The probability that a child picked
at random, has a sibling is _____
ECE - 2010
12. A fair coin is tossed independently four 18. Let X X nd X , be independent and
times. The prob bility of the event “the identically distributed random variables
number of times heads show up is more with the uniform distribution on [0, 1].
th n the number of times t ils show up” is The probability P{X is the largest} is _____
(A) ⁄ (C) ⁄
(B) ⁄ (D) ⁄
19. Let X be a random variable which is
uniformly chosen from the set of positive
ECE - 2011
odd numbers less than 100. The
13. A fair dice is tossed two times. The
expectation, E[X], is __________.
probability that the second toss results in
a value that is higher than the first toss is
20. An unbiased coin is tossed an infinite
(A) 2/36 (C) 5/12
number of times. The probability that the
(B) 2/6 (D) 1/2
fourth head appears at the tenth toss is
(A) 0.067 (C) 0.082
ECE\EE\IN - 2012
(B) 0.073 (D) 0.091
14. A fair coin is tossed till a head appears for
the first time probability that the number 21. A fair coin is tossed repeatedly till both
of required tosses is odd , is head and tail appear at least once. The
(A) 1/3 (C) 2/3 average number of tosses required is
(B) 1/2 (D) 3/4 _______.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 37
GATE QUESTION BANK Mathematics
EE - 2005 EE - 2008
1. If P and Q are two random events, then 5. X is a uniformly distributed random
the following is TRUE variable that takes values between 0 and
(A) Independence of P and Q implies that 1. The value of E{X } will be
probability (P Q) = 0 (A) 0 (C) 1/4
(B) Probability (P ∪ Q)≥ Probability (P) (B) 1/8 (D) 1/2
+Probability (Q)
EE - 2009
(C) If P and Q are mutually exclusive,
6. Assume for simplicity that N people, all
then they must be independent
born in April (a month of 30 days), are
(D) Probability (P Q) Probability (P)
collected in a room. Consider the event of
2. A fair coin is tossed three times in atleast two people in the room being born
succession. If the first toss produces a on the same date of the month, even if in
head, then the probability of getting different years, e.g. 1980 and 1985. What
exactly two heads in three tosses is is the smallest N so that the probability of
(A) ⁄ (C) ⁄ this event exceeds 0.5?
(B) ⁄ (D) ⁄ (A) 20 (C) 15
(B) 7 (D) 16
EE - 2006
3. Two f ir dice re rolled nd the sum “ r ” EE - 2010
of the numbers turned up is considered 7. A box contains 4 white balls and 3 red
(A) Pr (r > 6) = balls. In succession, two balls are
randomly selected and removed from the
(B) Pr (r/3 is an integer) = box. Given that the first removed ball is
(C) Pr (r = 8|r/4 is an integer) = white, the probability that the second
removed ball is red is
(D) Pr (r = 6|r/5 is an integer) =
(A) 1/3 (C) 1/2
(B) 3/7 (D) 4/7
EE - 2007
4. A loaded dice has following probability ECE\EE\IN - 2012
distribution of occurrences 8. Two independent random variables X and
Dice Value Probability Y are uniformly distributed in the interval
1 ⁄ , -. The probability that max , - is
2 ⁄ less than 1/2 is
3 ⁄ (A) 3/4 (C) 1/4
(B) 9/16 (D) 2/3
4 ⁄
5 ⁄ EE - 2013
6 ⁄ 9. A continuous random variable x has a
If three identical dice as the above are probability density function
thrown, the probability of occurrence of f(x) e x . Then *x + is
values, 1, 5 and 6 on the three dice is (A) 0.368 (C) 0.632
(A) same as that of occurrence of 3, 4, 5 (B) 0.5 (D) 1.0
(B) same as that of occurrence of 1, 2, 5
(C) 1/128
(D) 5/8
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 38
GATE QUESTION BANK Mathematics
EE - 2014 IN - 2005
10. A fair coin is tossed n times. The 1. The probability that there are 53 Sundays
probability that the difference between in a randomly chosen leap year is
the number of heads and tails is (n – 3) is (A) ⁄ (C) ⁄
(A) (C) (B) ⁄ (D) ⁄
(B) (D)
2. A mass of 10 kg is measured with an
11. Consider a dice with the property that the instrument and the readings are normally
probability of a face with n dots showing distributed with respect to the mean of
up is proportional to n. The probability of 10 kg. Given that
the face with three dots showing up is ∫ exp . / d =0.6
√
_______________ and that 60per cent of the readings are
found to be within 0.05 kg from the mean,
12. Let x be a random variable with
the standard deviation of the data is
probability density function
(A) 0.02 (C) 0.06
for |x| (B) 0.04 (D) 0.08
f(x) { for |x|
otherwise 3. The measurements of a source voltage are
The probability P(0.5 < x < 5) is_________ 5.9V, 5.7V and 6.1V. The sample standard
deviation of the readings is
13. Lifetime of an electric bulb is a random (A) 0.013 (C) 0.115
variable with density f(x) kx , where x (B) 0.04 (D) 0.2
is measured in years. If the minimum and
maximum lifetimes of bulb are 1 and 2 IN - 2006
years respectively, then the value of k 4. You have gone to a cyber-cafe with a
is__________ friend. You found that the cyber-café has
only three terminals. All terminals are
14. The mean thickness and variance of unoccupied. You and your friend have to
silicon steel laminations are 0.2 mm and make a random choice of selecting a
0.02 respectively. The varnish insulation terminal. What is the probability that
is applied on both the sides of the both of you will NOT select the same
laminations. The mean thickness of one terminal?
side insulation and its variance are (A) ⁄ (C) ⁄
0.1 mm and 0.01 respectively. If the (B) ⁄ (D) 1
transformer core is made using 100 such
5. Probability density function p(x) of a
varnish coated laminations, the mean
random variable x is as shown below. The
thickness and variance of the core
value of is
respectively are
p(x)
(A) 30 mm and 0.22
(B) 30 mm and 2.44
(C) 40 mm and 2.44 α
(D) 40 mm and 0.24
0 α α b α c
(A) c (C)
( )
(B) c (D)
( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 39
GATE QUESTION BANK Mathematics
6. Two dices are rolled simultaneously. The measurements, it can be expected that the
probability that the sum of digits on the number of measurement more than 10.15
top surface of the two dices is even is mm will be
(A) 0.5 (C) 0.167 (A) 230 (C) 15
(B) 0.25 (D) 0.125 (B) 115 (D) 2
IN - 2007 IN - 2011
7. Assume that the duration in minutes of a 12. The box 1 contains chips numbered 3, 6,
telephone conversation follows the 9, 12 and 15. The box 2 contains chips
exponential distribution f(x) = e ,x≥ numbered 6, 11, 16, 21 and 26. Two chips,
one from each box, are drawn at random.
The probability that the conversation will
The numbers written on these chips are
exceed five minutes is
multiplied. The probability for the
(A) e (C) product to be an even number is
(B) e
(D) e (A) ⁄ (C) ⁄
(B) ⁄ (D) ⁄
IN - 2008
8. Consider a Gaussian distributed random IN - 2013
variable with zero mean and standard 13. A continuous random variable X has
deviation . The value of its cummulative probability density f(x) = .
distribution function at the origin will be Then P(X > 1) is
(A) 0 (C) 1 (A) 0.368 (C) 0.632
(B) 0.5 (D) σ (B) 0.5 (D) 1.0
IN - 2010
11. The diameters of 10000 ball bearings
were measured. The mean diameter and Assuming independence of failures of the
standard deviation were found to be machines, the probability that a given job
10 mm and 0.05mm respectively. is successfully processed (up to third
Assuming Gaussian distribution of decimal place)is ______________
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 40
GATE QUESTION BANK Mathematics
ME 4. [Ans. D]
1. [Ans. D] ( oth defective)
( oth defective)
The number of ways coming 8 and 9 are S mple sp ce
(2,6),(3,5),(4,4),(5,3),(6,2),(3,6),(4,5),
(5,4),(6,3)
Total ways =9
So Probability of coming 8 and 9 are 5. [Ans. D]
X and Y are independent
∴ ( ) ( ) ( ) re true
So probability of not coming these Only (D) is odd one
6. [Ans. A]
Number of favourable cases are given by
2. [Ans. B]
HHHT
Probability of defective item = HHTH
Probability of not defective item = 1 0.1 HTHH
= 0.9 THHH
So, Probability that exactly 2 of the Total number of cases
chosen items are defective = 2C1 2C1 2C1 2C1 =16
= ( ) ( ) ∴ Probability =
3. [Ans. B] 7. [Ans. A]
Mean (t)̅ = ∫ t f(t) dt A uniform distribution and density
function
∫ t( t)dt ∫ t( t)dt
0,x a
x x a
6
t t
7 6
t t
7 f(x) f x dx , axb
0 b a
0, xb
[ ] [ ]
Density function
1 a,x b
f(x) b a
Variance = ∫ t f(t)dt 0 a x,x b
=∫ t ( t)dt ∫ t ( t)dt b
ab
=∫ (t t )dt ∫ t ( t)dt
Mean E(x)= x(F(x))
x a 2
Variance = F(x)2 f(x)
2
=0 1 0 1
2
b
b
x F(x) xF(x)
= 2
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 41
GATE QUESTION BANK Mathematics
b 2 3
x3 xL 1 7
(3 3 1)
3(b a) a 2 b a 2 8
b3 a3 (b2 a2 )2
3(b a) 4 b a 2 9. [Ans. C]
Probability of drawing 2 washers, first
(b a)(b2 ab a2 ) (b a)2(b a)2 followed by 3 nuts, and subsequently the
3(b a) 4 b a
2
4 bolts
4b2 4ab 4a2 3a2 3b2 6ab
12
b2 a2 2ab
10. [Ans. D]
12
Required probability = . / . /
(b a)2
12
Standard deviation = √v ri nce
(b a)2 11. [Ans. D]
12 Given 4R and 6B
(b a) , -
12
Given: b=1, a=0
10 1
Standard deviation =
12 12
8. [Ans. D]
Let probability of getting atleast one head 12. [Ans. C]
= P(H) then
P (at least one head) = 1 P(no head)
P(H)=1 P(all tails)
But in all cases, 23=8
1 7 X=0
X=1
P (H) = 1
8 8 Below X (X ) is
Alternately (X ) has to be less than 0.5 but
Probability of getting at least one head greater than zero
( ) ( )
13. [Ans. D]
1 7 A event that he knows the correct
1
8 8 answer
Alternately B event that student answered
From Binomial theorem correctly the question P(B) = ?
Probability of getting at least one head ( ) ( )
pq
( ) ( ) ( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 42
GATE QUESTION BANK Mathematics
( ) ( ) ( ⁄ )
( ) ⁄
( ⁄ )
( ) ⁄ 18. [Ans. A]
14. [Ans. D]
x 1 2 3
P(x) 0.3 0.6 0.1
(x) x (x)
So from figure
(x)
Mean value = 1
x (x) V ri nce : μ me n x defective pieces
(x μ)
σ V(x) (x ) , (x)- σ
n(n )
x (x) ( x (x)) ( ) ( ) ( )
( ) ( ) ( )
σ √
( )
15. [Ans. A]
19. [Ans. *](Range 49 to 51)
∫ e dz
17. [Ans. *] Range 0.64 to 0.66 σ√
Let number of men = 100 ∴ of s ving ccount holder
Number of women = 100
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 43
GATE QUESTION BANK Mathematics
e 5 Calculators
(x )
1 Defective 4 Non-defective
CE p( defective in c lcul tors)
1. [Ans D]
A, B, C are true
(D) is not true. Since in a negatively
skewed distribution
4. [Ans. C]
mode > median > mean
σ
μ
2. [Ans. D]
Let the mean and standard deviation of
5. [Ans. B]
the students of batch C be μ and σ
Given f(x) = x for x
respectively and the mean and standard
= 0 else where
deviation of entire class of first year
students be μ and σ respectively
Now given, μ ( x ) ∫ f(x)dx ∫ x dx
σ
and μ
σ =0 1
In order to normalise batch C to entire
The probability expressed in percentage
class, the normalize score must be
equated P=
since Z = = 2.469% = 2.47%
Z = =
6. [Ans. A]
Now Z = = Given
Equation these two and solving, we get P(private car) = 0.45
= P(bus 1 public transport) = 0.55
Since a person has a choice between
x = 8.969 ≃ 9.0
private car and public transport
P(public transport) = 1 – P(private car)
3. [Ans. B]
= 1 – 0.45 =0.55
Since population is finite, hypergeometric
P(bus) = P(bus public transport)
distribution is applicable
(bus public tr nsport)
(public tr nsport)
= 0.55 × 0.55
= 0.3025 ≃ 0.30
Now P(metro)
= 1 [P(private car) + P(bus)]
= 1 (0.45 + 0.30) = 0.25
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 44
GATE QUESTION BANK Mathematics
[ ]
-0.44
The shades area in above figure is given
by F(0) –F ( 0.44)
= ( )( )
( ) ( )
= 0.5 – 0.3345 13. [Ans. 0.4]
= 1.1655 ≃ 16.55%
Closest answer is 16.7% ( ) ∫ f( )d ∫ d
8. [Ans. C]
( )| ( )
P(2 heads) =
9. [Ans. C]
P(one ball is Red & another is blue) 14. [Ans. *] Range 0.26 to 0.27
= P(first is Red and second is Blue) Avg= 5
= Let x denote penalty
(x ) (x ) (x )
(x ) (x )
10. [Ans. A]
Given μ = 1000, σ = 200 e
ew (x n)
x
We know that Z
e e e e
p(x )
When X= 1200, Z
Req. Prob = P (X ) e [ ]
(Z )
( Z )
Less than 50%
15. [Ans. B]
S * T+
11. [Ans. D]
n( )
(X ) (X ) (X ) ( )
n(S)
( ) ( )
16. [Ans. *] Range 0.25 to 0.28
e ( t)
(n t)
n
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 45
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 46
GATE QUESTION BANK Mathematics
6. [Ans. D] 8. [Ans. C]
umber of permut tions with ‘ ’ in the Let C denote computes science study and
first position =19! M denotes maths study.
Number of permutations with ‘ ’ in the P(C on Monday and C on Wednesday)
second position = 10 18! = P(C on Monday, M on Tuesday and C on
(Fill the first space with any of the 10 odd Wednesday)
numbers and the 18 spaces after the 2 + P(C on Monday, C on Tuesday and C on
with 18 of the remaining numbers in 18! Wednesday)
ways) =1 0.6 0.4+ 1 0.4 0.4
umber of permut tions with ‘ ’ in rd = 0.24 + 0.16 = 0.40
position =10 9 17!
9. [Ans. B]
(Fill the first 2 place with 2 of the 10 odd
It is given that
numbers and then the remaining 17
P (odd) = 0.9 P (even)
places with remaining 17 numbers)
Now since 𝜮P(x) = 1
nd so on until ‘ ’ is in th place. After
∴ P (odd) + P (even) = 1
that it is not possible to satisfy the given
0.9 P (even) + P (even) = 1
condition, since there are only 10 odd
numbers v il ble to fill before the ‘ ’ P(even) = = 0.5263
So the desired number of permutations Now, it is given that P(any even face) is same
which satisfies the given condition is i.e. P(2) = P(4) = P(6)
Now since,
… P(even) = P(2) or P(4) or P(6)
Now the probability of this happening is = P(2) + P(4) + P(6)
given by = ∴ P(2) = P(4) = P(6) = P(even)
( … )
= (0.5263)
Which are clearly not choices (A), (B) or (C) = 0.1754
It is given that
7. [Ans. A]
P(even | face > 3) = 0.75
Given μ = 1, σ = 4 σ =2 ( )
and μ = 1, σ is unknown = 0.75
( )
Given, P(X ) = P (Y ≥ 2 ) ( )
= 0.75
( )
Converting into standard normal variates, ( ) ( )
P(f ce ) = =0.468
.z / = P (z ≥ )
( ) 10. [Ans. A]
.z / = P (z ≥ )
The tree diagram of probabilities is
shown below
(z ) = P (z ≥ ) _____(i)
q decl red f ulty
Now since we know that in standard f ulty
p
normal distribution
q decl red not f ulty
P (z ) = P (z ≥ 1) _____(ii) decl red f ulty
not q
Comparing (i) and (ii) we can say that p
f ulty
=1 σ =3
q decl red not f ulty
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 47
GATE QUESTION BANK Mathematics
11. [Ans. A]
( )
If b c …
Then, no. of divisors of ( ∪ ) ( t le st one he d)
(x )(y )(z )… ( TT )
iven
∴ o of ivisors of
So required prob bility
( )( )
( )( )
16. [Ans. B]
No. of divisors of which are multiples Required Probability
of = P (getting 6 in the first time)
o of divisors of + P (getting 1 in the first time and getting
( )( ) 5 or 6 in the second time)
+ P (getting 2 in the first time and getting
4 or 5 or 6 in the second time)
+ P (getting 3 in the first time and getting
∴ equired rob bility
3 or 4 or 5 or 6 in the second time)
( ) ( ) ( )
12. [Ans. C]
V(x) (x ) , (x)-
17. [Ans. C]
Where V(x) is the variance of x,
The p.d.f of the random variable is
Since variance is σ and hence never
x +1
negative, ≥
P(x) 0.5 0.5
The cumulative distribution function F(x)
13. [Ans. A]
is the probability upto x as given below
The five cards are * +
x +1
Sample space ordered pairs F(x) 0.5 1.0
P (1 card = 2 card + 1)
st nd
So correct option is (C)
*( )( )( )( )+
18. [Ans. C]
e
(k)
k
14. [Ans. D] P is no. of cars per minute travelling.
𝛔y = a 𝛔x is the correct expression
Since variance of constant is zero. For no cars. (i.e. k = 0)
For no cars. P(0) e
15. [Ans. A] So P can be either 0,1,2. (i.e. k = 0,1,2)
Let A be the event of head in one coin. B For k = 1, p(1)=e
be the event of head in second coin.
For k = 2 , P(2)=
The required probability is
* ) ( ∪ )+ Hence
( )| ∪ ) ( ) ( ) ( )
( ∪ )
( ) e e e
( ∪ )
( ) (both coin he ds) 4 5
e
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 48
GATE QUESTION BANK Mathematics
( ) ( ) ( ) ( ) ( )
( ⁄ )
e ( ) ( )
( )
e e ∴ equired prob bility is
( ) ( ∪ ∪ )
19. [Ans. *] Range 0.24 to 0.27
The smaller sticks, therefore, will range in
24. [Ans. 0.25]
length from almost 0 meters upto a
( ∪ ) P(S) = 1
maximum of 0.5 meters, with each length
( ) ( ) ( )
equally possible.
utu lly exclusive ( )
Thus, the average length will be about
( ) ( )
0.25 meters, or about a quarter of the
et ( ) x; ( ) x
stick.
P(A) P(B) = x( x)
Maximum value of y = x ( x)
20. [Ans. 10]
dy
22 occurs in following ways ( x) x
dx
6 6 6 4 w ys
= 2x = 1
6 6 5 5 w ys
x
equired prob bility (max)
x ximum v lue of y ( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 49
GATE QUESTION BANK Mathematics
P x.dx 1
We know that, P
B PB
∴ ( ) ( ) ( )
Ke .dx 1
ax
= 0.6 0.2
or ∫ e dx ∫ e dx = 0.12
x x,for x 0
7. [Ans. A]
x for x 0 x
K K CDF: F x PDF dx
1
a a x
For x<0, F x x 1 dx
1
i
Then probability
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 51
GATE QUESTION BANK Mathematics
20. [Ans. C]
EE 6
1. [Ans. D]
(A) is false since of P & Q are 7
independent
8
pr(P Q) = pr(P) pr(Q)
which need not be zero.
9
(B) is false since
pr(P ∪ Q) 10
= pr(P) + pr(Q) – pr(P Q)
(C) is false since independence and 11
mutually exclusion are unrelated
properties. 12
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 53
GATE QUESTION BANK Mathematics
4. [Ans. C]
Dice value Probability
1
8. [Ans. B]
2 and is the entrie
rectangle
3
The region in which maximum of {x, y} is
4 less than ⁄ is shown below as shaded
region inside this rectangle
5
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 54
GATE QUESTION BANK Mathematics
( x ) ∫ f(x)dx
∫ dx ∫ dx ∫ dx
x| x|
( ) ( )
13. [Ans. *] Range 0.4 to 0.5
∴ ∫ kx dx
x
k | k ∴k
(x ) ∫ e dx , e - IN
,e e - e 1. [Ans. D]
Since leap chosen will be random, so, we
assume it being the case of uniform
10. [Ans. B] probability distribution function.
Let number of heads = x, Number of days in a leap year=366 days
∴ Number of tails n x =52 weeks and 2 days are extra. Out of
∴ ifference x (n x)or (n x) x
7, (SUN MON) (or) (SAT SUN) are
x n or n x
favorable.
If x n n x n
So, Probability of this event=
x n
If n x n x or x 2. [Ans. C]
As x and n are integers, this is not Since the reading taken by the instrument
possible is normally distributed, hence
( )
∴ Probability 0 P(x x ) ∫ e .dx
√
Where, μ e n of the distribution
11. [Ans. *] Range 0.13 to 0.15 σ St nd rd devi tion of the
Let proportionality constant = k distribution.
∴ ( dot) k ( dots) k
Now ∫ exp( )dx
( dots) k √
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 55
GATE QUESTION BANK Mathematics
3. [Ans. D] 8. [Ans. B]
Mean= =5.9 V. By definition of Gaussian distribution,
total area under the curve =1. Hence half
( ̅) ( ̅) ( ̅)
S √ of the area =0.5
V
(closest answer is 0.2) 9. [Ans. A]
P(x)= =
4. [Ans. C] Mean = μ ∫ x (x)dx = ∫ x dx = 6
( ) ( )
Var(x)= ∫ (x μ) (x)dx
1 2
=∫ (x ) dx =
3 3
c
Area under triangle = 1
2 11. [Ans. C]
α σ mm
μ mm
6. [Ans. A] Then probability
Probability that the sum of digits of two X μ
(X ) ( )
σ
dices is even is same either both dices
where x mm
shows even numbers or odd numbers on
the top of the surface ( ) ( )
∴ ( ) ( ) ( )
Where e
√
( ) Probability of occurring even
number of both the dices e
√
( ) Probability of occurring odd
number of both the dices So, number of measurement more than
( ) 10.15mm
P Total number of measurement
nd ( )
≃
∴ ( )
12. [Ans. D]
7. [Ans. A] For the product to be even, the numbers
from both the boxes should not turn out
∫ f(x) dx=P
to be odd simultaneously.
or ∫ e .dx =P
∴ ( ) ( )( )
or e |
or P = .
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 56
GATE QUESTION BANK Mathematics
13. [Ans. A]
∫ f(x)dx ∫ e dx
e | e
14. [Ans. 2]
For valid pdf ∫ pdf dx ;
∫ dx ;k
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 57
GATE QUESTION BANK Mathematics
Numerical Methods
ME – 2005 ME – 2010
1. Starting from x = 1, one step of Newton – 6. Torque exerted on a flywheel over a cycle
Raphson method in solving the equation is listed in the table. Flywheel energy (in
x³ +3x 7=0 gives the next value (x₁) as J per unit cycle) using impson’s rule is
(A) x₁=0.5 (C) x₁ = .5 Angle (degree) Torque (N-m)
(B) x₁= . 0 (D) x₁=2 0 0
60 1066
2. With a 1 unit change in b, what is the
change in x in the solution of the system 120 323
of equation = 2 .0 0. = 180 0
(A) Zero (C) 50 units 240 323
(B) 2 units (D) 100 units 300 55
360 0
ME – 2006 (A) 542 (C) 1444
3. Match the items in columns I and II. (B) 992.7 (D) 1986
Column I Column II
(P) Gauss-Seidel (1) Interpolation ME – 2011
method 7. The integral ∫ dx, when evaluated by
(Q) Forward (2) Non-linear using impson’s / rule on two equal
Newton-Gauss differential subintervals each of length 1, equals
method equations (A) 1.000 (C) 1.111
(R) Runge-Kutta (3) Numerical (B) 1.098 (D) 1.120
method integration
(S) Trapezoidal (4) Linear algebraic ME – 2013
Rule equation 8. Match the correct pairs.
(A) 2 Numerical Order of Fitting
(B) 2 Integration Scheme Polynomial
(C) 2 . impson’s / 1. First
(D) 2 Rule
Q. Trapezoidal Rule 2. Second
4. Equation of the line normal to function . impson’s / 3. Third
f(x) = (x ) at (0 5) is Rule
(A) y = x 5 (C) y = x 5 (A) P – 2 , Q – 1, R – 3
(B) y = x 5 (D) y = x 5 (B) P – 3, Q – 2 , R – 1
(C) P – 1, Q – 2 , R – 3
ME – 2007 (D) P – 3, Q – 1 , R – 2
5. A calculator has accuracy up to 8 digits
2
ME – 2014
after decimal place. The value of sinxdx
0
9. Using the trapezoidal rule, and dividing
the interval of integration into three equal
when evaluated using this calculator by
sub intervals, the definite integral
trapezoidal method with 8 equal
intervals, to 5 significant digits is ∫ |x|dx is ____________
(A) 0.00000 (C) 0.00500
(B) 1.0000 (D) 0.00025
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 58
GATE QUESTION BANK Mathematics
CE – 2010 CE – 2013
8. The table below given values of a function 12. Find the magnitude of the error (correct
F(x) obtained for values of x at intervals to two decimal places) in the estimation
of 0.25. of following integral using impson’s ⁄
x 0 0.25 0.5 0.75 1.0 Rule. Take the step length as 1.___________
F(x) 1 0.9412 0.8 0.64 0.50
∫ (x 0) dx
The value of the integral of the function
between the limits 0 to using impson’s
rule is CS – 2007
(A) 0.7854 (C) 3.1416 1. Consider the series =
(B) 2.3562 (D) 7.5000
= 0.5 obtained from the Newton-
CE 2011 Raphson method. The series converges to
9. The square root of a number N is to be (A) 1.5 (C) 1.6
obtained by applying the Newton (B) √2 (D) 1.4
Raphson iterations to the equation
CS – 2008
x = 0. If i denotes the iteration
2. The minimum number of equal length
index, the correct iteration scheme will be
subintervals needed to approximate
(A) x = (x ) 2
1
xe dx
x
to an accuracy of at least 106
(B) x = (x ) 1 3
using the trapezoidal rule is
(C) x = (x )
(A) 1000e (C) 100e
(D) x = (x ) (B) 1000 (D) 100
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 60
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 61
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 62
GATE QUESTION BANK Mathematics
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 63
GATE QUESTION BANK Mathematics
IN– 2011
7. The extremum (minimum or maximum)
point of a function f(x) is to be
( )
determined by solving = 0 using the
Newton-Raphson method.
Let f(x) = x x and x = 1 be the initial
guess of x. The value of x after two
iterations (x ) is
(A) 0.0141 (C) 1.4167
(B) 1.4142 (D) 1.5000
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 64
GATE QUESTION BANK Mathematics
ME y = sin ( ) =
1. [Ans. C] 2
( )
By N-R method , =x – x = y = sin ( ) = 0.70 0
( )
f(x) = x x 7 y = sin( ) = 0
f( ) = 5
y = sin ( ) = 0.70 0
( )
x =x ( )
y = sin ( )=
f (x) = x
f ( )= , 7
y = sin ( ) = 0.70 0
( )
=1 = (0.5) = .5
y = sin ( )=0
2. [Ans. C] Trapezoidal rule
Given x y = 2 (i) ∫ f(x)dx = [(y y ) 2(y y
.0 x 0.0 y = b (ii)
y )]
Multiply 0.99 is equation (i) and subtract
∫ sinx dx = [(0 0) 2(0.70 0
from equation (ii); we get
( .0 0. )x = b (2 0. ) 0.70 0 0.70 0 0.70 0 0=0
0.02x = b .
0.02Δx = Δb 6. [Ans. B]
ower = ω = Area under the curve.
Δx = = 50 units h
0.02 = [(y y ) (y y y )
3. [Ans. D] 2(y y )]
= [(0 0) ( 0 0 55)
4. [Ans. B]
/ 2( 2 2 )]
Given f(x) = (x )
= 2.7 /unit cycle.
2
f (x) = (x )
Slope of tangent at point (0, 5) 7. [Ans. C]
2 x 1 2 3
m = (0 ) / = 1
y=
Slope of normal = 3 x 2
h
(∵ roduct of slopes = 1) ∫ dx = (y y y )
x
Slope of normal at point (0, 5)
y 5 = (x 0) = ( )
2
y= x 5
= .
5. [Ans. A]
8. [Ans. D]
b a 2 0
h= = = By the definition only
n
y = sin(0) = 0
y = sin ( ) = 0.70 0
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 65
GATE QUESTION BANK Mathematics
∫ dx = [y y 2(y )] f (x ) =
x 2
For N-R method
= [ 0. 2 0.5] x =x
( )
2 ( )
= . ( )
x =x
12. [Ans. *] Range 0.53 to 0.56
Let f(x) = 5x 2 cos x Simplifying which we get
f (x) = 5 2 sin x x = 2x ax
f(0) = f( ) = 2.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 66
GATE QUESTION BANK Mathematics
2. [Ans. B] f(x )
x =x
For a = 7 iteration equation f (x )
Becomes x = 2x 7x (x x )
=x
with x = 0.2 ( x )
x = 2x 7x = 2× 0.2 – 7(0.2) = 0.12 x x x x
and x = 2x 7x = 2× 0.12 7(0. 2) =
( x )
= 0.1392 2x
x =
x
3. [Ans. A]
f(x) = 1, 4, 15 at x = 0, 1 and 2
5. [Ans. A]
respectively
Given
∫ f(x)dx = (f 2f f ) x – 10 x + 31x 30 = 0
(3 points Trapezoidal Rule) One root = 5
Here h = 1 Let the roots be α β and γ of equation
∫ f(x)dx = (1 + 2(4) + 15) = 12 ax + bx + cx + d = 0
Approximate value by rapezoidal ule αβγ=
= 12 and α β βγ γα =
Since f(x) is second degree polynomial, let ( )
α βγ = 5 βγ = = 30
f(x) = a0 + a x + a x
f(0) = 1 βγ = (i)
a 0 0= Also
a = αβ βγ γα = 5β βγ 5γ = =
f(1) = 4 5 (β γ) βγ =
a a a = ince βγ = from (i)
1+ a a = 5 (β γ) =
a a = β γ=5
f(2) = 15 βγ =
a 2a a = 5 olving for β and γ
2a a = 5 β (5 β) =
2a a = β 5β =0
Solving (i) and (ii) a = and a = β = 2 and γ =
f(x) = 1 – x + 4 x Alternative method
Now exact value ∫ f(x)dx 5 1 0 31 0
0 5 25 30
=∫ ( x x )dx
1 5 6 0
= *x + = (x 5)(x 5x )=0
Error = exact – Approximate value (x 5)(x 2)(x )=0
x=2 5
= 2=
4. [Ans. A ] 6. [Ans. D]
Y = a + bx
Given f(x) = x x =0
Given
f (x) = x
n= ∑x = ∑y = 2 ∑x = 14
Newton – Raphson formula is
and ∑xy =
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 67
GATE QUESTION BANK Mathematics
= 0.25( 0. 2 2 = [( 0 2 ) 2(2 ) ( )]
0. 0. 0.5) = 2 5.
= 0.7 5 The value of integral
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 68
GATE QUESTION BANK Mathematics
x = = 1000 e
∫ (x 0) dx = * 0x+ ( )/
5
3. [Ans. C]
= 0 =2 .
5 x = (x )
Magnitude of error
= 2 5. 2 . = 0.5 At convergence
x =x =α
CS α= (α )
1. [Ans. A] 2α=α+
Given x = + , x = 0.5
2α =
when the series converges x =x =α
2α = α + R
α= +
α =R
α= α=√
8α = 4α +9 So this iteration will compute the square
root of R
α =
α = = 1.5 4. [Ans. D]
y=x
2. [Ans. A] dy
= 2x
Here, the function being integrated is dx
f(x)= x
f(x) = xe
.
f (x) = xe + e = e (x + 1) x = .5
.
f’ (x) = xe + e + e = e (x + 2) = . 07
Since, both are increasing
functions of x, maximum value of f ( ) in 5. [Ans. B]
interval 1 2, occurs at = 2 so f( ) = 5
max |f ( )| =e (2 2) = e f( ) = 5 72 = 57 7 0
Truncation Error for trapezoidal rule f( ) 0 f( ) 0
= TE (bound) x =( )=5 f(x ) 0
2
= max |f ( )|
oot lies between and
Where is number of subintervals
x =( )=2 f(x ) 0
= 2
After ' ' interations we get the root
= max |f ( )|
6. [Ans. D]
= (b – a) max |f ( )| 1 2
h
= (2 – 1) [e (2 + 2)] ∫ f(x)dx = [f(0) f( ) 2(∑f )]
2
= e . 0 2(0.0 0.
= [ ]
Now putting = 0 0. . . 7.2 )
( )
.
= [ 5 . ]
=
= 9.045
h=
Now, No. of intervals, =
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 69
GATE QUESTION BANK Mathematics
7. [Ans. – ] 8 4
x1 2
Given (x) + f(x) + t cos x = 0 12 3
and f(x) = x sin x
f (x) = x cos x + sin x 3. [Ans. C]
f (x) = x ( sin x) + cos x + cos x Given : f(x)= x e
= 2 cos x – x sin x By Newton Raphson method,
= 2 cos x – f (x) f(x ) x e
x =x =x
2 cos x – f (x) + f(x) +t cos x = 0 f (x ) e
2 cos x = tcos x t = 2 e xn
1 x n
1 exn
8. [Ans. A]
f(x) = 0.75x 2x 2x 4. [Ans. C]
f (x) = 2.25x x 2 f(x )
x =2 f = 2 f = x =x
f (x )
f f(2) = (2 ) = √2 and
x =x =0 √2
f √
f = f = 2 f (2) = =
√ √
f x =2
(√ )
= .
x =x =2 √
f √
f = 2 f =
f 5. [Ans. D]
x =x =0 f(x) = a x a x a x a x a
f
Also, root does not lies between 0 and 1 If the above equation have complex roots,
So, the method diverges if x = 2 then they must be in complex conjugate
nly ( )is true. pair, because it’s given all co-efficients are
positive ( they are real )
9. [Ans. C] So if complex roots are even no. (in pair)
For value of K if trapezoidal rule is used then real roots will also be even.
then the value is either greater than ption ( )is wrong
actual value of definite integral and if From the equation
impson’s rule is used then value is exact roduct of roots = ( 0)
Hence both statements are TRUE As no. of roots = 4,
Product of roots < 1
ECE
either one root 0
1. [Ans. C]
(or)
By definition (& the application) of
Product of three roots < 0
various methods
ption ( )is rong.
2. [Ans. B] Now, take option (A),
y(t) =x3 x2 + 4x 4=0 Let us take it is correct .
x0 = 2 Roots are in complex conjugate pairs
f x0 =
Next approximation x1 x0
f ' x0
Product of roots
0
x03 x02 4x0 4 | | | | 0 which is not possible
x1 x0
3x02 2x0 4 ption (A) is wrong
orrect answer is option ( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 70
GATE QUESTION BANK Mathematics
8. [Ans. D] 3. [Ans. C]
=e u(t)
∑ = . .. = e
n 2 x
x x
as e = . . . x in
2
EE t
1. [Ans. D] x = ∫ e u(t) dt = ∫ f(t) dt
Here, = At t = 0.01, x = Area of trapezoidal
.
x = [f(0) f(0.0 )] = [ e .
]
f(x y) =
= 0.0099
Euler’s method equation is
x = x h. f(x y )
4. [Ans. A]
x ( )
x = x h( ) x =x
( )
h h
x =( )x = x
h = *x +
or stability | |
h 5. [Ans. B]
u(x x ) = 0x sin x 0. = 0
since h = Δ here v(x x ) = 0x 0x cosx 0. = 0
Δ
The Jacobian matrix is
u u
Δ 2
x x
o maximum permissible value of Δ is 2 .
v v
[ x x ]
2. [Ans. A]
Here f(x) = e 0x cos x 0sinx
=[ ]
0x sinx 20x 0cosx
f (x) = e
The Newton Raphson iterative equation is The matrix at x = 0 x = is
( )
x =x 0 0
( ) =* +
0 0
f(x ) = e
f’(x ) = e 6. [Ans. D]
x =x x x x =0
–( ) (x )(x )=0
i.e. x =
x =0 x =0
( )
= x= x= j
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 71
GATE QUESTION BANK Mathematics
x =5
Δ 2
/
x =5 = 1.70
6. [Ans. A]
2. [Ans. A] dv
Assume x = √ =v t
dt
f(x) = x =0 t v dv
=v t
f(x ) 2 dt
x =x = [x ] 0 0 0 0+0 0. = 0
f (x ) 2 x
0.1 0 0+0.1 0. = 0.0
3. [Ans. C]
Given p(x) = x + x + 2 7. [Ans. C]
There is no sign change, hence at most 0 f(x) = x x
positive root ( rom escarte’s rule of f (x) = x = g(x)
signs) x = initial guess
p( x) = x x+2 g (x) = x
g (x )
There is one sign change, hence at most 1 x =x
negative root ( rom escarte’s rule of g (x )
signs)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 72
GATE QUESTION BANK Mathematics
( )
= = .5
g(x )
x =x
g (x )
0.75
= .5
= . 7
8. [Ans. D]
dy
= 2xy x = 0 y = h = 0.2
dx
y =y h. f(x y )
= (0.2)f(0 ) =
and y = y [f(x y ) f(x y )]
= (0. )[f(0 ) f(0.2 )]
= 0.
is the value of y after first step, using
Euler’s predictor – corrector method
9. [Ans. B]
For convergence
x = x =x x= (2x )
x
x = x= √
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 73
GATE QUESTION BANK Mathematics
Calculus
ME – 2005 ME – 2006
1. The line integral ∫ ⃗ ⃗⃗⃗⃗ of the vector 2x2 7x 3
7. If f( x ) = , then limf(x) will
function ⃗ ( ) 2xyz ̂+ x²z + ̂ k²y ̂ from 5x2 12x 9 x 3
leads to
ME – 2007
I =∫ ∫ ( ) What is q?
( )
(A) 4y (C) X 10.
(B) 16y² (D) 8 (A) 0 (C)
(B) ⁄ (D) 1
5. ∫ ( ) is equal to
(A) ∫ 11. The area of a triangle formed by the tips
(B) 2∫ of vectors a , b and c is
(C) 2∫ ( ) (A) ( )( )
(D) Zero (B) |( ) ( )|
B
x+2y=2
1
P x X
A
0 2
(A) ⁄ (C) ⁄ (A) (C)
(B) ⁄ (D) 1 (B) (D) 1
ME – 2010 ME – 2012
26. Velocity vector of a flow field is given as 33. Consider the function ( ) in the
⃗ ̂ .̂ The vorticity vector at interval . At the point x = 0,
(1, 1, 1) is f(x) is
(A) 4 ̂ ̂ (C) ̂ ̂ (A) Continuous and differentiable.
(B) 4 ̂ ̂ (D) ̂ ̂ (B) Non – continuous and differentiable.
(C) Continuous and non – differentiable.
27. The function (D) Neither continuous nor
(A) o o ∀ R differentiable.
∀ R
(B) o o ∀ R 34. . / is
∀ R
(A) 1/4 (C) 1
except at x = 3/2
(B) 1/2 (D) 2
(C) o o ∀ R
∀ R
35. At x = 0, the function f(x) = has
except at x = 2/3
(A) A maximum value
(D) o o ∀ R except at x = 3
(B) A minimum value
∀ R
(C) A singularity
28. The value of the integral ∫ is (D) A point of inflection
(A) –π (C) π
36. For the spherical surface
(B) –π (D) π
the unit outward
29. The parabolic arc √ is normal vector at the point
revolved around the x-axis. The volume of . /
√ √
the solid of revolution is (A) ̂ ̂
(A) π (C) π √ √
42. . ( )
/ is equal to CE – 2005
(A) 0 (C) 1 1. Value of the integral ∮ ( ).
(B) 0.5 (D) 2 Where, c is the square cut from the first
quadrant by the lines x = 1 and y = 1 will
43. Curl of vector ( G ’ h o o h h
⃗ ̂ ̂ ̂ line integral into double integral)
(A) ( )̂ ̂ ̂ (A) ⁄ (C) ⁄
(B) ( )̂ ̂ ̂ (B) 1 (D) ⁄
(C) ̂ ̂ ̂
(D) ̂ ̂ ̂ 2. A rail engine accelerates from its
stationary position for 8 seconds and
44. The best approximation of the minimum travels a distance of 280 m. According to
value attained by (100x) for ≥ the Mean Value theorem, the
is _______ speedometer at a certain time during
acceleration must read exactly.
(A) 0 kmph (C) 75 kmph
(B) 8 kmph (D) 126 kmph
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 77
GATE QUESTION BANK Mathematics
CE – 2008 (B) 2∫ √
8. The equation + = 0 can be
(C) ∫ √
transformed to + = 0 by substituting
(D) ∫ √
(A) (C) √
(B)
(D) √ . /
14. The is
(A) 2/3 (C) 3/2
9. The inner (dot) product of two vectors ⃗ (B) 1 (D)
and ⃗ is zero. The angle (degrees)
between in two vectors is 15. Given a function
(A) 0 (C) 90 ( )
(B) 30 (D) 120 The optimal value of f(x, y)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 78
GATE QUESTION BANK Mathematics
CE – 2011 CE – 2014
√
16. ∫ ? 22. . / o
√ √
(A) 0 (C) a (A) (C) 1
(B) a/2 (D) 2a (B) (D)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 79
GATE QUESTION BANK Mathematics
CS – 2005 CS – 2010
1
1. Let G(x) g(i)xi where |x|<1. 7. What is the value of . / ?
(1 x) i0
2
(A) 0 (C)
What is g(i)?
(B) (D) 1
(A) i (C) 2i
(B) i+1 (D) 2i
CS – 2011
8. Given i = √ , what will be the
CS – 2007
evaluation of the definite integral
2. Consider the following two statements
about the function f(x) =|x|: ∫
P: f(x) is continuous for all real values of x (A) 0 (C) –i
Q: f(x) is differentiable for all real values (B) 2 (D) i
of x
Which of the following is true? CS – 2012
(A) P is true Q is false 9. Consider the function f(x)= sin(x) in the
(B) P is false Q is true interval x ,π⁄ π⁄ -. The number and
(C) Both P and Q are true location(s) of the local minima of this
(D) Both P and Q are false function are
(A) One , at π⁄
CS – 2008 (B) One , at π⁄
x sinx (C) Two , at π⁄ and π
3. Lim equals
x x cosx (D) Two , at π⁄ and π
(A) 1 (C)
CS – 2013
(B) 1 (D)
10. Which one the following function is
continuous at x =3?
4. Let
P=∑ ∑
(A) ( ) {
where k is a positive integer. Then
(A) (C)
(B) ( ) 2
(B) (D)
(C) ( ) 2
5. A point on a curve is said to be extreme if
it is a local minimum or a local maximum. (D) ( )
The number of distinct extrema for the
CS – 2014
curve 3x 16x 24x 37 is
4 3 2
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 80
GATE QUESTION BANK Mathematics
The integral sin d is given by
3
3.
15. The value of the integral given below is 0
1 4
∫ o (A) (C)
2 3
(A) π (C) – π 2 8
(B ) (D)
(B) π (D) π 3 3
(B) P P
2
(D) P 2P
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 81
GATE QUESTION BANK Mathematics
1
h ∫ ( ) along
1
X the semicircle with the line segment PQ as
1 2 3
its diameter
(A) 1.0 (C) 4.0
(A) Is
(B) 2.5 (D) 5.0
(B) Is 0
(C) Is 1
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 82
GATE QUESTION BANK Mathematics
(A) 1
x 2 ..... volume V. If is the position vector of a
3! point inside S, with ̂ the unit normal of S,
1
x
2
.....
the value of the integral ∯ ̂⃗ is
(B) (A) 3V (C) 10V
3!
(B) 5V (D) 15V
1
x
2
.....
(C)
3! ECE\IN – 2012
x 2
23. The direction of vector A is radially
(D) 1 ..... outward from the origin, with
3!
where and K is
19. If a vector field ⃗ is related to another constant. The value of n for which
. A = 0 is
vector field ⃗ through ⃗ = ⃗ , which
(A) 2 (C) 1
of the following is true? Note: C and
(B) 2 (D) 0
refer to any closed contour and any
surface whose boundary is C.
ECE\EE – 2012
(A) ∮ ⃗ ⃗ = ∬ ⃗ ⃗
24. The maximum value of
(B) ∮ ⃗ ⃗ = ∬⃗ ⃗ ( ) in the interval
⃗ ⃗ = [1,6] is
(C) ∮ ∬⃗ ⃗
(A) 21 (C) 41
(D) ∮ ⃗ ⃗ = ∬⃗ ⃗ (B) 25 (D) 46
(A) 0 (C) 1
(B) ⁄√ (D) 2√
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 83
GATE QUESTION BANK Mathematics
27. Consider a vector field ⃗ ( ) The closed 34. The magnitude of the gradient for the
loop line integral ∮ ⃗ can be expressed function ( ) at the
as point (1,1,1) is_______.
(A) ∯( ⃗ ) over the closed
35. The directional derivative of
surface boundary by the loop
( ) ( ) ( )in the direction
(B) ∰( ⃗ )dv over the closed volume √
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 84
GATE QUESTION BANK Mathematics
EE – 2007 EE – 2010
6. The integral ∫ ( ) o 11. At t = 0, the function ( ) has
equals (A) a minimum
(A) o (C) (1/2) o (B) a discontinuity
(B) 0 (D) (1/2) (C) a point of inflection
(D) a maximum
EE – 2008
7. Consider function f(x)= ( ) where 12. Divergence of the three-dimensional
x is a real number. Then the function has radial vector field is
(A) only one minimum (A) 3 (C) ̂ ̂ ̂
(B) only two minima (B) 1/r (D) ̂( ̂ ̂)
(C) three minima
(D) three maxima 13. The value of the quantity P, where
∫ , is equal to
EE – 2009
(A) 0 (C) e
8. f(x, y) is a continuous function defined
(B) 1 (D) 1/e
over (x, y) [0, 1] [0, 1]. Given the two
constraints, x > and y > , the
EE – 2011
volume under f(x, y) is
14. The two vectors [1, 1, 1] and [1, a, ],
√
(A) ∫ ∫ ( ) √
where a = . /, are
(B) ∫ ∫ ( ) (A) orthonormal
(C) ∫ ∫ ( ) (B) orthogonal
(C) parallel
√ √
(D) ∫ ∫ ( ) (D) collinear
9. A cubic polynomial with real coefficients 15. The function f(x) = 2x – has
(A) can possibly have no extrema and no (A) a maxima at x = 1 and a minima at
zero crossings x=5
(B) may have up to three extrema and (B) a maxima at x = 1 and a minima at
upto 2 zero crossings x= 5
(C) cannot have more than two extrema (C) only a maxima at x = 1
and more than three zero crossings (D) only a minima at x = 1
(D) will always have an equal number of
extrema and zero crossings EE – 2013
16. Given a vector field
10. F(x, y) = ( )̂ ( )̂ ’ , the line integral
line integral over the straight line from ∫ evaluated along a segment on the x-
( ) = (0, 2) to ( ) = (2, 0) axis from x = 1 to x = 2 is
evaluates to (A) 2.33 (C) 2.33
(A) –8 (C) 8 (B) 0 (D) 7
(B) 4 (D) 0
17. The curl of the gradient of the scalar field
defined by
(A)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 85
GATE QUESTION BANK Mathematics
(B)
√ (D)
21. To evaluate the double integral √
( ⁄ )
∫ .∫ . / / dy, we make the
2. Given a real-valued continuous function
substitution u = ( ) and . The f(t) defined over [0,1], ∫ ( ) is
integral will reduce to (A) (C) f(1)
( ) ∫ (∫ ) (B) 0 (D) f(0)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 86
GATE QUESTION BANK Mathematics
6. The plot of a function f(x) is shown in the (B) once differentiable but not twice
following figure. A possible expression for (C) twice differentiable but not thrice
the function f(x) is (D) thrice differentiable
f(x)
11. For real x, the maximum value of is.
1 (A) 1 (C) √
(B) e 1 (D)
x IN – 2008
0 12. Consider the function y = x2 6x + 9. The
(A) ( ) (C) ( ) maximum value of y obtained when x
(B) . / (D) . / varies over the interval 2 to 5 is
(A) 1 (C) 4
IN – 2006 (B) 3 (D) 9
7. The function ( ) is
approximated as where is in 13. The expression for x > 0 is equal to
radian. The maximum value of for (A) – (C)
which the error due to the approximation (B) x (D)
is within
(A) 0.1 rad (C) 0.3 rad 14. Given y = + 2x + 10, the value of |
(B) 0.2 rad (D) 0.4 rad
is equal to
(A) 0 (C) 12
8. The solution of the integral equation
(B) 4 (D) 13
()
() ( )∫ ( ) ( ) 15.
(A) Indeterminate (C) 1
(A) ( () ( )) (B) 0 (D)
(B) ( () ( )) IN – 2009
( () ( )) 16. A sphere of unit radius is centered at the
(C)
( () ( )) origin. The unit normal at a point (x, y, z)
( () ( )) on the surface of the sphere is
(D) ( ( ) ( ))
(A) (x, y, z) (C) . /
√ √ √
(B) . /
IN – 2007
√ √ √ (D) . /
√ √ √
9. The value of the integral
∫ ∫ dx dy is. IN – 2010
(C) Π 17. The electric charge density in the region
(A) √π⁄
(D) π⁄ R: is given as
(B) √π
σ( ) , where x and y are in
meters. The total charge (in coulomb)
10. Consider the function f(x) = , where x
contained in the region R is
is real. Then the function f(x) at x = 0 is
(A) π (C) π⁄
(A) continuous but not differentiable
(B) π (D) 0
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 87
GATE QUESTION BANK Mathematics
IN – 2013
21. For a vector E, which one the following
statement is NOT TRUE?
(A) E E o o
(B) If E E is called conservative
(C) If E E is called irrotational
(D) E E -rotational
IN – 2014
22. A vector is defined as
̂ ̂ ̂
Where ̂ ̂ ̂ are unit vectors in
Cartesian ( ) coordinate system.
The surface integral ∯ f.ds over the
closed surface S of a cube with vertices
having the following coordinates:
(0,0,0),(1,0,0),(1,1,0),(0,1,0),(0,0,1),
(1,0,1),(1,1,1),(0,1,1) is________
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 88
GATE QUESTION BANK Mathematics
ME = 0 o 1
1. [Ans. A]
√ √
Since, potential function of ⃗ is x²yz = 0 1
( ) ( ) ( )
9. [Ans. B]
2. [Ans. D]
o h 10. [Ans. B]
π h π o ( ) ( )
For V to be max
This is of the form . /
Hence, h Applying L hospital rule
( )
. /
3. [Ans. A]
=
( ) | | | | =
=
11. [Ans. B]
Let the vectors be
4. [Ans. A]
After changing order ∫ ∫ ( )
12. [Ans. B]
Applying ’ Hospital rule, we get
Given: √ √ √
I=
( ) √
I=
( )
8. [Ans. A]
For
∫ 0 1 [ ]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 89
GATE QUESTION BANK Mathematics
16. [Ans. B]
h o o o Φ 20. [Ans. D]
⃗⃗ div {( )̂ ( )̂ ( )̂}
along a vector ⃗ ( Φ)
( ) ( ) ( )
Hence directional derivative is
( ̂ ̂) =3
(grad (x2+2y2+z)).
√
̂ ̂)
(2x ̂ ̂ ̂ ). ( 21. [Ans. C]
=
Hence at (1,1,2),
⇒
Directional derivative =
⇒ ( )
17. [Ans. A]
I = ∬ .dx dy
⇒ ( )
The limit of y is form 0 to and limit
of x from 0 to 2 ( )( )
I =∫ ∫ ∫ . /
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 90
GATE QUESTION BANK Mathematics
24. [Ans. B]
x4
4x Y
16
or x4 64x B
or x(x 64) 0
3
or x3 64 A
X
or x 4 x = cos
y 4 y=sin
Required area = ∫ .√ / Path is x2 y2 1
2 x3
4
R e
2 x3 2
3 120 (x y)2 1 2sin cos
2 2
4 64 cos2
(4)3 2 (1 sin2)d
3 12 0 2 0
32 16 16 1 1
= 1
3 3 3 2 2 2 2
Alternately Alternately
For point where both parabolas cut each Given: x2 y2 1
other
Put x=cos , and y=sin
y2 4x, x2 4y
x 4 4x
2
x y 2 cos2 sin2 2sincos
= 1 sin2
or x2 8 x
or x4 64x
∫ ( )
or x3 64
x 4,0 ,(4,0) cos2 1 1
2
Required area 2 0 2 2 2
4 4
x2
4x dx 1
0 0 4 2
4
2 x3 16
2 x3 2 25. [Ans. C]
3 120 3
F 3xzi 2xyj yz2k
⃗ ⃗
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 91
GATE QUESTION BANK Mathematics
( ) ( ) ( ) √
3z 2x 2yz
π ∫ π* +
At point (1, 1, 1), divergence =3+2 2=3
π
π( )
26. [Ans. D]
⃗
o ⃗ ⃗ 30. [Ans. D]
̂ ̂ ̂ If f(x) even function
∫ ( ) ∫ ( )
|| ||
31. [Ans. D]
̂ ( )̂ Standard limit formulae
o ( ) ̂ ̂
32. [Ans. B]
27. [Ans. C]
⇒ 33. [Ans. C]
The function is continuous in [ 1, 1]
It is also differentiable in [ 1, 1] except at
x = 0.
Since Left derivative = 1 and
Right derivative = 1 at x = 0
1 1 2
34. [Ans. B]
o
y is continuous for all x R, and
differentiable for all x R, except at , Using this standard limit, here a = 1 then
since at o o ’ h = ( ) /2 =1/2
value towards the left and right side of
35. [Ans. D]
( )
( )
28. [Ans. D] ( )
( )
∫ , - π
f(x) has a point of inflection at x =0.
∫ π ( )
Volume from x = 1 to x = 2, ̂ ̂ ̂
̂ ̂ ̂
∫π
( )
√ √
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 92
GATE QUESTION BANK Mathematics
̂ 38. [Ans. A]
̂ ̂
√ √ By Gauss Divergence theorem,
√ ̂ √ ̂ ̂
√ √ ∬( ̅ ̅) ∭( )
The unit outward normal vector at point
P is (Surface Integral is transformed to
volume Integral)
( )
( ) ( ) ( )
(√ ̂ √ )̂
̂ ̂
√ √
∭( ) ∭
37. [Ans. A]
The area enclosed is shown below as
shaded π
π
( ) ∬( ̅ ̂) ∭( )
( π)
( ) π
The coordinates of point P and Q is
obtained by solving 39. [Ans. C]
y = x and y = simultaneously,
i.e. x = ∫(√ ) ( )
⇒ ( )
⇒ Using Integration by parts
Now, x = 0 ⇒ which is point Q(0,0) ∫ ∫
and x = 1 ⇒ which is point
P(1,1) Here,
So required area is f=ln(x) and dg=√
and g=
∫ ∫ o
∫(√ ) ( )
* + * +
[ ] ∫ ( )
[ ] [ ]
( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 93
GATE QUESTION BANK Mathematics
40. [Ans. A] π
0 o 1
So the minimum value is
[Differentiating both . /
=
o o o w ’
Hospital method]
. / 45. [Ans. D]
o o o o ( ) o
o o
( ) ( )
otherwise it is said to be discontinuous.
41. [Ans. B] So the most appropriate option is D.
G o
46. [Ans. C]
̂ ̂ ̂ ( )
| |
Div
Vectors are linearly dependent
42. [Ans. B]
( )
) (
( ) 47. [Ans. B]
, ho - Let
o ( )( )
( )
( ) ( )
o ( )( ) ∫
( ) o ( )
43. [Ans. A] ∫
̂ ̂ ̂ o
( ) () o o
⃗
[ ]
48. [Ans. B]
̂[ ( ) ( )]
∫ ∫ ∫ |
̂[ ( ) ( )]
∫ , -
̂[ ( ) ( )]
,̂ - ,̂ - ̂, - ∫ ( ) |
( )̂ ( )̂ ( )̂
[ ]
44. [Ans. *] Range 1.00 to 0.94
h o , - , -
π
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 94
GATE QUESTION BANK Mathematics
Here I = ∮ ( )
, ∫ ∫ -
∮ (( ) ( ) )
= xy =∫ ∫ ( o )
= y and = 2y o
∫( )
’ h o w
I= ∫ ∫ , ( )-
π
. / | |
=∫ ∫
=∫ ∫ π π π √
. / ( )
2. [Ans. D] π π √
* ( )+
Since the position of rail engine S(t) is
continuous and differentiable function π π √
* +
according to Lagrange’s mean value
theorem more π √
( ) ( ) ( )
(t) = v(t) =
( )
= m/sec
= × kmph 4. [Ans. C]
= 126 kmph f = 2 +3 ( )⃗
Where v(t) is the velocity of the rail
engine.
= 4xi + 6yj + 2zk
3. [Ans. D] At P (2, 1, 3)
h ’ o h
r=2acos Directional derivation ̂
(i) r = a represents a circle with centre ( )
( )
( ) ‘ ’ √ ( )
(ii) r = 2acos represents a circle ( ) ( ) ( )
symmetric about OX with centre at
√
( ) ‘ ’
The circles are shown in figure below. At
√
h o o o ‘ ’
P 5. [Ans. A]
y Q
Potential function,
π 3
x
O A
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 95
GATE QUESTION BANK Mathematics
8. [Ans. D]
Put √
Integrating ∫ ∫
=√
wh o
=√ …… ( )
⇒
Now given equation is
……….. (ii)
6. [Ans. B] h h h
Let I(α) ∫ dx …( ) ( ) ( )
=∫ ( ) . / = ( √ ) [ from eqn(i)]
= ∫
h
Then Integrating by parts we get, √ ( )
= 0 ( α o )1
h h
= . / √ ( ( ) )
=
h
dI = √ ( √ )
Integrating, I = α
( ) o () ( ) h
+C=0
C=
π Now substitute in eqn (ii) we get
(α) α
h h
π
( )
I(0) = h h
⇒
But from equation (i), I(0) = ∫ dx
h h
⇒
∫ dx =
Which is the desired form
7. [Ans. D]
√ is the correct transformation.
̅=5 +2 + 3y ⃗
(⃗ ) 9. [Ans. C]
̅ ̅=0
= 5y + 4y + 6yz
̅ ̅ o
At(1, 1, 1)
If ̅ ̅ = 0
div ( ) = 5.1 + 4.1 + 6.1.1
= 15 o
Since P and Q are non-zero vectors
o
0
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 96
GATE QUESTION BANK Mathematics
10. [Ans. A] √
Since the limit is a function of x. We first √
√ √
integrate w.r.t. y and then w.r.t. x √
∫ ∫( )
13. [Ans. D]
Length of curve f(x) between x = a and
x = b is given by
∫ ∫( )
∫√ ( )
∫ * +
Here, 4h … … ( )
= 8h
∫ ( )
Since
and y = h at x =
∫ ( )
(As can be seen from equation (i), by
substituting x = 0 and x = L/2)
* ( ) ( )+
(Length of cable)
* + =∫ √ . /
h
ho ∫ √
11. [Ans. B]
f = + 3 +2 14. [Ans. A]
f = grad f = i +j +k
= i(2x) + j(6y) + k(4z)
The gradient at P(1, 2, 1) is
= i(2×1) + j(6×2) + k(4 ( ))
= 2i + 12j – 4k 15. [Ans. A]
( )
12. [Ans. B]
( )
⃗
⃗ ̂
⃗ Putting,
⃗
√
o ̂ Given,
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 97
GATE QUESTION BANK Mathematics
Since, π
⇒λ
Since, ⇒λ
We have either a maxima or minima at
. / 18. [Ans. A]
( )
19. [Ans. A]
Area = |̅ ̅ |
̅̅̅̅ ̅̅̅̅
R ( ) ( )
2I = |
∫ o o
I = a/2
⇒ o
17. [Ans. C]
For a function f(x) to be continuous, ⇒ ∫ ( )
at x=a
( ) ( ) ∫ ( )
If f(x) is continuous at x=
π λ o * +
. /
[ ]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 98
GATE QUESTION BANK Mathematics
( ) ( ) ( )
[ ] | |
π π
∫ o
∫ o ( o )
( )
∫ o o
o ( )
∫ o
( )
[ ] ⇒
Magnitude of acceleration
22. [Ans. C] =√ ( )
( ) 25. [Ans. B]
We have
⇒ ( )
∫ ( )
⇒
, ow - ∫ ( ) ∫ ( )
=1+0=1
Hence correct option is (C)
∫ ( )
23. [Ans. A]
(4, 3)
a
(2, 2)
c
b x ( )μ
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 99
GATE QUESTION BANK Mathematics
26. [Ans. A]
=
α = =1
Use L – hospital Rule
4. [Ans. A]
α
P=∑ … ( –1)
o
= log x ‘ ’ w h a =1, l=2k 1
P= ( ) ( )
CS =
1. [Ans. B] Q=∑ … k
1
n 1 r
Cr xr ‘ ’ w h k
1 x r0
n
( ) ( )
1
Putting n=2, 21 r
Cr xr
1 x 2 r0
r1 Cr xr r1 C1xr ⇒
r 0 r 0
r 1 xr i 1 xi 5. [Ans. D]
r 0 i 0 y = 3 – 16 – 24 + 37
(since r is a dummy variable, r can be = 12 48 – 48 x = 0
replaced by i)
x (12 – 48x 48 ) = 0
x = 0 or 12 – 48x – 48 = 0
∑ ()
4x – 4 = 0
g(i) =i+1 √ √ √
x= = =
=2 √
2. [Ans. A]
f(x)= |x| = 36 96x 48
Continuity: In other words, Now at x = 0
f(x) = x o ≥ = 48 0
x for x< 0
Since, = =0 , At 2 ± √ also 0 (using
f (x) is continuous for all real values of x calculator)
Differentiability: There are 3 extrema in this function
( ) ( )
( ) 6. [Ans. D]
( )
Since ∫ ( ) =∫ ( )
R h
I =∫
So |x| is continuous but not differentiable
( )
at x=0 =∫
( )
Since tan (A B) =
3. [Ans. A]
⁄
= ⁄
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 100
GATE QUESTION BANK Mathematics
[ ]
∫
[ ]
9. [Ans. B]
0 1
∫ f(x) = sin x
0 1 ⇒ ( ) o
( ) ⇒ o
( ) ( ) π π π π
∫ [ ]
( ) ( )
( )
∫ ∫ At . / gives maximum
value
=, ( )- At . / gives minimum
= ln ( sec ) – ln (sec 0) value
= ln (√ ) ( )
= ln ( )–0= 10. [Ans. A]
For x = , f(x) =
7. [Ans. B] For x = , f(x) = 3 – 1 = 2
For x = 3, f(x) = 2
( ) *( ) + ( ) ( ) = f(3)
* ( ) + 11. [Ans. C]
By Mean value theorem
. /
( ) [ ]
12. [Ans. A]
Define g(x) = f(x) – f(x + 1) in [0, 1]. g(0)
is negative and g(1) is positive. By
8. [Ans. D] intermediate value theorem there is
€( ) h h g(y) = 0
o That is f(y) = f(y + 1)
∫
o Thus Answer is (A)
∫ 13. [Ans. 2]
* w +
* w +
∫ For min maximum non – common
elements must be there
⇒ * +
* + must be common to any 2 elements
of V1
[ ] ( )minimum value = 2
, -( o π π )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 101
GATE QUESTION BANK Mathematics
14. [Ans. 4]
∫ | ∫∫
∫ π
o ( )
oπ π o (π)
π o π π
Hence option (A) is correct
∫ ∫( )
ECE
1. [Ans. C]
∫ ∫ (∫ )
dy
o ∫ o 0 for x< 0
dx
o dy
0 for x> 0
Substituting the limits dx
π o (π) o ( )
π 2. [Ans. A]
ex
∫ Given, f x
1 ex
f ' x
1 e .e e
x x 2x
ex
0
1 e x 2
∫ | ∫∫ 2
1 ex
= x cos 3. [Ans. C]
= π o ( π) π o π ∫
= π
LHS = I + II = π π π⇒
∫( o )
∫
| |
∫ ( ) ( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 102
GATE QUESTION BANK Mathematics
8. [Ans. A]
Given, f x x2 x 2
df x
0
dx
4. [Ans. A] 2x 1=0
o ’ h o 1
x
∬( ) ∮ 2
d2f x
= 2 ve
5. [Ans. D] dx2
From vector triple product So it shows only minima for interval
( ) ( ) ( ) [ 4, 4], it contains a maximum value that
Here, will be at x= 4 or x=4
⇒ ( ) ( ) ( ) f( 4)=18 and f(+4)=10
( ) ( )
9. [Ans. D]
6. [Ans. A] y f x ; x 0,
( )
For strictly bounded, 0 limy
x x0 f' x0 x x0 f'' x0
2 x0
f x0 ...... or 0 lim y
1 2 x
x 22 2
So, y e x is strictly bounded
e (x 2)(e
2 2
)
2
e ......
2
e2 3 x
x 22 ...... 10. [Ans. A]
2 sin /2 1 sin /2
lim lim
0 0 2
/2
(Neglecting higher power of x)
1 sin /2 1
= lim
7. [Ans. C] 2 0 /2 2
ex e x
coth (x)= =
ex ex
11. [Ans. B]
x x2 x3 Two points on line are ( 1, 0) and (0, 1)
e 1 ..........
x
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 103
GATE QUESTION BANK Mathematics
4
I 4x3 10 2x dx 4x3 160x4 dx
0 0
1
4x4 160 5
= x 33
5 0
(1, 0)
4
∫( ) 16. [Ans. A]
f(x)= +
(x)= =0 x=0
∫ ∫ (x)= + >0 x R.
Hence minimum at x=0
f(0)=1+1=2
[ | | ] Alternatively:
For any even function the maxima &
minima can be found by
13. [Ans. B] A.M. >= GM
Let f(x) ex sinx => exp(x) + exp( x) ≥ 2
o ’ Hence minimum value = 2
f x f a x a f'a
x a
2
f x f x f'
x
2
f''
2!
f '' P
Coefficient of (x )2 is
2
f'' ex sinx |at x e
Coefficient of (x )2=0.5 exp () ∫( )
14. [Ans. A]
∫ ∫
o [ | | ]
Thus, ( )w h o ow
( )w h ow
o ( )w h ow
o ( )w h ow
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 104
GATE QUESTION BANK Mathematics
20. [Ans. C] ( )∭
̂ ̂ ( and is the position vector)
⃗⃗⃗ ̂ ̂
⃗⃗⃗ ⃗⃗⃗ 23. [Ans. A]
Y
̂ ̂
S R
3 ̅ ( )]
⇒ [
1 Q
P ⇒ [ ( )]
X ⇒ ( )
√ √
⇒ ( ) ⇒
∮ ⃗ ⃗⃗⃗
⇒
∫ ⃗ ⃗⃗⃗ ∫ ⃗ ⃗⃗⃗ ∫ ⃗ ⃗⃗⃗ ∫ ⃗ ⃗⃗⃗
√
24. [Ans. C]
√
∫ ⃗ ⃗⃗⃗ ∫ * + [ ] ( ) , -
√ √ ( ) ( )
= [ along PQ y =1 dy =0] ( ) ⇒
are the stationary points
∫ ⃗ ⃗⃗⃗ ∫ .√ / , - ( )
( ) ( )
∫ ⃗ ⃗⃗⃗
√
∫√ . / and f(2) = 25 and f(4)=21
√ √
M o ( ) , -
[ ] f(6)=41
∫ ⃗ ⃗⃗⃗ ∫ .√ / ( )
25. [Ans. B]
∮ ⃗ ⃗⃗⃗
⇒
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 105
GATE QUESTION BANK Mathematics
o 30. [Ans. C]
E o
( )
π
⇒
31. [Ans. *] Range to 0.01
E o o ( ) ( )
26. [Ans. D] ( )
̅ ̂ ̂ ̂ ⇒
⇒
( )
= ( )
=1+1+1 ( )
=3 o h
∫ * +
∫
Given o …
( )( o )
29. [Ans. A]
o o
( )
̇( ) ⇒ ( ) o ⇒
⇒ ( ) o
Since ( ) is negative, maximum value of ⇒
o
f(x) will be where ( )
0( )
1
⇒ ⇒
o oh
⇒ ( ) ( ) ( ) ( ( )( ))
( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 106
GATE QUESTION BANK Mathematics
EE ∫ ( ) ∫ ( π )
1. [Ans. C] On simplification we get option (D)
Grad u = ̂ ⁄
7. [Ans. B]
At (1, 3) Grad u = √ ,( ⁄ ) - f(x) = ( )
(x) = 2( )
=√ =4x( ) =0
x = 0, x = 2 and x = 2 are the stationary
2. [Ans. A] points.
f(x) = (x) = 4[x(2x) +( ) ]
(x) = ( ) = 4[2 -
= ( ) = 4 [3 -
Putting ( (x) = 0 = 12
( )=0 (0) = < 0, maxima at x = 0
( )=0 (2) =(12)
x = 0 or x = 2 are the stationary points. = 32 > 0, minima at x =
Now, ( 2) =12( )
(x) = ( ) ( )( ) = 32 > 0; minima at x =
= ( ( )) There is only one maxima and only two
= ( ) minima for this function.
At x = 0, (0) = ( )=2
Since (x) = 2 is > 0 at x = 0 we have a
minima.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 107
GATE QUESTION BANK Mathematics
8. [Ans. A] = , -
=, ( )-
= ( ) ( ) =1
1
14. [Ans. B]
0 Dot product of two vectors
=1+a+ =0
So orthogonal
√
15. [Ans. C]
∫ ∫ ( ) f(x) =
( )
( )
9. [Ans. C] So the equation f(x) having only maxima
( ) at x = 1
( )
( ) 16. [Ans. B]
( )
( ) ̇̂
̂
̂ ̂ ̂
10. [Ans. D]
̅=( ̂ ̂ ̂
)̂ ( )̂
( ) = (0, 2) ∫ ∫
( ) = (2, 0)
Along x axis ,y=0,z=0
Equation of starting line = The integral reduces to zero.
⇒ y = 2 – x , dy = – dx
̅ ̅ =( ) ( ) 17. [Ans. D]
Putting y = 2 – x and dy = – dx
∫̅ ̅ ∫ ∫ ( ) C o o ‘ ’
( )
11. [Ans. B] .( )̂ ( )̂
( )̂ /
( )
̂ ̂ ̂
But at is undefined
Discontinuous || ||
( ) ( ) ( )
12. [Ans. A] ̂ ( ) ̂ ( ) ̂ ( )
̂ ̂ ̂
=0
Div ( ) ⃗
̂
=. ̂ ̂ /( ̂ ̂ ̂) 18. [Ans. A]
= 1+1+1= 3 ( ) ( ) ( )
o ( ) ( )
13. [Ans. B] ⇒
M
P=∫
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 108
GATE QUESTION BANK Mathematics
19. [Ans. B] π
0 . /1
∫⃗
∫ [ ]
⇒ o o π 23. [Ans. A]
( ⃗) ⃗ ⃗
∫ ( )( )( )
( ) ( )
⃗
o
∫ ( ) [ ]
π 24. [Ans. B]
( )
20. [Ans. C] ( ) ⇒
⇒
( ) ( )
⇒( )( )
( ) ⇒
( )
( ) w , -
For number of values of ( )
⁄ ( )
o ( ) ( )
( )
( ) ( )
( ) ( )
M ( )
21. [Ans. B] IN
G 1. [Ans. A]
o h o
⇒
o o
( )
⇒ o
Unit vector along y = x is
G ∫ (∫ ) π
̂ o
∫ (∫ ) ̂
√ √
o ̂
22. [Ans. 2] . /. /
( ) √ √
π π π √ √
∫ ∫ o . / . /
√
√
2. [Ans. D]
Using L Hospital Rule., numerator
()
becomes = = ( )
From the graph, distance at
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 109
GATE QUESTION BANK Mathematics
3. [Ans. B] When
Given integral is, I=∫ ( ) ( )
Let f(x) = so curve of 1/ will be And when
f(x)
( ) ( )
The possible expression for f(x) is
1 . /
7. [Ans. B]
-1 0 1 x
Error,
This curve will be discontinuous at x=0
o ’ w o For error to be minimum
( o ) ( )
4. [Ans. A]
Let R ̂ z (t) ̂
̅ (t) =x (t) ̂+y (t) + ⇒ o
̅( ) =K (constant)
|R ⇒
i.e., (t) + (t) + (t) = constant.
⇒
On analyzing the given (A) option, we find √
̅( )
̅(t)
that R will give constant magnitude,
so first differentiation of the integration will √
be zero.
5. [Ans. C] 1
Given : G
f= + …… + o
where, (i=0 to n) are constant.
= +(n 1) ……
+ ⇒
√
and =0+ + ……
(n 1) +n ⇒
√
+
⇒ ( )
= , + + -
= nf ⇒
⇒
6. [Ans. B]
8. [Ans. B]
( ) ( )
When () ∫ ( ) …( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 110
GATE QUESTION BANK Mathematics
() 14. [Ans. B]
, ()
Given y = x2 + 2x + 10
= 2x + 2
∫ ( ) -
|
1 +1 X
1
, - o
9. [Ans. D]
Area = ( )
Total charge = σ
10. [Ans. A]
This is a standard question of =
differentiability & continuity = coulomb.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 111
GATE QUESTION BANK Mathematics
21. [Ans. D]
.E=0 is not irrational (it is solenoidal)
22. [Ans. 1]
From Gauss divergence theorem, we have
∫ ̅ ̅ ∫ ̅ ∫ ̅
∫. /dxdydz
∫ ∫ ∫ ( )
̅ ̂ ̂ ̂
[ ]
⇒
23. [Ans. C]
24. [Ans. D]
/
π
π
o .
( π )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 112
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 113
GATE QUESTION BANK DSA
9. Consider the following C-program the best way for P to score the
double foo (double);/* Line 1 */ frequencies?
int main () { (A) An array of 50 numbers
double da, db; (B) An array of 100 numbers
// input da (C) An array of 500 numbers
db = foo(da);} (D) A dynamically allocated array of 550
double foo(double a){ numbers
return a;
} Linked data Questions Q 12 & Q 13
The above code complied without any We are given 9 tasks are , , , .
error or warning. If Line 1 is deleted, the The execution of each task requires one
above code will show unit of time. We can execute one task at a
(A) no compile warning or error time. has a profit and a deadline
(B) some complier-warnings not leading profit is earned if the task is completed
to unintended results before the end of the unit of time.
(C) Some complier-warnings due to Task Profit Deadline
type-mismatch eventually leading to 15 7
unintended results 20 2
(D) Complier errors 30 5
18 3
10. Consider the following C-program 18 4
void foo (int n,int sum 0) { 10 5
int k = 0, j = 0; 23 2
if (n = = 0) return;
16 7
k = n % 10;
25 3
j = n / 10;
sum = sum + k;
12. Are all tasks completed in the schedule
foo (j, sum);
that gives maximum profit?
print “% d”, k ;
(A) All tasks are completed
}
(B) nd are left out
int main () {
(C) nd are left out
int a = 2048, sum = 0;
(D) nd are left out
foo(a, sum);
printf “%d\n” sum ;
13. What is maximum profit earned?
}
(A) 147 (C) 167
What does the above program print?
(B) 165 (D) 175
(A) 8, 4, 0, 2, 14
(B) 8, 4, 0, 2, 0
CS- 2006
(C) 2, 0, 4, 8, 14
14. Consider the polynomial
(D) 2, 0, 4, 8, 0
p(x) = a0 + a1x + a2x2 + a3x3,where
ai 0, i. The minimum number of
11. A program P reads in 500 integers in the
multiplications needed to evaluate p on
range [0, 100] representing the scores of
an input x is
500 students. It then prints the frequency
(A) 3 (C) 6
of each score above 50. What would be
(B) 4 (D) 9
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 114
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 115
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 116
GATE QUESTION BANK DSA
26. Consider the following C function: order. What will be the contents of the list
int f(int n) after the function completes execution?
{ struct node {
static int r=0; int value;
if(n<=0) return 1; struct node * next;};
if(n>3) void rearrange (struct node *list)
{ {
r = n; struct node *p, *q;
return f(n 2)+2; int temp;
} if (!list || !list next) return;
return f(n 1)+r; p = list; q = list next;
} while (q) {
What is the value of f(5)? temp = p value;
(A) 5 (C) 9 p value = q value;
(B) 7 (D) 18 q value = temp;
p = q next;
27. An array of n numbers is given, where n is q = p ? p next: 0;
an even number. The maximum as well as }
the minimum of these n numbers needs }
to be determined. Which of the following (A) 1, 2, 3, 4, 5, 6, 7
is true about the number of comparisons (B) 2, 1, 4, 3, 6, 5, 7
needed? (C) 1, 3, 2, 5, 4, 7, 6
(A) At least n comparisons, for some (D) 2, 3, 4, 5, 6, 7, 1
constant c, are needed
(B) At most n comparisons are 30. The minimum number of comparisons
needed. required to determine, if an integer
(C) At least n log n comparisons are appears more than n/2 times in a sorted
needed array of n integers is
(D) None of the above (A) n) (C) (1)
(B) (log n) (D) (log n)
28. Consider the following segment of C-code
int j, n; 31. Consider the following functions:
j=1; f(n) =
while (j<=n) g(n) = n!
j=j*2; h(n) =
The number of comparisons made in the Which of the following statements about
execution of the loop for any n>0 is the asymptotic behavior of f(n), g(n) and
(A) log n (C) log n h(n) is true?
(B) n (D) log n (A) f(n) = O(g(n)); g(n) = O(h(n))
(B) f n = g n ; g n = O h n
CS- 2008 (C) g(n) = O(f(n)); h(n) = O(f(n))
29. The following C function takes a singly- (D) h(n) = O(f(n)); g(n) = f n
linked list of integers as a parameter and
rearranges the elements of the list. The
function is called with the list containing
the integers 1, 2, 3, 4, 5, 6, 7 in the given
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 117
GATE QUESTION BANK DSA
Statement for the Linked Answer 37. Arrange the following function in
Questions 34 & 35 increasing asymptotic order:
Consider the following C program that
A. n
attempts to locate an element x in an array
B. e
Y [ ] using binary search. The program is
erroneous. C. n
1. f(int Y[10], int x) { D. n log n
2. int i, j, k; E. 1.0000001n
3. i = 0; j = 9; (A) A,D,C,E,B (C) A,C,D,E,B
4. do { (B) D,A,C,E,B (D) A,C,D,B,E
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 118
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 119
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 120
GATE QUESTION BANK DSA
50. Which does the following fragment of C 53. Let W(n) and A(n) denote respectively,
program print? the worst case and average case running
h rt = “GATE ”; time of an algorithm executed on an input
char *p = c; of size n. Which of the following is
printf % s, p p p ; ALWAYS TRUE?
(A) GATE2011 (C) 2011 (A) A n = W n
(B) E2011 (D) 011 (B) A n = W n
(C) A (n) = O (W(n))
51. Four matrices , , nd of (D) A (n) = o (W(n))
dimensions p q, q r, r s nd s t
respectively can be multiplied with 54. The recurrence relation capturing the
several ways with different number of optimal execution time of the Towers of
total scalar multiplications. For example Hanoi problem with n discs is
when multiplied as (A) T(n) = 2T(n 2) + 2
( ), the total (B) T(n) = 2T(n 1) + n
number of scalar multiplications is (C) T(n) = 2T(n/2) + 1
(D) T(n) = 2T(n 1) + 1
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 121
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 122
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 123
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 124
GATE QUESTION BANK DSA
70. Consider the function func shown below: Give a value q (to 2 decimals) such that
int func(int num) { f (q) will return q: ___________.
int count = 0;
while (num) { 74. Consider the C function given below.
count++; int f(int j)
num>>= 1; {
} static int i = 50;
return (count); int k;
} if (i == j)
The value returned by func(435)is {
__________. printf “something” ;
k = f(i);
71. Suppose n and p are unsigned int return 0;
variables in a C program. We wish to set p }
to C . If n is large, which one of the else return 0;
following statements is most likely to set }
p correctly? Which one of the following is TRUE?
(A) p = n n n ; (A) The function returns 0 for all values
(B) p = n n n ; of j.
(C) p = n n n ; (B) The function prints the string
(D) p = n n n ; something for all values of j.
(C) The function returns 0 when j = 50.
72. For a C program accessing X[i][j][k], the (D) The function will exhaust the
following intermediate code is generated runtime stack or run into an infinite
by a compiler. Assume that the size of an loop when j = 50.
integer is 32 bits and the size of a
character is 8 bits. 75. Let A be a square matrix of size n × n.
t = i Consider the following pseudocode. What
t = j is the expected output?
t = k c = 100;
t = t t for i = 1 to n do
t = t t for j = 1 to n do
t = Xt {
Which one of the following statements Temp = A[i] [j] + c;
about the source code for the C program A [i] [j] = A[j] [i];
is CORRECT? A [j] [i] = Temp – c;
(A) X is de l red s “int X 8” }
(B) X is de l red s “int X ” for i = 1 to n do
(C) X is de l red s “ h r X 8” for j = 1 to n do
(D) X is de l red s “ h r X ” output (A [i] [j]);
(A) The matrix A itself
73. Consider the following function (B) Transpose of the matrix A
double f (double x) { (C) Adding 100 to the upper diagonal
if (abs (x*x – 3) < 0.01) return x; elements and subtracting 100 from
else return f (x/2 + 1.5/x); lower diagonal elements of A
} (D) None of the above
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 125
GATE QUESTION BANK DSA
1. [Ans. C] 3. [Ans. B]
n = n n It would require n rr y of size ‘n’ to
By M ster’s method, = , = store temporary results.
n =n =n 0< = I<n
f n = (n )
4. [Ans. D]
n = (n logn)
The time complexity of computing the
= nlogn
transitive closure of a binary relation on a
So, it is also O nlogn & O n
set of n elements is O(n3). Apply the
but not n
w rsh ll’s algorithm to compute the
transitive closure. The algorithm contains
2. [Ans. C]
three nested for loops each having
double foo (int n)
frequency n so time complexity is O(n3)
{
int i ;
5. [Ans. C]
double sum ;
int (*f) (int *);
if (n ==0)return;
returns type int, (*f) is a pointer to a
else {sum = 0;
function and the argument is (int *), an
for (i = 0 ; i <n; i++)
integer pointer. So, int (*f) (int *) means a
sum = sum +foo (i);
pointer to a function that takes an integer
return (sum);
pointer as an argument and returns an
}
integer.
}
The size of recursion stack space is not
more th n ‘n!’
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 126
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 127
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 128
GATE QUESTION BANK DSA
f = f n r 31. [Ans. D]
So we need to identify the correct order of
f = f n r relative growth rates of the given
functions
1 n Either we use L hospital rule to compute
the above or we may simplify the
27. [Ans. B] functions so that growth rate can be
When we apply the divide and conquer proved with obvious reasons.
method such that dived n into two parts of h(n) can be written in form of as
n/2 then recurrence equations is follows:
T(n) = 1 for n = 2 h(n) =
T(n) = 2T(n/2)+2 for n > 2 The following is the growth rates in
The solution of T(n) is increasing order, h(n) < f(n) < g(n). Thus
D is the answer.
n = n
= n omp risons 32. [Ans. B]
Function f1 contain recursive function so
28. [Ans. D] its running time must be O(2n) but f2 have
Let the increment of j is , , , , for not.
some value of i so according to the Alternately
question for f1 has complexity of O(2n), while f2 has a
while loop: n or i log n loop from 2 to N , so the complexity of it is
One extra comparison required for the O(n)
termination of while loop. So total number
of comparisons 33. [Ans. C]
=i = log n When solved .
f =
29. [Ans. B] f = f f =
If there are even number of nodes in the f = f f =
linked list , given program interchanges f = f f =
values of successive numbered nodes .
respectively i.e. interchanges values of .
nodes. If there are odd number of nodes in .
the linked list last node value remain f 8 =
unchanged, all other nodes values are Now for f ,
interchanged as given in program. x = y = z =
Current values are x = y = z =
1,2,3,4,5,6,7 In loop
After interchange x = y = z =
2,1,4,3,6,5,7 x = y = z =
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 129
GATE QUESTION BANK DSA
x = y = z =60
log = log √ =
. f n
h n =
. n
x8 = √n
= =
√n
34. [Ans. C] n = , Where i =0
In C option when we give x =4 (say )the n = log n
working is as follows. n =f n n
I iteration
= √n log n
k = (0+9)/2=4
(y[4]<x) true
37. [Ans. C]
i=4 [j =9]
Here, n< n log9 n< en
II iteration So
k= (4+9)/2=6
(y[6]<x) true n n n log n e
i=6 [j =9] e n log n
n
III iteration
k= (6+9)/2 =7
(y[7]<x) true
i =7 [j=9] Fig. Plot of function values
IV iteration
k= (7+9)/2=8
38. [Ans. A]
(y[8]<x) true
a= (x > y) ? ((x > z) ? x : z) : ((y>z) ? y : z)
i =8 [j = 9]
In C “? : “ is tern ry oper tor the synt x
V iteration
is (exp 1 ? exp2 : exp3). It means if exp 1 is
K=(8+9)/2=8
true print exp2 else exp3.
(y[8]<x) true
Let x = 3, y = 4, z = 2.
i =8 [j = 9]
= ?( ? ): ((4 > 2) ? 4 : 2)
remains in loop forever as condition
(4[8]! = x &&i<j) is always true. a = (3 > 4) ? 3 : 4
a=4
35. [Ans. A]
If increase i to k+1 when y [k] <x and 39. [Ans. B]
f(c, b, a ) is called by the main () function
decrease j to k–1 then the program works
the graphical execution of the program is
properly. Otherwise, above scenario does
given below.
not happen and moreover the element at k
position will be checked for equality in
the while condition.
in
36. [Ans. A] f
T(n)= √ n⁄ √n x py ppz
T(1)=1 z y
Comparing it with T(n) = aT (n/b) +f(n)
x y z= = 9
We get , a= √ ; = ; f n = √n
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 130
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 131
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 132
GATE QUESTION BANK DSA
69. [Ans. C]
2 1 2 Let n=4
= When i=1; j=1: number of multiplications:
=3+3=6 3
When i=1; j=2; number of multiplications:
65. [Ans. D] 2
1. Recursion cannot be implemented When i=1; j=3; number of multiplications:
with only static allocation (TRUE) 1
2. Garbage collection is not essential for When i=1; j=4; number of multiplications:
recursion implementation 0
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 134
GATE QUESTION BANK DSA
When i=2; j=2: number of multiplications: This expression works only when n is
2 small
When i=2; j=3: number of multiplications: (ii) C is also wrong because in left to right
1 evaluate on n n may not
When i=2; j=4: number of multiplications: give exact integer. It may be fractional
0 value. But C – language ignores
When i=3; j=3: number of multiplications: fractional part and multiples it with
1 (n – 2) then divided by 2. So it will
When i=3; j=4: number of multiplications: not give correct result.
0 (iii) B is correct. n(n – 1) will be divided
When i=4; j=4: number of multiplications: by 2 exactly because n or (n – 1) is
0 even; then multiply with (n – 2) then
Total number of multiplications: 10 divide by 3.
The 3 consecutive numbers are: 3,4,5
One-sixth of product of 3 consecutive 72. [Ans. A]
numbers is: )/6 = 60/6 = 10 Three address code to access arr [n]
t = size of word
70. [Ans. 9] t =t n
num = num t = rr t
me ns divide num er y . In given ode in question
while : count = 1; num = 217 t =i
while : count = 2; num = 108 It is equivalent to
while 8 : count = 3; num = 56 t =
while : count = 4; num = 27 t =i t
while : count = 5; num = 13 So the rr y is de l red s ‘int’ nd first
while : count = 6; num = 6 index is of 32 size
while : count = 7; num = 3 So Option (A) is correct
while : count = 8; num = 1
while : count = 9; num = 0 73. [Ans. *] Range 1.72 to 1.74
while meout of loop f(q) must give q
Count = 9 So f(x) must give x
if condition must be tree
71. [Ans. B] ie abs (x * x – 3) < 0.01
n n n n ! So x must be almost equal to 3
p=n =
n ! ! x=
n n n
= 74. [Ans. D]
But all the 4 options give the same When j = 50
expression as above i = j printf statement executes;
(i) A & D are wrong because, it is given k = f (50)
that n is large so the multiplication of So j = 50 again and the recursion
n n– n result is must continues for ever.
also be unsigned int and its result will untime stack exhaust & it will run into
be very large & cannot fit in unsigned infinite loop.
int variable.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 135
GATE QUESTION BANK DSA
75. [Ans. A]
Initially A[i][j] is interchanged with A[j][i].
But again when processing A[j][i], it is
again interchange A[i][j]. So the matrix
remains the same once block is executed.
76. [Ans. B]
3 7 9 10 13 16 18
0 1 2 3 4 5 6
Case 1: (found case)
Let x = 10
i = 0, j = 6
k = 6/2 = 3
10 < = list A[3]
j= =
list A[3] < =10
i = 3 + 1 =4
i = j exit loop
list A [3] = = 10
return
Bin ry se r h
Case 2: (not found case)
Let x = 11
i = 0, j = 6
1st iteration: k = 6/2 = 3
11 = list A
list A[3] < = 11
i=3+1=4
i = j (true)
2nd iteration: k = (6 + 4)/2 = 5
11< = list A[5]
j=5–1=4
list A =
i==j
3rd iteration:
k = (4 + 4)/2 = 2
11 < = list A[4]
j=4–1=3
i = j (exit loop)
list A [k] ! = x
return
(Binary search)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 136
GATE QUESTION BANK DSA
CS-2005 CS-2007
1. A function f defined on stacks of integers 3. The following postfix expression with
satisfies the following properties. single digit operand is evaluated using a
f(ф) = 0 and stack
f(push(S, i)) = max (f(S), 0) + i for all 8 2 3 ^ / 2 3 * + 5 1 *
stacks S and integers i. If a stack S Note that ^ is the exponentiation
contains the integers 2, 3, 2, 1, 2 in operator. The top elements of the stack
order from bottom to top, what is f(S)? after the first * is evaluated are
(A) 6 (C) 3 (A) 6, 1 (C) 3, 2
(B) 4 (D) 2 (B) 5, 7 (D) 1, 5
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 137
GATE QUESTION BANK DSA
CS-2012 CS-2014
5. Suppose a circular queue of capacity 7. Suppose a stack implementation supports
(n 1) elements is implemented with an an instruction REVERSE, which reverses
array of n elements. Assume that the the order of elements on the stack, in
insertion and deletion operations are addition to the PUSH and POP
carried out using REAR and FRONT as instructions. Which one of the following
array index variables, respectively. statements is TRUE with respect to this
Initially, REAR = FRONT = 0. The modified stack?
conditions to detect queue full and queue (A) A queue cannot be implemented
empty are using this stack.
(A) full: (REAR+1) mod n = = FRONT (B) A queue can be implemented where
empty: REAR = = FRONT ENQUEUE takes a single instruction
(B) full: (REAR+1) mod N = = FRONT and DEQUEUE takes a sequence of
empty: two instructions.
(FRONT+1) mod n = = REAR (C) A queue can be implemented where
(C) full: REAR = = FRONT ENQUEUE takes a sequence of three
empty: instructions and DEQUEUE takes a
(REAR+1) mod n = = FRONT single instruction.
(D) full: (FRONT+1) mod n = = REAR (D) A queue can be implemented where
empty: REAR = = FRONT both ENQUEUE and DEQUEUE take a
single instruction each.
CS-2013
6. Consider the following operation along 8. The minimum number of arithmetic
with Enqueue and Dequeue operations on operations required to evaluate the
queues, where k is a global parameter. polynomial P(X) = for
MultiDequeue (Q){ a given value of X, using only one
m = k; temporary variable is _________.
while (Q is not empty) and (m >0) {
Dequeue (Q)
m=m–1
}
}
What is the worst case time complexity of
a sequence of n queue operations on an
initially empty queue?
(A) (n) (C) (n )
(B) (n ) (D) (n )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 138
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 139
GATE QUESTION BANK DSA
e. t=t*( )
[Evaluate ( ) and store in
memory]
f. t=6*x
[Evaluate 6x and store in memory]
g. t=t+5
[Evaluate 6x + 5 and store in memory]
t = t + ( )
[Retrieve ( ) from memory
and evaluate { ( ) ]
In the above 8 steps of evaluation, the
total number of arithmetic operation
required are 7
[4 Multiplications, 3 Additions]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 140
GATE QUESTION BANK DSA
Trees
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 141
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 142
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 143
GATE QUESTION BANK DSA
S T U V
W
The order in which the nodes are W visited
during an in – order traversal of the tree
is
(A) SQPTRWUV (C) SQPTWUVR
(B) SQPTUWRV (D) SQPTRUWV
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 144
GATE QUESTION BANK DSA
2. [Ans. C] 7. [Ans. B]
The number of internal nodes of a The root of the tree is stored at X [1]
complete k- ary tree of height h is Left X[i] stored at X[2i]
…… Right X[i] stored at X [2i+1]
If tree is complete Binary tree minimum it
= =n require n consecutive memory locations
= n( ) of
Here is the number of leaves at height x, x[1],…..x[n 1], x[n].
h
8. [Ans. C]
3. [Ans. A] 0 0
The inorder traversal of a binary search
tree is always in sorted order or in
increasing order of a given sequence. So,
the in order traversal of the tree T is
9,10,15,22,23,25,27,29,40,50,60,95 0
4. [Ans. D]
5
( ) possi le ( ) Possible
6 possible( )
3
Possible
8
1 4
2 7
5. [Ans. B]
Draw the tree as per the definition and
count the nodes.
dif =2 dif =2
dif =2 ( ) not Possible ( ) Possible
dif =1 dif =0
dif =2
dif =2 dif =2 Because 43 is less than 47, but placed in
dif =0 dif =1
dif =1 right subtree of 47
dif =2 dif =0
dif =0 dif =1
dif =0 9. [Ans. B]
dif =0
If a tree of height 4 will be down.
In which at third level 3 nodes can have
6. [Ans. C] 2- children 5- nodes can have one
If we insert the number x, first it becomes children to fulfill the given requirement.
the root of resulting B.S.T. There should No. of leaf nodes will be 11
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 145
GATE QUESTION BANK DSA
dbe fcg
nodes in nodes in right
left subtree subtree
Second node in preorder is b, so again
1 2 3 4 5 6 7 8 9 10 11 dividing,
a
10. [Ans. C]
The given routine will return the number b c
of leaf nodes in the tree
Since the function is recursive, the left d e f g
child invoked function of a node will Postorder will be : d e b f g c a
return number of leaves in left subtree,
right child invoked function will return 14. [Ans. C]
number of leaves in right subtree. For a complete n – ary tree where each
Both will e added and returned ⇒ node has n children or no children,
total number of leaves. following relation holds L = (n 1) *I +1,
where L is the number of leaf nodes and
11. [Ans. C] I is the number of internal nodes. Let us
Maximum nodes in binary tree of height find out the value of n for the given data :
0= 1= ( ) L = 41, I = 10 implies
Maximum nodes in binary tree of height 41 = 10* (n ) n=
1= 3= ( )
Maximum nodes in inary tree of height 15. [Ans. B]
h=( ) We have post order traversal and the tree
is Binary Search tree. So, in order
12. [Ans. B] traversal of Binary Search Tree is
sequence order , , ,………..,n. By using
inorder, postorder can construct unique
Binary Tree with in O (n) time.
3 unlabeled nodes
Possible Binary tress total = 5 16. [Ans. D]
Formula = Last element of postorder search must
match with the first element of pre-order
( )
= = = = search. That means first is postorder,
second is preorder and third one is
inorder.
13. [Ans. A]
Inorder : d b e a f c g
Preorder : a b d e c f g
As a is the first node in pre-order, it must
be the root of the tree So, according to
inorder,
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 146
GATE QUESTION BANK DSA
(D) Incorrect
149 root, then it should come at the
0
end of sequence.
But option C can be possible, where
orrect 97 is left child of root and 52 is left
child of it.
.
52 will be leaf node
19. [Ans. B]
0 Consider keys 3, 4, 5
3,4,5 3,4,5 3,4,5 3,4,5 3,4,5
5 5
3 4
3
3
0
5 5 4
4 3
4
4 3
5
0
orrect
20. [Ans. A]
0 Now, if any of the nodes is having exactly
one child then, it will be having even
number of descendant (2) because each
node is also its own descendent, which is
0
not possible in this tree structure. Hence,
0 zero is right.
ncorrect
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 147
GATE QUESTION BANK DSA
21. [Ans. B] 30
n = {1 , 2 , 3}
20
2 39
⇒ 10
23
42
1 35
3 15
23. [Ans. A]
E.g.
h = max(0, 0) h = 0 ,
return max(h , h )
26. [Ans. A]
Inorder traversal of m – ary tree:
f T , T , ……, Tm are su trees then
h = 0, h = 0 Return ‘0’
inorder traversal is
visit (T1)
0 visit (root)
Return ‘0’ visit (T ,……,Tm)
Follow inorder for T ,…..,Tm.
Return ‘0’ According to this logic, inorder traversal
of given tree is
another e.g. SQPTRWUV
return ( (height(n right)
27. [Ans. D]
At every node, if left sibiling = null,
( height(n right))
value =1 & it is added to Dosomething
return ‘ ’ (right sibiling).
If right sibiling = null then value = 0 is
returned & it is added to value.
return 0,
Value = 1 + 0 = 1
It is counting number of leaf nodes.
Option ‘ ’ is correct y going through
options.
24. [Ans. D]
Postorder travel sequences
15, 10 ,23, 25, 20, 35, 42, 39, 30
Preorder
30, 20, 10, 15, 23, 25, 39, 35, 42
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 148
GATE QUESTION BANK DSA
CS-2009
3. What is the maximum height of any
AVL-tree with 7 nodes? Assume that the
height of a tree with a single node is 0.
(A) 2 (C) 4
(B) 3 (D) 5
CS-2010
4. Consider a -tree in which the maximum
number of keys in a node is 5. What is the
minimum number of keys in any non-root
node?
(A) 1 (C) 3
(B) 2 (D) 4
CS-2014
5. Consider a rooted n node binary tree
represented using pointers. The best
upper bound on the time required to
determine the number of subtrees having
exactly 4 nodes is ( ) Then the
value of a + 10b is _________.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 149
GATE QUESTION BANK DSA
a = 1 and b = 0
A B – tree of order m contains n records So
and if each node contains b records on the a + 10 b = 1 + (10 0) = 1
average then the tree has about ⌈ ⌉
leaves. If we split k nodes along the path 6. [Ans. 110]
from leave then Out of n number of balanced binary
⌈ ⁄ ⌉ search trees, to search for a number L in
tree, the time required is = O(log n).
In given problem n = 10 , b =3, m=4 So From L, to sum up of m elements the time
⌈ ⌉ needed is = m
Total time complexity = O
The given function
=
a = 0, b =1, c = 1, d = 0
2. [Ans. A]
Cost of searching BST :
Best case O (min height);
Worst case O (max height ) = O(n)
where n is total number of nodes. Worst
case can occur if the BST is skewed, but
AVL tree is always height balanced
3. [Ans. B]
+
1
+ 1
1
1 + 1
+
0 1 1
0
0 1 0
OR
0 0
x hei ht →
3
4. [Ans. C]
As per tree definition each node has to
be full or atleast 50% of its total capacity.
Here, order of B+ tree
= maximum of keys in a node +1 =6 (say b)
So, minimum number of keys in any
internal node is ceiling(b/2)=3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 150
GATE QUESTION BANK DSA
Priority Queues
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 151
GATE QUESTION BANK DSA
CS – 2007 (A) 10
10. Consider the process of inserting an
element into a Max Heap, where the Max
Heap is represented by an array. Suppose, 8
6
we perform binary search on the path
from the new leaf to the root to find the
4 5 2
position for the newly inserted element,
the number of comparisons performed is 1
(A) (log2 n) (C) (n)
(B)
(B) (log2 log2 n) (D) (n log2 n) 10
CS – 2008
11. We have a binary heap on n elements and
8 6
wish to insert n more elements (not
necessarily one after another) into this
heap. The total time required for this is 4 5 1 2
(A) (log n) (C) (n log n)
(C)
(B) (n) (D) (n2) 10
CS – 2009
Statement for linked answer Questions
5 6
12 & 13
Consider a binary max-heap implemented
using an array
4 8 2 1
(D)
12. Which one of the following array 5
represents a binary max- heap?
(A) {25, 12, 16, 13, 10, 8, 14}
(B) {25, 14, 13, 16, 10, 8, 12} 2 8
(C) {25, 14, 16, 13, 10, 8, 12}
(D) {25, 14, 12, 13, 10, 8, 16}
1 4 6 10
13. What is the content of the array after two
delete operations on the correct answer CS - 2014
to the previous question? 15. A priority queue is implemented as a
(A) {14, 13, 12, 10, 8} Max-Heap. Initially, it has 5 elements. The
(B) {14, 12, 13, 8, 10} level-order traversal of the heap is: 10, 8,
(C) {14, 13, 8, 12, 10} 5, 3, 2. Two new elements 1 and 7 are
(D) {14, 13, 12, 8, 10} inserted into the heap in that order. The
level-order traversal of the heap after the
CS – 2011 insertion of the elements is:
14. A max-heap is a heap where the value of (A) 10, 8, 7, 3, 2, 1, 5
each parent is greater than or equal to (B) 10, 8, 7, 2, 3, 1, 5
value of its children. Which of the (C) 10, 8, 7, 1, 2, 3, 5
following is a max-heap? (D) 10, 8, 7, 5, 3, 2, 1
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 152
GATE QUESTION BANK DSA
1. [Ans. D] 3. [Ans. D]
root The 3 ary max heap
10 9
Heap after
inserting the 5 5
elements
8
5 6 8
2
3
3 1
root
10 So the valid sequence is 9, 5, 6, 8, 3, 1
root
Heap after inserting 7 10
and heapify 7 9 8
7
8
3 1 5 2
2 1 5 6 4
3
5. [Ans. D]
2. [Ans. A] Complete binary tree ⇒ array
The algorithm as follows: representation
Prepare a heap of lists that means each 0
node will have a list. And treat the first
element as the key of each respective node.
Perform deleteMin, which will return list
1 2
whose first element is smallest among all.
Then delete the current list first element
4 5 6
and insert the same list now based on next
list element. Perform these steps 3
repeatedly until heap is empty completely. 9
Preparing heap step will take O(logn) as 7
8 1
there are logn list. Each deleteMin and
0
insert will take O(loglogn) as the height of
heap is O(loglogn). There will be n such
operation. Thus, A is correct choice.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 153
GATE QUESTION BANK DSA
1 2 8. [Ans. C]
Level 1 = 2
= 21 {23, 17, 14, 7, 13, 10, 1, 5, 6, 12}
3 4 5 6
Level 2 = 4
23
= 22
7 8 9 10 11 12 13 14
0 1 3
Level 3 = 8 17 14
= 23
15 16 17 18
Level 4 = 16
Maximum no. of nodes at level 1 is 21 = 24 7 13 10 1
Since elements are stored in an array
To place an element at level ‘1’ we need to
put (completely all possible) max 5
6 12
possible elements at level “1-1” i.e. 21-1.
i.e. if we have to put an elements at level 4 Max heap
all the above 3 levels have max possible
capacities.
9. [Ans. A]
i.e. level’0’ → 1 MAX heap used to identity max element in
O (1) time. So, to identify min element
level’1’ → 2 require O (n), to apply the linear search.
level’2’ → 4
10. [Ans. A]
Inserting an element into a max heap
level’3’ → 8
takes O(1) times. When we perform a
So, the least index of an element at the binary search on the path from the new
level ‘1’ will be leaf to the root to find the position for the
newly inserted element takes (log n) as
expected.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 154
GATE QUESTION BANK DSA
n
∑ i n
2 13 12
= {14, 13, 12, 8, 10}
12. [Ans. C]
8 10
In a max-heap, parent node should have
value greater than or equal to both its
children 14. [Ans. B]
The structure of a heap is near-complete
25 binary tree. All levels except the last level
must be completely full. Option A does
not have this property, whereas options C
14 16 and D violate max-heap property that
every node must have higher value than it
children.
13 10 8 12
15. [Ans. A]
13. [Ans. D] Level order traversal is: 10, 8, 5, 3, 2
Delete 25 : Replace it by 12 So the tree will be
12 10
8 5
14 16
3 2
13 10 8
After inserting 1 the tree is
After heafying: 10
16
8 5
14 12 3 2 1
13 10 8
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 155
GATE QUESTION BANK DSA
3 2 1 7 3 2 1 5
Final tree
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 156
GATE QUESTION BANK DSA
Sorting Algorithms
CS-2009 CS-2012
5. What is the number of swaps required to 8. A list of n strings, each of length n, is
sort n elements using selection sort, in the sorted into lexicographic order using the
worst case? merge-sort algorithm. The worst case
(A) (n) (C) ( ) running time of this computation is
(B) (n log n) (D) ( g ) (A) O(n log n) (C) O (n2 + log n)
(B) O(n2 log n) (D) O(n2)
6. In quick sort, for sorting n elements, the
( ) the smallest element is selected as
pivot using an O(n) time algorithm. What
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 157
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 158
GATE QUESTION BANK DSA
3. [Ans. A] 9. [Ans. B]
Sorting Worst case complexity Selection sort
Algorithm (with n input) Selects the next big element and swaps
Merge sort O(nlogn) with initial elements
Comparisons – O ( )
Bubble sort ( )
Swaps – O(n)
Quick sort ( )
10. [Ans. C]
Selection sort ( )
If we have an array of x elements then
time complexity to sort x elements using
4. [Ans. B] heap sort is (x g x).
If we want to sort n elements with the We need to find value of x so that time
help of Quicksort algorithm. If pivot complexity to sort x elements gets ( g )
elements which split the list into two sub- We can direct discard option (A) & (D).
lists each in which one list contains one Now check option (C)
fifth element or n/5 and other list g g
[ g( )]
contains 4n/5 and balancing takes n. So g g g g
( ) ( / ) (4 / )
[Note : n ] g( )
g [ ]
g g
⏟
5. [Ans. A] ( )
In each pass there can be at most 1 swap. ( g )
There are n such passes in selection sort ∴ pti (C) is c rrect
i.e. maximum n swaps will happen in
worst case. 11. [Ans. C]
First input [1 2 3 4 5 ] is the worst case of
6. [Ans. B] quicksort and it will require more no.of
The relation T(n) = T(n/4)+T(3n/4)+n comparisons than input 2 [4 1 5 3 2]
The pivot element is selected in a such
way that it will divide the array into 1/4th 12. [Ans. 358]
and 3/4th always solving this relation When we are merging two sorted lists of
given (n log n). lengths m and n, the maximum number of
comparisons will be m+n 1. Also the
7. [Ans. A] worst case merging is done by merging
The algorithm uses dynamic program the two smallest length sequences.
paradigm. The given lengths of sequences are: L1:20,
L2:24, L3:30, L4:35, L5:50.
8. [Ans. B] Step1: The number comparisons in
In merge – sort algorithm no. of splits are merging sequences L1, L2 is
proportional to height and in each level ( 0 4 ) 4 (Sequence L6)
work done is . Step2: The number comparisons in
∴ ta ime C mp exity ( log n) merging sequences L3, L4 is
(30+35 1)=64 (sequence L7)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 159
GATE QUESTION BANK DSA
13. [Ans. A]
The worst case time complexity of quick
sort is ( ) irrespective of whether pivot
element is first element or middle element
or last element. If the input array is such
that middle element is the minimum or
maximum one, then the worst case can
occur
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 160
GATE QUESTION BANK DSA
Graph Algorithms
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 161
GATE QUESTION BANK DSA
8. Consider the depth-first-search of an 12. Let be the minimum weight among all
undirected graph with 3 vertices P, Q and edge weights in an undirected connected
R. Let discovery time d(u) represent the graph. Let e be a specific edge of weight
time instant when the vertex u is first w. Which of the following is FALSE?
visited and finish time f(u) represents the (A) There is a minimum spanning tree
time instant when the vertex u is last containing e.
visited. Given that (B) If e is not in minimum spanning tree
d(P) = 5 units f(P) = 12 units T, then in the cycle formed by adding
d(Q) = 6 units f(Q) = 10 units e to T, all edges have the same
d(R) = 14 units f(R) = 18 units weight.
Which one of the following statements is (C) Every minimum spanning tree has an
TRUE about the graph? edge of weight .
(A) There is only one connected component (D) e is present in every minimum
(B) There are two connected components spanning tree
and P and R are connected
(C) There are two connected components Linked data for Q.13 & Q.14
and Q and R are connected Suppose the letters a, b, c, d, e, f have
(D) There are two connected components probabilities , , , , ,
and P and Q are connected
respectively.
CS - 2007 13. Which of the following is the Huffman
9. In an unweighted, undirected connected code for the letters a, b, c, d, e, f?
graph, the shortest path from a node S to (A) 0, 10, 110, 1110, 11110, 11111
every other node is computed most (B) 11, 10, 011, 010, 001, 000
efficiently, in terms of time complexity by (C) 11, 10, 01, 001, 0001, 0000
(A) Dijkstra’s algorithm starting from S (D) 110, 100, 010, 000, 001, 111
(B) Warshall’s algorithm
14. What is the average length of the correct
(C) Performing a DFS starting from S
answer to above question?
(D) Performing a BFS starting from S
(A) 3 (C) 2.25
(B) 2.1875 (D) 1.9375
10. What is the largest integer m such that
every simple connected graph with n 15. Consider the DAG with
vertices & n edges contains at least m V = {1, 2, 3, 4, 5, 6}, shown below
different spanning trees? 2 5
(A) 1 (C) 3
(B) 2 (D) n
1
11. A depth-first search is performed on a
directed acyclic graph. Let d[u] denote the
time at which vertex u is visited for the 3 6
first time & f[u] the time at which the dfs Which of the following is NOT a
call to the vertex u terminates. Which of topological Ordering?
the following statements is always true (A) 1 2 3 4 5 6
for all edges (u,v) in the graph? (B) 1 3 2 4 5 6
(A) d[u] < d[v] (C) f[u] < f[v] (C) 1 3 2 4 6 5
(B) d[u] < f[v] (D) f[u] > f[v] (D) 3 2 4 1 6 5
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 162
GATE QUESTION BANK DSA
CS – 2008 a 5 d 10 g
1 3
16. The most efficient algorithm for finding 2
b 6 f
the number of connected components in 7 i
an undirected graph on n vertices and m 6 3 8 8
edges has time complexity:
c e h
(A) (n) (C) (m + n) 7 12
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 163
GATE QUESTION BANK DSA
Linked Answers Questions Q.22 and Q.23 Q. Finds whether any negative weighted
The subset-sum problem is defined as cycle is reachable from the source.
follows. Given a set of n positive integers, (A) P only (C) Both P and Q
S *a , a , a , . . . . . , a + and a positive (B) Q only (D) Neither P nor Q
integer W is there a subset S whose
elements sum of W? A dynamic program Common Data for Question Q.26 and Q.27
for solving this problem uses a A subsequence of a given sequence is just
2-dimensional Boolean array, X with n the given sequence with some elements
rows and W 1 columns X[i, j], (possibly none or all) left out. We are
1 i n, 0 j W, is TRUE if and only given two sequences X[m] and Y[n] of
if there is a subset of *a , a . . . . . , a + lengths m and n, respectively , with
whose elements sum to j. indexes of X and Y starting from 0.
22. Which of the following is valid for 26. We wish to find the length of the longest
2 i n and a j W common subsequence (LCS) of X[m] and
(A) ,i, j- ,i 1, j- ,i, j a - Y[n] as (m, n), where an incomplete
(B) ,i, j- ,i 1, j- ,i 1, j a - recursive definition for the function (I, j)
(C) ,i, j- ,i 1, j- ,i, j a - to compute the length of the LCS of X[m]
(D) ,i, j- ,i 1, j- ,i 1, j a - and Y[n] is given below:
(i, j) = 0, if either i = 0 or j = 0
23. Which entry of the array X, if TRUE, = expr1, if i, j>0 and x[i 1] = ,j 1-
implies that there is a subset whose = expr2, if i, j>0 and x[i 1] ,j 1-
elements sum to W? Which one of the following option is
(A) X[1, W] (C) X[n, W] correct?
(B) X[n, 0] (D) X[n 1, n] (A) expr1 (i 1, j) 1
(B) expr1 (i, j 1)
CS – 2009 (C) expr2 max( (i 1, j), (i, j 1))
24. Consider the following graph: (D) expr2 max( (i 1, j 1), (i, j))
5 b 2 e 5
6 27. The values of (i, j) could be obtained by
a 4 6 d g
6 3 dynamic programming based on the
5 correct recursive definition of (i, j) of the
3 c f 4
6 form given above, using an array L[M, N],
c
Which of the following is NOT the where M = m + 1 and N = n + 1, such
sequence of edges added to the minimum that L[I, j] = (i, j).
spanning tree using Kruskal’s algorithm Which of the following statements would
(A) (b,e) (e,f) (a,c) (b,c) (f,g) (c,d) be TRUE regarding the dynamic
(B) (b,e) (e,f) (a,c) (f,g) (b,c) (c,d) programming solution for the recursive
(C) (b,e) (a,c) (e,f) (b,c) (f,g) (c,d) definition of (i, j) ?
(D) (b,e) (e,f) (b,c) (a,c) (f,g) (c,d) (A) All elements of L should be initialized
to 0 for the values of (i, j) to be
25. Which of the following statement (s) properly computed
is/are correct regarding Bellman-Ford (B) The values of (i, j) may be computed
shortest path algorithm? in a row major order or column major
P. Always find a negative weighted cycle, order of L[M, N]
if one exists.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 164
GATE QUESTION BANK DSA
(C) The values of (i, j) cannot be the same. Let X denote the maximum possible
computed in either row major order or weight of a subsequence of a , a , … , a
column major order of L[M, N] and Y is the maximum possible weight of a
(D) L[p, q] needs to be computed before subsequence of a , a … a . Then X is equal
L [r, s] if either p < r or q < s to
(A) max( , a )
28. Let be a problem that belongs to the (B) max( , a 2)
class NP. Then which one of the following (C) max( , a 2 )
is TRUE? (D) a 2
(A) There is no polynomial time
algorithm for CS - 2011
(B) If can be solved deterministically Linked Answer Question Q.32 and Q.33
in polynomial time, then P = NP An undirected graph G(V, E) contains
(C) If is NP-hard, then it is NP n(n>2) nodes named v , v , … , v . Two
complete nodes v , v are connected if and only if
(D) may be undecidable 0<| i j | 2. Each edge (v , v ) is
assigned a weight i + j. A sample graph
CS – 2010 with n = 4 is shown below.
Common Data for Questions 29 and 30: 7
Consider a complete undirected graph
with vertex set {0, 1, 2, 3, 4}. Entry in
the matrix W below is the weight of the
edge {i,j}. 4 5
0 1 8 14 6
1 0 12 4 9
W = 8 12 0 7 3
1 4 7 02 3
[4 9 3 2 0]
32. What will be the cost of the Minimum
29. What is the minimum possible weight of a Spanning Tree (MST) of such a graph with
spanning tree T in this graph such that n nodes?
vertex 0 is a leaf node in the tree T? (A) (11n 5n) (C) 6n 11
(A) 7 (C) 9 (D) 2n 1
(B) n n 1
(B) 8 (D) 10
33. The length of the path from v to v in the
30. What is the minimum possible weight of a MST of previous question with n = 10 is
path P from vertex 1 to vertex 2 in this (A) 11 (C) 31
graph such that P contains at most 3 (B) 25 (D) 41
edges?
CS – 2012
(A) 7 (C) 9
34. Consider the directed graph shown in the
(B) 8 (D) 10
figure below. There are multiple shortest
31. The weight of a sequence a , a , … , a of paths between vertices S and T. Which
real numbers is defined as .A one will be reported by Dijkstra’s shortest
path algorithm? Assume that, in any
subsequence of a sequence is obtained by
iteration, the shortest path to a vertex v is
deleting some elements from the sequence,
keeping the order of the remaining elements
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 165
GATE QUESTION BANK DSA
CS – 2013 (B)
36. What is the time complexity of Bellman – P NP
Ford single – source shortest path NPC
algorithm on a complete graph of n
vertices?
(A) ( ) (C) ( )
(B) ( log ) (D) ( log )
(C) P = NP
37. Which of the following statements are NPC
TRUE?
1. The problem of determining whether
there exists a cycle in an undirected
graph is in P. (D)
2. The problem of determining whether P = NP = NPC
there exists a cycle in an undirected
graph is in NP.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 166
GATE QUESTION BANK DSA
40. Consider the tree arcs of a BFS traversal (C) Solvable in constant time since any
from a source node W in an unweighted, input instance is satisfiable.
connected, undirected graph. The tree T (D) NP-hard, but not NP-complete.
formed by the tree arcs is a data structure
for computing
(A) the shortest path between every
pair of vertices.
(B) the shortest path from W to every
vertex in the graph.
(C) the shortest paths from W to only
those nodes that are leaves of T.
(D) the longest path in the graph.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 167
GATE QUESTION BANK DSA
2∑| |
2. [Ans. D] 5. [Ans. C]
In Dijkstra’s algorithm for single – source Heap or priority queue are very neat data
shortest path when we implement the structures allowing :
algorithm using the binary heap data Add an element to heap with an
structure then total updates of E edges associated priority.
require O(logv) time and total spent time Remove the element from the heap or
becomes O(|E|log|V|) but of |E| is much priority queue that has the highest
less than |V|2 then time priority, and return it.
O(E+ V) log V Peak at the element with highest
priority without removing it.
3. [Ans. D] A simple way to implement a heap or
If k edges are marked as tree edges then priority queue data type is to keep a list of
k + 1 vertices are connected to each elements, and search through the list for
other. That means n – k 1 vertices are the highest priority which taken O(n)
not connected with any of k + 1 vertices. time to implement Dijkstra’s shortest
Now we can maximize number of path algorithm on unweighted graph.
components only if all n – k – 1 vertices
are isolated. 6. [Ans. D]
Therefore, n – k – 1 + 1 = n – k In the Kruskal’s algorithm we will start
This 1 is for the component having k+1 with the edge with minimum weight and
vertices add the edges in non-decreasng order if it
does not form a cycle.
4. [Ans. B] (A) (a b), (d f), (b f), (d c), (d, e)
Given vertex set of G = {v1 , v2 , ……, vn} 1 + 1 + 2 + 2 + 3 =9
Weight of an edge = 2 |i j| : (vi , vj) ϵ G (B) (a b), (d f), (d c), (b f), (d, e)
1 + 1 + 2 + 2 + 3 =9
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 168
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 169
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 170
GATE QUESTION BANK DSA
25. [Ans. B]
Bellman-Ford shortest path algorithm 1
always finds whether any negative 4 3
4 3
27. [Ans. B]
(i, j) values can be computed in a row
major order or column major order of
L[M, N]. So weight = 1+4+3 = 8
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 171
GATE QUESTION BANK DSA
32. [Ans. B]
Minimum spanning tree for 2 nodes 4 6 here cost
would be 13
(v1) (v2)
Total weight 3
3
Minimum spanning tree for 3 nodes
n n 1 16 4 1 13
would be
(v1) (v2)
33. [Ans. C]
|
Any MST which has more than 5 nodes
(v3)
will have the same distance between v5
Total weight= 3 + 4 = 7
and v6 as the basic structure of all MSTs
Minimum spanning tree for 4 nodes
(with more than 5 nodes) would be
would be
following.
(v1) (v2) (v4)
(v1) (v2) (v4) (v6) …. (more even
|
numbered nodes)
(v3)
|
Total weight= 3 + 4 + 6 = 13
(v3)
Minimum spanning tree for 5 nodes
|
would be
(v5)
(v1) (v2) (v4)
|
|
.
(v3)
.
|
(more odd numbered nodes)
(v5)
Distance between v5 and v6
Total weight= 3 + 4 + 6 + 8 = 21
= 3 + 4 + 6 + 8 + 10 = 31
Minimum spanning tree for 6 nodes
would be
34. [Ans. D]
(v1) (v2) (v4) (v6)
A B C D E F G h
|
S 4 ③ ∞ 7 ∞ ∞ ∞ ∞
(v3)
B ④ ∞ 7 ∞ ∞ ∞ ∞
|
A ⑤ 7 ∞ ∞ ∞ ∞
(v5)
C 7 ⑥ ∞ ∞ ∞
Total weight= 3 + 4 + 6 + 8 + 10 = 31
E 7 ∞ 8 ⑩
We can observe from above examples that
when we add kth node, the weight of S T
spanning tree increases by 2k 2. Let T(n)
be the weight of minimum spanning tree. The shortest path from S T is SACET
T(n) can be written as
T(n) = T(n 1) + (2n 2) for n > 2
T(1) = 0, T(2) = 0 and T(2) = 3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 172
GATE QUESTION BANK DSA
37. [Ans. A]
2 2 3 1. We can use “Depth irst Search”
Algorithm to check it there is a cycle
in an undirected graph. If we
d c encounter any “back edge” in “Depth
3
first search” then given undirected
4 graph has a cycle. DFS can be done in
a b
O(| | | |) time for graph G ( , ).
So, it is in P.
4 4 9 2. P NP,So, it is also in NP
3. NP-Complete problem NP by
definition every problem in NP can be
d c
solved in polynomial time using non-
9 deterministic alogrithms.
MST So, Answer is (A) i.e., 1, 2 and 3 are true.
a 2 b a 4 b
38. [Ans. C]
2 T 2 4
4 T DFS visits each vertex once and as it visits
c
each vertex, we need to find all of its
c c c
neighbors to figure out where to search
E.g. next. Finding all its neighbors in an
2 4
adjacency matrix requires O(V) times, so
overall the running time will be O( )
2 G 2 4 4
39. [Ans. D]
2 4
Then all NP & NPC problems can be
MST reduced to P problems. Because to
2 compute the largest clique is NPC
2 T 4 T 4 problem.
2 4
40. [Ans. B]
We can make different as well as same BFS is used in shortest path problems. So
MST also. it finds the shortest path from source
Option (D) is correct vertex to each and every vertex of a graph
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 173
GATE QUESTION BANK DSA
42. [Ans. B]
2CNFSAT problem is solvable in
polynomial time by reduction to Directed
Graph Reachability.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 174
GATE QUESTION BANK DSA
Hashing
CS – 2007 CS – 2010
1. Consider a hash table of size seven, with Statement for Linked Answer Questions
starting index zero, and a hash function 3 and 4:
(3x+4) mod 7. Assuming the hash table is A hash table of length 10 uses open
initially empty, which of the following is
addressing with hash function
the contents of the table when the
sequence 1, 3, 8, 10 is inserted into the h(k) = k mod 10, and linear probing.
table using closed hashing? Note that – After inserting 6 values into an empty
denotes an empty location in the table hash table, the table is as shown below.
(A) 0
(B) 1
(C) 2 42
(D) 3 23
4 34
CS – 2009
2. The keys 12, 18, 13, 2, 3, 23, 5 and 15 are 5 52
inserted into an initially empty hash table 6 46
of length 10 using open addressing with 7 33
hash function h(k) = k mod 10 and linear 8
probing. What is the resultant hash table? 9
(A) 0 (B) 0
1 1 3. Which one of the following choices gives a
2 2 2 12 possible order in which the key values
3 23 3 13 could have been inserted in the table?
4 4 (A) 46, 42, 34, 52, 23, 33
5 15 5 5 (B) 34, 42, 23, 52, 33, 46
6 6 (C) 46, 34, 42, 23, 52, 33
7 7 (D) 42, 46, 33, 23, 34, 52
8 18 8 18
9 9 4. How many different insertion sequences
of the key values using the same hash
(C) 0 (D) 0 function and linear probing will result in
1 1 the hash table shown above?
2 12 2 12,2
(A) 10 (C) 30
3 13 3 13,3,23
(B) 20 (D) 40
4 2 4
5 3 5 5,15
6 23 6 CS – 2014
7 5 7 5. Consider a hash table with 9 slots. The
8 18 8 18 hash function is ℎ(k) = k mod 9. The
9 15 9 collisions are resolved by chaining. The
following 9 keys are inserted in the order:
5, 28, 19, 15, 20, 33, 12, 17, 10. The
maximum, minimum and average chain
lengths in the hash table, respectively, are
(A) 3, 0, and 1 (C) 4,0 and 1
(B) 3, 3, and 3 (D) 3,0 and 2
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 175
GATE QUESTION BANK DSA
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 176
GATE QUESTION BANK DSA
5. [Ans. A]
Slot Keys Collisions
at slots
0 17 8
1 28
2 19 1
3 20 2
4 10 1, 2, 3
5 5
6 15
7 33 6
8 12 5, 6, 7
Total no of collision = 10
Average =
6. [Ans. A]
Collision resolution method: Chaining
As the 1st 3 slots must be empty
Probability to fill 1st element =
( )
Probability to fill 2nd element
= ( Collision resolution is chaining.
Same slot call be filled again )
Probability to fill 3rd element =
( ollision resolution is chaining. Same
slot call be filled again
Total probability
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 177
GATE QUESTION BANK Operating System
2. [Ans. A]
SIGKILL is signal which is generated by
Ctrl-C and this signal will execute in
kernel mode.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 178
GATE QUESTION BANK Operating System
Process Management
CS – 2005 P1 must complete use of R2 before P2
1. Consider the following code fragment: gets access to R2.
if (fork( ) == 0) P2 must complete use of R3 before P1
* a = a + 5; printf (“%d, %d\n”, a, &a); + gets access to R3.
else { a= a – 5; P1 must complete use of R4 before P2
printf (“%d, %d\n”, a, &a); + gets access to R4.
Let u and v be the values printed by the There are no other scheduling constraints
parent process and x and y be the values between the processes. If only binary
printed by the child process. Which one of semaphores are used to enforce the above
the following is TRUE? scheduling constraints, what is the
(A) u = x + 10 and v = y minimum number of binary semaphores
(B) u = x +10 and v y needed?
(C) u + 10 = x and v = y (A) 1 (C) 3
(D) u + 10 = x and v y (B) 2 (D) 4
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 179
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 180
GATE QUESTION BANK Operating System
9. Processes P1 and P2 use critical_flag in 11. The contents of the text file t1.txt
the following routine to achieve mutual containing four lines are as follows:
exclusion. Assume that critical_flag is a1 b1
initialized to FALSE in the main program. a2 b2
get_exclusive_access ( ) a3 b2
{ a4 b1
if ( critical_flag == FALSE) The contents of the text file t2. txt
{ containing five lines are as follows:
critical_flag = TRUE; a1 c1
critical_region ( ); a2 c2
critical_flag = FALSE; a3 c3
} a4 c3
} a5 c4
Consider the following statements. Consider the following Bourne shell
(i) It is possible for both P1 and P2 to script:
access critical_region concurrently. awk – (Print $1, $2) ‘ t1.txt
(ii) This may lead to a deadlock. while read a b ;
Which of the following holds? do awk – v aV = $ a – v by = $b –
(A) (i) is false and (ii) is true ‘a V = = $1 (print aV, bV, $2) ‘ t2.txt
(B) Both (i) and (ii) are false done
(C) (i) is true and (ii) is false Which one of the following strings will
(D) Both (i) and (ii) are true NOT be present in the output generated
when the above script in run? (Note that
10. Synchronization in the classical readers the given strings may be substrings of a
and writers problem can be achieved printed line.)
through use of semaphores. In the (A) “b1 c1” (C) “b1 c2”
following incomplete code for readers- (B) “b2 c3” (D) “b1 c3”
writers problem, two binary semaphores
mutex and wrt are used to obtain CS - 2008
synchronization 12. A process executes the following code for
wait ( wrt ) (i = 0; i < n; i ++) fork ( );
writing is performed The total number of child processes
signal (wrt) created is
wait (mutex) (A) n (C) 2
readcount = readcount + 1 (B) 2 1 (D) 2 1
if readcount = 1 then S1
S2 13. The P and V operations on counting
reading is performed semaphores, where s is a counting
S3 semaphore, are defined as follows:
readcount = readcount – 1 P (s): s = s – 1;
if readcount = 0 then S4 if s < 0 then wait;
signal (mutex) V (s): s = s + 1;
The values of S1, S2, S3 and S4 (in that if s < = 0 then wakeup a process
order) are
waiting on s;
(A) signal (mutex), wait (wrt),
signal (wrt), wait (mutex) Assume that Pb and Vb, the wait and signal
(B) signal (wrt), signal (mutex), operations on binary semaphore are
wait (mutex), wait (wrt) provided. Two binary semaphores Xb and
(C) wait (wrt), signal (mutex), Yb are used to implement the semaphore
wait ( mutex), signal (wrt) operations P (s) and V (s) as follows:
(D) signal (mutex), wait (mutex), P(s): Pb (Xb);
signal (mutex) , wait (mutex)
s = s – 1;
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 181
GATE QUESTION BANK Operating System
(B)
ExitX(R, S) {
V(R);
V(S);
}
EntryY(R, S) {
P(R);
P(S);
}
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 183
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 184
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 185
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 186
GATE QUESTION BANK Operating System
Threads
1. [Ans. D] 3. [Ans. A]
In kernel level threads, if the blocking Threads are called light weight processes
system call comes, the kernel can because they only need storage for stack
schedule another thread in the and registers. They don’t need separate
application for execution. So, statement space for other things.
(D) is false about kernel level threads. It
is true for user level threads 4. [Ans. D]
All types of threads share code segment.
2. [Ans. C] So operation (D) is false
Process switching includes mode All other statements are true.
switching. Context switching can occur
only in kernel mode. So t2 will include t1
in itself
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 187
GATE QUESTION BANK Operating System
CPU Scheduling
CS – 2005 giving priority to the process with the
1. We wish to schedule three processes lowest process id. The average
P1, P2 and P3 on a uni-processor system. turnaround time is
The priorities, CPU time requirements (A) 13 units (C) 15 units
and arrival times of the processes are as (B) 14 units (D) 16 units
shown below.
Process Priority CPU Arrival 4. Consider three processes, all arriving at
time time time zero, with total execution time of
required (hh:mm:ss) 10, 20 and 30 units respectively. Each
P1 10 20 sec 00:00:05 process spends the first 20% of execution
(highest)
time doing I/O, the next 70% of time
P2 9 10sec 00:00:03
doing computation and the last 10% of
P3 8 15 sec 00:00:00 time doing I/O again. The operating
(lowest) system uses a shortest remaining
We have a choice of preemptive or non- compute time first scheduling algorithm
preemptive scheduling. In preemptive and schedules a new process either when
scheduling, a late-arriving higher priority the running process get blocked on I/O or
process can preempt a currently running when the running process finishes its
process with lower priority. In non- compute burst. Assume that all I/O
preemptive scheduling, a late arriving operations can be overlapped as much as
higher priority process must wait for the possible. For what percentage of time
currently executing process to complete does the CPU remain idle?
before it can be scheduled on the (A) 0% (C) 30.0%
processor. (B) 10.6% (D) 89.4%
What are the turnaround times (time
from arrival till completion) of P2 using 5. The arrival time, priority and durations
preemptive and non-preemptive of the CPU and I/O bursts for each of
scheduling respectively? three processes P1, P2, and P3 are given
(A) 30 sec, 30 sec (C) 42 sec, 42 sec in the table below. Each process has a
(B) 30 sec, 10 sec (D) 30 sec, 42 sec CPU burst followed by an I/O burst
followed by another CPU burst. Assume
CS – 2006 that each process has its own I/O
2. Consider three CPU intensive processes, resource.
which require 10, 20 and 30 time units Process Arrival Priority Burst
and arrive at times 0, 2 and 6 time durations
respectively. How many context switches (CPU,
are needed if the operating system I/O,CPU)
implements a shortest remaining time P1 0 2 1, 5, 3
first scheduling algorithm? Do not count P2 2 3(lowest) 3, 3, 1
the context switches at time zero and at P3 3 1(highest) 2, 3, 1
the end The multi- programmed operating
(A) 1 (C) 3 system uses preemptive priority
(B) 2 (D) 4 scheduling. What are the finish times of
the processes P1, P2 and P3?
3. Consider three processes (process id 0, 1, (A) 11, 15, 9 (C) 11, 16, 10
2 respectively) with compute time bursts (B) 10, 15, 9 (D) 12, 17, 11
2, 4 and 8 time units. All processes arrive
at time zero. Consider the longest
remaining time first (LRTF) scheduling
algorithm. In LRTF ties are broken by
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 188
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 189
GATE QUESTION BANK Operating System
(B) This algorithm is equivalent to the 15. An operating system uses shortest
round – robin algorithm remaining time first scheduling algorithm
(C) This algorithm is equivalent to the for pre – emptive scheduling of processes.
shortest – job – first algorithm Consider the following set of processes
(D) This algorithm is equivalent to the with their arrival times and CPU bust
shortest – remaining – time – first times (in milliseconds)
algorithm Process Arrival Time Burst Time
P1 0 12
CS – 2014 P2 2 4
13. Consider the following set of processes
P3 3 6
that need to be scheduled on a single CPU.
All the times are given in milliseconds. P4 8 5
Process Arrival Execution The average waiting time (in
Name Time Time milliseconds) of the processes is __________.
A 0 6
B 3 2
C 5 4
D 7 6
E 10 3
Using the shortest remaining time first
scheduling algorithm, the average process
turnaround time (in msec) is ___________
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 190
GATE QUESTION BANK Operating System
e e e
Total time spent = 47
Idle time = 2+3 = 5
Percent of time CPU is IDLE =
Total time = 45 – 3(arrival time) = 42
=
For Preemptive
5. [Ans. A]
idle no pro e
v
Total time = 33 3 = 30 k idle
u y in
k
2. [Ans. B] d
Let three processes are 6. [Ans. A]
k
Process Arrival time
Burst Group 1
time P. dGang scheduling
0 10 Q.k Rate Monotonic Scheduling
2 20 R. Fair show scheduling.
6 30
The Gannt chart for SRTF scheduling Group 2
algorithm is 3. Thread scheduling
2. Real time scheduling
1. Guaranteed scheduling
7. [Ans. B]
So there is only two context switches at The Gantt chart for SRTF scheduling
time unit 10 context switch from o algorithm is
and at time unit 30 context switch from P1 P2 P3 P2 P4
o
0 20 30 40 55 70
8. [Ans. C]
If the time used in RR scheduling is more
Turn around time for P0 = 12 0=12
than the maximum time required to
Turn around time for P1 =13 0 = 13
execute any process. Then the policy will
Turn around time for P2 = 14 0 = 14
degenerate to first come first serve
∴ Average urnaround ime = =
9. [Ans. D]
4. [Ans. B] All three options are correct
Process Burst I/O CPU I/O
Time Time Time Time
P1 10 2 7 1
P2 20 4 14 2
P3 30 6 21 3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 191
GATE QUESTION BANK Operating System
0 3 5 8 12 15 21
Turn around line of (A) = (8 – 0) = 8 P2[4] P4[5] P4[5] P1[10]
Turn around line of (B) = (5 – 3) = 2 P1[10] P3[4] P1[10]
P1 [10]
Turn around line of (C) = (12 – 5) = 7
P3[6]
Turn around line of (D) = (21 – 7) = 14 P2[3]
Turn around line of (E) = (15 – 10) = 5 P1 [10]
Average urn around ime
= = 7.2
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 192
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 193
GATE QUESTION BANK Operating System
Deadlocks
CS – 2005 (A) min (xp, xq) < maxkp,q yk
1. Suppose n processes, P1, ……, Pn share m (B) xp + xq minkp, qyk
identical resource units, which can be (C) max ( xp, xq) < 1
reserved and released one at time. The (D) min ( xp, xq) > 1
maximum resource requirement of
process Pi is si, where si > 0. Which one of CS - 2007
the following is a sufficient condition for 4. A single processor system has three
ensuring that deadlock does not occur? resource types X, Y and Z, which are
(A) i, si < m shared by three processes. There are 5
(B) i, si < n units of each resource type. Consider the
(C) ∑ following scenario, where the column
(D) ∑ alloc denotes the number of units of each
resource type allocated to each process
2. Two shared resource R1 and R2 are used and the column request denotes the
by processes P1 and P2. Each process has number of units of each resource type
a certain priority for accessing each requested by a process in order to
resource. Let Tij denote the priority of complete execution. Which of the
for accessing Rj. A process Pi can snatch processes will finish LAST?
a resource Rh from process if Tik is alloc request
greater than Tjk. X Y Z X Y Z
Given the following: P0 1 2 1 1 0 3
I. T11 > T21 P1 2 0 1 0 1 2
II. T12 > T22 P2 2 2 1 1 2 0
III. T11 < T21 (A) P0
IV. T12 < T22 (B) P1
Which of the following conditions ensures (C) P2
that P1 and P2 can never deadlock? (D) None of the above, since the system
(A) I and IV is in a deadlock
(B) II and III
(C) I and II CS - 2008
(D) None of the above 5. The following is a code with two threads,
producer and consumer, that can run in
CS – 2006 parallel. Further, S and Q are binary
3. Consider the following snapshot of a semaphores equipped with the standard
P and V Operations.
system running n processes. Process i is
Semaphore S = 1, Q = 0 ;
holding xi instances of a resource R, for integer x ;
1 i n. Currently all instances of R are producer: consumer:
occupied. Further, for all i, process i has while (true) do while (true) do
placed a request for an additional yi P(S) ; P(Q) ;
instances while holding the instances it x = produce ( ) ; consume (x) ;
V(Q) ; V(S) ;
already has. There are exactly two
done done
processes p and q such that yp = yq = 0. Which of the following is true about the
Which one of the following can serve as a program above?
necessary condition to guarantee that the (A) The process can deadlock
system is not approaching a deadlock? (B) One of the threads can starve
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 194
GATE QUESTION BANK Operating System
(C) Some of the items produced by the initialized to 0. Now consider the
producer may be lost following statements
(D) Values generated and stored in ‘ ’ by I. The above solution to CS problem is
the producer will always be
deadlock-free
consumed before the producer can
generate a new value II. The solution is starvation free
III. The processes enter CS in FIFO order
6. Which of the following is NOT true of IV. More than one process can enter CS
deadlock prevention and deadlock at the same time
avoidance schemes?
Which of the above statements are TRUE?
(A) In deadlock prevention, the request
for resources is always granted if the (A) I only (C) II and III
resulting state is safe. (B) I and II (D) IV only
(B) In deadlock avoidance, the request 9. Consider a system with 4 types of
for resources is always granted if the resources R1 (3 units), R2 (2 units),
resulting state is safe. R3 (3 units), R4 (2 units).
(C) Deadlock avoidance is less restrictive A non-preemptive resource allocation
than deadlock prevention policy is used. At any given instance, a
(D) Deadlock avoidance requires request is not entertained if it cannot be
knowledge of resource requirements completely satisfied. Three processes
a priori P1,P2,P3 request the resources as follows if
7. An operating system implements a executed independently.
policy that requires a process to
units of R1
unit of R4
t = 0 : requests 1
t = 2 : requests 2
t = 7 : requests 1
release all resources before making a
t = 8 :requests 1
Process P3 :
units of R1
t = 5:releases 2
unit of R2
unit of R3
t = 9 : Finishes
request for another resource . Select the
TRUE statement from the following:
(A) Both starvation and deadlock can
occur.
(B) Starvation can occur but deadlock
cannot occur.
units of R3
unit of R4
unit of R1
unit of R3
t = 0 : requests 2
t = 2 : requests 1
t = 4 : requests 1
t = 8 : Finishes
can occur.
(D) Neither starvation nor deadlock can
occur
CS - 2009
8. The enter_CS( ) and leave_CS( ) functions
t = 8 : requests 2
and 1 unit of
units of R2
unit of R3
t = 1 : requests 1
t = 3 : requests 2
units of R1
t = 5 : releases 1
t = 7 : releases 1
Process P1 :
unit of R2
unit of R3
t = 10: Finishes
as follows:
R1
void enter_CS ( X)
{
while (test-and-set (X)) Which one of the following statements is
} TRUE if all three processes run
void leave_CS (X) concurrently starting at time t = 0?
{ (A) All processes will finish without any
X = 0; deadlock
(B) Only P1 and P2 will be in a deadlock
}
(C) Only P1 and P3 will be in deadlock
In the above solution, X is a memory
(D) All three processes will be in deadlock
location associated with the CS and is
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 195
GATE QUESTION BANK Operating System
CS - 2010 CS – 2014
10. A system has n resources , .. 12. An operating system uses the Banker’s
and k processes , .. . The algorithm for deadlock avoidance when
implementation of the resource request managing the allocation of three resource
types X, Y and Z to three processes P0, P1,
logic of each process , is as follows:
and P2. The table given below presents
if ( i % 2 = = 0) { the current system state. Here, the
if ( i <n) request ; Allocation matrix shows the current
if ( i + 2 < n)request ;} number of resources of each type
else { allocated to each process and the Max
if ( i <n) request ; matrix shows the maximum number of
if ( i + 2<n) request ; resources of each type required by each
process during its execution.
}
In which one of the following situations is Allocation Max
a deadlock possible? X Y Z X Y Z
(A) n = 40, k = 26 P0 0 0 1 8 4 3
(B) n = 21, k = 12 P1 3 2 0 6 2 0
(C) n = 20, k = 10 P2 2 1 1 3 3 3
(D) n = 41, k = 19 There are 3 units of type X, 2 units of type
Y and 2 units of type Z still available. The
CS - 2013 system is currently in a safe state.
11. Three concurrent processes X, Y and Z Consider the following independent
execute three different code segments requests for additional resources in the
that access and update certain shared current state:
variables. Process X execute the REQ1: P0 requests 0 units of X, 0 units of
P operation (i.e., wait) on semaphores a, b Y and 2 units of Z
and c; process Y executes the P operation REQ2: P1 requests 2 units of X, 0 units of
on semaphores b, c and d; process Z Y and 0 units of Z
executes the P operation on semaphores Which one of the following is TRUE?
c, d and a before entering the respective (A) Only REQ1 can be permitted.
code segments. After completing the (B) Only REQ2 can be permitted.
execution of its code segments, each (C) Both REQ1 and REQ2 can be
process invokes the V operation (i.e., permitted.
signal) on its three semaphores. All (D) Neither REQ1 nor REQ2 can be
semaphores are binary semaphores permitted.
initialized to one. Which one of the
following represents a deadlock – free 13. A system contains three programs and
order of invoking the P operations by the each requires three tape units for its
processes? operation. The minimum number of tape
(A) X: P(a)P(b)P(c) units which the system must have such
Y: P(b)P(c)P(d) that deadlocks never arise is ____.
Z: P(c)P(d)P(a)
(B) X: P(b)P(a)P(c)
Y: P(b)P(c)P(d)
Z: P(a)P(c)P(d)
(C) X: P(b)P(a)P(c)
Y: P(c)P(b)P(d)
Z: P(a)P(c)P(d)
(D) X: P(a)P(b)P(c)
Y: P(c)P(b)P(d)
Z: P(c)P(d)P(a)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 196
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 197
GATE QUESTION BANK Operating System
9. [Ans. A]
Initially available resources
R1 R2 R3 R4
3 3 3 2
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 198
GATE QUESTION BANK Operating System
11. [Ans. B]
Suppose X performs P(b) and preempts, Y
gets chance, but cannot do its first wait
i.e., so waits for X, now Z gets the chance
and performs P(a) and preempts, next X
get chance. X cannot continue as wait on
‘a’ is done by Z already, so X aits for Z. At
this time Z can continue its operations as
down on c and d. Once Z finishes, X can do
its operations and so Y. In any of
execution order of X, Y, Z one process can
continue and finish, such that waiting is
not circular. In option (A), (C) and (D) we
can easily find circular wait, thus
deadlock
12. [Ans. B]
Allocation Max Need
X Y Z X Y Z X Y Z
P0 0 0 1 8 4 3 8 4 2
P1 3 2 0 6 2 0 3 0 0
P2 2 1 1 3 3 3 1 2 2
Need = Max – Allocation
Available = [3, 2, 2]
REQ 2 can be permitted because needed
resources by P1 are [3, 0, 0] and after that
there is no any condition for unsafe state.
REQ 1 can not be permitted because P0
and P2 can not be completed in available
resources [3, 2, 2]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 199
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 200
GATE QUESTION BANK Operating System
addresses x to x + 99 are loaded on to 10. Match the following flag bits used in
the memory. the context of virtual memory
How many page faults will occur? management on the left side with the
(A) 0 (C) 7 different purpose on the right side of
(B) 4 (D) 8 the table below.
Name of the bit Purpose
Common Data for Q. 7 & 8 i. Dirty a. Page initialization
A process has been allocated 3 page ii. R / W b. Write–back policy
frames. Assume that none of the pages of
iii. Reference c. Page protection
the process are available in the memory
initially. The process makes the following iv. Valid d. Page replacement
sequence of page references (reference policy
string) : 1, 2, 1, 3, 7, 4, 5, 6, 3, 1. (A) i – d , ii – a , iii – b , iv – c
7. If optimal page replacement policy is (B) i – b , ii - c , iii – a , iv – d
used, how many page faults occur for the (C) i – c , ii – d , iii – a , iv – b
above reference string? (D) i – b , ii – c , iii - d , iv – a
(A) 7 (C) 9 CS - 2009
(B) 8 (D) 10
11. In which one of the following page
8. Least Recently Used (LRU) page replacement policies, Belady’s anomaly may
replacement policy is a practical occur?
approximation to optimal page (A) FIFO (C) LRU
replacement. For the above reference (B) Optimal (D) MRU
string, how many more page faults occur
12. The essential content(s) in each entry of a
with LRU than with the optimal page
page table is/are
replacement policy?
(A) Virtual page number
(A) 0 (C) 2
(B) Page frame number
(B) 1 (D) 3
(C) Both virtual page number and page
CS - 2008 frame number
9. A processor uses 36-bit physical (D) access right information
addresses and 32-bit virtual addresses,
with a page frame size of 4 Kbytes. Each 13. A multilevel page table is preferred in
page table entry is of size 4 bytes. A three comparison to a single level page table for
level page table is used for virtual-to- translating virtual address to physical
physical address translation, where the address because
virtual address is used as follows (A) It reduces the memory access time to
read or write a memory location
bits 30-31 are used to index into the
(B) It helps to reduce the size of page table
first level page table
needed to implement the virtual
bits 21-29 are used to index into the
address space of a process
second level page table
(C) It is required by the translation look a
bits 12-20 are used to index into the
side buffer
third level page table
(D) It helps to reduce the number of page
bits 0-11 are used as offset within faults in page replacement algorithms.
the page
The number of bits required for CS - 2010
addressing the next level page table (or 14. A system uses FIFO policy for page
page frame) in the page table entry of the replacement. It has 4 page frames with no
first, second and third level page table are pages loaded to begin with. The system
respectively first accesses 100 distinct pages in some
(A) 20, 20 & 20 (C) 24, 24 & 20 order and then accesses the same 100
(B) 24, 24 & 24 (D) 25, 25 & 24 pages but now in the reverse order. How
many page faults will occur?
(A) 196 (B) 192 (C) 197 (D) 195
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 201
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 202
GATE QUESTION BANK Operating System
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 203
GATE QUESTION BANK Operating System
M
M
H
M
M
H
HIT
M
H
M
M
M
M
H
12. [Ans. B]
H
H
H
HIT
MISS
MISS
MISS
MISS
Page frame numbers are most important,
virtual page number may not be stored 5 MISS 6 MISS
entirely. LRU
3 3 3 1 1 1 4 4
13. [Ans. B] 2 2 2 2 2 3 3 3 1
Multilevel page table is preferred to 1 1 1 1 4 4 4 2 2 2
M M M H M M M M M M
reduce the size of page table needed to
implement the virtual address space of a
process. So optimal < FIFO < LRU
( ) 2 ns ( ) ns
ns
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 204
GATE QUESTION BANK Operating System
19. [Ans. 7]
1 2 3 4 2 1 5 3 2 4 6
1 1 1 1 1 1 5 3 3 3 3
2 2 2 2 2 2 2 2 2 6
3 4 4 4 4 4 4 4 4
No. of page faults = 7
20. [Ans. 6]
Total frames = 3
LRU page replacement algorithm: Least recently used page has to be replaced
4 7 6 1 7 6 1 2 7 2
4 4 4 1 1 1
7 7 7 2 2
6 6 6 7
Total no. of page faults = 6
Effective Access Time [EAT] = 0.6 (10 + 80) + 0.4 (10 + 80 + 80)
= 54 + 68
= 122 milliseconds
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 205
GATE QUESTION BANK Operating System
Page
numbered
, 2, …2 in
main
Memory Page : 21 Page : 22 Page : 23 Page : 24
occupying
20 Free
Frames
101 1 101 1 101 1 101 1 101 1
102 2 102 2 102 2 102 2 102 2
103 3 103 3 103 3 103 3 103 3
104 4 104 4 104 4 104 4 104 4
105 5 105 5 105 5 105 5 105 5
106 6 106 6 106 6 106 6 106 6
107 7 107 7 107 7 107 7 107 7
108 8 108 8 108 8 108 8 108 8
109 9 109 9 109 9 109 9 109 9
110 10 110 10 110 10 110 10 110 10
111 11 111 11 111 11 111 11 111 11
112 12 112 12 112 12 112 12 112 12
113 13 113 13 113 13 113 13 113 13
114 14 114 14 114 14 114 14 114 14
115 15 115 15 115 15 115 15 115 15
116 16 116 16 116 16 116 16 116 16
117 17 117 17 117 17 117 17 117 17
118 18 118 18 118 18 118 18 118 18
119 19 119 19 119 19 119 19 119 19
120 20 120 21 120 22 120 23 120 24
For every Fault Optimal Algorithm will be selecting the Most Recently Used Page a Replacement.
Both Optimal & Most recently Used will generate same no of Page Faults.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 206
GATE QUESTION BANK Operating System
File System
CS – 2005 CS – 2014
1. In a computer system, four files of size 4. A FAT (file allocation table) based file
11050 bytes, 4990 bytes, 5170 bytes and system is being used and the total
12640 bytes need to be stored. For overhead of each entry in the FAT is 4
storing these files on disk, we can use bytes in size. Given a bytes
either 100 byte disk blocks or 200 byte disk on which the file system is stored
disk blocks (but can‘t mix block sizes). and data block size is bytes, the
For each block used to store a file, 4 bytes maximum size of a file that can be stored
of bookkeeping information also needs to on this disk in units of bytes is
be stored on the disk. Thus, the total ____________.
space used to store a file is the sum of the
space taken to store the file and the space
taken to store the bookkeeping
information for the blocks allocated for
storing the file. A disk block can store
either bookkeeping information for a file
or data from a file, but not both. What is
the total space required for storing the
files using 100 byte disk blocks and 200
byte disk blocks respectively?
(A) 35400 and 35800 bytes
(B) 35800 and 35400 bytes
(C) 35600 and 35400 bytes
(D) 35400 and 35600 bytes
CS - 2008
2. The data block of a very large file in the
Unix file system are allocated using
(A) Contiguous allocation
(B) Linked allocation
(C) Indexed allocation
(D) An extension of indexed allocation
CS – 2012
3. A file system with 300 Gbyte disk uses a
file descriptor with 8 direct block
addresses, 1 indirect block address and 1
doubly indirect block address. The size of
each disk block is 128 Bytes and the size
of each disk block address is 8Bytes. The
maximum possible file size in this file
system is
(A) 3 Kbytes
(B) 35 Kbytes
(C) 280 Bytes
(D) Dependent on the size of the disk
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 207
GATE QUESTION BANK Operating System
2. [Ans. D]
The data blocks of a very large file in the
unix file system are allocated using an
extension of indexed allocation or EXT2
file system.
3. [Ans. B]
Maximum possible size =
add ess pointed b doubl indi ect block)
add ess pointed b single add ess)
add ess pointed b single di ect add ess)
block size
[( ) ( ) ]
k k k
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 208
GATE QUESTION BANK Operating System
I/O System
CS - 2009 CS - 2013
1. Consider a disk system with 100 3. Consider a hard disk with 16 recording
cylinders. The requests to access the surfaces (0-15) having 16384 cylinders
cylinders occur in the following sequence: (0-16383) and each cylinder contains 64
4, 34, 10, 7, 19, 73, 2, 15, 6, 20 sectors (0-63). Data storage capacity in
Assuming that the head is currently at each sector is 512 bytes. Data are
cylinder 50, what is the time taken to organized cylinder – wise and the
satisfy all requests if it takes 1 ms to move addressing format is <cylinder no.,
from one cylinder to adjacent one and surface no., sector no>. A file of size
shortest seek time first policy is used? 42797 KB is stored in the disk and the
(A) 95 ms (C) 233 ms starting disk location of the file is
(B) 119 ms (D) 276 ms < 1200, 9, 40>. What is the cylinder
CS - 2011 number of the last sector of the file, if it is
2. An application loads 100 libraries at stored in a contiguous manner?
startup. Loading each library requires (A) 1281 (C) 1283
exactly one disk access. The seek time of (B) 1282 (D) 1284
the disk to a random location is given as
10 ms. Rotational speed of disk is
6000rpm. If all 100 libraries are loaded
from random locations on the disk, how
long does it take to load all libraries? (The
time to transfer data from the disk block
once the head has been positioned at the
start of the block may be neglected.)
(A) 0.50 s (C) 1.25 s
(B) 1.50 s (D) 1.00 s
Total moves = 16 + 14 + 1 + 4 + 5 + 3
+1 + 2 + 2 + 71
= 119
So for each move time taken = 1ms
So for 119 moves time =119 ms
2. [Ans. B]
Rotation speed = 6000 rpm
Seek time = 10 ms
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 209
GATE QUESTION BANK Operating System
3. [Ans. D]
Each surface contains = 64 sectors
Each cylinder contains = 64
sectors
42797 KB =
Current cylinder 1200, can have
24+(6 64) = 408 sectors more for this
file
Remaining sectors = 85186
No. of sectors in one cylinder = 1024
So, to store remaining sectors cylinders
needed
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 210
GATE QUESTION BANK TOC
Finite Automata
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 211
GATE QUESTION BANK TOC
CS – 2009 CS – 2011
6. Given the following state table of an FSM 9. Definition of a language L with alphabet
with two states A and B, one input and {a} is given as following
one output: L={ k n n is positiv int g r
Present Present Input Next Next Out constant}
State A State B State State put What is the minimum number of states
A B
needed in a DFA to recognize L?
0 0 0 0 0 1
(A) k + 1 (C) 2n+1
0 1 0 1 0 0
(B) n + 1 (D) 2k+1
1 0 0 0 1 0
1 1 0 1 0 0 10. A deterministic finite automaton (DFA) D
0 0 1 0 1 0 with alphabet ∑ {a,b} is given below:
0 1 1 0 0 1
1 0 1 0 1 1 p q r
1 1 1 0 0 1
If the initial state is A = 0, B = 0, what is
the minimum length of an input string
which will take the machine to the state
A = 0, B = 1 with Output = 1? t
(A) 3 (C) 5
Which of the following finite state
(B) 4 (D) 6
machines is a valid minimal DFA which
accepts the same language as D?
7. The following DFA accepts the set of all
strings over {0,1} that
1
1 0 p q r
0 0
1
(A) Begin either with 0 or 1 s
(B) end with 0
(C) end with 00
(D) contain the substring 00 s
CS – 2010
8. Let w be any string of length n in {0, 1}*. p q r
Let L be the set of all substrings of w.
What is the minimum number of states in
a non-deterministic finite automaton that
accepts L?
(A) n 1 (C) n+1
(B) n (D) 2 p q r
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 212
GATE QUESTION BANK TOC
1
1
1 q 1
s
1 1 1
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 213
GATE QUESTION BANK TOC
CS – 2013 CS – 2014
15. Consider the DFA A given below. 16. Consider the finite automaton in the
1 following figure
1 1
1 1 1
1 q
q q q
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 214
GATE QUESTION BANK TOC
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 215
GATE QUESTION BANK TOC
15. [Ans. D]
1. Complement of L(A) is context – free
– True
As there exist a DFA , L(A) is regular.
Regular languages are closed under
complement
∴Complement of L(A) is regular and
therefore context free.
2. L(A)= L((11*0+0)(0+1)*0*1*) –
True
As L(A)=L((11*0+0)(0+1)*) is
equivalent to
L((11*0+0)(0+1)*0*1*).
3. For the language accepted by A, A is
minimal DFA – False
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 216
GATE QUESTION BANK TOC
Regular Expression
CS – 2005 CS – 2007
1. Which of the following statements is 6. Which of the following languages is
TRUE about the regular expression 01*0? regular?
(A) It represents a finite set of finite (A) *ww w * + +
strings. (B) *ww x x w * + +
(B) It represents an infinite set of finite (C) *wxw x w * + +
strings. (D) *xww x w * + +
(C) It represents a finite set of infinite
strings. Common Data for Q.7 & Q.8
(D) It represents an infinite set of infinite Consider the following Finite state
strings. Automation
2. The language * n + is q3
b
b
(A) Regular a b
(B) context free but not regular a
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 217
GATE QUESTION BANK TOC
CS – 2008 Q. 1
10. Given below are two finite state automata
( indicates the start state and F 0
1
indicates a final state) 0
0
Y: Z:
a b a b
1 2 2 2
2(F) 2 1 2(F) 1 1
R. 1
Which of the following represents the
product automaton Z Y? 0
(A) 1
1
a b 0
P S R
Q R S
R(F) Q P
S Q P
(B) S.
1
a b
P S Q 0
1
Q R S 1
0
R(F) Q P
S P Q
(C)
a b
. ε + ( * + )* *
P Q S
. ε + ( * + )*
Q R S
3. ε + ( * + )*
R(F) Q P
4. ε + ( * + )* *
S Q P
(A) P–2, Q-1, R-3, S-4
(D)
(B) P-1. Q-3, R-2, S-4
a b
(C) P-1, Q-2, R-3, S-4
P S Q (D) P-3, Q-2, R-1, S-4
Q S R
R(F) Q P 12. Which of the following are regular sets?
S Q P 1. { n 0, m 0 }
2. { n=2m}
11. Match the following NFAs with the
3. { n m}
regular expressions they correspond to.
4. * x y x y є * +*+
P. 1 (A) 1 and 4 only (C) 1 only
1 (B) 1 and 3 only (D) 4 only
0
0 0
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 218
GATE QUESTION BANK TOC
CS -2012
0,1 0,1 17. Given the language L = {ab, aa, baa},
which of the following strings are in L*?
1 1 1. abaabaaabaa
2. aaaabaaaa
3. baaaaabaaaab
Which one of the following is TRUE? 4. baaaaabaa
(A) (C) L1 (A) 1, 2 and 3 (C) 1, 2 and 4
(B) (D) L1 (B) 2, 3 and 4 (D) 1, 3 and 4
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 219
GATE QUESTION BANK TOC
(C) Both L and are r.e. but not 25. Let A B denotes that language A is
recursive. mapping reducible (also known as many-
(D) Both L and are recursive. to-one reducible) to language B. Which
one of the following is FALSE?
21. Which of the regular expressions given (A) If A B and B is recursive then A is
below represent the following DFA? recursive.
0 0 1
(B) If A B and A is undecidable then B
is undecidable.
(C) If A B and B is recursively
enumerable then A is recursively
enumerable.
1 (D) If A B and B is not recursively
enumerable then A is not recursively
I) 0*1(1 + 00* 1)*
enumerable.
II) 0*1* 1+ 11* 0* 1
III) (0 + 1)* 1
(A) I and II only (C) II and III only
(B) I and III only (D) I, II and III
22. If = * n + n * n +,
consider
(I) is regul r l ngu ge
(II) * n +
Which one of the following is CORRECT?
(A) Only (I)
(B) Only (II)
(C) Both (I) and (II)
(D) Neither (I) nor (II)
23. Let *w * +* w h s t le st s
m ny o urren es of ( )’s s ( )’s+.
et *w * + w has at least as
m ny o urren es of ( )’s s ( )’s+.
Which one of the following is TRUE?
(A) is regular but not
(B) is regular but not
(C) Both and are regular
(D) Neither nor are regular
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 220
GATE QUESTION BANK TOC
5. [Ans. C]
9. [Ans. B]
6. [Ans. C] (A) is false. Consider L = {w | where w is
A B D n’t etermine the en of w n in {a, b} *} and L1 = {anbn| where
start of w . n > = 0};
If language is regular then an FA Clearly is a subset of L and L1 is not a
definitely exists for it. Let us try to design regular.
FA for each option. No FA can remember (B) is true; since all finite sets are regular.
(C) is false; consider non-regular set
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 221
GATE QUESTION BANK TOC
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 222
GATE QUESTION BANK TOC
20. [Ans. C]
Because if both L and are recursive
enumerable then L is recursive.
So option (C) is not possible
21. [Ans. B]
Option II will not accept 10101 but it is
accepted by given DFA. So regular
expression II does not represent the given
DFA
R.E I & III do
22. [Ans. A]
. is concatenation of languages and it
is regular
. is not* n +
23. [Ans. D]
None of the languages are regular because
both need counting and DFA lacks
memory element.
24. [Ans. 3]
R.E = a * b *(ba)* a *
Length 0 is present as it accepts , all
length of 1 string are present (a, b) also
n re present ut ‘ ’ is
not present. So it is 3
25. [Ans. D]
If A B and B is not recursively
enumerable then A will surely be not
recursively enumerable.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 223
GATE QUESTION BANK TOC
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 224
GATE QUESTION BANK TOC
1. [Ans. A] 3. [Ans. D]
and are both context free languages. : Non-Deterministic finite automata.
Context free languages are not closed : Non-Deterministic push-down
under intersection. automata.
D : Deterministic finite automata.
2. [Ans. D] D : Deterministic push down automata.
The complement of CFL need not be a A ording to “Su set Constru tion”
CFL. theorem every language accepted by Non-
[A] is false; Let us consider Mc as a CFL, deterministic-finite automata. ( ) is also
now remember not every CFL is regular. accepted by some Deterministic-Finite
Therefore it is not necessary that union is automata (D ) so D = .
regular. Deterministic push-down automata (D )
[B] is false; as we know complement may
recognizes a proper subset of the
not CFL. Thus union over non-CFL with
language of context-free languages and
regular will result into non-CFL.
the non-deterministic push down
[C] is false; it is not necessarily as argued
automata recognizes the context-free
in previously.
languages.
Thus [D] is most appropriate choice
So D
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 226
GATE QUESTION BANK TOC
6. [Ans. D] 1 0
* nm + is context free
(first n+m ’s re pushed into the st k
0, 1
then for each of the 1s and 0s following,
we will pop the 0s in the stack one by one
until at the end of the word. If the stack is 8. [Ans. B]
empty then the word is accepted). G *S → SS S → S→ S→ }
* nm + is not 1. “G is m iguous” is true sin e “ ”
context free, since two comparisons have has infinite number of derivations
to be made here to determine if w . some of which are shown below:
. s nd s are equal
2. Since m <n+m, we have to ensure that,
’s whi h ome fter are less
in number, compared to n+m.
* nm +is clearly
context sensitive since 2 comparisons
have to be made. Infact this language is
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 227
GATE QUESTION BANK TOC
11. [Ans. B]
ε ε * 2 i } is a DCFL since, a DPDA can
ept this l ngu ge. ’s re pushed into
2. “G produ es ll strings with equ l the stack and then when 2 appears in
num er of ’s nd ’s” is f lse sin e input, state is changed and immediately
L(G) = (ab + ba)* and this language after that for every 1, a zero is popped out
cannot produce all strings with equal of the stack. In the end, if stack has start
num er of ’s nd ’s. For ex mple stack symbol only, then the string is
aabb h s equ l num er of ’s nd ’s accepted, else it is rejected. Since every
ut ∉ (G). DCFL is recursive, we can say that the
3. “G n e epted y DPDA” is language is recursive, and is a DCFL.
true, since L(G) = (ab + ba)* and this
is a regular language, since we have 12. [Ans. D]
written a regular expression for it. There is a theorem which states that
Since every regular language is also a whenever L and are both RE, then both
DCFL, a DPDA exists, which accepts will be REC.
this language.
13. [Ans. B]
9. [Ans. D] S→ S S is the grammar
There is a DFA corresponding to corresponding to all odd length
d(s) mod 5 = 2 as well as d(s) mod 7 = 4. palindromes.
Therefore, both of them are regular Notice that choice (C)is not correct since
languages. Let they be and . The "abaa" is a string that begins and ends
given language is . with the same symbol but cannot be
Since regular languages are closed under generated by above grammar.
intersection and complementation, the Since all strings generates by this
given language is also regular. grammar have odd length, choices (A)
and (D) are also incorrect.
10. [Ans. B]
Given be regular, is DCFL and is 14. [Ans. D]
RE but not REC. The set of DCF ’s re proper su l ss of
A. “ is DCF ” is true sin e DCF ’s the set of CF ’s of PDA’s. So, choice (D)
are closed under regular intersection. is false.
B. “ is re ursive” is f lse sin e is
RE but not REC and therefore 15. [Ans. C]
is surely RE according to closure of RE * m n 0}
under regular intersection, but we { |i j k +
cannot be sure that is REC. L=
C. “ is CF ” is true sin e is is context free language and ia
DCFL and hence a CFL and is regular language, as intesection of and
regul r. Therefore y losure of CF ’s
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 228
GATE QUESTION BANK TOC
17. [Ans. B]
L2 and L3 are recusively enumerable
languages, r.e. languages are closed under
intersection and union. So, option (C) and
(D) are not correct. All recursive
languages are also recursive languages.
So, L2-L1 must be recusively enumerable.
So, Option (A) is not correct.
18. [Ans. D]
* pqr + regular
language
* pqr p r+ CFL
A. is CFL : True
B. is context free : True because
CFL is closed on regular intersection.
C. Complement of is recursive : true,
because CFL is not closed under
complement. Any language which is
CFL is also REC and complement of
REC is REC so it is true.
D. Complement of is context free but
not regular : false because regular
language are closed under
complement.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 229
GATE QUESTION BANK TOC
Turing Machines
CS – 2005 (C) DHAM3 is NP-hard, but SHAM3 is not
1. Consider three decision problems (D) Neither DHAM3 nor SHAM3 is
n . It is known that is NP-hard
decidable and is undecidable. Which
one of the following is TRUE? CS – 2007
(A) is decidable if is reducible to 5. Which of the following problems is
(B) is undecidable if is reducible to undecidable?
(A) Membership problem for CFGs
(C) is undecidable if is reducible to (B) Ambiguity problem for CFGs
(C) Finiteness problems for FSAs
(D) is decidable if is reducible to (D) Equivalence problem for FSAs
’s complement
CS – 2008
2. Consider the following two problems on 6. Which of the following is true for the
undirected graphs language {ap| p is a prime} ?
: Given G (V, E), does G have an (A) It is not accepted by a Turning
in epen ent set of size ∣V∣ 4? Machine
: Given G (V, E), does G have an (B) It is regular but not context-free
independent set of size 5? (C) It is context-free but not regular
Which one of the following is TRUE? (D) It is neither regular nor context-free,
(A) is in the P and is NP-complete but accepted by a Turning Machine
(B) is NP-complete and is in P
(C) Both and are NP-complete 7. Which of the following are decidable?
(D) Both and are in P 1. Whether the intersection of two
regular languages is infinite
CS – 2006 2. Whether a given context – free
3. Let S be an NP –complete problem and Q language is regular
and R be two other problems not known 3. Whether two push –down automata
to be in NP. Q is polynomial-time accept the same language
reducible to S and S is polynomial-time 4. Whether a given grammar is context
reducible to R. Which one of the following – free
statements is true? (A) 1 and 2 (C) 2 and 3
(A) R is NP-complete (B) 1 and 4 (D) 2 and 4
(B) R is NP-hard
8. Which of the following statement is false?
(C) Q is NP-complete
(A) Every NFA can be converted to an
(D) Q is NP-hard
equivalent DFA
(B) Every non –deterministic Turing
4. Let SHAM3 be the problem of finding a
machine can be converted to an
Hamiltonian cycle in a graph G = (V,E)
equivalent deterministic Turing
with |V| divisible by 3 and DHAM3 be the
machine
problem of determining if a Hamiltonian
(C) Every regular language is also a
cycle exists in such graphs. Which one of
context –free language
the following is true?
(D) Every subset of a recursively
(A) Both DHAM3 and SHAM3 are NP-hard
enumerable set is recursive
(B) SHAM3 is NP-hard, but DHAM3 is not
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 230
GATE QUESTION BANK TOC
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 231
GATE QUESTION BANK TOC
14. Assuming ≠ N which of the following 18. Which one of the following problems is
is TRUE? undecidable?
(A) NP-complete = NP (A) Deciding if a given context-free
(B) NP-complete ∩ ∅ grammar is ambiguous.
(C) NP-hard = NP (B) Deciding if a given string is
(D) P = NP-complete generated by a given context-free
grammar.
CS – 2013 (C) Deciding if the language generated
15. Which of the following statement is/are by a given context-free grammar is
FALSE? empty.
1. For every non – deterministic Turing (D) Deciding if the language generated
machine, there exists an equivalent by a given context-free grammar is
deterministic Turning machine. finite.
2. Turing recognizable languages are
closed under union and
complementation
3. Turing decidable languages are
closed under intersection and
complementation
4. Turing recognizable languages are
closed under union and intersection
(A) 1 and 4 (C) 2 only
(B) 1 and 3 (D) 3 only
CS – 2014
17. Let <M> be the encoding of a Turing
machine as a string over ∑ = {0,1}. Let
L = {<M>| M is a Turing machine that
accepts a string of length 2014}. Then, L is
(A) decidable and recursively enumerable
(B) undecidable but recursively enumerable
(C) undecidable and not recursively
enumerable
(D) decidable but not recursively
enumerable
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 232
GATE QUESTION BANK TOC
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 233
GATE QUESTION BANK TOC
7. [Ans. B] S
1. “Intersection of two regul r
l ngu ges is infinite” is eci le
since we can construct a product A B
DFA of the 2 given DFA’s and then,
using the algorithm to check
finiteness or infiniteness on this
a C D
DFA’s, we can solve the problem.
2. “Whether given CF is regul r” is
undecidable.
3. “Whether two PDA’s ccept the s me c d
l ngu ge” is un eci le since
equiv lence of CF ’s is un ecidable.
10. [Ans. C]
4. “Whether given gr mmar is context
In *w c w | w ∈ ( | )*+ leftmost w is the
– free” is eci le since we c n
identifier checking and rightmost w is the
easily check using a TM, whether the
use of w.
LHS of every production has a single
In c the actual parameters are
variable and, then it is a CFG, else it is
and and the formal parameters and c
not a CFG.
and such that the number of
∴ n re eci le
arguments of a and b are equal to c and d
respectively.
8. [Ans. D]
The gr mm r *X X X|XcX| Xf|g+
(A) True
generates the arithmetic expressions with
(B) True
matched pair of parentheses.
(C) True
The gr mm r *X X |cXc|ε} generates
(D) Every subset of a recursively
the palindromic string.
enumerable set is recursive, is false,
since a set is a subset of itself and
11. [Ans. C]
there are RE languages, which are
is not context free. (It fails to satisfy
not recursive.
pumping lemma for context free
languages.) One can also infer the answer
9. [Ans. C]
by observing that options A, B and D
1. True
which are true.
2. All ε - productions can be removed
from only context free grammars
12. [Ans. B]
th t pro uce λ – free CF ’s
DFA ≡ NFA
If λ ε L(G), then all ε - productions D DA ≠ N DA
cannot be successfully removed. So 2 DT ≡ NT
is false ingle t pe T ≡ ulti-tape TM
3. True
4. True, since is Chomsky normal form, 13. [Ans. D]
every production is of the form of If L is regular, ̅ is surely regular.
So statement number (3) is trivially
A BC or A
decidable.
An example of a binary tree generated by
Also if L is recursive, ̅ is also surely
CNF derivation is shown below: recursive. So statement number (4) is
also trivially decidable.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 234
GATE QUESTION BANK TOC
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 235
GATE QUESTION BANK Computer Organization
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 236
GATE QUESTION BANK Computer Organization
Memory Hierarchy
CS – 2005 6. A computer system has a level 1
1. What is the swap space in the disk used instruction cache (I cache), a level 1
for? data cache (D-cache) and a level 2
(A) Saving temporary html pages cache (L2 – cache) with the following
(B) Saving process data specifications:
(C) Storing the super-block Capacity Mapping Block
(D) Storing device drivers method size
I- 4K Direct 4
2. Increasing the RAM of a computer
cache words mapping words
typically improves performance because
D- 4K 2-way set- 4
(A) Virtual memory increases
cache words associative words
(B) Larger RAMs are faster
mapping
(C) Fewer page faults occur
L2- 64K 4-way set- 16
(D) Fewer segmentation faults occur
cache words associative words
3. Consider a direct mapped cache of size mapping
32KB with block size 32 bytes. The CPU The length of the physical address of a
generates 32 bit addresses. The number word in the main memory is 30 bits. The
of bits needed for cache indexing and the capacity of the tag memory in the
number of tag bits are respectively I-cache, D-cache and L2-cache is,
(A) 10, 17 (C) 15, 17 respectively,
(B) 10, 22 (D) 5, 17 (A) 1 K×18-bit, 1K ×19-bit, 4K×16-bit
(B) 1K ×16-bit, 1K × 19-bit, 4K×18-bit
4. Consider a 2-way set associative cache
(C) 1K ×16-bit, 512×18-bit, 1K×16-bit
memory with 4 sets and total 8 cache
(D) 1K ×18-bit, 512 ×18-bit, 1K ×18-bit
blocks (0-7) and a main memory with
128 blocks (0-127). What memory
7. A CPU has a cache with block size
blocks will be present in the cache after
64 bytes. The main memory has k banks,
the following sequence of memory block
each bank being c bytes wide.
references if LRU policy is used for cache
Consecutive c-byte chunks are mapped
block replacement. Assuming that
on consecutive banks with warp-around.
initially the cache did not have any
All the k banks can be accessed in
memory block from the current job?
parallel, but two accesses to the same
0 5 3 9 7 0 16 55
bank must be serialized. A cache block
(A) 0 3 5 7 16 55
(B) 0 3 5 7 9 16 55 access may involve multiple iterations of
(C) 0 5 7 9 16 55 parallel bank accesses depending on the
(D) 3 5 7 9 16 55 amount of data obtained by accessing all
the k banks in parallel. Each iteration
CS – 2006
requires decoding the bank numbers to
5. A cache line is 64 bytes. The main
be accessed in parallel and this takes
memory has latency 32ns and
k/2 ns. The latency of one bank access is
bandwidth 1GBytes/s. The time required
80 ns. If c = 2 and k = 24, then latency of
to fetch the entire cache line from the
retrieving a cache block starting at
main memory is
address zero from main memory is
(A) 32 ns (C) 96 ns
(A) 92 ns (C) 172 ns
(B) 64 ns (D) 128 ns
(B) 104 ns (D) 184 ns
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 237
GATE QUESTION BANK Computer Organization
P1 and P2 are executed independently 14. How many data cache misses will occur
with the same initial state, namely, the in total?
array A is not in the cache and i, j, x are (A) 48 (C) 56
in registers. Let the number of cache (B) 50 (D) 59
misses experienced by P1 be and
that for P2 be
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 238
GATE QUESTION BANK Computer Organization
15. Which of the following lines of the data 3. The associativity of L2 must be
cache will be replaced by new blocks in greater than that of L1
accessing the array for the second time? 4. The L2 cache must be at least as
(A) line 4 to line 11 large as the L1 cache
(B) line 4 to line 12 (A) 4 only
(C) line 0 to line 7 (B) 1 and 4 only
(D) line 0 to line 8 (C) 1, 3 and 4 only
(D) 1, 2, 3 and 4
16. Consider a 4-way set associative cache
consisting of 128 lines with a line size of Common Data For Q.20, Q.21& Q.22
64 words. The CPU generates a 20-bit Consider a machine with a 2-way set
address of a word in main memory. The associative data cache of size 64K bytes
number of bits in the TAG, LINE and and block size 16 bytes.The cache is
WORD fields are respectively managed using 32 bit virtual addresses
(A) 9, 6, 5 (C) 7, 5, 8 and the page size is 4 Kbytes. A program
(B) 7, 7, 6 (D) 9, 5, 6 to be run on this machine begins as
follows:
CS – 2008
double ARR [ ][ ];
17. For a magnetic disk with concentric
int i, j;
circular tracks, the seek latency is not
/* initialize array ARR to 0.0 */
linearly proportional to the seek distance
for (i=0; i 1024;i++)
due to
for (j=0, j 1024; j ++)
(A) Non - uniform distribution of
ARR [i] [j] = 0.0;
requests
The size of double is 8 bytes. Array ARR
(B) Arm starting and stopping inertia
is located in memory starting at the
(C) Higher capacity of tracks on the
beginning of virtual page 0 x FF000 and
periphery of the platter
stored in row major order. The cache is
(D) Use of unfair arm scheduling
initially empty and no pre-fetching is
policies
done. The only data memory references
made by the program are those to array
18. In an instruction execution pipeline , the
ARR.
earliest that the data TLB (Translation
20. The total size of the tags in the cache
Look aside Buffer) can be accessed is
directory is
(A) Before effective address calculation
(A) 32 Kbits (C) 64 Kbits
has started (B) 34 K bits (D) 68 K bits
(B) During effective address calculation
(C) After effective address calculation 21. Which of the following array elements
has completed has the same cache index as ARR [0] [0]?
(D) After data cache lookup has (A) ARR [0] [4] (C) ARR [0][5]
completed (B) ARR [4][0] (D) ARR [5][0]
19. For inclusion to hold between two cache 22. The cache hit ratio for this
level L1 and L2 in a multilevel cache initialization loop is
hierarchy, which of the following are (A) 0% (C) 50%
necessary? (B) 25% (D) 75%
1. L1 must be a write –through cache
2. L2 must be write –through cache
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 239
GATE QUESTION BANK Computer Organization
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 240
GATE QUESTION BANK Computer Organization
information for each cache block The lines in set s are sequenced before
comprising of the following. the lines in set (s+1). The main memory
1 Valid bit blocks are numbered 0 onwards. The
1 Modified bit main memory block numbered j must be
As many bits as the minimum needed mapped to any one of the cache lines
to identify the memory block mapped from
in the cache. (A) (j mod v ) k to (j mod v) k+(k 1)
(B) (j mod v ) to (j mod v) +(k 1)
What is the total size of memory
(C) (j mod k) to (j mod k) +(v 1)
needed at the cache controller to store
(D) (j mod k ) v to (j modk) v+(v 1)
meta-data (tags) for the cache?
(A) 4864 bits (C) 6656 bits
CS - 2014
(B) 6144 bits (D) 5376 bits
35. An access sequence of cache block
addresses is of length N and contains n
CS - 2012
unique block addresses. The number of
Statement for linked Answer Question
unique block addresses between two
31 and 32:
consecutive accesses to the same block
A computer has a 256Kbyte, 4-way set
addresses is bounded above by k. What
associative, write back data cache with is the miss ratio if the access sequence is
block size of 32 Bytes. The processor passed through a cache of associatively
sends 32 bit addresses to the cache A k exercising least – recently – used
controller. Each cache tag directory replacement policy?
entry contains, in addition to address (A) n/N (C) 1/A
tag, 2 valid bits, 1 modified bit and 1 (B) 1/N (D) k/n
replacement bits
31. The number of bits in the tag field of an 36. A 4-way set-associative cache memory
unit with a capacity of 16 kB is built
address is
using a block size of 8 words. The word
(A) 11 (C) 16
(B) 14 (D) 27 length is 32 bits. The size of the physical
address space is 4 GB. The number of
32. The size of the cache tag directory is bits for the TAG field is ________________.
(A) 160 Kbits (C) 40 Kbits
(B) 136 Kbits (D) 32 Kbits 37. In de igning a omputer’ a he y tem
the cache block (or cache line) size is an
CS - 2013 important parameter. Which one of the
33. A RAM chip has a capacity of 1024 words following statements is correct in this
of 8 bits each (1K 8). The number of context?
2 decoders with enable line needed (A) A smaller block size implies better
to construct a 16K 16 RAM from spatial locality
1K RAM is (B) A smaller block size implies a
(A) 4 (C) 6 smaller cache tag and hence lower
(B) 5 (D) 7 cache tag overhead
(C) A smaller block size implies a larger
34. In a k – way set associative cache, the cache tag and hence lower cache hit
cache is divided into v sets, each of which time
consists of k lines. The lines of a set are (D) A smaller block size incurs a lower
placed in sequence one after another. cache miss penalty
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 241
GATE QUESTION BANK Computer Organization
38. If the associativity of a processor cache is modules may overlap in time, but only
doubled while keeping the capacity and one request can be on the bus at any
block size unchanged, which one of the time. The maximum number of stores (of
following is guaranteed to be NOT one word each) that can be initiated in 1
affected? millisecond is ____________
(A) Width of tag comparator
(B) Width of set index decoder 40. The memory access time is
(C) Width of way selection multiplexor 1 nanosecond for a read operation with a
(D) Width of processor to main memory hit in cache, 5 nanoseconds for a read
data bus operation with a miss in cache,
2 nanoseconds for a write operation with
39. Consider a main memory system that a hit in cache and 10 nanoseconds for a
consists of 8 memory modules attached write operation with a miss in cache.
to the system bus, which is one word Execution of a sequence of instructions
wide. When a write request is made, the involves 100 instruction fetch
bus is occupied for 100 nanoseconds operations, 60 memory operand read
(ns) by the data, address, and control operations and 40 memory operand
signals. During the same 100 ns, and for write operations. The cache hit-ratio is
500 ns thereafter, the addressed 0.9. The average memory access time (in
memory module executes one cycle nanoseconds) in executing the sequence
accepting and storing the data. The of instructions is __________.
(internal) operation of different memory
3. [Ans. A] 6. [Ans. A]
Size of cache = 32 KB For I cache: Number of block = 1 k
= 32 bytes 10 bits can be used to distinguish
= yte between blocks
yte it 1 block = 4 Words
Size of tag = 32 – 15 = 17 bits 2 bits to recognize between words
Cache indexing size = 10 bits
30
4. [Ans. C]
Notice here conflict occurs in placement 18 10 2
of block 55
Tag memory
3 is come first and never refuse so in this
set 3 is only victim for replacement Capacity of I – cache = 18 1k
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 242
GATE QUESTION BANK Computer Organization
D – cache: Number of blocks = For the next 15 address, there will be hit
as A [0] [0] to A [0] [15] are there in the
= 1k block
cache.Then again there will be a miss at
10 bits are enough to recognize b/w
A [0] [16] and hit at next 15 accesses.
blocks.
2 bits are required to recognize among & There for every = 16384 blocks
words within a block and it uses 2 way transfer during , there will be one
set mapping miss and 15 hits
19 9 2
Since the # of tags are always same 11. [Ans. B]
= k = 262144 (Because every access to
The size of tag memory is 19 × k array element is a miss)
Capacity of cache = 18 512
7. [Ans. D]
The main memory consists of 24 banks, 12. [Ans. C]
each of c bytes. Since parallel accesses to Size of instruction 24 bits
all banks are possible. Only two parallel Starting address of the program is 300.
accesses of all banks are needed to The size of instruction is 3 bytes long. So
traverse the whole data. the address is always the multiple of 3
For one parallel access, byte next address is 600 it is also the
Total time next instruction of the program
= Decoding time + latency time
= + 80 = 92 ns 13. [Ans. B]
0 8,0,16,24
Hence, for 2 such accesses,
time = 2 92 = 184 ns
1 9,17,25,17,
2 2,18,2,82
8. [Ans. A] 3 3
Tag Set Block 4 20
18 9 5 5 5
h = 6 30
= 2.4 ns 7 63
So, 18 is not present in final map shown
9. [Ans. D] of cache memory
Tag Set Block
17 10 5 14. [Ans. C]
56 data cache misses will occur.
h = 1.7 ns
There are 32 lines in the 50 × 50 array,
Because multiplexer is not required in therefore initial 32 misses + 8 misses
case of direct-mapping (this will replace initial 8 lines data). In
second round initial lines needs to be
10. [Ans. C]
reloaded again so 8 more misses i.e. 48
Cache is 32 KB with 128 bytes block size.
M1: When the first element A[0] [0] is 15. [Ans. A]
accessed , 128 byte block consisting of Line 4 to line 11.
At the last, while accessioning last 8 lines
(33 40) aging initial 8-lines 4-11 of the
Elements is brought into the cache.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 243
GATE QUESTION BANK Computer Organization
23. [Ans. C]
The address < 400, 16, 29> corresponds
So cache must be at least large as the to sector no.
cache is very necessary. Because 400 2 10 63 + 16 63 + 29
and both are write through cache = 505037
this is not the sufficient condition.
24. [Ans. C]
20. [Ans. D]
The address < 0, 16, 31> corresponds to
2 way set associative
sector no. 16 63 + 31 = 1039
Cache memory size = 64 kB
Block size = 16 B
25. [Ans. C]
k
line k Basic RAM = 32k 1
Design RAM = 256k 8
et No. of RAM = = 64
it virtual addre It requires 8 parallel line and in each
32 bits
parallel line 8 parallel lines& in each
TAG SO WO parallel line 8 serial RAM chips are
required.
(
⇓ )
⇓
log ( )
⇓
log ( )
=17 bits = 11 bits it
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 244
GATE QUESTION BANK Computer Organization
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 245
GATE QUESTION BANK Computer Organization
32 38. [Ans. D]
16 11 5 Width of processor to main memory data
Tags So Word bus is independent of cache associativity
offset
No. of Tag bits are 16 bits 39. [Ans. 10000]
For 1 store time required
32. [Ans. A] = 100ns(because of overlape)
Tag directory size = So in 1ns no. of stores =
Number of sets no of tags in each set
(no. of tag bits in each tag + valid bits + In 1 ms no. of stores =
modified bit + replacement bit) = 10000
( ) it
ption i orre t 40. [Ans. 1.68]
Total instructions
33. [Ans. B] = 100 instruction fetch operations
+60 memory operand read operations
At 1st level we need 4 decoders to select
+40 memory operand write operations
16 RAMS. At second level we need
= 200 instructions (operations)
1 decoder to select the 4 decoders of 1st
Time taken for fetching 100 instructions
level.
(equivalent to read)
= 90 × 1 ns + 10 × 5 ns = 140 ns
34. [Ans. A]
Memory operand Read operation
ain memory lo k ‘j’ mapped to any of
time = 90%(60) × 1ns +10%(60)×5 ns
cache line. Cache line range is:
= 54 ns + 30 ns = 84 ms
(j mod v)*k to (j mod v)*k + (k 1)
Memory operand write operation
35. [Ans. A] time = 90% (40)×2 ns+10%(40)×10 ns
As given n N =72 ns + 40 ns = 112 ns
And the miss ratio will not be dependent Total time taken for execution 200
on associativity and k and LRU policy will instructions = 140 + 84 + 112 = 336 ns
lead to n/N n
verage memory a e time
37. [Ans. D]
If a block size is smaller then less no. of
words will be replaced into cache from
main memory. So cache miss penalty will
be less.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 246
GATE QUESTION BANK Computer Organization
Pipeline
CS - 2005 fetching new instructions following a
1. A 5 stage pipelined CPU has the conditional branch until the branch
following sequence of stages: outcome is known. A program executes
IF – Instruction fetch from instruction 10 instructions out of which 20% are
memory, conditional branches. If each instruction
RD – Instruction decode and register takes one cycle to complete on average,
read, then total execution time of the program
EX – Execute: ALU operation for data and is
address computation, (A) 1.0 sec (C) 1.4 sec
MA – Data memory access – for write (B) 1.2 sec (D) 1.6 sec
access, the register read at RD
CS - 2007
stage it used,
4. Consider a pipelined processor with the
WB – Register write back.
following four stages
Consider the following sequence of
IF : Instruction Fetch
instructions:
ID: Instruction Decode and Operand
: L R0, Loc 1; R0 ← M [Loc 1]
Fetch
: A R0, R0; R0 ← R0 + R0
EX : Execute
:S R2, R0; R2 ← R2 – R0
WB : Write Back
Let each stage take one clock cycle.What
The IF, ID and WB stages take one clock
is the number of clock cycles taken to
cycle each to complete the operation.
complete the above sequence of
The number of clock cycles for the EX
instructions starting from the fetch of ?
stage depends on the instruction. The
(A) 8 (C) 12
ADD and SUB instructions need 1 clock
(B) 10 (D) 15
cycle and the MUL instruction need 3
2. We have two designs D1 and D2 for a clock cycles in the EX stage. Operand
synchronous pipeline processor. D1 has forwarding is used in the pipelined
5 pipeline stages with execution times of processor. What is the number of clock
3 nsec, 2 nsec, 4 nsec, 2 nsec and 3 nsec cycles taken to complete the following
while the design D2 has 8 pipeline stages sequence of instructions?
each with 2 nsec execution time. How ADD R2,R1,R0 R2←R1+R0
much time can be saved using design D2 MUL R4,R3,R2 R4←R3*R2
SUB R6,R5,R4 R6←R5 R4
over design D1 for executing 100
(A) 7 (C) 10
instructions? (B) 8 (D) 14
(A) 214 nsec (C) 86 nsec
(B) 202 nsec (D) 200 nsec CS - 2008
5. Which of the following are NOT true in a
CS – 2006 pipelined processor?
3. A CPU has five-stage pipeline and runs at 1. Bypassing can handle all RAW
1 GHz frequency. Instruction fetch hazards.
happens in the first stage of the pipeline. 2. Register renaming can eliminate all
A conditional branch instruction register carried WAR hazards.
computes the target address and 3. Control hazard penalties can be
evaluates the condition in the third stage eliminated by dynamic branch
of the pipeline. The processor stops prediction
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 247
GATE QUESTION BANK Computer Organization
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 248
GATE QUESTION BANK Computer Organization
frequency, the designers have decided to of one in both the designs. The execution
split the ID/RF stage into three stages times of this program on the old and the
(ID, RF1, RF2) each of latency 2.2/3 ns. new design are P and Q nanoseconds,
Also, the EX stage is split into two stages respectively. The value of P/Q is
(EX1, EX2) each of latency 1 ns. The new __________.
design has a total of eight pipeline
stages. A program has 20% branch 16. Consider two processors P and P
instructions which execute in the EX executing the same instruction set.
stage and produce the next instruction Assume that under identical conditions,
pointer at the end of the EX stage in the for the same input, a program running
old design and at the end of the EX2 on P takes 25% less time but incurs
stage in the new design. The IF stage 20% more CPI (clock cycles per
stalls after fetching a branch instruction instruction) as compared to the program
until the next instruction pointer is running on P . If the clockfrequency of P
computed. All instructions other than the is 1GHz, then the clock frequency of P
branch instruction have an average CPI (in GHz) is _________.
(100 + 5 1) × 4 = 416nsec R ←R +R IF ID EX WB
Time required by design D2 R ←R R IF ID EX EX EX WB
(100 + 8 1) × 2 = 214nsec IF ID EX WB
R ←R R
So time saved using design D2 =
416 – 214 = 202nsec So total required clock cycle is 8.
3. [Ans. C] 5. [Ans. D]
For 80% of 10 instructions a single cycle All statements 1, 2 and 3 are false for a
is sufficient as there is no conditional pipelined processor.
branch. For the rest 20%, one extra cycle
will be needed making the number of 6. [Ans. B]
cycles required to 3.
For all delayed conditional branch
Total time will be computed as below
instruction the first instruction in the fall
One cycle takes = 10
through path is executed and evaluates to
true of false.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 250
GATE QUESTION BANK Computer Organization
hazards.
OW
PO
14
12. [Ans. B]
Given: Five stage instruction pipeline
WO
PO
13
PO
PO
12
PO
PO
11
PO
10
PO
PO
PO
PO
, , , , , , ,
8
→
WO
PO
c o
O
7
PO
PO
PO
PO
PO
PO
5
instructions from I1 to I4 is
PO
= 11 5 + (4 1) 11 =88 ns
O
4
from I9 to I12 is
= 11 5 + (4 1) 11 = 88 ns
2
overlap with WO of I4
Hence total times is
No. of cycles required = 15 cycles. = 88 +88 11 = 165 ns
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 251
GATE QUESTION BANK Computer Organization
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 252
GATE QUESTION BANK Computer Organization
Instruction Types
CS – 2005 Common Data Questions Q.3 & Q.4
1. Consider a three word machine Consider the following data path of a CPU.
instruction “ADD A[ ], @B” MAR MD
R
The first operand (destin tion) A [ ]
uses indexed addressing mode with R0 as
the index register. The second operand S T
(source) “@B” uses indirect ddressing IR PC
mode. A and B are memory addresses GPRS
ALU
residing at the second and the third
words, respectively. The first word of the
The, ALU, the bus and all the registers in
instruction specifies the opcode, the index
the data path are of identical size. All
register designation and the source and
operations including incrementation of
destination addressing modes. During
the PC and the GPRs are to be carried out
execution of ADD instruction, the two
in the ALU. Two clock cycles are needed
operands are added and stored in the
for memory read operation – the first one
destination (first oper nd). The number
for loading address in the MAR and the
of memory cycles needed during the
next one for loading data from the
execution cycle of the instruction is
memory bus into the MDR.
(A) 3 (C) 5
(B) 4 (D) 6
3. The instruction “ dd , ” has the
register transfer interpretation
2. Match List I(high level language
R0 ⇐ R0 + R1. The minimum number of
statements) and List II(addressing modes)
clock cycles needed for execution cycle of
and pick the correct options .
this instruction is
List I List II
( high level language (addressing modes) (A) 2 (C) 4
statements) (B) 3 (D) 5
1. A [I] = B[J]; a. Indirect
addressing 4. The instruction “c ll n, sub” is two
2. while (* A ++); b. Indexed word instruction. Assuming that PC is
addressing incremented during the fetch cycle of the
3. int temp = *x; c. Auto increment first word of the instruction, its register
(A) (1,c), (2,b), (3,a) transfer interpretation is
(B) (1,a), (2,c), (3,b) Rn< = PC + 1;
(C) (1,b), (2,c), (3, a) PC < = M [PC];
(D) (1,a), (2,b), (3,c) The minimum number of CPU clock cycles
needed during the execution cycle of this
instruction is
(A) 2 (C) 4
(B) 3 (D) 5
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 253
GATE QUESTION BANK Computer Organization
CS - 2006 CS - 2007
5. Consider a new instruction named Common Data for Q.8 , Q.9 & Q10.
branch-on-bit-set (mnemonic bbs). The Consider the following program segment.
instruction “bbsreg, pos, l bel” jumps to Here R1, R2 and R3 are the general purpose
label if bit in position pos of register registers.
operand reg is one. A register is 32 bits Instruction Operation Instruction
wide and the bits are numbered 0 to 31, size
(no. of words)
bit in position 0 being the least
MOV R1,( ) R1 2
significant. Consider the following [ ]
emulation of this instruction on a LOOP:
processor that does not have bbs MOV R2, M[R3] R2 [ ] 1
implemented. ADD R2, R1 R2 1
temp reg and mask
Branch to label if temp is non-zero MOV ( ), M [R3] 1
INC R3 R3 R3 + 1 1
The variable temp is a temporary register.
DEC R1 R1 R1 – 1 1
For correct emulation,the variable mask
BNZ LOOP Branch on 2
must be generated by not zero
(A) mask 0 pos HALT `Stop 1
(B) mask 0 ffffffff>> pos Assume that the content of memory
(C) mask pos location 3000 is 10 and the content of the
(D) mask 0 f register R3 is 2000. The content of each of
the memory locations from2000 to 2010
6. The memory locations 1000, 1001 and is 100. The program is loaded from the
1020 have data values 18, 1 and 16 memory location 1000. All the numbers
respectively before the following program are in decimal.
is executed.
8. Assume that the memory is word
MOVI Rs, 1;Move immediate
addressable. The number of memory
LOAD Rd, 1000(Rs); Load from memory
references for accessing the data in
ADDI Rd, 1000;Add immediate
executing the program completely is
STOREI 0(Rd), 20;Store immediate
(A) 10 (C) 20
Which of the statements below is TRUE (B) 11 (D) 21
after the program is executed?
(A) Memory location 1000 has value 20 9. Assume that the memory is word
(B) Memory location 1020 has value 20 addressable. After the execution of this
(C) Memory location 1021 has value 20 program, the content of memory location
(D) Memory location 1001 has value 20 2010 is
(A) 100 (C) 102
7. Which of the following statements about (B) 101 (D) 110
relative addressing mode is FALSE?
(A) It enables reduced instruction size 10. Assume that the memory is byte
(B) It allows indexing of array elements addressable and the word size is 32 bits.
with same instruction If an interrupt occurs during the
(C) It enables easy relocation of data e ecution of the instruction “INC ”,
(D) It enables faster address calculations what return address will be pushed on to
than absolute addressing the stack?
(A) 1005 (C) 1024
(B) 1020 (D) 1040
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 254
GATE QUESTION BANK Computer Organization
CS - 2011
16. Consider a hypothetical processor with an
instruction of type LW R1, 20(R2), which
during execution reads a 32-bit word
from memory and stores it in a 32-bit
register R1. The effective address of the
memory location is obtained by the
addition of a constant 20 and the contents
of register R2. Which of the following best
reflects the addressing mode
implemented by this instruction for the
operand in memory?
(A) Immediate Addressing
(B) Register Addressing
(C) Register Indirect Scaled Addressing
(D) Base Indexed Addressing
CS – 2013
17. Consider the following sequence of micro
– operations.
B C
A
C
emor B
Which one of the following is a possible
operation performed by this sequence?
(A) Instruction fetch
(B) Operand fetch
(C) Conditional branch
(D) Initiation of interrupt service
CS - 2014
18. A machine has a 32-bit architecture, with
1-word long instructions. It has 64
registers, each of which is 32 bits long. It
needs to support 45 instructions, which
have an immediate operand in addition to
two register operands. Assuming that the
immediate operand is an unsigned
integer, the maximum value of the
immediate operand is ____________.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 256
GATE QUESTION BANK Computer Organization
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 258
GATE QUESTION BANK Computer Organization
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 259
GATE QUESTION BANK Computer Organization
How many bits of the control words can read 1 MB contiguous data starting from
be saved by using vertical micro- the sector 4 of the outer-most track?
programming over horizontal (A) 13.5 ms (C) 9.5 ms
microprogramming? (B) 10 ms (D) 20 ms
(A) 0 (C) 22
CS - 2007
(B) 103 (D) 55
9. Consider a disk pack with 16 surfaces,
6. Consider a disk drive with the following 128 tracks per surface and 256 sectors
specifications: per track. 512 bytes of data are stored in a
16 surfaces, 512 tracks/surface, bit serial manner in a sector. The capacity
512 sectors/track, 1 KB/sector, rotation of the disk pack and the number of bits
speed 3000 rpm. The disk is operated in required to specify a particular sector in
cycle stealing mode whereby whenever the disk are respectively
one 4 byte word is ready it is sent to (A) 256 Mbyte, 19 bits
memory; smilarly, for writing, the disk (B) 256 Mbyte, 28 bits
interface reads 4-byte word from the (C) 512 Mbyte, 20 bits
memory in each DMA cycle. Memory cycle (D) 64 Gbyte, 28 bits
time is 40 nsec. The maximum percentage
CS - 2008
of time that the CPU gets blocked during
10. Which of the following statements about
DMA operation is
synchronous and asynchronous I/O is
(A) 10 (C) 40
NOT true?
(B) 25 (D) 50
(A) An ISR is invoked on completion of
Statement for Linked Answer Questions 7 I/O in synchronous I/O but not in
and 8 asynchronous I/O
A disk has 8 equidistant tracks. The (B) In both synchronous and
diameters of the innermost and asynchronous I/O an ISR ( Interrupt
outermost tracks are 1cm and 8 cm Service Routine) is invoked after
respectively. The innermost track has a completion of the I/O
storage capacity of 10MB. (C) A process making a synchronous I/O
7. What is the total amount of data that can call waits until I/O is complete, but a
be stored on the disk if it is used with a process making an asynchronous I/O
drive that rotates it with call does not wait for completion of
(i) Constant Linear Velocity the I/O
(ii) Constant Angular Velocity? (D) In the case of synchronous I/O, the
(A) (i) 80 MB (ii) 2040 MB process waiting for the completion of
(B) (i) 2040 MB (ii) 80 MB I/O is woken up by the ISR that is
(C) (i) 80 MB (ii) 360 MB invoked after the completion of I/O
(D) (i) 360 MB (ii) 80 MB
CS - 2009
11. A CPU generally handles an interrupt by
8. If the disk has 20 sectors per track and is
executing an interrupt service routine
currently at the end of the 5th sector of the
(A) as soon as an interrupt is raised
inner-most track and the head can move
(B) by checking the interrupt register at
at a speed of 10 meters/sec and it is
the end of fetch cycle
rotating at constant angular velocity of
6000 RPM, how much time will it take to
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 260
GATE QUESTION BANK Computer Organization
2. [Ans. A] 6. [Ans. B]
Memory mapped I/O requires that Time takes for 1 rotation
memory locations and I/O ports share the = 60 sec = 3000 rotations
same set of addresses, so address bit 60/3000 sec= 1 rotation
pattern that is assign to memory cannot In 1 rotation it reads –
also be assigned to an I/O port and vice- 1/50 sec
versa. I/O protection in this approach in ? = 4 bytes
ensured by operating system macros and Time it takes to read 4 bytes = 153 ns
routines. % of time CPU gets blocked
3. [Ans. B]
Data transfer rate = 10KB/sec
Total transfer = 25 7. [Ans. D]
Data transfer rate = For Constant Linear Velocity, density of
So perform gain = 25 % bits per track will increase as the head
moves towards outside of the disk.
4. [Ans. D]
So the disk capacity
Notice here that S5 have to be activated
= 10 + 20 + 30 + 40 + 50 + 60 + 70 +80
on T1 for all instructions and for I2 and I3
=360MB
on T3.
For Constant Angular Velocity, density of
S10 have to be activated
bits per track is uniform.
for I2 and I4 on T5
So the disk capacity = 10 × 8 = 80MB
for I1 and I3 on T4
for I4 on T3 8. [Ans. A]
for I2 and I3 on T2 To move from 1st sector to 8th sector, the
distance covered by head
5. [Ans. B] =(8 1)/2=3.5cm
As head can move at 10m/s, the above
movement will take 3.5ms
After this movement head arrives at the
end of 5th sector. So to read 1MB data
from starting of 4th sector to ending of
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 262
GATE QUESTION BANK Computer Organization
10. [Ans. B]
Statement (B) is not true because an ISR
(Interrupt Service Routine) is invoked on
before completion of I/O in synchronous
as well as in asynchronous I/O.
11. [Ans. C]
By checking interrupt register after
finishing the execution of the current
instruction.
12. [Ans. D]
Higher priority interrupt levels are When head is moving then it is reading
assigned to requests which, if delayed or data from all 16 surfaces simultaneously.
interrupted, could have serious Currently head is on 9th surface, sector no.
consequences. Interrupt from CPU 40.
temperature sensor would have serious Data it read from 9th surface
consequences if ignored. So it has the
highest priority. Data it read from surface 10th to 15th
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 263
GATE QUESTION BANK Digital Logic
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 264
GATE QUESTION BANK Digital Logic
11. The following bit pattern represents a biased exponent and 23 bits for mantissa.
floating point number in IEEE 754 single A float type variable X is assigned the
precision format decimal value of 4.25. The
1 10000011 representation of X in hexadecimal
10100000000000000000000 notation is
The value of the number in decimal form (A) C1640000H (C) 41640000H
is (B) 416C0000H (D) C16C0000H
(A) 10
(B) 13
(C) 26
(D) None of the above
CS - 2009
12. (1217) is equivalent to
(A) (1217) (C) (2297)
(B) (028F) (D) (0B17)
CS - 2010
13. P is a 16-bit signed integer. The 2’s
complement representation of P is
87 ) . The 2’s complement
representation of 8*P is
(A) 3 8) (C) 878)
(B) 87 ) (D) 987 )
CS - 2013
14. The smallest integer that can be
represented by an 8- bit number in 2’s
complement form is
(A) 256 (C) 127
(B) 128 (D) 0
CS - 2014
15. The base (or radix) of the number system
such that the following equation holds is
________
3 2
= 3.
20
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 265
GATE QUESTION BANK Digital Logic
2. [Ans. A] 4 A E 8
657) = 0 0 ) = 4A 8)
000 0 0 )
= 5. [Ans. A]
A
657) = A ) 34.4) 23.4) = 053.6)
6. [Ans. C]
3. [Ans. D]
Let b , b , b , b are binary and
The decimal number is 0.239 2
h , h , h , h , g , g , g , g as discussed in
We have to find hexadecimal
Question then
representation without normalization.
b b b b h h h h g g g g
Biased exponent = 13 + 64 = 77
0 0 0 0 0 0 0 0 0 0 0 1
Representing 77 in binary 0 0 0 1 0 0 0 1 0 0 1 1
77) = 00 0 ) 0 0 1 0 0 0 1 1 0 0 1 0
Representing mantissa in binary 0 0 1 1 0 0 1 0 0 1 1 0
0.239) = 0.00 0 000 0 0 1 0 0 0 1 1 0 0 1 1 1
Floating point representation is an 0 1 0 1 0 1 1 1 0 1 0 1
follows: 0 1 1 0 0 1 0 1 0 1 0 0
0 1 1 1 0 1 0 0 1 1 0 0
Sign Exponent Mantissa
1 0 0 0 1 1 0 0 1 1 0 1
0 1001101 00111101 1 0 0 1 1 1 0 1 1 1 1 1
0100 1101 0011 1101 1 0 1 0 1 1 1 1 1 1 1 0
1 0 1 1 1 1 1 0 1 0 1 0
1 1 0 0 1 0 1 0 1 0 1 1
4 D 3 D 1 1 0 1 1 0 1 1 1 0 0 1
= 4 3 ) 1 1 1 0 1 0 0 1 1 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0
4. [Ans. D] Now clearly g is high at position 0, so
The decimal number is 0.239 2 option (A) is wrong, also g is high at
We have to find hexadecimal position 1, so option (B) is also wrong, for
representation with normalization. g h , h , h , h )g is high at
Binary representation of 0.239 is g h , h , h , h ) = Σm 2,6,7,5,4, 2, 3, 5)
0.00111101000101 g h , h , h , h ) = Σm 2,4,5,6,7, 2, 3, 5)
is 0.00 0 000 0 ) 2 Hence option (C) is correct answer.
After normalization we have
1.11101000101 × 2
Then, biased exponent = 10 + 64 = 74
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 266
GATE QUESTION BANK Digital Logic
7. [Ans. C] 0
Overflow condition is check with the 0
expression x yz yxz where x is MSB of 0
first number, y is MSB of second and z is 0
0
MSB of output (all in same size, 4 bit
0
here) 0
Here x =1 0
y=0& 0
z=0 0
So x yz xyz = 0 0
0
So no overflow will be there.
Checking options.
8. [Ans. A] (a) 10
0 2.2 5) = 400 22. 2) Sign = 1
0 0 00 0. 0 ) = 2 7 6 .5 ) 0) = 0 0 = .0 0 2
40022. 2) 27 6.5) The exponent is biased by 2 ,
= 35 03.4 2) where ‘e’ is the number of bits used
for the exponent field which is 8.
9. [Ans. D] 2 = 27
Hexadecimal value 0x00000000 in binary For the 32 bit IEEE 754 format, the
bias is + 127 and so 3 + 127 = 130.
0 0 0 0 0 0 0 0
In binary (130) is encoded as 1 0 0
0 0 0 0 0 0 0 0 00010.
0 0 0 0 0 0 0 0 Thus, it is not equal to exponent field.
(b) 13
0 0 0 0 0 0 0 0
Sign = 1
3) = 1101 = 1.101 × 2
10. [Ans. D] 3 27 = 30
√ 2 = ) √ r 2r )= r ) Hence 30) = 00000 0 exponent
r 2r ) = r ) (c) 26
r 2r =r 2r 26) = 0 0 = . 0 0 2
Given equation will satisfy for every vale 27 4 = 3 and 3 )
of r, however with radix r = 2 we cannot = 00000
have sign 2 in it. So answer is r > 2. But fraction part does not match
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 267
GATE QUESTION BANK Digital Logic
15. [Ans. 5]
Given
3 2)
= 3. )
20)
3r r 2
=r 3
2r r
3
r =r 3
2 2 r r
r 5
=
2 2
r=5
16. [Ans. 3]
Given 23) = x 8)
5 2 5 3 5 ) = x y 8)
38 = xy 8
xy = 30
So possible combination of (x, y) are
(1, 30); (2, 15); (3, 10); (5, 6); (6, 5);
(10, 3); (15, 2); (30, 1)
However 8 is a symbol in base y, so y
must be > 8. So that means only three
combination of (x, y) are only possible.
17. [Ans. A]
4.25
Sign bit = 1
4.25
= .78 25
2
So exponent = 3 + 127 (biased)
= 30)
= 00000 0)
antissa = 0.78 25 = 00
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 268
GATE QUESTION BANK Digital Logic
CS - 2006 10 1 0 0 1
3. Consider a Boolean function f(w, x, y, z).
Which of the product terms given below
Suppose that exactly one of its inputs is
is an essential prime implicant of the
allowed to change at a time. If the
function?
function happens to be true for two
(A) QRS (C)
input vectors i w x y z
(B) PQS (D)
n i w x y z w would like
the function to remain true as the input CS - 2007
changes from i to i i n i differ in 6. What is the maximum number of
exactly one bit position), without different Boolean functions involving n
becoming false momentarily. Let Boolean variables?
f(w, x, y, z,) = (5, 7, 11, 12, 13, 15). (A) n (C) 2
Which of the following cube covers of (B) 2 (D) 2
f will ensure that the required property
is satisfied? 7. Consider the following Boolean function
(A) w ̅ x z w x y̅ x y̅z x y z w y z of four variables
(B) w x y , w ̅ xz wyz f w x y z) 1 3 4 6 9 11 12 14)
(C) w x ̅̅̅̅,
y z x z, w x̅ y z The function is
(D) w z y, w y z, w ̅ x z x y̅ z x y z (A) Independent of one variable
(B) Independent of two variables
4. Given a Boolean function f (x1, x2 ….. xn),
(C) Independent of three variables
which of the following equation is NOT
(D) Dependent on all the variables
true
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 269
GATE QUESTION BANK Digital Logic
̅ CS - 2008
12. In the Karnaugh map shown below, X
denotes on’t r t rm. Wh t is th
minimal form of the function
represented by the Karnaugh map
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 270
GATE QUESTION BANK Digital Logic
ab CS – 2010
cd 00 01 11 10 16. The minterm expansion of
00 1 1 1 f (P, Q, R) = PQ + Q̅ + P̅ is
(A) m + m + m + m
X (B) m + m + m + m
01
(C) m + m + m + m
X
11 (D) m + m + m + m
10 1 1 X
CS - 2011
̅. ̅ + 17. The simplified SOP (Sum Of Product)
(A) ̅. ̅
form of the Boolean expression
(B) ̅. ̅ + ̅ . ̅ + ̅. . ̅
(P+ ̅ + ̅).(P+ ̅ +R). (P+Q+̅)
(C) ̅. ̅ + ̅. . ̅ (A) (̅. + ̅) (C) (̅. + )
(D) ̅. ̅ + ̅ . ̅ + ̅. ̅
(B) (P+ ̅ . ̅) (D) (P.Q+R)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 271
GATE QUESTION BANK Digital Logic
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 272
GATE QUESTION BANK Digital Logic
5. [Ans. D] 8. [Ans. A]
PQ Consider a simple method let w = 1,
RS
00 01 11 10 x = 1, y = 1, z = 1 then the value of f is 1.
Consider each statement
00 1 0 0 1
(P) x y z + w xy + wy z + xz
01 0 0 1 1 =000+010+101+11=1
11 1 1 1 0 (Q) w y z + wx y + xz
1 0 0 1 000+100+11=1
10
(R) w y z + wx y + xyz + xy z
So is essential prime implicants. =000+100+111+101=1
(S) x y z + wx y + w y
6. [Ans. C] =000+100+01=0
Let the binary constant be the value of So statement (S) is false because w = 1,
the function f(x x … … x ) for the x = 1, y = 1, z = 1 the value of f is 0. (S)
combination of variables whose decimal is not contain the essential minterms.
code is i. Then every switching function So option not containing S is answer
can be expressed in form. which is option (A)
f (x x … . x ) = x́ x́ … x́ +
x́ x́ … x́ + … + x x … x . 9. [Ans. D]
A factor is either 0 or 1 if the +
corresponding minterm is contained in Z = X*Y
canonical form of the function. Then y + from eq. (i)
there are r = 2 coefficients each of P:X=
which can have values either 0 or 1 = YZ + by eq.(i)
hence there are 2 possible =Y(XZ + X Z ) + Y Z
assignments. = XYZ + X YZ + Y Z
Q:Y=
7. [Ans. B] Y = XZ + X Z by eq.(i)
Given Y =XZ + X Z
f(w, x, y, z) = (1, 3, 4, 6, 9, 11, 12, 14) R: = 1 if we will take the truth
Corresponding K – map for f is table for P, Q, R, then all are valid
formulas
yz
wx 00 01 11 10
10. [Ans. A]
00 1 1
cd a + +
01 ab 00 01 11 10
1 1
00 1 1
11 1 1 01 1
1
11 1 1 1
10
1 1
10 1 1
f(w, x, y, z) = xz + x z
So f (w, x, y, z) is independent of two
variables w and y.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 273
GATE QUESTION BANK Digital Logic
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 274
GATE QUESTION BANK Digital Logic
20. [Ans. A]
K-map for given expression
RS 00 01 11 10
PQ
00
01 1 1 1
11 1 1 1 1
10
QS
PQ QR
21. [Ans. D]
A function F is self dual if it has equal
number of minterms and maxterms, also
mutually exclusive term should not be
included.
The number of mutually exclusive terms
(pair wise) is 2
Number of function possible by taking any
of the one term from the above mentioned
mutually exclusive pair is = 2
22. [Ans. B]
RS
PQ 00 01 11 10
00 1 x
01 1 x QS
11 x 1
10 x 1
23. [Ans. D]
1 ) ) ) 0)
) ) { 1
0
1 ) 0) { 1
0
{ 1
0
+
)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 275
GATE QUESTION BANK Digital Logic
Logic Gates
CS – 2005 CS - 2007
1. A two-way switch has three terminals a, b 4. The following expression was to be realized
and c. In ON position (logic value 1), a is using 2 input AND and OR gates. However,
connected to b, and in OFF position, a is during the fabrication all 2 input AND
connected to c. Two of these two way gates were mistakenly substituted by
switches S1 and S2 are connected to a 2 input NAND gates.
bulb as shown below. (a. b).c + (̅.c).d + (b.c).d + a.d
b b What is the function finally realized?
a a (A) 1
c c
(B) ̅ + ̅ + ̅ + ̅
Switch
c S1 Switch
c S2 (C) ̅ + b + ̅ + ̅
(D) ̅ + ̅ + c + ̅
Bulb
5. The line T in the following figure is
Which of the following expressions, if
permanently connected to the ground.
true, will always result in the lighting of X1
the bulb? X2
X3
(A) S1. ̅̅̅ (C) ̅̅̅̅̅̅̅̅̅̅ X2
X4
X3
(B) S1+ S2 (D) S1 S2 X3 T
CS - 2006 CS - 2009
3. The majority function is a Boolean 6. What is the minimum number of gates
function f (x, y, z) that takes the values 1 required to implement the Boolean
whenever a majority of the variables x, y function (AB + C) if we have to use only
and z. In the circuit diagram for the 2-input NOR gates?
majority function shown below, the logic (A) 2 (C) 4
gates for the boxes labeled P and Q are, (B) 3 (D) 5
respectively
z y
P 1
f
Q 0
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 276
GATE QUESTION BANK Digital Logic
CS – 2010 CS – 2014
7. What is the Boolean expression for the 10. Consider the following combinational
output f of the combinational logic circuit of function block involving four Boolean
NOR gates given below? variables x, y, a, b where x, a, b are inputs
P and y is the output.
Q
f (x, y, a, b)
Q {
R if (x is 1) y = a;
f
R
RP
else y = b;
R }
R Which one of the following digital logic
QR
R blocks is the most suitable for
R implementing this function?
R
(A) ̅̅̅̅̅̅̅̅ (C) ̅̅̅̅̅̅̅ (A) Full adder
(B) ̅̅̅̅̅̅̅ (D) ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
(B) Priority encoder
CS – 2011 (C) Multiplexer
8. Which one of the following circuits is NOT (D) Flip-flop
equivalent to a 2-input XNOR (exclusive
NOR) gate?
(A)
(B)
(C)
(D)
CS - 2012
9. What is the minimal form of the Karnaugh
map shown below? Assume that X
enotes on’t re term
(A) ̅ ̅ (C) ̅ ̅ +a ̅ ̅
(B) ̅ ̅ ̅̅ (D) ̅ ̅ + ̅ ̅ ̅ ̅
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 277
GATE QUESTION BANK Digital Logic
1. [Ans. C] ( )
Either both ON or OFF i.e. ( ( ))
( )
2. [Ans. C] ( )
Given ( )
( ) ( )
4. [Ans. C]
( ) ( ) ( )
Now (A),
Replace AND gate with NAND gate,
( )( )
( ) ( ) ( )
( ) ( ) ( ) ( )
( )
So A is false (not correct option)
(B) ( )( )
( )
( )
( )( )
So B is false (not correct option)
(C) ( ) ( )
( )
( )
So option C is correct 5. [Ans. D]
X1
X2
3. [Ans. D] X3
X2 X4
X3 X4 y
f= () X3 X3
X3 T
where ( ) X4
( ) X4
Now we know a 3 variable majority X4
X3 X4 X4 + y
X4
circuit is given as
( ) 0 1
0
Now on comparing, we get that there is 0 1 0
no on actual expression, so we have to
1 0 0
eliminate from equation (i) we know
that 1 1 0
( )
So the eliminate , Q must also be present But both n
in P and in addition P must contain some c n’t o ur t s me t me so none o these
other terms so by observation option A, B
& C are eliminated
Now option (D)
( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 278
GATE QUESTION BANK Digital Logic
6. [Ans. B] (B)
= AB + C
= (A + C) (B + C)
(( ) ( )) (C)
A ( )
C
(D)
(( ) +( ) ( )
B
C
( )
7. [Ans. A] ( )( )
̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅
P ( ) ( )
(P + Q) (Q+R) = Q+RP
Q
Q
∴ pt on s not
R
P 9. [Ans. B]
R ab 00 01 11 10
cd
Q
̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ 00 1 x x 1
R ̅̅̅̅̅̅̅ ̅̅̅̅̅̅̅̅
(P + R) (Q+R) = R+PQ
01 x 1
( ) 11
( )
10 1 x
∴C=
∴ ( )
8. [Ans. D]
(A) 10. [Ans. C]
x
y nput nes output ne
( )( )
se e t ne
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 279
GATE QUESTION BANK Digital Logic
z
Which one of the following is TRUE?
(A) f is independent of x
(B) f is independent of y
(C) f is independent of z
(D) None of x, y, z is redundant
1. [Ans. D]
The given circuit is
x
+ yz
y
f = x + yz
=x ( ) ( ) [∵ = 1]
=x
K – map:
yz
x 00 01 11 10
0 1
1 1 1 1
( )
So none of x, y, z is redundant.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 280
GATE QUESTION BANK Digital Logic
CL C
0 1 2 3 4 5
KX Clock ̅
A B C
Let represent the complement of A. The (A) 1 0 1
correct output sequence on Y over the 0 0 1
clock periods 1 through 5 is 0 1 0
(A) (C) (B) 1 0 1
(B) (D) 1 1 0
1 1 1
2. Consider the following circuit
(C) 0 1 1
1 0 1
1 1 1
CLK (D) 0 0 1
The flip-flops are positive edge triggered 1 1 0
D FFs. Each state is designated as a two 1 1 1
bit string . Let the initial state be 00. 5. The circuit shown below implements a
The state transition sequence is 2-input NOR gate using two 2 1 MUX
(A) 00→11→01 (control signal 1 selects the upper input).
What are the values of signals x, y and z?
(B) 00→11
x 1
(C) 00→10→01→11 y
0
A 1
(D) 00→11→01→10 B
0
0z
(A) 1, 0, B (C) 0, 1, B
(B) 1, 0, A (D) 0, 1, A
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 281
GATE QUESTION BANK Digital Logic
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 282
GATE QUESTION BANK Digital Logic
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 283
GATE QUESTION BANK Digital Logic
16. What is the final value stored in the linear 20. The Boolean expression for the output f of
feedback shift register if the input is the multiplexer shown below is
101101?
R 0
101101 ̅ 1
f
+ 0 1 1 0
̅ 2
XOR ̅
(A) 0110 (C) 1101 R 3
(B) 1011 (D) 1111 R
CS - 2008 R P Q
17. What Boolean function does the circuit ̅
below realize? (A) ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅ (C) P + Q + R
(B) (D) ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
z
3 to 8
CS - 2011
y f (x, y, z) Common data for questions 21 and 22:
Decoder
Consider the following circuit involving
x three D-type flip-flops used in a certain
type of counter configuration.
(A) xz + x z (C) x y + yz
(B) xz xz (D) xy + y z
D Q
clock ̅
18. The two numbers given below are
mu tip ie usi g the ooth’s gorithm
Multiplicand: 0101 1010 1110 1110 Q
D Q
Multiplier: 0111 0111 1011 1101
How many additions/Subtractions are clock ̅
required for the multiplication of the
above two numbers?
R
(A) 6 (C) 10 D Q
(B) 8 (D) 12 clock ̅
CS - 2010
19. In the sequential circuit shown below, if
the initial value of the output is 00, 21. If some instance prior to the occurrence
what are the next four values of ? of the clock edge, P, Q and R have a value
0, 1 and 0 respectively, what shall be the
value of PQR after the clock edge?
1 T Q T Q
(A) 000 (C) 010
Clock (B) 001 (D) 011
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 284
GATE QUESTION BANK Digital Logic
CS - 2014
25. Consider the 4 – to – 1 multiplex with two
select lines and given below
0 0
1 1 4 – to – 1
Multiplexer
2
3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 285
GATE QUESTION BANK Digital Logic
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 286
GATE QUESTION BANK Digital Logic
7. [Ans. A] 9. [Ans. C]
x B=
0 A=
f
S=c c c
1
The over flow condition V
y̅
V= c c
c is c so
z 0
f V=c c
1
x So the over flow condition is
c c
y
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 287
GATE QUESTION BANK Digital Logic
xy z
15. [Ans. B] x xyz
S xyz
= xz xz)
= (x z ) xz)
R = (x + z) (x z)
S R = xx xz x z zz
= xz xz
1 1
1 0 0
18. [Ans. B]
0 1 1
ooth’s gorithm requires ex mi tio
0 0 Invalid
of the multiplier bits and shifting of the
Now since 00 leads to invalid state it
partial product. Prior to the shifting, the
cannot lead to an oscillation
multiplicand may be added to the partial
So (A) & (D) are wrong options
product, subtracted from the partial
In both option B & C oscillation will occur
but in option (C) oscillation will start after product or left unchanged according to
one clock cycle however in option (B) the following rules.
oscillation will state with first clock cycle 1. The multiplicand is subtracted from
so B is more correct answer the partial product upon
encountering the first least
16. [Ans. A]
significant 1 in a string of 1’s i the
Clock Output
multiplier.
0 0110
2. The multiplicand is added to the
1 1011
partial product upon encountering
2 1101
the first 0 i stri g of 0’s i the
3 0110 multiplier.
4 1011 3. The partial product does not change
5 1101 when the multiplier bit is identical to
6 0110 the previous multiplier bit.
As in multiplier we see that a change
101101 occurs in bit as 0 changes to 1 and 1
+ changes to 1.
Multiplier:
So option A 0111 0111 1011 1101
1 1 1 1 1 1 1 ↑
17. [Ans. B]
f xyz x yz xy z xyz
=x z y y) xz y y )
= x z 1) xz 1)
=x z xz
f=f
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 288
GATE QUESTION BANK Digital Logic
) 2
n - bit
bit
binary
f ) 0 1 0) the ext st te counter decode
r 1
) 0 1 1)
)
22. [Ans. B]
So output of n-bit binary counter move
There are four distinct states.
from 1, 2, 3, and so on according to that
000 →010→011→100 →000)
and so on output will be high.
23. [Ans. A]
Mod 258 counter has 258 different states.
So minimum number of bits required
each state is ceiling of og 25 , each
of which requires one flip-flop.
24. [Ans. A]
Truth table given represent the priority
encoder i.e, 4 2 priority encoder V = 0
indicates output is invalid and V = 1
indicates output is valid
25. [Ans. A]
0 1
( )
So answer
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 289
GATE QUESTION BANK DMGT
Mathematical Logic
CS - 2005 5. Which one of the first order predicate
1. What is the first order predicate calculus calculus statements given below correctly
statement equivalent to the following? expresses the following English
Every teacher is liked by some student statement?
(A) ( ), ( ) Tigers and lions attack if they are hungry
( ), ( ) ( )-] of threatened.
(B) ( ), ( ) (A) [( ( ) ( ))
( ), ( ) ( )-- {( ( ) ( ))
(C) ( ) ( ), ( ) ( )}]
, ( ) ( )--
(B) [( ( ) ( ))
(D) ( ), ( ) ( )
{( ( ) ( ))
, ( ) ( )--
( )}]
2. Let P, Q and R be three atomic (C) [( ( ) ( ))
propositional assertions. Let X denote { ( ) ( ( )
( ) and Y denote ( ))}]
( ) ( ). Which one of the
(D) [( ( ) ( ))
following is a tautology?
*( ( ) ( ))
(A) X Y (C) Y X
( )+]
(B) X Y (D) Y X
6. A logical binary relation ⨀, is defined as
3. Let P(x) and Q(x) be arbitrary predicates.
follows :
Which of the following statements is
always TRUE? A B A⨀B
(A) (( ( ) ( ))) True True True
(( ( )) ( ( ))) True False True
(B) ( ( ( ) ( ))) False True False
(( ( ( )) ( ( ))) False False True
(C) ( ( ( )) ( ( ))) Let ~ be the unary negation (NOT)
(( ( ( ) ( ))) operator, with higher precedence, than
⨀. Which one of following is equivalent
(D) . ( ( ))/ ( ( )))
A B?
( ( ( ) ( ))) (A) (~A ⨀ B) (C) ~(~A⨀~B)
(B) ~(A⨀~B) (D) ~(~A⨀B)
CS - 2006
4. Consider the following propositional CS - 2007
statements: 7. Which of the following is TRUE about
P1: ((A B) C) ((A C) (B C)) formulae in Conjunctive Normal Form?
P2: ((A B) C) ((A C) (B C)) (A) For any formula, there is a truth
Which one of the following is true? assignment for which at least half the
(A) P1 is a tautology, but not P2. clauses evaluate to true.
(B) P2 is a tautology, but not P1. (B) For any formula, there is a truth
(C) P1 and P2 are both tautologies assignment for which all the clauses
(D) Both P1 and P2 are not tautologies evaluate to true.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 290
GATE QUESTION BANK DMGT
(C) There is a formula such that for each Each finite state automaton has an
truth assignment, at most one-fourth equivalent pushdown automaton
of the clauses evaluate to true. (A) ( ( ))
(D) None of the above. ( ( ) ( ))
(B) ( ( )
8. Let Graph (x) be a predicate which denotes ( ( ) ( ))
that x is a graph. Let Connected (x) be a (C) ( ( ) ( ) ( ))
predicate which denotes that x is connected. (D) ( ( ) ( ) ( ))
Which of the following first order logic
sentences DOES NOT represent the 12. Which of the following is the negation of
statement. “N every graph is connec ”? [ ( ( ))-
(A) ¬ (Graph(x) ⇒ Connected (x)) (A) [ ( ( ))-
(B) x(Graph (x) Connected (x)) (B) [ ( ( ))-
(C) (¬Graph(x) Connected (x)) (C) [ ( ( ))-
(D) (Graph (x) ¬ Connected (x)) (D) [ ( ( ))-
9. Which one of these first-order logic 13. Which of the following first order
formulae is valid? m ?H ( )
(A) ( ( ) Q(x)) (( ( ( )) first order formula with x as free variable,
( ( ))) and is a first order formula with no free
(B) ( ( ) Q(x)) (( ( ( )) variable
( ( ))) (A) [ ( x, (x))] [ x, (x)]
(C) ( ( ) Q(x)) (B) [ x, (x)] [ ( x, (x))]
(( ( ( )) ( ( ))) (C) [( ( )) - , x, ( ) -
(D) ( ) ( ) (D) [( ( )) - , ( ) -
CS - 2008 CS - 2009
10. P and Q are two propositions. Which of 14. Consider the following well-formed
the following logical expressions are formulae:
equivalent? i. x P x
1)
2) ( ) ii. xP x
3) ( ) ( ) ( ) iii. x P x
4) (P Q) (P ~Q) (~P Q)
iv. xP x
(A) Only 1 and 2
(B) Only 1, 2 and 3 Which of the above are equivalent?
(C) Only 1, 2 and 4 (A) i and iii (C) ii and iii
(D) All of 1, 2, 3 and 4 (B) i and iv (D) ii and iv
11. Let fsa and pda be two predicates such 15. Which one of the following is the most
that fsa(x) means x is a finite state appropriate logical formula to represent
automaton, and pda(y) means that y is a the statement:
pushdown automaton. Let equivalent be “G m ”.
another predicate such that equivalent The following notations are used:
(a, b) means a and b are equivalent. G(x): x is a gold ornament
Which of the following first order logic S(x): x is a silver ornament
statement represents the following: P(x): x is precious
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 291
GATE QUESTION BANK DMGT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 292
GATE QUESTION BANK DMGT
CS - 2014
23. Consider the statement
“N ”
Predicate glitter (x) is true if x glitters and
predicate gold (x) is true if x is gold.
Which one of the following logical
formulae represents the above
statement?
(A) : ( )⇒ ( )
(B) : ( )⇒ ( )
(C) : ( ) ( )
(D) : ( ) ( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 293
GATE QUESTION BANK DMGT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 294
GATE QUESTION BANK DMGT
8. [Ans. A] ( ( ))
T m “N ( ( ) ( )) is the logical
” m “T m representation.
w ” which is
the same as 12. [Ans. D]
* ( ) ( )+ [ ( ( ))]
Which is choice (B)
[ ( ( ( ))]
Alternate solution
, x, ( ( u, v, ))]
We can translate the given statement
“N T ( )”
13. [Ans .C]
( ( ) ( ))
Consider ,( ( )) - , ( ) -
( ( ) ( ))
If ( ( )) is FALSE, then ( ) is
( ( ) ( ))
TRUE, and hence the entire statement is
( ( ) ( ))
TRUE. If ( ( )) is TRUE and
Which is choice (B)
,( ( )) - is TRUE, then is TRUE,
and hence the entire statement is TRUE.
9. [Ans. A]
When ( ( )) FALSE, then the
14. [Ans .B]
formula
( ) ( )
F: ( ( ) ( )) ( ( ( ))
& iv ( ( ))
( ( ( )))becomes TRUE. If
Clearly, choices i and iv are equivalent.
( ( )) TRUE and
ii ( ) ( )
( ( ) ( )) TRUE, then and iii , ( )- ( )
( ( )) TRUE, and Clearly ii & iii are not equivalent to each
∴ F TRUE. Hence formula F is valid. other or to i & iv.
11. [Ans. A]
“F w fsa, there exists a y
which is a pda and which is equivalent to
.”
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 295
GATE QUESTION BANK DMGT
16. [Ans. A]
~Q I : ⇒
~P
T
F
∴
Which corresponds , ⇒ -⇒
,( ) -⇒
T
F
, -⇒
)
̅̅̅̅̅̅̅̅̅̅̅̅
⇒
~P Q
T
F
F
( )
(
So I is incorrect inference
T
F
20. [Ans. C]
P Q
, ( ) ( )-
T
F
Q
F
P
, ( ) ( )- “C”
, ( ) ⇒ -
~Q
T
F
, ( ) ( )- Option “B”
, ⇒ ⇒ -
~P
T
F
, ( ) ( )-
, ( ) ⇒( ))-
17. [Ans. B]
(F( ))
22. [Ans. D]
( F( )), which means
None of my friends are perfect
there does not exist a person who can fool
i.e., All of my friends are not perfect
every one at all times.
((F( ) ( ))
(F( ) ( ))
18. [Ans. A]
(F( ) ( ))
The given statement reads,
P(x) is true whenever x is not 1 and for Alternatively
every y, if there is a z such that x = y*z, (F( ) ( )) gives there exist some of
then either x = y or y = 1 my friends who are perfect.
In other words, P(x) is true whenever x is (F( ) ( )) there does not exists
prime. any friend who is perfect i.e., none of my
friends are perfect.
19. [Ans. B] So (D) is correct.
Let p : It rains
q : cricket match will not be played 23. [Ans. D]
I : ⇒ (A) For all x, which glitter are not gold
(B) For all x, which are gold, glitter
∴ (C) There are few x, which are gold and
Clearly I is correct since it is in the form not glitter
of Modus Tollens (rule of contrapositive) (D) There are few x, which glitters and
not gold.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 296
GATE QUESTION BANK DMGT
So the representation is
)
T
T
T
T
T
T
T
F
( ( ) C ( ))
(
(
(
T
T
T
T
T
F
F
F
(
T
F
F
F
F
F
F
T
T
T
T
F
F
F
F
T
T
F
F
F
F
T
T
F
F
c
T
T
T
T
F
F
F
F
b
T
T
T
T
F
F
F
F
a
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 297
GATE QUESTION BANK DMGT
Combinatorics
CS - 2005 5. Suppose that the robot is not allowed to
1. What is the minimum number of ordered traverse the line segment from (4,4) to
pairs of non-negative numbers that (5,4). With this constraint , how many
should be chosen to ensure that there are distance paths are there for the robot to
two pairs (a, b) and (c, d) in the chosen reach (10,10)starting from (0,0)
set such that a ≡ c mod 3 and (A)
b ≡ d mod 5 (B)
(A) 4 (C) 16 (C) ( ) ( )
(B) 6 (D) 24 5
(D) ( ) ( ) ( )
5
2. Let G(x)=1/(1 x)2=∑ g(i) where
| | . What is g(i)?
CS - 2008
(A) i (C) i
Statement for Linked Answer Questions 6
(B) i + 1 (D)
&7
Let Xn denote the number of binary
CS - 2006
strings of length n that contain no
3. For each element in a set of size 2n, an
consecutive 0s.
unbiased coin is tossed. The 2n coins
6. Which of the following recurrences does
tosses are independent. An element is
Xn satisfy?
chosen if the corresponding coin toss
(A) Xn 2Xn1 (C) Xn X n/2 n
were head. The probability that exactly n
elements are chosen is (B) Xn Xn/2 1 (D) Xn Xn1 Xn2
( ) (C)
(A) ( )
7. The value of X5 is
( ) (D)
(B) (A) 5 (C) 8
(B) 7 (D) 13
CS - 2007
Statement for Linked Answer Questions 4 8. In how many ways can b blue balls and r
and 5 red balls be distributed in n distinct
Suppose that a robot is placed on the boxes?
( )( )
Cartesian plane. At each step is allowed to (A) ( ) ( )
move either one unit up or one unit right, ( ( ) )
(B)
i.e., if it is at (i, j) then it can move to ( )( )( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 298
GATE QUESTION BANK DMGT
1. [Ans. C]
( ) ( )
The number of pairs ( a mod 3, b mod 5 )
is 3 × 5 = 15
(since a mod 3 can be 0, 1, or 2 and ( )
b mod 5 can be 0, 1, 2, 3, or 4)
∴ If 16 ordered pairs are chosen at least 2 4. [Ans. A]
of them must have (a mod 3, b mod 5) the Each path from (0,0) to (10,10) consists
same (basic pigeon hole principle). of 20 steps which contains 10 horizontal
Let such two pairs be (a, b) and (c, d) moves and 10 vertical moves. The 10
then horizontal moves, we can choose in
a mod 3 c mod 3 ac mod 3 ways.
and b mod 5 d mod 5 bd mod 5
5. [Ans. C]
2. [Ans. B] The number of paths from (0,0)to (10,10)
( )
via the line segment from (4,4) to (5,4)
∑ = C(8,4).C(11,5)
( )
Put n = 2
6. [Ans. D]
∑
( ) There are only two possibilities for the
( ) strings counted by . First is that the
sequence ends in 1 and the second
( )
∑ possibility is that ending in 0. If a string
ends in 1, then the number of possibilities
( ) for the first bits such that there are
∑
no consecutive 0s is . If a n-bit string
ends in 0, then the (n 1) st bit must be 1
∑( ) and the number of possibilities for the
first n 2 bits such that there are no
consecutive 0s is .
∑(i )
∴ = 3.
(Since r is a dummy variable, r can be
replaced by i) 7. [Ans. D]
, 3, 5,
∑ g(i) , 3.
∴ g(i) i 8. [Ans. A]
The number of ways to distribute b blue
3. [Ans. A] balls in n distinct boxes is equal to the
The probability that exactly n elements number of solutions of the equation
are chosen b, which is
= the probability of getting n heads out distribution of the r red balls
2n tosses is . Since the distribution of red
( ) ( ) ( inomia fo mu a) balls and blue balls are independent, the
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 299
GATE QUESTION BANK DMGT
9. [Ans. 8]
Resu t : If ‘n’ is a powe of p ime
(n p ) then n has x + 1 factors (they
are ( p p p p ))
Result 2: Every number can be written as
product of powers of primes
(n p p p ) then by product rule
the no.of factors
=( )( ) ( )
The given number is 2014
2014 = 53
So the no. of integral factors
=( )( )( )
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 300
GATE QUESTION BANK DMGT
[ ]
b c d
Where a, b, c, d, e and f are real numbers
and abc ≠ . Under the matrix
multiplication operation, the set H is
(A) a group e
(B) a monoid but not a group The poset is
(C) a semigroup but not a monoid (A) not a lattice
(D) neither a group nor a semigroup (B) a lattice but not a distributive lattice
(C) a distributive lattice but not a
2. The set {1, 2, 4, 7, 8, 11, 13, 14} is a group Boolean algebra
under multiplication modulo 15. The (D) a Boolean algebra
inverses of 4 and 7 are respectively
(A) 3 and 13 (C) 4 and 13 6. Let A, B and C be non-empty sets and let
(B) 2 and 11 (D) 8 and 14 X=(A B) C and Y=(A C) (B C).
Which one of the following is TRUE?
3. Let R and S be any two equivalence (A) X=Y
relations on a non-empty set A. (B)
Which one of the following statements is (C)
TRUE? (D) none of these
(A) , are both equivalence 7. Let A be a set with n elements. Let C be a
relations collection of distinct subsets of A such
(B) is an equivalence relation that for any two subsets S1 and S2 in C,
(C) is an equivalence relation either S1 S2 or S2 S1 . What is the
(D) Neither nor is an equivalence maximum cardinality of C?
relation (A) n (C)
(B) n+1 (D) n!
4. Let f:B C and g:A B be two functions
and let h=f o g . Given that h is an onto 8. Let f be a function from a set A to a set B, g
function. Which one of the following is is a function from B to C, and h is a
TRUE? function from A to C, such that
(A) f and g should both be onto functions h(a)= g(f(a)) for all a ϵ A. Which of the
(B) f should be onto but g need not be following statements is always true for all
onto such functions f and g?
(C) g should be onto but f need not be (A) g is onto h is onto
onto (B) h is onto f is onto
(D) both f and g need not be onto (C) h is onto g is onto
5. The following is the Hasse diagram of the (D) h is onto f and g are onto
poset [{a, b, c, d, e}, ≺]. CS - 2006
9. Given a set of elements N=* , ,……,n+ and
two arbitrary subsets A ⊆ N and B ⊆ N,
how many of the n! permutations π from
N to N satisfy min ,π(A)-= min ,π(B)-,
where min (S) is the smallest integer in
the set of integers , and π( ) is the set of
integers obtained by applying
permutation π to each element of ?
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 301
GATE QUESTION BANK DMGT
11. Let X, Y, Z be sets of sizes x, y and z 17. For the set N of natural numbers and a
respectively. Let W=X Y and E be the binary operation f: N×N N, an element
set of all subsets of W. The number of z ϵ N is called an identity for f,
functions from Z to E is if f(a, z) = a = f(z, a), for all a ϵ N. Which
(A) (C) of the following binary operations have
(B) Z (D) an identity?
(I) f(x, y) = x + y – 3
12. A relation R is defined on ordered pairs of (II) f(x, y) = max(x, y)
integers as follows (III) f(x, y) = xy
(x, y) R (u, v) if x<u and y>v. Then R is (A) I and III only
(A) Neither a partial order nor an (B) II and III only
Equivalence Relation (C) I and II
(B) A Partial order but not a Total order (D) None of these
(C) A Total Order
(D) An Equivalence Relation CS - 2007
18. How many different non-isomorphic
13. The set {1, 2, 3, 5, 7, 8, 9} under Abelian groups of order 4 are there?
multiplication modulo 10 is not a group. (A) 2 (C) 4
Given below are four possible reasons. (B) 3 (D) 5
Which one of them is false?
(A) It is not closed 19. Consider the set S={a, b, c, d}. Consider
(B) 2 does not have an inverse the following 4 partitions , , ,
(C) 3 does not have an inverse on
(D) 8 does not have an inverse ̅̅̅̅̅̅}, π = {ab
: π1={abcd ̅̅̅, cd
̅̅̅}, π = {abc
̅̅̅̅̅, d̅},
14. Let E, F and G be finite sets.
̅ ̅
π = *a̅, b, c̅, d+
Let = (E F) (F G) and Let be the partial order on the set of
Y = (E – (E G)) (E – F ). partitions ’= (π , 2 3 , 4 ), defined
Which one of the following is true ? as follows: πi πj if and only if πi
(A) refines πj . The poset diagram for ( , )
(B) ⊃ is
(C) X = Y
(D) X – ≠ ∅ and – ≠ ∅
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 302
GATE QUESTION BANK DMGT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 303
GATE QUESTION BANK DMGT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 304
GATE QUESTION BANK DMGT
34. Let S denote the set of all functions Which one of the following is CORRECT?
* , + * , +. Denote by N the (A) P, Q and R are true
number of functions from S to the set (B) Only Q and R are true
{0,1}. The value of log log is ______. (C) Only P and Q are true
35. A non-zero polynomial f(x) of degree 3 (D) Only R is true
has roots at x = 1, x = 2 and x =3. Which
one of the following must be TRUE? 39. There are two elements x, y in a group
(A) f( )f( ) (G,∗) such that every element in the group
can be written as a product of some
(B) f( )f( )
number of x's and y's in some order. It is
(C) f( ) f( ) known that
(D) f( ) f( ) ∗ = ∗ = ∗ ∗ ∗ = ∗ ∗ ∗
=
36. Consider the following relation on subsets Where e is the identity element. The
of the set of integers between 1 and 2014. maximum number of elements in such a
For two distinct subsets U and V of S we group is ____.
say U<V if the minimum element in the
symmetric difference of the two sets is in
U.
Consider the following two statements:
S1: There is a subset of S that is larger
than every other subset.
S2: There is a subset of S that is smaller
than every other subset.
Which one of the following is CORRECT?
(A) Both S1 and S2 are true
(B) S1 is true and S2 is false
(C) S2 is true and S1 is false
(D) Neither S1 nor S2 is true
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 305
GATE QUESTION BANK DMGT
3. [Ans. C] b c d
R S is an equivalence relation as can be
[{a, b, c, d, e+,≺-
seen from proof given below.
Let xA (x, x)R and (x, x)S(since R
e
and S are reflexive)
(x, x)R S also.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 306
GATE QUESTION BANK DMGT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 307
GATE QUESTION BANK DMGT
16. [Ans. B]
E F ( )
U
F G
= (E (E G)) (E F)
= (E (E G)) (E F)
E F
( )
(shaded)
E F
G E G
So X=Y
Or alternatively the solution can be
obtained ( )
From Boolean algebra as follows:
= (E F) (F G)
= EF FG
= EF (FG) Now
= EF (F G) ( )is
= EFF EFG
= EFG
imilarly, = (E (E G)) (E F)
= (E EG) (E F )
= E (EG) EF
= E (E G ) EF , EE = -
= EG EF
= EG (EF )
= EG (E F) And
= EE G EFG
= EFG
X=Y
15. [Ans. D]
=
*n| n 3,
n is divisinle by either , 3 or 5+
The number of elements divisible 2 and 3
must be in a multiple of 6
i.e., 6, , 8, , 3 , …..
The no. of such elements = =
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 308
GATE QUESTION BANK DMGT
And Now ( ) ( ) =?
( ) ( )
=
… . . (A)
And
And is
( ) ( )
… . . (B)
17. [Ans. C]
Now ( ) ( )= f: N N N
If f (a, z) = a = f(z, a) then on element
z N is called the identity
(i). f(x, y) = x y 3 Now f(a, y) = a y 3
f(y, a ) = y + a 3
Clearly f(a, y) = a = f(a, y)for y = 3 and a N
(ii). f(x, y) = max (x, y)
Now f(a, y) = max(a, y)
( )= and f(y, a) = max(y, a)
If we take y = 1 then f(y, a) = f(a, y) = a
always
The identity exists
(iii). f(x, y) = x f(a, y) = a
f(y, a) = y no identity is there but
f(a, y) ≠ f(y, a )for all a N
‘C’ is correct
18. [Ans. A]
And = Let G = {e, a, b, c} be an Abelian group of
order 4, where e is the identity element and
∙ is the group operation. ince the order of
each element divides the order of the
group, ord (a), ord (b) and ord (c) can be
either 2 or 4. If any of the orders is 4 then
the group is cyclic and hence isomorphic to
(the group {0, 1, 2, 3} under addition
modulo 4).
Otherwise, if ord (a) = ord (b) = ord (c) = 2,
then a ∙ a = b ∙ b = c ∙ c = e.
a ∙ b can only be c and similarly
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 309
GATE QUESTION BANK DMGT
23. [Ans. A]
The remaining 3 sets are functionally
π complete
Which is choice (C).
24. [Ans. D]
20. [Ans. B] Let
Let S be a set of n elements say A=( ) ( )
* , , 3,……., n+. Now the smallest = .( ) ( )/ ( )
equivalence relation on S must contain all
the reflexive pairs *( , ), ( , ), (3, 3) …., = ( ) , = U]
(n, n)} and its cardinality is therefore n. = U.
The largest equivalence relation on S is
S × S, which has cardinality n × n = n . 25. [Ans. A]
The largest and the smallest equivalence a
relations on S have cardinalities n and n
respectively. The correct choice is (B).
b
21. [Ans. D] c
It can be seen that ( , ) if and only if
the decimal digit of b at the 10th place is d
greater than or equal to that corresponding It is a lattice because for each pair
to , ≥ . This follows from the fact that supremum and infimum exists
% returns the decimal digit at unit’s a
place and truncates the digit at the
unit’s place.
b c
The rule % % specifies that the
decimal digit of b at the unit’s place must
be decimal digit of b at the unit’s place d
must be greater than or equal to that of a.
The rule ( , ) respectively
specifies this rule for all the other digit
e
positions.
Hence, only (145, 265) and (0, 153) P. is not a lattice because lub (e, d) does not
exist (b and c are not comparable).
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 310
GATE QUESTION BANK DMGT
a 27. [Ans. A]
Group properties are closure, associativity
existence of identity and existence of
b c inverse for every element. Commutativity
is not required for a mathematical
structure to a group.
d e 28. [Ans. D]
Given, R={(x, y),(x, z),(z, x),(z, y)} on the set
{x, y, z}, here (x, y) R but x = z (y, x) R.
f is not symmetric.
is not a lattice since lub (e, d) does not Also (x, z) R and (z, x) R.
exist. is not antisymmetric.
R is neither symmetric nor anti-symmetric.
a
29. [Ans. A]
{S, *} is a group. To be a ring, an integral
c domain, or a field, there must be two
b
binary operations.
d 30. [Ans. C]
e
Let S be a set of n elements. A relation
is a lattice since every pair has lub as well R S×S is reflexive if (r, r) R r S.
as glb. Each of the remaining elements of S×S may
or may not be present in R. Hence the
26. [Ans. C]
number of reflexive relations on S is .
If an element is a generator, all the
When n = 5, the answer is .
elements must be obtained as powers of
that element. 31. [Ans. C]
Try a, b, c, d one by one to see which are Let n = 2. There are only 2 onto functions
the generators. as shown below:
a=a A B
a = a. a = a
a = a. a = a. a = a and so on. a
a is not the generator.
b=b
b = b. b = a b
b = b. b = b. a = b
b = b. b = b. b = a and so on
b is not the generator A B
c=c
c = c. c = b a
c = c. c = c. b = d
c = c. c = c. d = a
Since all of a, b, c, d have been generated as b
powers of c,
c is a generator of this group.
Similarly For n = 2
d=d Option (A) = =
d = d. d = b Option (B) = =3
d = d. d = d. b = c Option (C) = =
d = d. d = d. c = a Option (D) ( )= ( )=
d is the other generator. So only the option (C) gives the correct answer.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 311
GATE QUESTION BANK DMGT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 312
GATE QUESTION BANK DMGT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 313
GATE QUESTION BANK DMGT
Graph Theory
CS – 2005 CS - 2006
1. Let G be a directed graph whose vertex set Common Data for Questions 4, 5, 6:
is the set of numbers from 1 to 100. There The vertices of a graph G correspond
is an edge from a vertex i to a vertex j iff to all subsets of a set of size n, for n 6.
either j = i + 1 or j = 3i. The minimum Two vertices of G are adjacent if and only
number of edges in a path in G from if the corresponding sets intersect in
vertex 1 to vertex 100 is: exactly two elements.
(A) 4 (C) 23 4. The number of vertices of degree zero in
(B) 7 (D) 99 G is
(A) 1 (C) n +1
2. Let G be a simple connected planar graph (B) n (D)
with 13 vertices and 19 edges. Then, the
number of faces in the planar embedding 5. The maximum degree of a vertex in G is
of the graph is (A) ( ) (C)
(A) 6 (C) 9 (B) (D)
(B) 8 (D) 13
6. The number of connected components in
3. Which one of the following graphs is NOT G is
planar? (A) n (C)
( )
(B) n +2 (D)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 314
GATE QUESTION BANK DMGT
CS - 2010
14. The degree sequence of a simple graph is
the sequence of the degrees of the nodes
in the graph in decreasing order. Which of
the following sequences cannot be the
degree sequence of any graph?
I. 7, 6, 5, 4, 4, 3, 2, 1
II. 6, 6, 6, 6, 3, 3, 2, 2
III. 7, 6, 6, 4, 4, 3, 2, 2
IV. 8, 7, 7, 6, 4, 2, 1, 1
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 315
GATE QUESTION BANK DMGT
( ) ( ) CS – 2014
23. Let G=(V,E) be a directed graph where V
is the set of vertices and E is the set of
edges. Then which one of the following
graphs has the same strongly connected
( ) components as G ?
( ) ( )
(A)
*( ) ( ) +
(B) ( )
*( ) ( ) +
(C) ( )
19. Let G be a complete undirected graph on
6 vertices. If vertices of G are labeled, then *( )
the number of distinct cycles of length 4 }
in G is equal to (D) ( ) is the set of
(A) 15 (C) 90 vertices in
(B) 30 (D) 360
24. Consider the direct graph given below
CS - 2013
20. Which of the following statement is/are P Q
TRUE for undirected graphs?
P: Number of odd degree vertices is even.
Q: Sum of degrees of all vertices is even
(A) P only
(B) Q only R S
(C) Both P and Q
(D) Neither P nor Q Which one of the following is true?
(A) The graph does not have any
21. Consider an undirected random graph of topological ordering
eight vertices. The probability that there (B) Both PQRS and SRQP are topological
is an edge between a pair of vertices is
ordering
1/2. What is the expected number of
unordered cycles of length three? (C) Both PSRQ and SPRQ are topological
(A) 1/8 (C) 7 ordering
(B) 1 (D) 8 (D) PSRQ is the topological ordering
22. The line graph L(G) of a simple graph G is 25. Consider an undirected graph G where
defined as follows: self-loops are not allowed. The vertex set
There is exactly one vertex v(e) in of G is
L(G) for each edge e in G. *( ) +. There is
For any two edges e and e' in G, L(G) an edge between (a, b) and (c, d)
has an edge between v(e) and v(e'), if b .T b
and only if e and e' are incident with of edges in this graph is __________.
the same vertex in G.
Which of the following statements is/are 26. An ordered n tuple ( ) with
TRUE? is called graphic if there
P. The line graph of a cycle is a cycle. exists a simple undirected graph with n
Q. The line graph of a clique is a clique. vertices having degrees
R. The line graph of a planar graph is planar. respectively. Which of the following
S. The line graph of a tree is a tree. 6-tuples is NOT graphic?
(A) P only (A) (1, 1, 1, 1, 1, 1)
(B) P and R only (B) (2, 2, 2, 2, 2, 2)
(C) R only (C) (3, 3, 3, 1, 0, 0)
(D) P, Q and S only
(D) (3, 2, 1, 1, 1, 0)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 316
GATE QUESTION BANK DMGT
2 1 1
2
2 2
2 1
1 1
2 2
32. L δ
vertex in a graph. For all planar graphs
δ
following is TRUE?
(A) In any planar embedding, the
number of faces is at least
(B) In any planar embedding, the
number of faces is less than
(C) There is a planar embedding in
which the number of faces is less
than
(D) There is a planar embedding in
which the number of faces is at most
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 317
GATE QUESTION BANK DMGT
6. [Ans. B]
The number of connected components
in G is determined by the degree of
vertices and edges of vertices. There are
vertices whose degree is zero, so
4. [Ans. C] they can form connected
The vertices of degree zero are vertex
components. The remaining vertices of
corresponding to the empty set, and those
the graph G are all connected as a single
corresponding to the singleton sub-sets of
component. So the total number of
the given set of n elements. Hence the
number of vertices of degree 0 is n + 1. connected component is .
7. [Ans. C]
5. [Ans. C]
The shortest distance between two
L b S * 4 . +
vertices u and v whose corresponding
Consider a subset containing 2 elements
bit strings are at hamming distance d is
of the form {1, 2}. Now {1, 2} will be
adjacent to any subset with which it has of length d. Hence, the diameter of G is
exactly 2 elements in common. These sets n. Also, since all the paths between any
can be formed by adding zero or more two given vertices are all of odd length
elements from remaining n 2 elements and are all of even length, we get that
to the set {1, 2}. Since each of these the chromatic number of G is 2. Hence
elements may be either added or not the required ratio is .
added, number of ways of making such
sets containing 1 and 2 is . 8. [Ans. A]
∴ The vertices with 2 elements will have Any k regular graph for k (even no)
degrees. Eulerian circuit because we have a result
Now consider the subsets of 3 elements y “
say {1, 2, 3}
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 318
GATE QUESTION BANK DMGT
every vertex has even degree, then it has (B) Complete graph on 90 vertices does
” not contains Euler circuit, because
And since k – regular graph where k-even every vertex has odd degree odd(89)
number is connected and every vertex is (C) The complement of a cycle on 25
of even degree ∴ Option (A) is correct vertices must contain Euler circuit,
where of each vertex is even (22)
9. [Ans. B]
K5 and are the smallest non planar 13. [Ans. A]
graphs. K5 has 5 vertices and = 10 If a n-vertex simple connected graph
contains no cycles of odd length, then its
edges and has 6 vertices and
chromatic number is two. Since the
edges. So, the non planar graph
vertices can be alternately colored with
with the minimum number of edges is
the first color, the second color, then the
with 9 edges and 6 vertices.
first color and the second color and so on.
Note: K5 is the non planar graph with the
Alternatively, since a simple connected
minimum number of vertices.
graph with no cycles of odd length must
10. [Ans. B] be bipartite, and since the chromatic
number of bipartite graph is always 2 (in
b b
a c a bipartite graph each partition requires
one color there are no edges within a
partition of a bipartite graph and there
d
are only two partitions).
14. [Ans. D]
e
The length of a degree sequence gives the
Let us try to color the graph with two number of vertices in the corresponding
colors. graph. All the given sequences have
From the path (a, b, c, d, e), we see that a length equal to 8, since graphs are simple,
and e must be colored with the same no vertex can have degree more than 7.
color. But this is not possible since there ∴ The sequence 8, 7, 7, 6, 4, 2, 1, 1 is not
is an edge between a and e. It is easy to possible.
see that 3 colors sufficient. A pattern of A vertex can have degree 6 when it is
coloring is given and we can observe that connected to every other, except one.
the chromatic number of the given graph When there are four vertices of degree six
is 3. each, then there are at most two vertices
of degree two each (if no vertex is of
11. [Ans. D] degree 1), in which case other vertices
A connected graph has an Euler circuit if are of degree at least 4. Hence the
and only if every vertex is of even degree. sequence 6, 6, 6, 6, 3, 3, 2, 2 cannot be
A K-regular graph has all vertices of possible.
degree K each. Hence if K is even, a The other two sequences are possible.
connected K-regular graph has an Euler
circuit. 15. [Ans. C]
Given, ( ) = i d = Sum of degrees
d
d
12. [Ans. C]
Whenever in a graph of vertices have By handshaking lemma, ( )
even degrees, it will surely have an Euler where, is the number of edges in G.
circuit. If S and T are two trees with (S) (T).
(A) Since in a k-regular graph, every
vertex has exactly k degrees and if k
is even, every vertex in the graph has In a tree, S and T
even degrees. k-regular graph need Where |S| is the number of vertices of
not be connected, hence k-regular tree S and |T| is the number of vertices of
graph may not contain Euler circuit tree T.
∴ S T S T
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 319
GATE QUESTION BANK DMGT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 320
GATE QUESTION BANK DMGT
A B ( 1, 1, 1, 1) ( 1, 1)
In G the number of strongly connected
( 0, 0)
components are 2 ,where as in it is (1, 1)
only one.
Got all zeros so graphic
24. [Ans. C]
PQRS is not a topological ordering Option (B)
because no edge is there from Q to R
( 2, 2, 2, 2, 2, 2) ( 1, 1, 2, 2, 2)
PSRQ and SPRQ are topological
ordering because ( 1, 1, 1, 1)
( 2, 2, 2, 1, 1)
S Q and
Q exits ( 1, 1,)
( 1, 1, 1, 1)
b y y ( 0, 0)
(1, 1)
25. [Ans. 506]
Given vertex set is Got all zeros so graphic
V = {(i, j)|1 } Option (C)
Imagine vertex set as a matrix as follows 2 2 0
(3, 3, 3, 1, 0, 0) (2, 2, 0, 0, 0)
( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( ) ( ) 1
( ) ( ) ( ) ( ) ( ) ( ) (2, 2, 0, 0, 0) (1, 0, 0)
( ) ( )
( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( ) ( ) Got negative number. So it is not graphic
( ) ( ) ( ) ( ) ( ) ( )
Option (C) is correct
[ ( ) (4) ]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 321
GATE QUESTION BANK DMGT
27. [Ans. 36] group is not equal to given group. Thus the
Max no.of edges in bipartite graph on n order cannot be 3 or 5. Hence it is 5.
vertices is given by ⌊ ⌋
31. [Ans. C]
If G is a tree with n vertices then
. ⌊ ⌋
4 no.of edges = n – 1
If G is forest (collection of trees) with k
28. [Ans. 5] connected components then the edges
Result 1: In a cycle graph = n – k.
no.of vertices = n, edges = n ∴Option (C) is correct
Result 2: If a graph G is isomorphic to its
( ) 32. [Ans. A]
complement then E(G) =
( ) By Euler formula
S
.( )
4=n–1 By Hand shaking theorem.
n=5
∑ ( )
29. [Ans. 6] δ
In graph portion δ .
δ
2 1
, δ -
2 2 From (1) we have
Two ST are possible f=2+e–v
2 1 =2+e–n
2 2 2
And in subgraph
∴ So no. of faces is atleast
2
Option (A)is answer
2 1
1
2
Three ST possible
2
1 1 1 1
1 2 1 2
So these two sub graphs are divided by only
single edge
So total no. of ST
30. [Ans. 5]
L ’
subgroup divides order of group.
3, 5, 15 can be the order of subgroup in this
problem since there are 4 elements and the
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 322
GATE QUESTION BANK DBMS
ER Diagrams
CS – 2005 (A) Person
1. Let and be two entities in an ER (B) Hotel Room
diagram with simple single-valued (C) Lodging
attributes. R1 and R2 are two relationships (D) None of these
between and , where R1 is
one-to-many and R2 is many-to-many. R1 CS - 2008
and R2 do not have any attributes of their Linked Answer Questions 4 & 5
own. What is the minimum number of Consider the following ER diagram
tables required to represent this situation
in the relational model?
(A) 2 (C) 4
(B) 3 (D) 5
2. The following table has two attributes A 4. The minimum number of tables needed to
and C where A is the primary key and C is represent M, N, P, R1, R2 is
the foreign key referencing A with (A) 2 (C) 4
on-delete cascade. (B) 3 (D) 5
A C
2 4 5. Which of the following is a correct
3 4 attribute set for one of the tables for the
4 3 correct answer to the above question?
5 2 (A) {M1, M2, M3, P1}
7 2 (B) {M1, P1, N1, N2}
9 5 (C) {M1, P1, N1}
6 4 (D) {M1, P1}
The set of all tuples that must be
additionally deleted to preserve CS - 2012
referential integrity when the tuple (2, 4) 6. Given the basic ER and relational models,
is deleted is: which of the following is INCORRECT?
(A) (3,4) and (6,4) (A) An attributes of an entity can have
(B) (5,2) and (7,2) more than one value
(C) (5, 2) (7, 2) and (9, 5) (B) An attribute of an entity can be
(D) (3, 4) (4, 3) and (6, 4) composite
(C) In a row of a relational table, an
3. Consider the entities ‘hotel room’, and attribute can have more than one
‘person’ with a many to many relationship value
‘lodging’ as shown below: (D) In a row of a relational table, an
attribute can have exactly one value
HotelRoom Lodging Person or a NULL value
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 323
GATE QUESTION BANK DBMS
1. [Ans. B] 4. [Ans. B]
1: N M, P ⟶ Entity sets, will become tables
N ⟶ Weak Entity set, will become a table
R1 ⟶ Relationship set with cardinality
E1 E2 N:1, will not be a table
R2 ⟶ Identifying Relationship set, will
not be a table
Total No of tables = 3
N: N
1) M=(M1, M2, M3, P1)
E1, E2 are entities will become tables 2) P =(P1, P2)
Relationship with cardinality 1:N 3) N =(N1, P1, N2)
will not be a table
[Primary key of 1- side [E1] will be 5. [Ans. A]
included as foreign key of N – side [E2]] The correct attribute set is
Relationship with cardinality N:N {M1, M2, M3, P1}
will become a table.
Total No of tables = 3 = {E1, E2, } 6. [Ans. C]
⟶ An attribute of an Entity can be atomic,
2. [Ans. C] Multi-valued, and composite.
A rimary key Parent column ⟶ An attribute (or) column of a table
C Foreign key Child column must take exactly one value (or) a NULL
“C” refers to “A” O -DELETE CASCADE, value.
when parent gets deleted, all Option A ⟶Correct, Multivalued
corresponding child rows will be deleted Attribute
automatically. Option B ⟶Correct, Composite Attribute
(2, 4) is deleted [Parent =2] (5, 2) and Option C ⟶Incorrect, since column
(7, 2) will get deleted cannot take multiple values
(5, 2) is deleted [Parent = 5] (9, 5) will Option D ⟶ Correct, column in a table
get deleted takes single value (or) NULL.
(9, 5) is deleted [Parent = 9] no child
rows for parent = 9
(7, 2) is deleted [Parent = 7] no child
rows for parent = 7
Total no. of parents deleted = {2, 5, 9, 7}
Total no. of rows deleted
= {(5, 2), (7, 2), (9, 5)}
3. [Ans. C]
“rent payment” is a descriptive attribute,
because it is related to the Lodging
Relationship.
“rent ayment” neither belongs to
Hotel Room nor to a Person Entity Sets.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 324
GATE QUESTION BANK DBMS
CS – 2005 CS - 2006
1. Which-one of the following statements 5. The following functional dependencies
about normal forms is FALSE? are given:
(A) BCNF is stricter than 3NF AB→ CD, AF →D, DE→ F, C →G, F→ E,
(B) Lossless, dependency-preserving G→ A
decomposition into 3NF is always Which one of the following options is
possible false?
(C) Lossless, dependency-preserving (A) {CF}+ = {ACDEFG}
decomposition into BCNF is always (B) {BG}+ = {ABCDG}
possible (C) {AF}+ = {ACDEFG}
(D) Any relation with two attributes is in (D) {AB}+ = {ABCDG}
BCNF
6. Consider a relation R with five attributes
2. Consider a relation scheme V, W, X, Y and Z. The following functional
R= (A, B, C, D, E, H) on which the dependencies hold:
following functional dependencies hold: VY → W, WX → Z, and ZY → V. which of
*A→ B, BC →D, E →C, D →A+. What are the the following is a candidate key for R?
candidate keys of R? (A) VXZ (C) VWXY
(A) AE, BE (B) VXY (D) VWXYZ
(B) AE, BE, DE
(C) AEH, BEH, BCH CS - 2007
(D) AEH, BEH, DEH 7. Which one of the following statements is
FALSE?
3. A table has fields F1, F2, F3, F4, F5 with (A) Any relation with two attributes is in
the following functional dependencies BCNF.
F1 → F3; F2 → F4; (F1. F2) → F5 (B) A relation in which every key has
In terms of Normalization, this table is in only one attribute is in 2NF.
(A) 1 NF (C) 3 NF (C) A prime attribute can be transitively
(B) 2 NF (D) None of these dependent on a key in a 3NF relation.
(D) A prime attribute can be transitively
4. In a schema with attributes A, B, C, D and dependent on a key in a BCNF
E following set of functional dependencies relation.
are given
8. Consider the following implications
A B
relating to functional and multivalued
A C
dependencies given below, which may or
CD E
may not be correct.
B D
E A i) If A B and A C then A → BC
Which of the following functional ii) If A→B and A→C then A BC
dependencies is NOT implied by the iii) If A BC and A →B and A → C
above set? iv) If A →BC and A B and A C
(A) CD AC (C) BC CD Exactly how many of the above
(B) BD CD (D) AC BC implications are valid?
(A) 0 (C) 2
(B) 1 (D) 3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 325
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 326
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 327
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 328
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 329
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 330
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 331
GATE QUESTION BANK DBMS
depositor relations are much bigger than IV. Select R.a, R.b
the branch relation. from R, S
Consider the following query: Where R.c = S.c
∏c-name b-city= “Agra” ∧ al<0 (branch Which of the above queries are
(account depositer))) equivalent?
Which one of the following queries is the (A) I and II (C) II and IV
most efficient version of the above (B) I and III (D) III and IV
query?
(A) c-name bal< 0 b-city = “Agra” branch CS - 2010
account) depositer) 10. The following functional dependencies
(B) c-name b- ity = “Agra” branch hold for relations R(A, B, C) and
bal< 0 account depositer)) S(B, D, E):
(C) c-name b- ity = “Agra” branch B A,
b- ity = “Agra” ∧ al< 0 account A C
depositer) The relation R contains 200 tuples and
(D) c-name b- ity = “Agra branch the relation S contains 100 tuples. What
b- ity = “Agra” ∧ al< 0 account is the maximum number of tuples
depositer)) possible in the natural join R S?
(A) 100 (C) 300
CS - 2008 (B) 200 (D) 2000
8. Let R and S be two relations with the
following schema CS - 2011
R(P,Q,R1, R2, R3) 11. Consider a relational table r with
S(P,Q ,S1, S2) sufficient number of records, having
attributes A1, A2…… An an let 1 ≤ p ≤ n
Where {P,Q} is the key for both schemas.
Two queries Q1 and Q2 are given below.
Which of the following queries are
Q1: π …… ( )
where c is a
equivalent?
I. R S constant
II. R (S) Q2: π …… ( )
where and
III. P( R ∩ (S)) are constants. The database can be
IV. P( (R) ( P,Q (R) (S))) configured to do ordered indexing on A
(A) Only I and II or hashing on A . Which of the following
(B) Only I and III statements is TRUE?
(C) Only I, II and III (A) Ordered indexing will always
(D) Only I, III and IV outperform hashing for both queries
(B) Hashing will always outperform
CS - 2009 ordered indexing for both queries
9. Let R and S be relational schemes such (C) Hashing outperform ordered
that R={a, b, c} and S={c}. Now consider indexing on Q1, but not on Q2
the following queries on the database: (D) Hashing will outperform ordered
I. πR-S (r) πR-S πR-S(r) × indexing on Q2, but not on Q1
s πR-S,S (r))
II. {t|t ϵ πR-S (r) ∧ ∀uϵs ∃vϵr CS - 2012
(u = v[s] ∧ t = v [R S]))} 12. Suppose R (A,B) and R (C,D) are two
III. {t|t ϵ πR-S (r) ∧ ∀vϵr ∃uϵs relation schemas. Let r and r be the
(u = v[s] ∧ t = v [R S]))} corresponding relation instances. B is a
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 332
GATE QUESTION BANK DBMS
foreign key that refers to C in R . If data size(r(R))<size(s(S)), the join will have
in r and r satisfy referential integrity fewer number of disk block accesses if
constraints. Which of the following is (A) relation r(R) is in the outer loop.
ALWAYS TRUE? (B) relation s(S) is in the outer loop.
(A) r r = (C) join selection factor between r(R)
(B) r r = and s(S) is more than 0.5.
(C) r = r (D) join selection factor between r(R)
(D) r r ≠ and s(S) is less than 0.5.
1. [Ans. C] 1 2 1
4 4 2
Relation =R(A, B, C, D) 3 stu info 3 enroll enroll
r = R
r = r
As e omposition of “R” into “r and r ” is
Selects only
LOSSY ⇒ Spurious tuples will e generate
girls students
s = r ∗ r Natural Join]
Will get “r” + spurious tuples Assumes that all girl students
⇒ “r” is a proper su set of “s” [r ⊂ s] joined in all courses
It selects the course ID in which only a proper subset
2. [Ans. A] of girl students are enrolled.
It consider only pairs of tuples that have the Stu i
1
same value on R. Step: 1 stu info =
2
3
3. [Ans. D] Step: 2
All given relational query language have the stu info enroll
same expressive power. = Stud ID Course ID
1 MCA ×
4. [Ans. B] 1 MBA ×
Every Course Must e taken y at least 2 MCA ×
one male and at least one female student. 2 MBA ×
Let us assume there are only 2 courses 3 MCA ×
3 MBA
{MCA, MBA}
Step: 3 Step(2) enroll
MCA Course opte y all girls + 1-boy
= Stud ID Course ID
[3girls + 1-boy]
3 MBA
MBA Course opted by 2 girls + 1-boy Step: 4 (step.3)=MBA, course in
[2girls + 1-boy] whi h “proper su set of female stu ents are
Let total no of students = 5, enrolled”.
where 3 girls 2-boys.
{A, B, C} girls 5. [Ans. C]
{D, E} Boys employee (name, sex, supervisor name)
Student info Enroll Foreign key
Stud Name sex Stud Course
{e. name|Employee e ˄ ∀x
id id id
1 A F 1 MCA [ employee (x) ˅
2 B F 2 MCA x. supervisor name # e. name ˅
3 C F 3 MCA x. sex= “Male”]}
4 D M 4 MCA we are using 2 tuple variables
5 E M 1 MBA e free tuple varia le referring employee
2 MBA x Bounded tuple variable referring all the
5 MBA subordinates of the selected free tuple
varia le “e”
Finally the formulae ∀x F verifying
whether all the subordinates of the
particular employee are males (or) not.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 334
GATE QUESTION BANK DBMS
z M a 2 R S = 1 1 = 1
b M 2 2 2
u F b
P Q P
v M b 3 ( R ∩ s )= 1 a = 1
1) If e name = a then x ={x y z} “a” will e
selected, since all his subordinates are 4 ( R ( R S ))
Males. P Q P
= = 1
2) If e name = then x={u v} “ ” will not be 1 a
selected, since all his subordinates are ⇒ Queries (1),(3) and (4) are equivalent,
NOT Males. because they all are operating on complete
⇒ Query returns the names of employees key (PQ). Where are Query (2) considering
with no immediate female subordinates. only part of key (P), hence it is different.
6. [Ans. D] 9. [Ans. C]
Given: II and IV are equivalent.
There are 100 tuples
These are uniformly distributed, in the 10. [Ans. A]
interval [0,500] R (A, B, C) and S (B, D, E)
So for values A≤100 There will e 200 F= Set of FD’s = {B A A C}
tuples returned by the given selected query. ⇒ “B” is the key for R A B C
R S
7. [Ans. B] A B C =200rows B D E =100rows
b - Schema = (b-name, b-city, assets)
a - Schema = (a-num, b-name, bal) Key = B
d - Schema = (c-name, a-number) Parent table = R Child table = S
∧
Parent column =B Child column = B
( ran h a ount epsitor )
Max rows of R S
Most efficient version of this query.
= Max always from the child table only.
( ran h
= 100 rows
a ount epositor ) 100 rows 200 rows
Employee Dept
eno ename dno dno dname
8. [Ans. D]
1 D1 D1
R (P, Q, R1, R2, R3)
2 D1 D2
S (P, Q, S1, S2) : :
Key= P+Q for oth ta les omposite key 100 D20 D200
Let us consider the following instances:- Child table = Primary key =
Employee foreign dno
key = dno parent table =
Dept
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 335
GATE QUESTION BANK DBMS
⇒ Emp Dept ⇒ Maximum rows Let r(A,B,C) = 30,000 rows 25 rows fit in
= All Employee = 100 rows. 1-block Total Blocks required for
⇒ Maximum rows of natural join = Total no. “r” = 1200 lo ks
of rows from child table. S(C,D,E) = 60,000 rows 30 rows fit in 1-
block Total Blocks reqd for
11. [Ans. C] “s” =2000 lo ks
If records are accessed for a particular value If' “r” is use as the outer relation:-
from table, hashing will do better. If records “r” requires 30000/25 = 1200 lo ks of
are accessed in a range of values, ordered storage and s requires
indexing will perform better. (60000/30) = 2000 blocks of storage. The
formula for number of block accesses is
12. [Ans. A] (nr bs + br) i.e. 30000 2000+1200 =
R AB 60,001,200 disk accesses are required for a
R CD nested loop join.
B is a foreign key & referring to C & C is a If “s” is use as the outer relation:-
candidate key. The formula for number of block accesses is
So, r r = (ns br + bs) i.e. 60000 × 1200+2000 =
72,002,000.
13. [Ans. A] So the numbers of block accesses are less if
Find the distinct names of all students who “r” is use outsi e
score more than 90% in the course no. 107
1. SQL query 15. [Ans. A]
Condition would give all s.name having π (π ( ( r )))
score > 90 and attending course no. 107
and DISTINCT S.sname will give distinct =π ∧ r
student names π (π ( ( r )))
TRUE
2. Relational algebra =π ( ∧ r )
gives projection of all students
meeting the on ition an ‘ ’ gives 16. [Ans. D]
DISTINCT value Every employee has at least one
TRUE dependent.
3. Tuple calculus gives DISTINCT student EMPLOYEE
name having score > 90 and course no is empId empName empAge
107 1 A 50
2 B 60
TRUE
3 C 70
4. Domain calculus
Domain calculus is equivalent to
DEPENDENT
relational algebra and provide distinct
depId eId depName depAge
value for the query D1 1 X 30
TRUE D2 1 Y 40
D3 2 Z 50
14. [Ans. A] D4 2 U 80
As Size(r(R)) < Size (s(S)), let us consider D5 3 V 90
the following illustration D6 3 W 100
Consider these relations with the following Empi =1 An employee having 2 younger
properties: dependents [empAge > depAge]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 336
GATE QUESTION BANK DBMS
returns {2 3}
Final Answer –{1, 2, 3} –{2 3} = {1}
Employee whose age is greater than all his
dependents.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 337
GATE QUESTION BANK DBMS
SQL
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 338
GATE QUESTION BANK DBMS
Relations S and H with the same schema in decreasing balance order and
as those of these two tables respectively assigning ranks using ODBC
contain the same information as tuples. A Which two of the above statements are
new relation S is obtained by the correct?
following relational algebra operation: (A) 2 and 5 (C) 1 and 4
S = ( . . (B) 1 and 3 (D) 3 and 5
( (S)) (H))
The difference between the number of 5. Consider the relation enrolled (student,
rows output by the SQL statement and the course) in which (student, course) is the
number of tuples in S is primary key, and the relation paid
(A) 6 (C) 2 (student, amount) where student is the
(B) 4 (D) 0 primary key. Assume no null values and
no foreign keys or integrity constraints.
CS - 2006 Given the following four queries:
4. Consider the relation account (customer, Query 1: Select student from enrolled
balance) where customer is a primary key where student in (Select student from
and there are no null values. We would paid)
like to rank customers according to Query 2: Select student from paid where
decreasing balance. The customer with student in (Select student from enrolled)
the largest balance gets rank 1. Ties are Query 3: Select E. student from enrolled E,
not broken but ranks are skipped: if paid P where E. student = P. student
exactly two customers have the largest Query 4: Select student from paid where
balance they each get rank 1 and rank 2 is exists (select * from enrolled where
not assigned. enrolled. student = paid. student)
Query 1: Select A. customer, Which one of the following statements is
count (B. customer) from account A, correct?
account B where (A) All queries return identical row sets
A. balance < = B. balance group by for any database
A. customer (B) Query 2 and Query 4 return identical
Query 2: Select A. customer, row sets for all databases but there
1+ count (B. customer) from account A, exist databases for which Query 1
account B where A. balance< B. balance and Query 2 return different row
group by A. customer sets
Consider these statements about Query 1 (C) There exist databases for which
and Query 2. Query 3 returns strictly fewer rows
1. Query 1 will produce the same row than Query 2
set as Query 2 for some but not all (D) There exist databases for which
databases. Query 4 will encounter an integrity
2. Both Query 1 and Query 2 are correct violation at runtime.
implementations of the specification
3. Query 1 is a correct implementation Statement for Linked Answer Questions 6
of the specification but Query 2 is not and 7
4. Neither Query 1 nor Query 2 is a Consider a database with three relation
correct implementation of the instances shown below. The primary keys
specification for the Drivers and Cars relations are did
5. Assigning rank with a pure relational and cid respectively and the records are
query takes less time than scanning stored in ascending order of these
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 339
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 342
GATE QUESTION BANK DBMS
17. How many tuples does the result of the 20. SQL allows duplicate tuples in relations,
following relational algebra expression and correspondingly defines the
contain? Assume that the schema of A∪ multiplicity of tuples in the result of joins.
is the same as that of A. Which one of the following queries
(A∪ ) . . C always gives the same answer as the
(A) 7 (C) 5 nested query shown below:
(B) 4 (D) 9 select * from R where a in (select S.a from
S)
18. How many tuples does the result of the (A) Select R.* from R, S where R.a=S.a
following SQL query contains? (B) Select distinct R.* from R,S where
SELECT A.Id R.a=S.a
FROM A (C) Select R.* from R,(select distinct a
WHERE A.Age>All (SELECT B.Age FROM from S) as S1 where R.a=S1.a
B WHERE . name = ‘Arun’) (D) Select R.* from R,S where R.a=S.a
(A) 4 (C) 0 and is unique R
(B) 3 (D) 1
21. Consider the following relational schema:
CS - 2014 employee(empId,empName,empDept)
19. Given the following schema: customer(custId,custName,salesRepId,
employees (emp-id, first-name, rating)
last-name, hire-date, dept-id, salary) salesRepId is a foreign key referring to
empId of the employee relation. Assume
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 343
GATE QUESTION BANK DBMS
that each employee makes a sale to at 22. Given an instance of the STUDENTS
least one customer. What does the relation as shown below:
following query return?
SELECT empName
CPI
9.4
9.5
9.4
9.3
8.7
FROM employee E
WHERE NOT EXISTS (SELECT custId
Student
FROM customer C
Age
WHERE C.salesRepId = E.empId
19
19
18
19
AND C.rating< ’GOOD’);
X
(A) Names of all the employees with at
shankar@math
least one of their customers having a
Student Email
shankar@cse
ganesh@civil
swati@mech
‘GOOD’ rating.
swati@ee
(B) Names of all the employees with at
most one of their customers having a
‘GOOD’ rating.
(C) Names of all the employees with
none of their customers having a
Student
Shankar
Shankar
Name
Ganesh
‘GOOD’ rating.
Swati
Swati
(D) Names of all the employees with all
their customers having a ‘GOOD’
rating.
Student
ID
2345
1287
7853
9876
8765
For (StudentName, StudentAge) to be a
key for this instance, the value X should
NOT be equal to ________
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 344
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 345
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 347
GATE QUESTION BANK DBMS
e.emp INNER QUERY OUT NOT 11. [Ans. *](Answer is not matching with IIT
Id PUT EXISTS keys)
1 SELECT * FROM 1 row Not SUPPLIERS
employee s Qualified
Sid Sname City Street
WHERE s. department
=5 and s.salary>=1000; S1 A
2 SELECT * FROM No rows Qualified
S2 B
employee s S3 C
WHERE s. department =5
and s.salary>=2000; PARTS
3 SELECT * FROM No rows Qualified Pid Pname Color
employee s
WHERE s.department =5
P1 Blue
and s.salary >=3000; P2 Blue
4 SELECT * FROM 1 row Not P3 Blue
employee s Qualified P4 Green
WHERE s. department=5 P5 Green
and s.salary >=1500; P6 Green
5 SELECT * FROM 2 rows Not
employee s Qualified
WHERE s. department=5 CATALOG
and s.salary >=500; Sid Pid Cost
S1 P1
Q2:- SELECT e. empId S1 P2
FROM employee E S2 P3
WHERE e.salary > ANY
S2 P4
(SELECT distinct
salary FROM S3 P5
employee s WHERE S3 P6
s.department=5);
S1 → Supplier supplying only lue parts,
→ returns *2, 3, 4+ employees
Final Answer = Only Q2 is giving the correct [P1, P2]
result S2 → Supplier supplying both Blue &
Green parts. [P3, P4]
9. [Ans. D] S3 → Supplier supplying only Green parts,
If SELECT clause consists aggregate and [P5, P6]
non – aggregate. All non-aggregate
columns in the SELECT list must appear in Initial Query
Group by clause. But in this query Group SELECT S.sname
by consists school_id instead of sch_name FROM Suppliers S
WHERE S.sid NOT IN (SELECT C.sid
FROM Catalog C
10. [Ans. C] WHERE C.pid NOT IN (SELECT
Here, we used division operator. P.pid FROM Parts P
Numerator produces all who scores more WHERE P.colour< ‘blue’));
than 35 marks, denominator checks all
exams. Hence it produces pass percentage After execution of second inner query:-
above 35% over all exams taken together. SELECT S.sname
FROM Suppliers S
WHERE S.sid NOT IN (SELECT C.sid
FROM Catalog C
WHERE C.pid NOT
IN (P4, P5, P6);
→Main Query returns output as {S3}
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 348
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 349
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 350
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 351
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 352
GATE QUESTION BANK DBMS
(D) Both S1 and S2 are not conflict (C) S1: lock S(A); S2: lock S(B);
serializable read (A); read (B);
lock X(B); lock X(A);
5. Consider the following two transactions
read(B); read(A);
T1 and T2.
T1: read(A); if A = 0 if B≠ 0
read(B); then then
if A = 0 then B ⟵ B+1; B←B+1; A→A 1;
write(B); write (B); write (A);
T2: read (B); unlock (A); unlock (A);
read (A); commit; commit;
if B ≠ 0 then A⟵A 1;
unlock (B); unlock (B);
write(A);
Which of the following schemes, using
shared and exclusive locks, satisfy the (D) S1: lock S(A); S2: lock S(B);
requirements for strict two phase locking read (A); read (B);
for the above transactions? lock X(B); lock X(A);
(A) S1: lock S(A); S2: lock S(B); read(B); read(A);
read (A); read(B); if A = 0 if B≠ 0
lock S(B); lock S(A) then then
read(B); read(A); B←B+1; A→A 1;
if A = 0 if B≠0 write (B); write (A);
then then unlock (A); unlock (A);
B←B+1; A ← A – 1; unlock (B); unlock (B);
write (B); write(A); commit; commit;
commit; commit;
unlock (A); unlock (B); CS – 2009
unlock (B); unlock (A); 6. Consider two transactions T1 and T2, and
four schedules S1, S2, S3, S4 of T1 and T2 as
given below:
(B) S1: lock X(A); S2: lock X(B); T1: R1[x] W1 [x] W1 [y]
read (A); read (B); T2: R2 [x] R2 [y] W2 [y]
lock X(B); lock X(A); S1: R1[x] R2 [x] R2[y] W1 [x] W1 [y] W2 [y]
read(B); read(A); S2: R1[x] R2 [x] R2[y] W1 [x] W2 [y] W1 [y]
if A = 0 if B≠ 0 S3: R1[x] W1 [x] R2[x] W1 [y] R2 [y] W2 [y]
then B←B+1; then S4: R2[x] R2 [y] R1[x] W1 [x] W1 [y] W2 [y]
Which of the above schedules are conflict-
write (B); A→A 1;
serializable?
unlock (A); write (A); (A) S1 and S2 (C) S3 only
commit; unlock (A); (B) S2 and S3 (D) S4 only
unlock (B); commit;
unlock (B); CS - 2010
7. Which of the following concurrency
control protocols ensure both conflict
serializability and freedom from
deadlock?
I. 2-phase locking
II. Time-stamp ordering
(A) I only
(B) II only
(C) Both I and II
(D) Neither I nor II
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 353
GATE QUESTION BANK DBMS
8. Consider the following schedule for 11. Consider the following schedule S of
transactions T1, T2 and T3 transactions T1, T2, T3, T4:
T1 T2 T3 T1 T2 T3 T4
Read(X) Reads (X)
Read(Y) Writes(X)
Read(Y) Commit
Writes (X)
Write(Y)
Commit
Write(X) Writes (Y)
Write(X) Reads(Z)
Read(X) Commit
Write(X) Reads (X)
Which one of the schedules below is the Reads (Y)
correct serialization of the above? commit
(A) T1 → T3 → T2 Which one of the following statements is
(B) T2 → T1 → T3 CORRECT?
(C) T2 → T3 → T1 (A) S is conflict – serializable but not
(D) T3 → T1 → T2
recoverable
CS - 2012 (B) S is not conflict – serializable but is
9. Consider the following transactions with recoverable
data items P and Q initialized to zero: (C) S is both conflict – serializable and
T1: read (P); recoverable
read(Q); (D) S is neither conflict – serializable nor
if P = 0 then Q: = Q + 1 ; is it recoverable
write (Q).
T2: read(Q);
read (P); 12. Consider the transactions T1, T2, and T3
if Q = 0 then P: = P + 1 ; and the schedules S1 and S2 given below.
write (P). T1: r1(X); r1(Z); w1(X); w1(Z)
Any non-serial interleaving of T1 and T2 T2: r2(Y); r2(Z); w2(Z)
for concurrent execution leads to T3: r3(Y); r3(X); w3(Y)
(A) A serializable schedule S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z);
(B) A schedule that is not conflict w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
serializable S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z);
(C) A conflict serializable schedule
r2(Z); w3(Y); w1(X); w2(Z); w1(Z)
(D) A schedule for which a precedence
graph cannot be drawn Which one of the following statements
about the schedules is TRUE?
CS - 2014 (A) Only S1 is conflict-serializable.
10. Consider the following four schedules due (B) Only S2 is conflict-serializable.
to three transactions (indicated by the (C) Both S1 and S2 are conflict-
subscript) using read and write on a data
serializable.
item x, denoted by r(x) and w(x)
respectively. Which one of them is conflict (D) Neither S1 nor S2 is conflict-
serializable? serializable.
(A) r (x); r (x); w (x); r (x); w (x)
(B) r (x); r (x); w (x); r (x); w (x)
(C) r (x); r (x); r (x); w (x); w (x)
(D) r (x); w (x); r (x); r (x); w (x)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 354
GATE QUESTION BANK DBMS
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 355
GATE QUESTION BANK DBMS
8. [Ans. A] T1 T2 T3 T4
Given Schedule → Serializable, Since no Reads(X)
cycle is formed → Writes(X)
Serial Order =T1→ T3 →T2 Commit
T1 T2 T3 Writes(X)
Read(X) Commit
Read(Y) Writes(Y)
Read(Y) Reads (Z)
Write(Y) Commit
Write(X)
Reads (X)
Write(X)
Reads (Y)
Read(X)
Commit
Write(X)
T1 T2
T T
T4 T3
T
T
12. [Ans. A]
Test for Conflict Serializability→ Precedence
9. [Ans. B]
T T Graph
r (P) r (Q) Graph without Cycle → Schedule is Conflict
r (Q) r (P) Serializable
w (Q) w (P) Graph with Cycle → Schedule is NOT Conflict
Serializable
T Schedule S1→ No Cycle → Conflict Serializable
T
Whereas Schedule S2→ Cycle → Not Conflict
Cycle present so not conflict serializable Serializable
Schedule: S1
10. [Ans. D] S1
Schedule in option D
T1 T2 T3
T T T
r1(X)
r(x)
r3(Y)
w(x)
r3(X)
r(x)
r2(Y)
r(x)
r2(Z)
w(x)
w3(Y)
Dependency graph (T ) → (T ) → (T )
Conflict serializable. w2(Z)
r1(Z)
11. [Ans. C] w1(X)
Given Schedule is Recoverable → since all w1(Z)
transactions read the committed data only. No cycle → schedule is conflict serializable
Given Schedule is Serializable→Since there is Equivalent serializable order =
no cycle in the graph T2 → T3 → T1
Equivalent Serializable Schedule =
T2 → T3 → T1 → T4
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 356
GATE QUESTION BANK DBMS
r2(Z),w1(Z)
T1 T2
r3(X),w1(X) r2(Y),w3(Y)
T3
Schedule: S2
S2
T1 T2 T3
r1(X)
r3(Y)
r2(Y)
r3(X)
r1(Z)
r2(Z)
w3(Y)
w1(X)
w2(Z)
w1(Z)
Cycle is formed→Schedule is NOT conflict
serializable
Equivalent serializable order
= T2 → T3 → T1
r1(Z),w2(Z)
T1 T2
r2(Z),w1(Z)
r3(X),w1(X) r2(Y),w3(Y)
T3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 357
GATE QUESTION BANK DBMS
File Structures
(Sequential files, Indexing, B and trees)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 358
GATE QUESTION BANK DBMS
Statement for Linked Answer Questions 6 non-key field, and the file organization is
and 7 unspanned. The file is stored in a file
Consider the tree in the adjoining system with block size 1024 bytes, and
figure, where each node has at most two the size of a block pointer is 10 bytes. If
keys and three links. the secondary index is built on the key
field of the file, and a multi-level index
scheme is used to store the secondary
index, the number of first-level and
second-level blocks in the multi-level
index are respectively
(A) 8 and 0 (C) 256 and 4
(B) 128 and 6 (D) 512 and 5
6. Keys K15 then K25 are inserted into this
tree in that order. Exactly how many of
the following nodes (disregarding the 9. A clustering index is defined on the fields
links) will be present in the tree after the which are of type
two insertions? (A) Non-key and ordering
(B) Non-key and non-ordering
(C) Key and ordering
(D) Key and non-ordering
(A) 1 (C) 3
(B) 2 (D) 4 CS - 2009
10. The following key values are inserted into
7. Now the key K50 is deleted from the B+ a B+-tree in which order of the internal
tree resulting after the two insertions nodes is 3, and that of the leaf nodes is 2,
made earlier. Consider the following in the sequence given below. The order of
statements about the tree resulting internal nodes is the maximum number of
after this deletion. tree pointers in each node, and the order
(i) The height of the tree remains the of leaf nodes is the maximum number of
same. data items that can be stored in it. The
(ii) The node B+-tree is initially empty.
K20
10, 3, 6, 8, 4, 2, 1. The maximum number
(disregarding the links) is present in the of times leaf nodes would get split up as a
tree. result of these insertions is
(A) 2 (C) 4
(ii) The root node remains unchanged (B) 3 (D) 5
(disregarding the links).
Which one of the following options is CS - 2013
true? 11. An index is clustered , if
(A) Statements (i) and (ii) are true (A) It is on a set of fields that form a
(B) Statements (ii) and (iii) are true candidate key.
(B) It is on a set of fields that include the
(C) Statements (iii) and (i) are true
primary key
(D) All the statements are false (C) The data records of the file are
organized in the same order as the
CS - 2008 data entries of the index
8. Consider a file of 16384 records. Each (D) The data records of the file are
record is 32 bytes long and its key field is organized not in the same order as
of size 6 bytes. The file is ordered on a the data entries of the index
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 359
GATE QUESTION BANK DBMS
15 50
second level 30
third level 40
10 20 25 50
15 30
fourth level
3. [Ans. C]
Size of Key = K=9 Bytes
15 30
Size of Block = B = 512 Bytes 40
Size of Record Pointer = RP = 7 Bytes
Size of Block Pointer = BP = 6 Bytes
Order (non-leaf node) of B + Tree = n =? 10 15 20 25 30 40
(n × BP) + (n ) K=B
So (i) is true
(n × 6) + (n ) 9 =512
(ii) is also true
n=CEIL (521/15) = CEIL (34.73) = 34
(iii) is false because root not remain
unchanged
4. [Ans. C]
The seek time of disk is 4ms and data
8. [Ans. C]
transfer node is 300 MB/s. So if x = 5000
DATA FILE
then plan 1 execute faster than plan 2 for
File → Ordered on Non – Key field
all database.
Total no. of Records = 16384 records
Size of the Record = 32 Bytes
5. [Ans. A]
INDEX FILE
Order (leaf node) = max (value, record
Type of Index = Secondary Index ( ey) →
pointers) = n =?
DENSE INDEX
Size of Block = B = 1K bytes
Size of Key = 6 Bytes
= 1024 Bytes
Size of block pointer =10 Bytes
Size of Record Pointer = RP = 7 Bytes
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 360
GATE QUESTION BANK DBMS
9. [Ans. A]
A clustering index is defined on the fields 2* 3* 4* 6* 8* 10*
which are of type non-key and ordering.
Insert: 1
10. [Ans. C] 4
4
Insert into B+ Tree in the order 10, 3, 6,
8, 4, 2, 1 & Calculate the No. of leaf Splits
2 3 6
Order of Non Leaf Node = 3
Insert : 10
10*
Insert: 3
3* 10*
Insert: 6
6 1
3* 6* 10*
Insert: 8
6
3* 6* 8* 10*
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 361
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 362
GATE QUESTION BANK Computer Networks
3. [Ans. B] 8. [Ans. B]
SMTP ---------- Application layer 8-bit delimeter = 01111110 We will
BGP ------------ Network layer stuff with “0” after every 5 consecutive 1’s
TCP ------------ Transport layer Output String = 011111 00101 [Stuffed
PPP ------------- Data link layer bit has been highlighted]
Then, Input String = 0111110101 [After
4. [Ans. C] destuffing the stuffed “0”]
Total no. of source = 10
Packet size = 1000 bits
Output capacity of multiplexer= 5000 bits
∴ Average number of backlogged of
packet = 3.45
5. [Ans. D]
Mean Number of hop = 5.26
6. [Ans. B]
How many bytes of data can be sent in 15
seconds?
Baud Rate = 9600 [9600 signals can be
transmitted per second]
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 363
GATE QUESTION BANK Computer Networks
10. A broadcast channel has 10 nodes and 14. The minimum frame size required for
total capacity of 10 Mbps. It uses polling CSMA/CD based computer network
for medium access. Once a node finishes running at 1 Gbps on a 200m cable
transmission, there is a polling delay of with a link speed of 2 10 m/s is
80 s to poll the next node. Whenever a (A) 125 bytes
node is polled, it is allowed to transmit a (B) 250 bytes
maximum of 1000 bytes. The maximum (C) 500 bytes
throughput of the broadcast channel is (D) None of the above
(A) 1 Mbps (C) 10 Mbps
(B) 100/ 11 Mbps (D) 100 Mbps CS – 2013
15. Determine the maximum length of the
Common Data for Questions 11 & 12: cable (in km) for transmitting data at a
Consider a token ring topology with N rate of 500 Mbps in an Ethernet LAN with
stations (numbered 1 to N) running token frames of size 10,000 bits. Assume the
ring protocol where the stations are signal speed in the cable to be
equally spaced. When a station gets the 2,00,000 km/s.
token it is allowed to send one frame of (A) 1 (C) 2.5
fixed size. Ring latency is tp, while the (B) 2 (D) 5
transmission time of a frame is tt. All
other latencies can be neglected.
11. The maximum utilization of the token
ring when tt = 3 , tp = 5 ms, N =10 is
(A) 0.545 (C) 0.857
(B) 0.6 (D) 0.961
CS – 2008
13. A computer on a 10Mbps network is
regulated by a token bucket. The token
bucket is filled at a rate of 2Mbps. It is
initially filled to capacity with 16
Megabits. What is the maximum duration
for which the computer can transmit at
the full 10Mbps?
(A) 1.6 seconds (C) 5 seconds
(B) 2 seconds (D) 8 seconds
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 365
GATE QUESTION BANK Computer Networks
2. [Ans. A]
Access Method = CSMA/CD
Bandwidth = B = 1Gbps = 109 bits/sec
Distance = d = 1km = 103 mts
Speed of Signal = s = 2 × 108 mts/sec
Minimum Frame Size = =?
= 2 × d/s × B bits
= 2× ×109=10,000 bits
3. [Ans. D]
Bandwidth = B = 4 Kbps
= 4 × 103 bits/sec
Number of packets = 16
Propagation Delay = Tp = 20 ms
= 20 × 10 sec
7. [Ans. A]
Protocol = Stop-and-Wait
Manchester ncoding 2 signals will be
Transmission Time for Ack = Negligible
used for sending 1-bit. For sending 10
= 0 sec
bits, we have to send 20 signals. Hence
Channel Efficiency = 50% = 1/2
baud rate is twice the bandwidth.
[Utilization]
Bandwidth = Baud rate/2 [Half the baud
Minimum Frame Size = F = ?
T rate]
fficiency
T 2T
8. [Ans. A]
1
p(1) = n p 1 p
2 2 20 10 4 10
n
160 bits = p 1 p
1 n 1
4. [Ans. C] = np 1 p
2 100
n 10 n 10 9. [Ans. C]
3 15 10
LAN = Token Ring
5. [Ans. C] Bandwidth = B = 10 bits/sec
Propagation Speed = 200 mts/micro
Round trip propagation delay
seconds [signal travels 200 meters in
(2 T ) 46.4 sec 46.4 10 10 seconds]
Frame size 2 T andwidth 1 bit delay in this network = ?
46.4 10 10 10 As B= 10 bits/sec, To place 1-bit in the
464 bits channel it takes 10 sec
As signal travels 200 meters in 10-6
seconds, then how much distance 1-bit
travels in 10 sec ?
10 seconds 200 meters
10 seconds ? meters
= 20 meters
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 366
GATE QUESTION BANK Computer Networks
12. [Ans. D]
LAN = Token Ring
Total no. of Stations = N = 15
Ring Latency = t = 3 ms
Transmission Time = t = 5 ms
Max Utilization
U= (N × t ) / ((N × t )+ t )
= (15×5) / ((15×5 )+ 3)
= 75/78
= 0.961
13. [Ans. B]
Bandwidth = B =10 Mbps
Token Bucket filled at the rate = r
= 2 Mbps
Capacity of Token Bucket = C
= 16 Mega bits
Max Duration at which computer can
transmit at fully 10 Mbps rate = S = ?
S = C/(B r)
= 16/(10 2)
= 2 seconds.
14. [Ans. B]
Min frame size 2 data rate
2 10
2 10 10
2 10
2000 bits = 250 bytes
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 367
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 368
GATE QUESTION BANK Computer Networks
(respectively , row r ) gives the parity always piggy backed. After sending 2
of the corresponding row (respectively , frames, what is the minimum time the
column). These 40 bits are transmitted sender will have to wait before starting
over the data link . transmission of the next frame? (Identify
the closest choice ignoring the frame
0 1 0 1 0 0 1 1 processing time)
1 1 0 0 1 1 1 0 (A) 16 ms (C) 20 ms
0 0 0 1 0 1 0 0 (B) 18 ms (D) 22 ms
0 1 1 0 1 0 1 0
1 1 0 0 0 1 1 0 CS – 2012
The table shows data received by a 12. Consider a source computer (S)
receiver and has n corrupted bits. What transmitting a file size 106 bits to a
is the minimum possible value of n ? destination computer (D) over a network
(A) 1 (C) 3 of two routers (R1 and R2) and three (L1, L2,
(B) 2 (D) 4 and L3). L1 connects S to R1;L2 connects R1
to R2; and L3 connects R2 to D. Let each link
CS – 2009 be of length 100 km. Assume signals travel
9. Let G(x) be the generator polynomial over each link at a speed of 108 meters per
used for CRC checking. What is the second. Assume that the link bandwidth
condition that should be satisfied by G(x) on each link is 1Mbps. Let the file be
to detect odd number of bits in error? broken down into 1000 packets each of
(A) G(x) contains more than two terms size 1000bits. Find the total sum of
(B) G(x) does not divide 1 + x , for any transmission and propagation delays in
k not exceeding the frame length transmitting the file from S to D?
(C) 1 + x is a factor of G(x) (A) 1005 ms (C) 3000 ms
(D) G(x) has an odd number of terms (B) 1010 ms (D) 3003 ms
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 369
GATE QUESTION BANK Computer Networks
15. Consider the store and forward packet Consider only transmission time and
switched network given below. Assume ignore processing, queuing and
that the bandwidth of each link is propagation delays. Also assume that
10 bytes / sec. A user on host A sends a there are no errors during transmission.
file of size 10 bytes to host B through Let T1, T2 and T3 be the times taken to
routers R1 and R2 in three different ways. transmit the file in the first, second and
In the first case a single packet containing third case respectively. Which one of the
the complete file is transmitted from A to following is CORRECT?
B. In the second case, the file is split into A B
R1 R2
10 equal parts, and these packets are
(A) T1 T2 T3
transmitted from A to B. In the third case,
(B) T1 T2 T3
the file is split into 20 equal parts and
(C) T2 = T3 , T3 < T1
these packets are sent from A to B. Each
(D) T1 = T3, T3 > T2
packet contains 100 bytes of header
information along with the user data.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 370
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 371
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 372
GATE QUESTION BANK Computer Networks
15. [Ans. D]
Given Bandwidth = 10 bytes/sec
L 10 bytes
Case: 1
L = 1000 bytes
Header size = 100 bytes
Total Frame size = 1000+100=1100
bytes
1100 8
∴T 1100 s
10 8
So, T 3300 s
Case: 2
L 100 bytes
Header size = 100 bytes
Total Frames size = 100 + 100 = 200 bytes
∴T 200 s for 1 packet
or 10 packets T 2000 s
So, T 2000 200 200 2400 s
Case: 3
L = 50 bytes
Header size = 100 bytes
Total frame size = 50 + 100 = 150 bytes
∴T 150 s for 1 packet
or 20 packets T 3000 s
So, T 3000 150 150 3300 s
∴T T
T T
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 373
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 374
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 375
GATE QUESTION BANK Computer Networks
CS – 2014
11. Consider the following three statements
about link state and distance vector
routing protocols, for a large network
with 500 network nodes and 4000 links.
[S1] The computational overhead in link
state protocols is higher than in distance
vector protocols.
[S2] A distance vector protocol (with split
horizon) avoids persistent routing loops,
but not a link state protocol.
[S3] After a topology change, a link state
protocol will converge faster than a
distance vector protocol.
Which one of the following is correct
about S1, S2, and S3 ?
(A) S1, S2, and S3 are all true
(B) S1, S2, and S3 are all false
(C) S1 and S2 are true, but S3 is false
(D) S1 and S3 are true, but S2 is false.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 376
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 377
GATE QUESTION BANK Computer Networks
For R6 9. [Ans. A]
Next hop Network ID = 245.248.128.0/20
R1 16 R5 alf of this IP addresses to “A”
ISP wants VLSM
R2 12 R5
to give Quarter to Organization “ ”
R3 13 R5
Retaining the remaining with
R4 5 R5 itself [Quarter]
R5 4 R5 Total subnets 2
2 level subnetting
So it is clear visualize from the all routing osts Subnet 2 2
table construction that we never use the
direct path between
6 8
R1 R2 and R4 R6
6. [Ans. B]
After changing the weights of unused link
R1 R2 & R4 R6 to 2. Then the no. of
unused links are only one [R5 R6]
7
2 R2 R4 2
6 8
R1 R6
2 1
3 4
R3 9 R5
Link R5-R6 will
be unused
7. [Ans. A]
In the next round, every node will send
and receive distance vectors to and from
neighbours, and update its distance
vector. N3 will receive (1, 0, 2, 7, 3) from
N2 and it will update distance to N1 and
Total soultions 2
N5 as 3 and 5 respectively
S. No Organization Network ID/
Subnet mast
8. [Ans. C] 1 A 50 245.248.128.0 21
In the next ground, N3 will receive 25 245.248.136.0 22,
distance from N2 to N1 as infinite. It will 245.248.140.0/22
receive distance from N4 to N1 as 8. So it 2 A 50 245.248.136.0 21
will update distance to N1 as 8+2 =10 25 245.248.128.0 22,
245.248.140.0/22
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 378
GATE QUESTION BANK Computer Networks
10. [Ans. C]
Network Layer = 4 times &
Data link layer = 6 times
S R R D
Network Network
Data link Data link
Physical Physical
11. [Ans. D]
S1 True, since in Link State Routing
every node has to execute the
shortest path algorithm.
S2 False, since looping problem is not
eliminated completely by Split
Horizon.
S3 True, since in Link State each node
broadcast the topology changes to
all other nodes in the network,
where as Distance Vector informs
only to its neighbors.
12. [Ans. 1]
IP Address = 131.23.151.76
Binary Value of given IP Address =
10000011. 00010111. 10010111.
0100110
We always compare the IP with the
Highest Mask.
131.19.0.0/16
10000011.00010011.00000000.
00000000 Match Failed
131.22.0.0/15
10000011.00010110.00000000.
00000000 Match Success
As the first 15 network bits of
131.22.0.0/15 and 131.23.151.76 are
same. So the outgoing interface will be
“1”.
13. [Ans. A]
RIP Routing Information Protocol uses
“Distance Vector Routing Algorithm”
OSPF Open Shortest Path First Protocol
uses “Link State Routing Algorithm”
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 379
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 380
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 381
GATE QUESTION BANK Computer Networks
B1 (C)
H1 H2 H3 H4 Hosts Port
1 2
H3, H4 3
2
H5, H6, H9, H10 1
4 3 H1, H2 4
B5 B3 H7, H8, H11, H12 2
3
1 4 1 2 (D)
Hosts Port
H1, H2, H3, H4 3
H5 H6 H7 H8
2 2 1 H5, H7, H9, H10 1
1 B4 B2
H7, H8, H11, H12 4
3 3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 382
GATE QUESTION BANK Computer Networks
but the second segment was received (D) connect() system call returns in a
correctly by the receiver. Let X is the core dump
amount of data carried in the first
segment (in bytes) and Y is the ACK 22. In the slow start phase of the TCP
number sent by the receiver. congesting control algorithm the size of
The values of X and Y (in that order) are the congestion window
(A) 60 and 290 (C) 60 and 231 (A) Does not increase
(B) 230 and 291 (D) 60 and 230 (B) Increases linearly
(C) Increases quadratic ally
18. Which one of the following uses UDP as (D) Increases exponentially
the transport Protocol?
(A) HTTP (C) DNS 23. Which of the following system calls
(B) Telnet (D) SMTP results in the sending of SYN packets?
(A) socket (C) listen
CS – 2008 (B) blind (D) connect
19. What is the maximum size of data that the
application layer can pass on to the TCP CS – 2009
layer below? 24. While operating a TCP connection, the
(A) Any Size initial sequence no. is to be derived using
(B) 216 bytes – size of TCP header a time of day (TOD) clock that keeps
(C) 216 bytes running even when the host is down.
(D) 1500 bytes The low order 32 bit of the counter of the
TOD clock is to be used for the initial
20. If a class B network on the internet has a sequence numbers. The clock counter
subnet mask 255.255.248.0, what is the increments once per milli second. The
max no. of hosts per subnet? maximum packet lifetime is given to be
(A) 1022 (C) 2046 64s. Which one of the choices given
(B) 1023 (D) 2047 below is closest to the minimum
permissible rate at which sequence
21. A client process P needs to make a TCP numbers used for packets of a
connection to a server process S. connection can increase?
Consider the following situation: the (A) 0.015/s (C) 0.135/s
server process S executes a socket(), a (B) 0.064/s (D) 0.327/s
bind() & a listen() system call in that
order, following which it is preempted. CS – 2010
Subsequently, the client process P 25. One of the header fields in an IP datagram
executes a socket() system call followed is the Time-to-Live (TTL) field. Which of
by connect( ) system call to connect to the the following statements best explains the
server process S. The server process has need for this field?
not executed any accept() system call. (A) It can be used to prioritize packets.
Which one following events could take (B) It can be used to reduce delays.
place? (C) It can be used to optimize
(A) connect() system call returns throughput.
successfully (D) It can be used to prevent packet
(B) connect () system call blocks looping.
(C) connect() system call returns an
error
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 383
GATE QUESTION BANK Computer Networks
26. Suppose computers A and B have IP 31. In an IPv4 datagram, the M bit is 0, the
addresses 10.105.1.113 and 10.105.1.91 value of HLEN is 10, the value of total
respectively and they both use the same length is 400 and the fragment offset
netmask N. Which of the values of N given value is 300. The position of the
below should not be used if A and B datagram, the sequence numbers of the
should belong to the same network? first and the last bytes of the payload,
(A) 255.255.255.0 respectively are
(B) 255.255.255.128 (A) Last fragment, 2400 and 2789
(C) 255.255.255.192 (B) First fragment, 240 and 2759
(D) 255.255.255.224 (C) Last fragment, 2400 and 2759
(D) Middle fragment, 300 and 689
CS – 2012
27. In the IPV4 addressing format, the CS – 2014
number of networks allowed under Class 32. Let the size of congestion window of a
C address is TCP connection be 32 KB when a timeout
(A) 2 (C) 2 occurs. The round trip time of the
(B) 2 (D) 2 connection is 100 msec and the maximum
segment size used is 2 KB. The time taken
28. Which of the following transport layer
(in msec) by the TCP connection to get
protocol is used to support electronic
back to 32 KB congestion window is _____.
mail?
(A) SMTP (C) TCP
33. Which one of the following socket API
(B) IP (D) UDP
function converts an unconnected active
29. Consider an instance of TCP’s Additive TCP socket into a passive socket?
Increase Multiplicative Decrease (AIMD) (A) Connect (C) Listen
algorithm where the window size at the (B) Bind (D) Accept
start of the slow start phase is 2 MSS and
the threshold at the start of the first 34. In the diagram shown below, L1 is an
transmission is 8 MSS. Assume that a Ethernet LAN and L2 is a Token – Ring
timeout occurs during the fifth LAN. An IP packet originates from S and
transmission. Find the congestion traverses to R, as shown. The links within
window size at the end of the tenth each ISP and across the two ISPs, are all
transmission. point – to – point optical links. The initial
(A) 8 MSS (C) 7 MSS value of the TTL field is 32. The maximum
(B) 14 MSS (D) 12 MSS possible value of the TTL field when R
receives the datagram is ______.
ISP1 ISP2
CS – 2013
30. The transport layer protocols used for
LAN L2
real time multimedia, file transfer, DNS R
S LAN L1
and email, respectively are
(A) TCP, UDP, UDP and TCP
(B) UDP, TCP, TCP and UDP 35. Host A (on TCP/IPV4 network A) sends
(C) UDP, TCP, UDP and TCP an IP datagram D to host B (also on
(D) TCP, UDP, TCP and UDP TCP/IPV4 network B). Assume that no
error occurred during the transmission of
D. When D reaches B, which of the
following IP header field(s) may be
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 384
GATE QUESTION BANK Computer Networks
1. [Ans. B] 4. [Ans. C]
In both TCP & UDP, packets of same ICMP reply packet is returned to A by
session will be routed in different paths, each router en-router to B.
because they are using IP protocol in the
Network Layer which is purely a
5. [Ans. B]
connection less protocol. Theoretically we
say that TCP is connection oriented Congestion window = cwnd = 4KB
protocol, it doesn’t mean that packets of Receiver window = rwnd = 6KB
same session will travel in the same path, Current Window Size = min(cwnd, rwnd)
we are simulating the connection by using = min(4KB, 6KB) = 4KB
buffers at both sender and receiver. Just to confuse us they provided the
Finally TCP is using a Virtual connection. additional information like Last Byte Sent
and Last Byte Acknowledged, which are
totally not required in finalizing the
2. [Ans. D]
window size.
ARP: Finding the MAC address that
corresponds to an IP address 6. [Ans. A]
Probability (p via L = 1 b p
3. [Ans. D] Probability (p via L = 1 b p
In a class B network initial two octets are ∴ Probability p) via L or L = p p
all 1’s but third octet specifies the
physical network for subnet of 64 7. [Ans. D]
department or 2 so initial 6 bits of third Class of network = class-C network
octets are 1’s [n=24, h=8] [25h hosts/Network]
11111111 . 11111111 .11111100 . 00000000
Network Address = 204.204.204.0
255 . 255 . 252 . 0
Requirement = 3 subnets
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 385
GATE QUESTION BANK Computer Networks
10. [Ans. C]
Boolean And (Destination Address, Mask)
Must give the Network ID
Given Destination Address =
144.16.68.117 = 144.16.68.01110101
Router always considers the Highest
Mask first, then second highest, and so
on…
First Highest Mask:-
Destination Network ID =144.16.68.64
and Mask = 255.255.255.224
Boolean And (144.16.68.117,
255.255.255.224)=144.16.68.96 Not
matching with NetworkID
Second Highest Mask:-
Destination Network ID =144.16.68.0 and
Mask = 255.255.255.0
Boolean And (144.16.68.117,
255.255.255.0)=144.16.68.0 Matched
with Network ID
Hence, the outgoing interface = Eth2
Total solution = 2
S. No Subnet Hosts/ Network ID/ Mask
subnet 11. [Ans. A]
1 100 204.204.204.0/255.255.255.128 Because UDP generate the error that
1 2 50 204.204.204.128/255.255.255.192
machine you are trying to reach is not
3 50 204.204.204.192/255.255.255.192
1 100 204.204.204.128/255.255.255.128 responding unlike TCP.
2 2 50 204.204.204.0/255.255.255.192
3 50 204.204.204.64/255.255.255.192
12. [Ans. D]
Broadcast Address with in a network
8. [Ans. C]
All host bits will be 1’s. ontinuous 1’s]
TTL field in IP Datagram To prevent We cannot confidently say the exact no. of
packets from looping indefinitely. network bits in a subnetted network.
As all options are appropriate for the
given question.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.comPage 386
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.comPage 387
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.comPage 388
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.comPage 389
GATE QUESTION BANK Computer Networks
37. [Ans. A]
Size of received IP Datagram
= 4404 bytes = 20 byte IP Header + 4384
payload
Maximum Transmission unit [MTU]
= 1500 bytes
Obviously, Router will fragment the 4384
Payload as follows:
S.No 1 2 3
Size of 1500 1500 1444
Datagram
IP Header 200 20 20
Payload 1480 1480 1424
MF bit 1 1 0
Value
Starting 0 1480 2960
Payload
Byte No
Ending 1479 2959 4383
Payload
Byte No
Fragment 0/8 = 1480/8 2960/8
Offset 0 = 185 = 370
Thus for 3 IP fragment values are as
follows:
Size of Datagram = 1444 bytes
MF bit Value = 0 [Since this is the last
fragment]
Fragment Offset = 370
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.comPage 390
GATE QUESTION BANK Computer Networks
Application Layer
CS –2005 CS –2011
1. A HTML form is to be designed to enable 5. Consider different activities related to
purchase of office stationery. Required email
items are to be selected (checked). Credit m1: Send an email from a mail client to a
card details are to be entered and then mail server
the submit button is to be pressed. Which m2: Download an email form mailbox
one of the following options would be server to mail client
appropriate for sending the data to the m3: Checking email in a web browser
server? Assume that security is handled Which is the application level protocol
in a way that is transparent to the form used in each activity?
design. (A) m1: HTTP m2: SMTP m3: POP
(A) only GET (B) m1: SMTP m2: FTP m3: HTTP
(B) only POST (C) m1: SMTP m2: POP m3: HTTP
(C) either of GET or POST (D) m1: POP m2: SMTP m3: IMAP
(D) neither GET nor POST
CS –2012
CS – 2006 6. The protocol data unit (PDU) for the
2. HELO and PORT, respectively are application layer in the Internet stack is
commands from the protocols (A) Segment (C) Message
(A) FTP and HTTP (B) Datagram (D) Frame
(B) TELNET and POP3
(C) HTTP and TELNET CS –2014
(D) SMTP and FTP 7. Identify the correct order in which the
following actions take place in an
CS –2008 interaction between a web browser and a
3. Provide the best matching between the web server.
entries in the two columns given in the 1. The web browser requests a webpage
table below: using HTTP.
I Proxy Server a. Firewall 2. The web browser establishes a TCP
II aZaA, D b. Caching connection with the web server.
III SLIP c. P2P 3. The web server sends the requested
IV DNS d. PPP webpage using HTTP.
(A) I a, II d, III c, IV b 4. The web browser resolves the
(B) I b, II d, III c, IV a domain name using DNS.
(C) I a, II c, III d, IV b (A) 4,2,1,3 (C) 4,1,2,3
(D) I b, II c, III d, IV a (B) 1,2,3,4 (D) 2,4,1,3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 391
GATE QUESTION BANK Computer Networks
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.comPage 392
GATE QUESTION BANK Computer Networks
9. [Ans. C]
1) Station “Q” will be downloading a file
from TTP server “ ” and 3 routers
R1, R2, and R3 between Q and H.
2) Sniffing at R2 alone what
information will be disclosed?
Only IP addresses & Port Numbers
3) As IP addresses & Port Numbers
remains same for the entire journey
to the destination, so sniffing will get
both IP addresses and Port Numbers
of “Q and ”.
4) URL Station “Q” alone knows the
URL and requests the DNS server for
destination IP. As URL won’t be
included in the packet, so the routers
in the middle are totally unaware of
URL’s.
5) Link Layer Addresses of Q and H
Ethernet Address (or) MAC address
(or) Physical Address. As the
physical addresses changes from
Hop to Hop, Sniffing at R2 will know
only the physical addresses of R1 and
R2 but not Q and H.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 393
GATE QUESTION BANK Computer Networks
Network Security
CS -2005 CS -2008
1. Suppose that two parties A and B wish to 4. The total number of keys required for a
setup a common secret key (D-H key) set of n individuals to be able to
between themselves using the Diffie- communicate with each other using
Hellman key exchange technique. They secret key and public key cryptosystems,
agree on 7 as the modulus and 3 as the respectively are :
primitive root. Party A chooses 2 and (A) n (n 1) and 2n
party B chooses 5 as their respective (B) 2n and
secrets. Their D-H key is:
(A) 3 (C) 5 (C) and 2n
(B) 4 (D) 6 (D) and n
CS -2007 CS -2009
2. Exponentiation is a heavily used 5. In the RSA public key cryptosystem, the
operation in public key cryptography. private & public keys are (e, n) & (d, n)
Which of the following options is the respectively, where n=p * q and p and q
tightest upper bound on the no. of are large primes. Besides, n is public & p
multiplications required to compute & q are private . Let M be an integer such
b modulo m, 0≤b, n≤m? that 0<M<n & ϕ(n) = (p – 1) (q – 1).
(A) O (log n) (C) O (n/log n) Now consider the following equations.
(B) O (√n ) (D) O (n) (A) M = Me mod n
M = (M )d mod n
3. A firewall is to be configured to allow host (B) ed = 1 mod n
in a private network to freely open TCP (C) ed = 1 mod ϕ(n)
connections & send packets on open (D) M = Me mod ϕ(n)
connections. However, it will only allow M = (M )d mod ϕ(n)
external hosts to send packets on existing Which of the above equations correctly
open TCP connections or connections represent RSA cryptosystem?
that are being opened (by internal host ) (A) I and II (C) II and IV
but not allow them to open TCP (B) I and III (D) III and IV
connections to hosts in the private
CS -2011
network. To achieve this he minimum
6. A layer-4 firewall (a device that can look
capability of the firewall should be that of
at all protocol headers up to the transport
(A) A combinational circuit
layer ) CANNOT
(B) A finite automation
(A) Block entire HTTP traffic during
(C) A pushdown automation with one
9:00 PM and 5:00 AM
stack
(B) Block all ICMP traffic
(D) A pushdown automation with two
(C) Stop incoming traffic from a specific
stacks
IP address but allow outgoing traffic
to the same IP address
(D) Block TCP traffic from a specific user
on a multi-user system during
9:00PM and 5:00AM
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 394
GATE QUESTION BANK Computer Networks
CS -2013
7. Using public key cryptography, X adds a
digital signature to message M, encrypts
<M, > and sends it to Y, where it is
decrypted. Which one of the following
sequences of keys is used for the
operations?
(A) ncryption :X’s private key followed
by Y’s private key;
Decryption: X’s public key followed
by Y’s public key
(B) ncryption: X’s private key followed
by Y’s public key;
Decryption: X’s public key followed
by Y’s private key
(C) ncryption: X’s public key followed
by Y’s private key;
Decryption : Y’s public key followed
by X’s private key
(D) ncryption : X’s private key followed
by Y’s public key;
Decryption : Y’s private key followed
by X’s public key
CS- 2014
8. Which of the following are used to
generate a message digest by the network
security protocols?
(P) RSA (Q) SHA 1
(R) DES (S) MD5
(A) P and R only (C) Q and S only
(B) Q and R only (D) R and S only
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 395
GATE QUESTION BANK Computer Networks
3. [Ans. D]
A pushdown automata with two stacks
4. [Ans. C]
Secret key --------
Public key ------- 2n
5. [Ans. B]
I and III equation correctly represent RSA
cryptosystem
6. [Ans. D]
To block TCP traffic from specific user,
requires information of specific user
which is done by application layer. To
block HTTP data, layer-4, i.e., transport
layer can be used because it can block
port used by HTTP
7. [Ans. D]
Decrypting first with Y’s private key
ensures confidentiality and rest of the
things follows that way
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 396
GATE QUESTION BANK Compiler Design
Introduction to Compilers
CS-2005 CS-2011
1. Consider line number 3 of the following 3. In a complier, keywords of a language are
C –program. recognized during
int min( ){ /* Line 1 */; (A) Parsing of the program
int I, n; /* Line 2 */; (B) The code generation
fro(I=0, I<n,I++) /* Line 3 */; (C) The lexical analysis of the program
} (D) Dataflow analysis
Identify the compiler’s response about
this line while creating the object-module CS-2014
(A) No compilation error 4. Which one of the following is NOT
(B) Only a lexical error performed during compilation?
(C) Only syntactic errors (A) Dynamic memory allocation
(D) Both lexical and syntactic errors (B) Type checking
(C) Symbol table management
CS-2010 (D) Inline expansion
2. Which data structure in a compiler is used
for managing information about variables
and their attributes?
(A) Abstract syntax tree
(B) Symbol table
(C) Semantic stack
(D) Parse table
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 397
GATE QUESTION BANK Compiler Design
Syntax Analysis
CS-2005 5. Consider the following grammar
1. The grammar A AA |(A)|ε is not S → FR
suitable for predictive-parsing because R → *S | ε
the grammar is F → id
(A) ambiguous In the predictive parser table, M, of the
(B) left-recursive grammar the entries M[S, id] and M[R, $]
(C) right-recursive respectively
(D) an operator-grammar (A) {S → FR} and {R →ε}
(B) {S → FR} and { }
2. Consider the grammar E E + n|E n|n (C) {S → FR} and {R → *S}
For a sentence n + n n, the handles in (D) {F → id} and {R →ε}
the right-sentential form of the reduction
are Linked Answer Questions 6 and 7
(A) n, E + n and E + n n 6. Which one of the following grammars
(B) n, E + n and E + E n generates the language L = {aibj | i j }?
(C) n, n + n and n + n n (A) S→ A |
(D) n, E + n and E n → a b|a|b
A → aA|
3. Consider the grammar → b|
S (S) | a (B) S → aS|Sb|a|b
Let the number of states in SLR(1), LR(1) (C) S → A |
and LALR(1) parsers for the grammar be → a b|
n1, n2 and n3 respectively. The following A → aA|
relationship holds good → b|
(A) n1< n2< n3 (C) n1 = n2 = n3 (D) S → A |
(B) n1 = n3< n2 (D) n1 n3 n2 → a b|
A → aA|a
CS-2006 → b|b
4. Consider the following grammar.
S S*E 7. In the correct grammar above, what is the
SE length of the derivation (number of steps
E F + E starting from S) to generate the string
E F a bm with l m?
F id (A) max (l,m) + 2 (C) l + m + 3
Consider the following LR(0) items (B) l + m + 2 (D) max (l, m) + 3
corresponding to the grammar above.
(i) S S*.E CS-2007
(ii) E F.+E 8. Which one of the following is a top-down
(iii) E F+.E parser?
Given the items above, which two of them (A) Recursive descent parser
will appear in the same set in the (B) Operator precedence parser
canonical sets-of-items for the grammar? (C) An LR(k) parser
(A) (i) and(ii) (C) (i) and (iii) (D) An LALR(k) parser
(B) (ii) and (iii) (D) None of these
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 398
GATE QUESTION BANK Compiler Design
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 399
GATE QUESTION BANK Compiler Design
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 400
GATE QUESTION BANK Compiler Design
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 401
GATE QUESTION BANK Compiler Design
7. [Ans. A] lm
In the q no. 6 if grammar generates a b aabbab.
or a b then the length is max (l, m) if it lm
generates a b initially we include two So aabbab is generated by the grammar.
extra derivation so the total length is
max (l, m) + 2. 12. [Ans. B]
There are two parse trees for the string
8. [Ans. A] aabbab from left most derivation and one
Predictive parser and recursive descent from right most derivation.
parser are example of top-down parser. S
Where as LR(k) and LALR(k) parser are
bottom up parser a B
9. [Ans. A] a B
B
S i C t SS | a
S eS | ∈
b S b
C b
S i C t SS
b A
S i b t SS [apply C b] a
After second step of derivation i, b, t are S
terminals but the left nonterminal symbol
is S so grammar it left recursive after step B
a
2. It is noted that in some cases we can’t
observe the left recursion in initial step of
a B
derivation but after some step of B
derivation we can seen the left recursion.
b S
b
10. [Ans. A]
a B
Regular grammar is well recognized by
LL(1) parsers and LR (1) parser is stronger b
and more than powerful than LL (1) so
regular grammar is also accepted by LR (1)
13. [Ans. D]
parser. Every regular set has LR (1)
Definition of handle is given in (D) option.
grammar. So both statements are correct.
14. [Ans. B]
11. [Ans. C]
LALR (1) parser uses the LR (1) items. So
S aB
LALR (1) parser or for a grammar G can
lm
have S-R conflict if add only if the LR (1)
aaBB
parser for G has S-R conflicts.
lm
aabB
15. [Ans. C]
lm
S → aSa|bS|c
aabbS
The above grammar is LL (1) because,
lm
First ,aSa- ∩ first ,bS- (a) ∩ (b)
aabbaB
&&
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 402
GATE QUESTION BANK Compiler Design
16. [Ans. A]
S → aAbB | bAaB |ε
A→S
X →.cX, c|d
B→S X → .cX, c|d |$
First of S = {a, b, ε} X → .d, c|d | $
First of A = {a, b, ε}
First of B = {a, b, ε}
1. Merging of two state depends on
Follow of S = {$, a, b}
core part (production rule with
Follow of A = {b, a}
dotoperator), not on look ahead.
Follow of B = {$, a, b}
2. The two states are not containing
reduce item, so after merging the
17. [Ans. C]
merged state cannotcontain any S – R
S → aAb | bAa | ε
conflict
A→S
3. As there is no Reduce item in any of
B→S
the state, so can’t have R – R conflict
LL(1) Parsing table:
4. Merging of state does not depend on
a b $
S S → aAb S → bAa S→ further goto on any terminal. So all
S→ S→ statements are false
A A→S A→S error
B →S →S →S
20. [Ans. D]
No any conflict, because both items will
18. [Ans. B]
be in different states of canonical sets.
If n tokens are there in string, then one
reduction is required for each token. But
21. [Ans. B]
at the end two tokens will be reduced to
Consider the following derivation tree
two terminals because grammar does not S
have any unit production. So for last two
token =1 T * P
id
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 403
GATE QUESTION BANK Compiler Design
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 404
GATE QUESTION BANK Compiler Design
3
id {print}
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 405
GATE QUESTION BANK Compiler Design
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 406
GATE QUESTION BANK Compiler Design
CS-2010 c a b;
5. Which languages necessarily need heap d c ∗ a;
allocation in the runtime environment? e c a;
(A) Those that support recursion. x c ∗ c;
(B) Those that use dynamic scoping. if (x a) *
(C) Those that allow dynamic data y a ∗ a;
structures. +
(D) Those that use global variables. else {
d d ∗ d;
CS-2011 e e ∗ e;
6. Consider two binary operators ‘ ’ and ' ' }
with the precedence of operator being
lower than that of the operator . 7. Suppose the instruction set architecture
Operator is right associative while of the processor has only two registers.
operator is left associative. Which one of The only allowed compiler optimization is
the following represents the parse tree code motion, which moves statements
for expression (7 3 4 3 ) from one place to another while
preserving correctness. What is the
(A) (B)
minimum number of spills to memory in
7 the compiled code?
2 (A) 0 (C) 2
3 7 (B) 1 (D) 3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 407
GATE QUESTION BANK Compiler Design
10. Consider the basic block given below. 11. Which one of the following is FALSE?
a b c (A) A basic block is a sequence of
c a d instructions where control enters the
d b c sequence at the beginning and exits
e d b at the end.
a e b (B) Available expression analysis can be
The minimum number of nodes and edges used for common sub expression
present in the DAG representation of the elimination.
above basic block respectively are (C) Live variable analysis can be used for
(A) 6 and 6 (C) 9 and 12 dead code elimination.
(B) 8 and 10 (D) 4and4 (D) x 4 ∗ 5 x 0 is an example of
common sub expression elimination.
1. [Ans. D] 3. [Ans. B]
(A) i%2 is inner loop invariant, it can be Some code optimizations are carried out
moved before inner loop on the intermediate code because
(B) 4*j is common sub – expression program analysis is more accurate on
appeared in two statements intermediate code than on machine code.
(C) 4*j can be reduced to j<<2 by
strength reduction. 4. [Ans. B]
(D) There is no dead code in given code Recursion cannot be implemented with
segment. So there is not scope of static storage allocation.
dead code elimination in this code. L – attributed definition can be evaluated
Hence only option (D) is FALSE. if all rules are at the end and all attributes
are synthesized.
2. [Ans. D] So I and IV are correct.
Both work1 and work2 performs the
same task so S1 is true. But code in work2 5. [Ans. C]
will improve performance. Runtime environment mean we deal with
In work1: dynamic memory allocation and heap is a
int x = a[i+2]; dynamic data structure. So it is clear that
Here a[i+2] is computed twice. those languages that allow dynamic data
return a[i + 2] – 1 structure necessarily need heap
In work2; allocation in the runtime environment.
t i
t a,t -; 6. [Ans. B]
return t 3
Therefore option S2 is also correct.
2
7
4 3
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 408
GATE QUESTION BANK Compiler Design
8. [Ans. B]
R R R c a b
R R ∗R d c∗a
R R R e c a
R R ∗R x c∗c
if(R R ) if(x 0)
{
R R ∗R y a∗b
}
else
{
R R ∗R d d∗d
R R ∗R e e∗a
}
4 registers are required
Option (B) is correct
9. [Ans. C]
Intermediate code is machine
independent code which makes it easy to
retarget the compiler to generate code for
newer and different processors.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 409
GATE QUESTION BANK SE & WT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 410
GATE QUESTION BANK SE & WT
Procedural
cell
Data coupling
Inclusion
coupling
Common
External
coupling
coupling
coupling
coupling
Content
coupling
Control
coupling
Stamp
Low
coupling
Import
coupling
2. [Ans. B]
Waterfall model is inflexible partitioning
because if once a phase is completed, it is
difficult to repeat that if any error
encounters in the later phases
Model is incremental
development
Spiral model is used where risk faction is
more important
3. [Ans. C]
Option (A) is false because implementation
details are not given in requirement
documents.
Option (B) is false because practically it
cannot be achieved perfectly
Option (D) is false because requirement
review is done on requirement document
after that design phase starts.
Option (C) is true.
4. [Ans. B]
Cohesion is a measure of internal strength
within a module, whereas coupling is a
measure of inter dependency among the
modules. So in the context of modular
software design there should be high
cohesion and low coupling.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 411
GATE QUESTION BANK SE & WT
Process Modeling
CS – 2009 CS – 2011
1. Consider the following statements about 3. Which one of the following is NOT
the Cyclomatic complexity of the control defined in a correct good Software
flow graph as a program module. Which of Requirement Specification (SRS)
these are true? document?
I. The Cyclomatic complexity of a (A) Functional Requirement
module is level to maximum (B) Non - Functional Requirements
number of linear independent (C) Goals of Implementation
circuits in a graph. (D) Algorithms for software
II. The Cyclomatic complexity of a Implementation
module is the number of decisions in
the module plus one where a decision CS – 2013
is effectively any conditional statement 4. The following figure represents access
in the module. graphs of two modules M1 and M2. The
III. The Cyclomatic complexity can also be filled circles represent methods and the
used as a number of linearly unfilled circles represent attributes. If
independent paths that should be method m is moved to module M2 keeping
tested during path coverage testing. the attributes where they are, what can we
(A) I &II (C) I & III say about the average cohesion and
(B) II & III (D) I, II & III coupling between modules in the system
of two modules?
CS – 2010 Module M1 Module M2
2. The Cyclomatic complexity of each of the
module A & B shown below is 10. What is
the Cyclomatic complexity of the sequential
integration shown on the right hand side.
m
(A) There is no change.
A (B) Average cohesion goes up but coupling
A B is reduced.
(C) Average cohesion goes down and
B coupling also reduces.
(D) Average cohesion and coupling
increased.
(A) 19 (C) 20
(B) 21 (D) 10
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 412
GATE QUESTION BANK SE & WT
3. [Ans. D]
A software requirements specification
(SRS), a requirements specification for a
software system, is a complete description
of the behavior of a system to be developed.
In addition it also contains non-functional
requirements. Algorithms are developed
during design phase.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 413
GATE QUESTION BANK SE & WT
Project Management
CS-2009 (A) 4000 (C) 4333
1. Which of the following statements are (B) 5000 (D) 4667
true?
I. The context diagram should depict the 3. A company needs to develop digital signal
system as a single bubble. processing software for one of its newest
II. External entities should be identified inventions. The software is expected to
clearly at all levels of DFDs have 40000 lines of code. The company
III. Control information should not be needs to determine the effort in person
represented in a DFD months needed to develop this software
IV. A data store can be connected either to using basic COCOMO model. The
another data store or to an external multiplicative factor for this model is given
entity. as 2.8 for the software development on
(A) II & III (C) I & III embedded systems, while the
(B) I, II & IV (D) I, II & III exponentiation factor is given as 1.20.
What is the estimated effort in person
CS-2011 months?
2. A company needs to develop a strategy for (A) 234.25 (C) 287.80
Software Product development for which it (B) 932.50 (D) 122.40
has a choice of two programming language
L1& L2. The number of lines of code (LOC)
developed using L2 is estimated to be twice
the LOC developed with L1.The product will
have to be maintained for five years. Various
parameters for the company are given in
the table below.
Parameter Language L1 Language L2
Man years LOC /10000 LOC/10000
needed for
development
Development $ 10,00, 00 $ 7,50,000
cost per man
year
Maintenance 5 years 5 years
time
Cost of $ 1,00, 000 $ 50, 000
maintenance
per year
Total cost of the project indicates cost of
yeayearyearm
development & maintenance. What is the
aintenancema
LOC for L1per
intenance for which the cost of the project
using
year L1 is equal to the cost of the project
using ?
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 414
GATE QUESTION BANK SE & WT
Invalid Notations
Valid Notations
2. [Ans. B]
L1 = x L2 = 2x
Given,
Cost of project using L1
= Cost of project using
3. [Ans. A]
Effort in person per month = ab
=2.8(40)1.20 = 234.22 Person – month
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 415
GATE QUESTION BANK SE & WT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 416
GATE QUESTION BANK SE & WT
CS - 2013 1. “ ” w “ ”
Common Data for Question 4 and 5 2. “ ” w “ ”
The procedure given below is required 3. “ ” w “ ”
to find and replace certain characters 4. “ ” w “ ”
inside an input character string supplied 4. The tester now tests the program on all
in array A. The characters to be replaced input strings of length five consisting of
are supplied in array oldc, while their h ‘ ’ ‘ ’ ‘ ’ ‘ ’ ‘ ’ w h
respective replacement characters are duplicates allowed. If the tester carries
supplied in array newc. Array A has a out this testing with the four test cases
fixed length of five characters, while given above, how many test cases will
arrays oldc and newc contains three be able to capture the flaw?
characters each. (A) Only one (C) Only three
However, the procedure is flawed. (B) Only two (D) All four
void find_and_replace (char *A, char *oldc,
char *newc) { 5. If array A is made to hold the string
for (int i = 0 ; i < 5 ; i++) “ ” which of the above four test
for (int j = 0 ; j < 3 ; j++) cases will be successful in exposing the
if (A[i] == oldc [j]) flaw in this procedure?
A [i] = newc[j] ; (A) None (C) 3 and 4 only
(B) 2 only (D) 4 only
}
The procedure is tested with the
following four test cases.
oldc [1] = c i= 0 j = 1
a c a [0] = b
i=0j=2 a [0] = oldc[1]
A[0] = a a [0] = newc[1]
oldc [2] = a array content abcde
A [0] == oldc[2] flow a two replacements
A [0] = newc[2]
Array content abcde
i = 1 j =0
a [1] = b
oldc [0] = b
a [1] == oldc[0]
a [1] = newc[0]
Array content = accde
i=1j=1
a [1] = c
oldc [1] = c
a[1] == oldc[1]
a[1] = newc[1]
adcde
flow
Two successive replacement but if should
break after one replacement.
5. [Ans. C]
There is problem in the given code because
Break statement is missing.
Correct implementation is
for (int j = 0; j < 3; j++)
if (A[i] == oldc[j])
{
A[i] = newc[j];
break;
}
In both the questions whether array contain
repeated element ot not, flaw is due to oldc
and newc string only.
Flaw is in test case 3 and 4.
Array abcde
i=0j=0
a [0] = a
oldc [0] = b
a [0] == oldc [0]
a [0] = newc [0]
array content bbcde
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 418
GATE QUESTION BANK SE & WT
HTML Structure
CS - 2005 CS - 2011
1. Consider the three commands: PROMPT, 3. HTML (Hyper Text Markup language) has
HEAD and RCPT. Which of the following language elements which permit certain
options indicate a correct association of actions other than describing the
these commands with protocols where structure of the web document. Which
these are used? one of the actions is NOT supported by
(A) HTTP, SMTP, FTP pure HTML (without any client or server
(B) FTP, HTTP, SMTP side scripting) pages?
(C) HTTP, FTP, SMTP (A) Embed web objects from different
(D) SMTP, HTTP, FTP sites into same page
(B) Refresh the page automatically after
CS - 2009 a specified interval
2. Consider the HTML table definition given (C) Automatically redirect to another
below: page upon download
<table border=1> (D) Display the client time as part of the
<tr><td rowspan=2>ab</td> page
<td colspan=2> cd </td>
</tr>
<tr><td>ef</td>
<td rowspan=2>gh</td>
</tr>
<tr><td colspan=2>ij</td>
</tr>
</table>
The number of rows in each column and
the number of columns in each row are:
(A) (2,2,3) and (2,3,2)
(B) (2,2,3) and (2,2,3)
(C) (2,3,2) and (2,3,2)
(D) (2,3,2) and (2,2,3)
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 419
GATE QUESTION BANK SE & WT
2. [Ans. C]
Rowspan is used to specifying how many
rows a cell should span Colspan is used to
specifying how many columns a cell should
span
Table looks like.
cd
ab ef gh
ij
3. [Ans. D]
Date and Time can be displayed using
JavaScript
(A) For Embedding Object Tag is
available. <Object> Following
Objects can be Embedded,
ActiveX Controls, Flash,
Fireworks etc.
(B) <META http-equiv="refresh"
Content="5"> this will refresh a
page after 5 seconds
(C) <META http-equiv="refresh"
Content="5;
URL=http://www.othersite.com"> this
will Redirect a page after 5 seconds
(D) It needs JavaScript. Pure HTML does
not have any tag to show time on the
page.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 420
GATE QUESTION BANK SE & WT
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 421
GATE QUESTION BANK SE & WT
2. [Ans. D]
Return $c - Query return 'c' where 'c' is
set as Course with all Evaluations
Where min ($cs) >avg ($ as) - min(cs) is
minimum score of each evaluation in a
course
avg(as) is average of all the scores in all
courses from all professors.
3. [Ans. C]
Service oriented computer (
publish find bind
H p
Information representation XML
Process p BPMN.
th th th
THE GATE ACADEMY PVT.LTD. H.O.: #74, KeshavaKrupa (third Floor), 30 Cross, 10 Main, Jayanagar 4 Block, Bangalore-11
: 080-65700750, [email protected] © Copyright reserved. Web: www.thegateacademy.com Page 422