You are on page 1of 13

13

GATE COMPUTER SCIENCE


PRACTICE SET-2

This Practice Set '’Gate Computer Science


Practice Set -2’' is taken from our Book:

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

(a) q ( n) (b) q(n)

(c) q(n log n) (d) q ( n log n ) seq = 9500, ACK = 4001


45. What will be the complexity of quick sort if the median of n
element can be found in O(n) times and remain select as
pivot.
(a) q(n) (b) q(n2) seq = x, ACK = y
(c) q(n )
3 (d) q(n log n)
Client Server
46. Consider the alphabet å = {0,1} , the null, empty string l What will be the value of x and y, respectively?
and the sets of strings X0, X1 and X2 generated by the (a) 4000 and 9501 (b) 4001 and 9500
corresponding non-terminals of regular grammar. X0, X1 and (c) 4001 and 9501 (d) 4000 and 9500
X2 are related as follows : 52. Consider the following set of processes with the length of
X0 = 1X1; X1 = 0X1 + 1X2; X2 = 0X1 + {l}
CPU burst given in mili second :
Which one of the following choices precisely represents
the strings in X0?
(a) 10(0* + (10)*)1 Process Burst time Priority
(b) 10(0* + (10)*)*1 P1 11 3
(c) 1(0 + 10)*1 P2 1 1
(d) 10(0 + 10*)*1 + 110(0 + 10)*1
P3 3 5
47. Consider the following grammar :
S ® PQ P4 2 4
P5 5 2
Q ® + S |Î
P ® *| id The processes are assumed to have arrived in the order P1,
In the predictive parsing table M, the entries M[S, *] and
P2, P3, P4, P5 at time 0, 1, 2, 3, 4 respectively. The average
M[Q, S] are
waiting time of processes in priority scheduling is _____
(a) {S ® PQ}{Q ®Î} (b) {S ® PQ}{Q ® id} 53. Assume that the operators +, – and * are left associative
and Ù is right associative the order of precidence from lowest
(c) {S ® PQ}{Q ® +S} (d) {S ® PQ}{Q ® +}
19
to highest is –, +, * and Ú . The infix expression corrospond 58. R(A, B, C, D) is a relation which of the following does not
to given prefix expression abc * +def ÙÙ- is have a loss less join, dependency preserving BCNF
decomposition?
(a) a + b * c - d Ù eÙ f (b) a * b + c Ù d - eÙ f (a) A ® B, B ® CD (b) A ® B, B ® C, C ® D
(c) a + b * c Ù d - e Ù f (d) a * b + c - d Ù eÙ f (c) AB ® C, C ® AD (d) A ® BCD
59. What will be the normal form of a table after normalization in
54. In a binary min heap containing n-numbers the largest
element can be found in time which all determinations are candidate key?
(a) O(1) (b) O(n) (a) BCNF (b) 2NF
(c) O(log n) (c) O (n log n) (c) 3NF (d) 4NF
55. A table T1 in a relational database has the following rows 60. Suppose a line has bandwidth of 7000 Hz. The signal to
and columns noise ratio is 30 dB. Then, the capacity of channel in bps
would be ________.
Account Number Balance 61. A channel has a bit rate of 20 kbit/s and a propagation delay
of 100 ms. For what sizes does stop and wait gives an
A 301 5000
efficiency of 50%?
A 302 10000 62. You have an IP of 130.233.42.48 with subnet mask of 7 bits.
A 303 15000 How many hosts and subnets are possible?
A 304 20000 (a) 128, 126 (b) 126, 510
A 305 NULL (c) 126, 512 (d) 128, 128
A 306 NULL 63. Consider the following code
if key < A [i]
The following sequence of SQL statement was successfully then error “new key is smaller then A[i]”
executed on Table T1. A[i] ¬ key
Update T1 set Balance = Balance + 7000; while i > 1 and A[Parent (i)] < A[i]
Select AVG (Balance) from T1; do exchange A[i] « A[Parent (i)]
What is the output of the select statement? i ¬ parent (i)
56. The relational schema student_performance (name, What is the running time of above code?
course_number, roll_number, grade) has the following (a) O(log n) (b) O(n)
functional dependencies : (c) O(n log n) (d) O(n2)
name, course_number ® grade 64. Let F {D ® AC, A ® DB, B ® E, E ® D} that hold on
roll_number, course_number ® grade attribute set ABCED, the highest normal form that hold for
name ® roll_number given set is
roll_number ® name (a) BCNF (b) 3NF
The highest normal form of this relation scheme is
(c) 2NF (d) 4NF
(a) 2 NF (b) 3 NF
65. Consider a tree in which each node has exactly two children.
(c) BCNF (d) 4 NF
Let n be the count of NULL links holds. Let m be the internal
57. Let R be a relation schema R (ABC), F = {A ® BC, B ® C ,
AB ® C} is the set of functional dependency. The canonical nodes of the tree. Which of the following is true?
cover will be (a) m = 2n (b) m = n
(a) A ® BC, B ® C (b) A® BC, AB ® C n n
(c) A ® BC, A ® B (d) A ® B, B ® C (c) m = -1 (d) m =
2 2
20

HINTS & SOLUTIONS


1. (b) To accost (v.) means to approach and speak to board with the fifth person common to each pair. And
someone, usually in a bold and aggressive manner as that means that the two positions left must be
with a demand. occupied by people who are members of only one
2. (d) To forfeit (v.) means to be deprived of or lose the board.
right to by the act of a crime, offense, fault, breach, The results look like this:
or error. Board A : A B C D E F H K
3. (c) Let x be the number of students already seated at the Board B: A B C D E G I L
beginning of class then the four additional late- Board C: A B C D F G J M
comers are equal to 25 percent of that. Since each distinct letter represents a distinct person,
So, 0.25x = 4 just count up the number of distinct letters to get the
x = 16 number of distinct persons on the boards. The total
The number of students originally seated was 16. But number of people represented is the number of
the question asks not about the number originally letters from A to M, and a quick count of the letters
seated, but about the total number of chairs in the on the chart will show that this is 13. So a total of
classroom. So, we must add in the four late-comers 13 persons serve on one or more boards.
and 16 + 4 = 20 chairs. 6. (c) Since the shorter side of the rectangle is 20 inches,
4. (d) Assume for simplicity that the total distance of and the sides of the rectangle have the ratio of 3:2
Monu’s trip is 100 km. Then the table below gives means that the long side is found by the equation
the pertinent information
3 x
= , which becomes x = 30 inches. The length of
2 20
Distance
Distance Rate Time = framing needed will be found by computing the
Rate
perimeter of the rectangle by 2(30)+ 2(20) = perimeter
x = 60 + 40 = 100 inches.
x 40 7. (d) The author of this statement suggests that doctors
40
are less independent. The author stresses that many
100 - x doctors have lost authority. There is no support for
100 – x 60
60 the opinion that doctors resent the health-care
managers, however – which rules out option (a). The
The total time for Monu’s trip is doctors’ training is never mentioned option (b)
Doctors may care about their patients option (c), but
x 100 - x 3x 2(100 - x)
+ = + this information is not part of the paragraph.
40 60 120 120 8. (a) The fact that Saurabh and Vikas live on the same
3x + 2(100 - x) street indicates that they live in the same
= neighborhood. There is no support for any of the
120
other choices.
3x + 200 - 2x x + 200 9. (a)
= = a + b + b + c = a + 2b + c
120 120 squaring on both sides
Monu’s average speed over the entire trip is
a + b + b + c + 2 (a + b)(b + c) = a + 2b + c
Total distance 100 12, 000
= =
Total time x + 200 x + 200 Þ 2 (a + b)(b + c) = 0
120 (a + b) (b + c) = 0
5. (c) Since 4 persons serve on each board, fill in a letter b = –a, b = –c
for each person for 4 slots on each board; it doesn't 10. (c) When used for 25 hours per month, provider A will
matter where. This takes care of 4 of the 5 persons that cost `20 + 7.5 × `1 (for the hourly charge above the
are common to each pair of charities (1 – 2, 2 – 3, free hours). This equals `27.50. Provider B will cost
and 1 – 3): `20 plus 5 × `1.50 (for the hourly charge above the
Board A: A B C D ______ free hours).
Board B: A B C D ______ This equals `20 + `7.50 = `27.50 as well, so option
Board C: A B C D ______ (c) is the correct answer.
Now you can fill in the fifth and sixth slots on each
21
11. (a) Given 97 functions from X to Y is 14. (b) T(1) = 1
So, |X| = 1, |Y| = 97.
12. 0.6944 T(n + 1) = T(n) + êë (n +1) úû for all n ³ 1
Let P and Q be any two points taken at random on the given If n = m2 – 1
straight line AB of length ‘a’.
T(m2) = T(m2 – 1) + ëê m ûú
Let AP = x and AQ = y (0 £ x £ a, 0 £ y £ a).
Then we want P {|x – y| > c}
T(2) = T(1) + êë 2 úû = 1 + 1 = 2
The probability can be easily calculated geometrically.
Plotting the lines x – y = c and y – x = c along the coordinates
axis, we get the following diagram : T(3) = T(2) + êë 3 úû = 2 + 1 = 3
Since 0 £ x £ a, 0 £ y £ a, total area = a.a = a2. T(4) = T(3) + 2 = 5
Area favourable to the event |x – y| > c is given by T(5) = 5 + 2 = 7
1 1 T(6) = 7 + 2 = 9
D LMN + D DEF = LN.MN + EF.DF T(7) = 9 + 2 = 11
2 2
T(8) = 11 + 2 = 13
1 1 T(9) = 13 + 3 = 16
= (a - c)2 + (a - c)2 = (a - c)2
2 2 T(10) = 16 + 3 = 19
T(11) = 19 + 3 = 22
T(12) = 22 + 3 = 25
Y c
x= T(13) = 25 + 3 = 28
o–c y–
c T(14) = 28 + 3 = 31
y=
y>x+c E c x– T(15) = 31 + 3 = 34
T(16) = 34 + 4 = 38
o–c

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

Let S ® AC 40. (a) Given : y = 3x 4 -16x 3 + 24x 2 +37


34. (b) S ® AB S ® AC S ® CB
®aÎ ®Î b ® aacb S ® accb For maximum value or minimum
®a ®b ® aab ® abb dy
=12x3 -18x 2 + 43x =0
dx
Hence, we can say the language generated is
Þ x(x 2 - 4x + 4) = 0
{
L = a n bm | n, m ³ 1 and n ¹ m }
35. (a) The predictive parsing table is
Þ x(x - 2)2 = 0
Þ x = 0, 2, 2
+ * id s d2y
= 36x 2 - 96x + 48
s s ® s1s 2 dx 2
s1 ® s3 + s1
s1 s 2 ®Î d2 y
s1 ® s3 At x = 0, = +48
s2 s 2 ® *s1s2 dx 2
s3 s3 ® id d2y
At x = 2, = 36´ 4 - 96´ 2 + 48 = 0
dx 2
36. (d) Number of permutations with ‘2’ in the first position = 19!
So only 1 local minima.
Number of permutations with ‘2’ in the second position
either x = 0 or complex root
= 10 × 18!
So only value = 0
(fill the first space with any of the 10 odd numbers and
41. (c) In the given code line 4 is the outer loop and line 7 and
the 18 spaces after the 2 with 18 of the remaining
10 are inner loop. The upper bound of the outer loop is
numbers in 18! ways)
n – 1, so it taken O(n) time.
Number of permutations with ‘2’ in 3rd position = 10 ×
The upper bound of the line 7 having complexity O(n)
9 × 17!
and line 10 also contain O(n). In both cases overall
(fill the first 2 places with 2 of the 10 odd numbers and
complexity is O(n2). It is noted if line 7 is executed then
then the remaining 17 places with remaining 17
line 10 is not executed due to if-else condition.
numbers) and so on until ‘2’ is in 11th place. After that
42. (c) Complexity for every individual group, since we use
it is not possible to satisfy the given condition, since
insertion sort = O(k2)
there are only 10 odd numbers available to fill before
the ‘2’. So the desired number of permutations which n 2
satisfied the given condition is For all groups = ´ k = O ( nk )
k
19! + 10 × 18! + 10 × 9 × 17! + 10 × 9 × 8 × 16! + ... 10! × 9!
Now the probability of this happening is given by n
Total number of merge pass required Þ log 2
k
19!+10×18!+10×9×17!...+10!×9!
Complexity of every merge pass = O(n)
20!
24
n
Total complexity of merge sort = n log 2 p q p Ú q p Þ (p Ú q )
k
T T T T
= n[log2n – log2k]
Total complexity using insertion sort and merge sort T F T T
= nk + n[log2 – log2k] F T T T
= n[k + log2n – log2k] F F F T
43. (d) All strings are accepted
(a) (S, aaaab) ® (P, aaab) ® (T, aab) ® (T, ab) ® (T, b) 50. (a) Average time required to perform a successful
®F sequential search for an element in an array
(b) (S, aabbba) ® (P, abbba) ® (T, bbba) ® (Q, bbba) ( n + 1)
® Q, (bba) A (1: n ) is
2
® (Q, ba) ® (Q, a) ® F 51. (c) Since, server has sent ACK = 4001, so client will sent
(c) (S, abb) ® (P, bb) ® (R, b) ® F next frame with sequence number = 4001, and client
Hence, option (d) is true. will ask for the next frame to the server by sending
44. (d) T(n) = 2T ( êé n / 4 úù ) + n ACK = 9501.
52. 7.4
Apply Master’s Theorem The processes will executed as follows
a = 2, b = 4, f ( n ) = n
P1 P2 P1 P1 P5 P1 P4 P3
log a log 4
n b =n 2
0 1 2 3 4 9 17 19 22
Waiting time of P1 = 9 – 3 – 0 = 6
æ1ö
nç ÷ Þ n Waiting time of P2 = 1 – 1 = 0
è2ø Waiting time of P3 = 19 – 2 = 17
then case 2 applied Waiting time of P4 = 17 – 3 = 14
T (n ) = ( n log n ) Waiting time of P5 = 4 – 4 = 0
6 + 0 + 17 + 14 + 0
45. (b) Median is selected in O(n) time and remains also in n Average waiting time = = 7.4 ms
5
time so it will take q(n2).
53. (a) abc * +def ÙÙ-
46. (c) X0 = 1X1 10X1 100X1
( )
Ù-
101X2 1010X1 abc * +d e Ù f
11X2
101 (string)
( )
-
110X1 a ( b *c ) + d Ù e Ùf
11 String (minimum)
( a + b*c ) + ( d ÙeÙf )
-

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

You might also like