Professional Documents
Culture Documents
CS It 2018
CS It 2018
ISBN : 978-9386629029
14
PRACTICE SET 2
INSTRUCTIONS
1. There are a total of 65 questions carrying 100 marks. Duration of the set is 3 hrs.
2. This question paper consists of 2 sections, General Aptitude (GA) for 15 marks and the subject specific
GATE paper for 85 marks. Both these sections are compulsory.
3. The GA section consists of 10 questions. Question numbers 1 to 5 are of 1-mark each, while question numbers 6 to
10 are of 2-marks each. The subject specific GATE paper section consists of 55 questions, out of which question
numbers 11 to 35 are of 1-mark each, while question numbers 36 to 65 are of 2-marks each.
4. Questions are of Multiple Choice Question (MCQ) or Numerical Answer type. A multiple choice question will have
four choices for the answer with only one correct choice. For numerical answer type questions, the answer is a number
and no choices will be given.
5. Questions not attempted will result in zero mark. Wrong answers for multiple choice type questions will result in
1
NEGATIVE marks. For all 1 mark questions, mark will be deducted for each wrong answer. For all 2 marks questions,
3
2
mark will be deducted for each wrong answer..
3
6. There is NO NEGATIVE MARKING for questions of NUMERICAL ANSWER TYPE.
GENERAL APTITUDE and fill the empty chairs. What is total number of chairs
in the classroom ?
QUESTION 1 TO 5 CARRY ONE MARK EACH
(a) 15 (b) 18
1. Choose the best word to fill the blank. (c) 20 (d) 24
When Melinda arrived in the impoverished city, she was 4. During a trip, Monu traveled x percent of the total
immediately _______ by bands of children begging for distance at an average speed of 40 kmph and the rest of
food. the distance at an average speed of 60 kmph. In terms of
(a) bedraggled (b) accosted x, what was Monu’s average speed in the entire trip?
(c) infiltrated (d) rebuked
1800 - x x + 6000
2. Choose the best word to fill the blank. (a) (b)
200 4
According to the terms of the agreement, if Nicole
defaulted on her loan, she would have to _____ her 6000 12000
(c) (d)
house and car, both which would become property of the x - 200 x + 200
bank.
5. Each of three in Shilpa Real Estates has 8 persons serving
(a) usurp (b) evince
on is board of directors. If exactly 4 persons serve on 3
(c) debut (d) forfeit
boards each pair of firms has 5 persons in common on
3. At the beginning of a class, a classroom has 4 empty
their boards of directors, then how many distinct persons
chairs and all students are seated. No student leaves the
serve on one or more boards of directors ?
classroom, and additional students equal to 25 percent of
(a) 7 (b) 11
the number of students already seated enter the class late
(c) 13 (d) 18
15
QUESTION 6 TO 10 CARRY TWO MARKS EACH TECHNICAL SECTION
6. A carpenter is buiding a frame for a wall painting. The
painting is in the shape of rectangle. If the sides of the QUESTION 11 TO 35 CARRY ONE MARK EACH
rectangle are in the ratio of 3:2 and the shorter side has
11. Suppose X and Y are sets and |X| and |Y| are their respective
a length of 20 inches. How many inches of framing
cardinalities. It is given that there are exactly 97 functions
material does the carpenter need to frame the painting ?
from X to Y. From this one can conclude that
(a) 50 (b) 75
(a) |X| = 1, |Y| = 97 (b) |X| = 97, |Y| = 1
(c) 100 (d) 120 (c) |X| = 97, |Y| = 97 (d) None of the above
7. During the last six years, the number of practicing 12. Two friends agree to meet at a park with the following
physicians has increased by about 20%. During the same conditions. Each will reach the park between 4.00 p.m. and
time period, the number of health care managers has 5.00 p.m. and will see if the other has already arrived. If not,
increased by more than 600%. These percentages mean they will wait for 10 minutes or the end of the hour whichever
that many doctors have lost the authority to make their is earlier and leave. What is the probability that the two will
own schedules, determine the fees that they charge, and not meet ?
decide on prescribed treatments. 13. The rank of the matrix given below is ______
This paragraph best supports the statement that doctors
é1 4 8 7ù
(a) resent the interference of health care managers. ê0
ê 0 3 0 úú
(b) no longer have adequate training.
ê4 2 3 1ú
(c) care a great deal about their patients. ê ú
(d) are less independent than they used to be. ë3 12 24 2 û
8. Saurabh has a paper route. Each morning, he delivers 37 14. Consider the following recurrence relation:
newspapers to customers in his neighborhood. It takes T(1) = 1
Saurabh 50 minutes to deliver all the papers. If Saurabh
is sick or has other plans, his friend Vikas, who lives on T(n +1) = T(n) + êë n +1 úû for all n ³ 1
the same street, will sometimes deliver the papers for him. The value of T(m)2 for m ³ 1 is
Which one of the following statements must be true m
based on the above? (a) (21m -39) + 4
6
(a) Saurabh and Vikas live in the same neighborhood.
(b) It takes Vikas more than 50 minutes to deliver the m
(b) (4m 2 - 3m +5)
papers. 6
(c) It is dark outside when Saurabh begins his deliveries. m 2.5
(c) (m - 11m + 20) -5
(d) Vikas would like to have his own paper route. 2
9. If a + b + b + c = a + 2b + c , then b is equal to m 5
(d) (5m3 -34m2 +137m -104) +
(a) –a, –c (b) a, c 6 6
(c) ± a, ± c (d) –a, c 15. The 2n vertices of graph G correspond to all subsets of a set
10. Raju is planning to get wireless Internet service at his of size n, for n ³ 6. Two vertices of G are adjacent if and only
house. Two service providers, A and B, offered different if the corresponding sets intersect in exactly two elements.
rates as shown in the table below. If Raju plans on using The number of connected components in G is _______
25 hours of internet service per month, which of the 16. In the following expressions, AND and OR arithmetic
following statements is true ? operators are used.
(42 OR 72) AND 55
Internet Service Rates What is the value of expression?
17. If the input to the digital circuit (in the figure) consisting of
Provider Free Hours Base Charge Hourly Charge
a cascade of 19 X-NOR gates is A, the output will be
A 17.5 `20 `1.00
1 Output
B 20 `20.00 `1.50 1 2 18 19
(a) Provider A will be cheaper.
(b) Provider B will be cheaper.
A
(c) The providers will cost the same per month.
(d) The answer cannot be determined from the information (a) A (b) 0
given. (c) 1 (d) A
16
18. Consider the following gates :
1. NAND 2. NOR 24. cd ab 00 01 11 10
3. EX-OR 4. EX-NOR
00 1 1 1
Which of the following can design any combinational circuit?
(a) 1 and 2 (b) 1, 2 and 3 01 x
(c) 1 only (d) 1, 2, 3 and 4
19. What is the application of XOR GATE? 11 x
(a) To check the output of two signals
10 1 1 x
(b) To check whether the two signals are different or same
(c) To check whether the two signals are same
(d) To check whether two signals are different (a) bd + a d (b) a b + bd + a b.d
20. The Boolean function f(x, y, z) = x¢yz¢ + xyz¢ + xyz is (c) bd + a b.d (d) a b + bd + a d
equivalent to
(a) yz + xy (b) yz¢ + xy 25. Consider the following program :
main ( )
(c) y¢z + xy (d) y¢z + x¢y¢
{
21. Consider the following Karnaugh map. Determine the putchar (‘M’)
corresponding switching function in its minimal form. first ();
putchar (‘r’);
CD }
AB 00 01 11 10 first ( )
00 1 1 1 {............}
second ( )
01 {putchar (‘i’);}
If Minister is the required output, then the body of first
11 1 1 must be
(a) empty
10 1 1 1 (b) second ( ); putchar (‘n’); putchar (‘s’)
(c) second ( ); putchar (‘n’); second ( ); putchar (‘s’);
putchar (‘t’); putchar (‘e’);
(a) F(A, B, C, D) = AD + BC + AB¢C¢
(d) None of the above
(b) F(A, B, C, D) = (A¢ + B¢) + (C¢ + D¢) (A + B + C) 26. If your compiler actually optimizes access time of only two
(c) F(A, B, C, D) = AD +B¢D + A¢B¢C¢ register variables per function, which two variables in the
(d) F(A, B, C, D) = B¢ D¢ + B¢ C + A B D following program are best ones to be made into register
22. Which one of the following array represents a binary max- variables.
heap? #include <stdio.h>
(a) {25, 12, 16, 13, 10, 8, 14} (b) {25, 14, 13, 16, 10, 8, 12} #include <conio.h>
(c) {25, 14, 16, 13, 10, 8, 12} (d) {25, 14, 12, 13, 10, 8, 16} void main (void)
23. Consider the digital circuit given in figure below which {
int i, j, k, m;
compares two numbers B0, B1, B2, B3 and A0, A1, A2, A3. To
do
get output y = 0, which of the following pair is correct ? {
printf(“enter value”) ;
A0 scanf (“%d”, &i);
B0 m = 0;
for (j = 0; j < i; j++)
}
A1 }
B1 27. Consider the given C program :
main ()
Y {
A2 char s[ ] = {‘a’, ‘b’, ‘c’, ‘\n’, ‘c’, ‘\0’};
char *p, *str, *str1;
B2 p = & s[3];
str = p;
str1 = s;
A3
printf (“% d”, ++ *p +++ *str1 – 32);
B3 }
What should be the output of the above program?
(a) 0010, 0010 (b) 1010, 1010 (a) 77 (b) 78
(c) 0101, 0101 (d) 0010, 1101 (c) Compile error (d) None of these
17
28. What does the following fragment of C program print? 35. Consider the grammar below
char c[ ] = “GATE 2017”; s ® s1s 2 ; s1 ® s3 + s1 | s3 ;s2 ® *s1s 2 |Î;s3 ® id
char * p = c;
In the predictive parsing table, M of the grammar, the entries
printf(“%s”, p + p[3] – p[1]);
M [s, id] and M [s2, $] are respectively.
(a) GATE 2017 (b) E2017
(c) 2017 (d) 017 (a) {s ® s1s2 },{s2 ®Î}
29. Consider the following C function : (b) {s ® s1s 2},{s2 ® *s1s 2}
float f (float x, int y){
float P, S; int i; (c) {s ® s1s 2 },{s3 ® id}
for (S = 1, P = 1, i = 1, i < y, i++){ (d) {s ® s1s2 },{s1 ® s3 + s1}
P* = x/i;
S+ = P; QUESTION 36 TO 65 CARRY TWO MARKS EACH
}
36. Suppose we uniformly and randomly select a permutation
returns; from the 20! permutations of 1, 2, 3..., 20. The probability
} that 2 appears at an earlier position than any other even
for large value of y the return value of the function of best number in the selected permutation is ______
approximates.
1 1
(a) xy (b) ex (a) (b)
(c) ln(1 + x) (d) xx 2 10
30. Consider the C function given below : 9!
(c) (d) None of these
int f (int j) 20!
{ 37. Consider the matrix as given below :
static int i = 50;
é1 2 3 ù
int k; ê0 4 7 ú
if (i == j) ê ú
{ êë0 0 3 úû
print f (“something”); Which one of the following options provides the CORRECT
k = f(i); values of the eigenvalues of the matrix ?
return 0; (a) 1, 4, 3 (b) 3, 7, 3
} (c) 7, 3, 2 (d) 1, 2, 3
else return 0; 38. The 2n vertices of graph G correspond to all subsets of a set
} of size n, for n ³ 6. Two vertices of G are adjacent if and only
31. Consider the following two regular languages: if the corresponding sets intersect in exactly two elements.
L1 = (a + b) * a and L2 = b(a + b)*. The number of vertices of degree zero in G is ________
The intersection of L1 and L2 is given by 39. The minimum number of equal length subintervals needed
(a) (a + b)*ab (b) ab(a+ b)* 2
(c) a(a + b)*b (d) b(a + b)*a 1 -6
to approximate ò xe x dx to an accuracy of at least ´10
32. Consider the following expression: 3
1
( P Ú Q ) Ú ( P ® R ) Ù ( Q ® S) using the trapezoidal rule is _________
Find the equivalent expression of the above expression. 40. A point on a curve is said to be an extremum if it is a local
minimum or a local maximum. The number of distinct extrema
(a) S Ù R (b) S ® R
for the curve 3x4 – 16x3 + 24x2 + 37 is
(c) S Ú R (d) None of these (a) 0 (b) 1
33. The grammar A ® AA |A| e is not suitable for predictive (c) 2 (d) 3
parsing because the grammar is 41. Consider the following code :
(a) ambiguous (b) left-recursive int f (int A [Size] [Size], int n)
(c) right-recursive (d) an operator grammar {
34. Consider the following grammar : int i, j, s = 0 ;
S ® AC | CB for (i = 0; i < n; ++1)
C ® aCb | Î {
A ® aA | a if (i % 2 == 0)
B ® bB | b for (j = 0; j <= i; j = j + 1)
What language is generated by given grammar? s = s + A [i] [j];
(a) L = {anbm | n, m ³ 1} else
for (j = n – 1; j >= 1; j = j – 1)
(b) L = {anbm | n, m ³ 1, n ¹ m}
s = s + A [i] [j];
(c) L = {anbm | n, m ³ 1, n ³ m}
}
(d) L = {anbm | n, m ³ 1, n £ m} }
18
What is the time complexity of code in term of n? 48. Consider the following regular expression
(a) O(n) (b) O(log n) R = (ab|abb)* bbab
(c) O(n2) (d) O(n3) Which of the following strings is not in the set denoted?
42. A list of n elements is divided into n/k groups such that in (a) ababab (b) abbab
each group k-elements are present. Initially, we have applied (c) abbabbbbab (d) abababbabbbab
insertion sort in each group of making every individual group 49. Which one of the following propositional form is a
a sorted list. Now, we have applied merge pass till all the list tautology?
become a sorted list of n elements. What is the total
(a) p Ù Øq (b) p Þ ( p Ú q )
complexity of this sorting algorithm?
(a) n (b) nk (c) p Þ (p Ù q ) (d) ( p Ú q) Þ (p Ù q)
(c) n[k + log2n – log2k] (d) n log2n
50. Average time required to perform a successful sequential
43. Consider the following NFA :
search for an element in an array A(1 : n) is
a
a ( n + 1)
P T (a) (b) n2
2
a b
a
n ( n + 1) n ( n + 1)( 2n + 1)
b e (c) (d)
S F 2 6
b a
2 51. For TCP connection establishment, three way handshaking
e b is used as shown in figure.
R Q
e
Which of the following strings is not accepted by the seq
automaton? = 400
(a) aaab (b) aabbba 0
(c) abb (d) None of these
44. A recurrence T(n) = 2T ( éê n / 4 ùú ) + n is
M P Q
A B
D T(m2) = T(m2 – 1) + êë m úû
o–c
x
c L x > y =c y Put m = 2, T(4) = T(3) + 1 = 4
o–c X a Put m = 3, T(9) = T(8) + 1 = 13 + 1 = 14
0 N
c
m
(a) (21m -39) + 4
2 6
(a - c)2 æ c ö
P(|x - y|< c) = = ç1- ÷ 2
a2 è aø Put m = 2, (42 -39) + 4 =5
6
For meeting to take place it is necessary and sufficient that
|x – y| < 10. 3
Put m = 3, (63-39) + 4 =16
Here c = 10 and a = 60 (all outcome can be described as 6
points of a square with side 60
4 2
2 Put m = 4 [84 - 39]+ 4 = ´45+ 4 =34
æ5ö 6 3
\ P[|x – y| > 10] = 1-ç ÷ (b) Put m = 2
è6ø
11
=
m
6
( )
2
4m 2 -3m + 5 = [16 - 6 + 5] =5
6
36
Put m = 3
\ Probability that the two will not meet
3 1
11 ( 4´9 -3´3+ 5 ) = [32] =16
= 1- 6 2
36
Put m = 4
25
= = 0.6944 4 2
36 [64 -12 + 5] = [57] =38
6 3
13. 3
Hence choice (b) satisfies the solution of T (m)2.
R4 = 3R1.
15. n + 2
\ Rank < 4
Number of connected component of G is determined by the
1 4 8 degree and edges of vertices there are n + 1 vertices whose
0 0 3 = 48 ¹ 0. degree is zero, so they can form n + 1 connected component.
and The remaining vertices of the graph G are all connected as a
4 2 3 single component. So total number of connected component
\ Rank = 3 is n + 2.
22
16. 50 23. (d) For output Y = 0, all 4 inputs of NAND gate should be
First convert all in binary high (i.e., 1), to get high, any one input of XOR gate
(42)10 = (101010)2 should be high. Hence 0010 and 1101 is right answer.
(72)10 = (1001000)2
24. (d) a b + bd + a d
(55)10 = (110111)2
(42 OR 72) = (101010)2 OR (1001000)2 25. (c) The required output is Minister. So, the firstly M will
= (1110010)2 be print by the first statement given in the program.
(42 OR 72) AND 55 = (1110010)2 AND (110111)2 Now, the function first ( ) is called. To print “insite”,
= (110010)2 = (50)10 the body of first ( ) should be
17. (a) Output of gate 1 = 1 e A first ( )
{
= 1e A + 1 e A = A second ( ); /* it prints ‘i’ */
Output of gate 2 = A e A = 1 putchar (‘n’)
second ( ); * it prints ‘i’*/
Output of gate 3 = 1 e A = A
putchar (‘s’) ;
Output of gate 4 = A e A = 1 putchar (‘t’) ;
Q Output of even numbered gate is 1 putchar (‘e’) ;
\ Output of gate 18 = 1 }
Output of gate 19 = 1 e A = A and the last statement putchar (‘r’) given in the program
18. (a) Any circuit can be designed using NAND and NOR will print r.
gate. 26. (c) It is known that register is used to define local variables
that should be stored in a register instead of RAM. A
A variable is used at many places in a program, it is better
y
19. (b) B to declare its storage class as register. In the given
program, K and m are used in many places. So, these
Truth table is
are the best one to be made into register variables.
A B Y 27. (a) p is pointed to character ‘\n’, str1 is pointing to
0 0 0 character ‘a’. For ++ *p, p is pointing to ‘\n’ and that is
incremented by one. The ASCII value of ‘\n’ is 10
0 1 1
which is then incremented by 1 to 11. The value of ++
1 0 1 *p is 11. ++* str1, str1 is pointing to ‘a’ that is
1 1 0 incremented by 1 and becomes b. ASCII value of b is
98.
It gives output 0 if both signals are same and gives output
Now performing (11 + 98 – 32) = 77 (“M”) so,
1if both signals are different.
Output = 77
20. (b) f(x, y, z) = x¢yz¢ + xyz¢ + xyz
28. (c) Assume that base address of c is 2000
= x¢yz¢ + xyz¢ + xyz¢ + xyz
= yz¢ + (x + x¢) + xy (z + z¢) 2000 01 02 03 04 05 06 07 08
= yz¢ + xy
21. (d) The Karnaugh map is G A T E 2 0 1 7 /0
0 1 2 3 4 5 6 7 8
CD p
AB 00 01 11 10
2000
00 1 1 1
p + p[3] – p[1]
01 2000 + 69 – 65 = 2004
æ p [3] = E = 69 in ASCII ö
11 1 1 Pair 3
Q ç p[1] = A = 65 in ASCII ÷
è ø
10 1 1 1 At position 2017 Þ 2017.
Pair 2 Pair 1 29. (b) ex
Pair 1 has common B¢ and C, so minterm will be B¢C. 30. (d) When f = 50, the f n will exhaust run time stack, because
Pair 2 has common B¢ and D¢ and so minterm will be B¢D¢. function will be called infinite times which results into
Pair 3 has common A, B and D. So minterm will be ABD. an infinite loop at j = 50.
So, F(A, B, C, D) = B¢C + B¢D¢ + ABD 31. (d) Here, L1 = (a + b)*a is nothing but set of all strings of
22. (c) a and b ending with a.
23
L2 = b(a + b)* is a set of all strings of a and b starting Which is clearly not choices (a), (b) or (c)
with b. \ Answer is (d)
The intersection of L1 and L2 is the set of all strings 37. (a) Given matrix is upper triangular matrix and its diagonal
starting with b and ending with a. elements are its eigen values = 1, 4, 3
38. n + 1
\ L1 Ç L2 = b ( a + b ) *a
Vertices of degree zero will be those subsets which do
Hence, option (d) is the correct answer. not have two elements common with any other subset.
32. (d) ( P Ú Q ) Ú ( P ® R ) Ú ( Q ® S) This is true only for the subsets of cardinality 0 and 1.
Number of sets with cardinality 1 = n
= ( P + Q ) Ú ( P¢ + R ) Ú ( Q¢ + S ) \ Number of vertices of degree 0 = n + 1
39. 1000e
= ( P + Q ) + ( P¢ + R ) + ( Q¢ + S)
2
= ( P + P¢ ) + ( Q + Q¢ ) + ( R + S) ò xe
x
dx = xe x - e x
=1+1+R+S (By Complement law) 1
=1+R+S 2
= éë e (x -1) ùû
x
=1+S=1 (by Identity law)
1
33. (a) Grammar is ambiguous since there are more than one
parse tree of single string of terminals. = 1000e using trapezoidal rule
All strings are starting with 1 with min string 11, which can
be generated by 1(0* + 10)*1. a + b * c - d Ù eÙ f
47. (a) Predictive parsing table is : 54. (b) To find largest element in min heap it require O(n) time
because it will find largest element in last.
id + * $ 55. 19500
UPDATE T1 Set Balance = Balance + 7000;
S S®PQ S®PQ This will result in following table.
P P®id P®*
Account Number Balance
Q Q®+S Q®Î
A 301 12000
A 302 17000
48. (a) ababab is not in set denote by R as in R every string A 303 22000
must end with bbab. A 304 27000
49. (b) p Þ ( p Ú q ) is a tautology. As A 305 NULL
A 306 NULL
25
Select AVG (Balance) from T1.
L
tf =
12000 + 17000 + 22000 + 27000 20 ´ 103
AVG ( Balance ) =
4 For stop and wait,
78000 1
= Channel utilization U =
4 1 + 2A
= 19500 tp
(We divide by 4 because COUNT (*) ignore NULL values in where, A =
the column) tF
56. (b) The functional dependency of the relation is
name, course – number ® grade — 1 1 1
0.5 = =
roll – number, course – number ® grade — 2 æ 100 ´ 10 -3 ö æ 2000 ö
ç ÷ 1 + 2ç ÷
name ® roll–number — 3 L è L ø
1+ 2 ç ÷
roll–number ® name — 4 ç 20 ´103 ÷
The candidate keys are {name, course–number} and ç ÷
è ø
{course–number, roll–number}.
Dependency 3 and 4 are transitive but they are prime Þ L = 4000 bit
attribute, so we will break this relation upto 3 NF. 62. (b) The given address is of class B.
57. (d) The canonical cover will be The default mask of class B is of 16 bits long.
A ® B, B ® C There is additional 7 bits to the default subnet mask.
58. (c) AB ® C, C ® AD The total number of bits in the subnet are 16 + 7 = 23
59. (a) The table will be in BCNF. bits.
60. 69770 This leaves us with the 32 – 23= 9 bits for assigning to
Signal to noise ratio = 30 dB host.
7 bits of subnet corresponds to 27 – 2 = 126 subnets 7
S bits belonging to host address corresponds to = 29 – 2
Q dB = 10log10
N = 510 hosts.
63. (a) The running time is O(log n) since the path from node
S updated to root has length O(log n)
\ 10 log10 = 30
N 64. (a) The attributes ABCD results in minimal cover {A ®
DB, D ® AC, B ® D}, since every key in minimal cover
S
Þ = 1000 is candidate key. Hence, the relation is BCNF.
N 65. (c) Each tree which have exactly two children’s
The capacity of channel
Internal
æ Sö nodes
C = Blog2 ç1 + ÷
è N ø
= 7000 log2 (1 + 1000)
= 69770 bps External
61. A channel has a bit rate of 20 kbit/s and a propagation delay nodes
of 100 ms. For what sizes does stop and wait gives an
null
efficiency of 50%? nodes
61. 4000
m= 3
Assume that, frame size = L
20 × 103 bit are transmitted in 1s n
Hence, m = -1
Also, L bit are transmitted in tfs. 2