CS 3 2015
CS 3 2015
CS 3 2015
Wrong answer for MCQ will result in negative marks, (−1/3) for 1 Mark Questions and (−2/3) for 2 Marks
Question.
General Aptitude
Number of Questions: 10 Section Marks: 15.0
Question 1 to Question 5 carry 1 mark each and Solution: Area of triangle PQR = Area of triangle
Question 6 to Question 10 carry 2 marks each. PQS+
Question Number: 1 Question Type: MCQ Area of triangle PSR
1
Out of the following four sentences, select the most Area of triangle PQR = (r) (q) sin ∠ P
suitable sentence with respect to grammar and usage: 2
1 rq
(A) Since the report lacked needed information, it = (r) (q) sin (2 ∠ QPS) = sin 120°
2 2
was of no use to them.
(∵ PS is the angle bisector of ∠ QPR)
(B) The report was useless to them because there
were no needed information in it. 1 1 1
∴ (r q sin 120°) = (r (PS) sin 60°) +
(C) Since the report did not contain the needed 2 2 2
information, it was not real useful to them. (q (PS) sin 60°)
(D) Since the report lacked needed information, it ⎛ 3⎞ 3 rq
would not have been useful to them. r q ⎜ ⎟ = r (PS) PS =
⎝ 2 ⎠ 2 r+q
Solution: Choice (A) is free of all errors. Though the Hence, the correct option is (B).
article ‘the’ before ‘needed’ would render it correct, but
of the given choices, (A) is correct. The use of ‘there Question Number: 3 Question Type: NAT
were’ in (B) is incorrect. ‘Real useful’ is ungrammati-
cal in (C). ‘Not had been’ is ungrammatical in (D). If p, q, r, s are distinct integers such that:
Hence, the correct option is (A). f (p, q, r, s) = max(p, q, r, s)
g(p, q, r, s) = min(p, q, r, s)
Question Number: 2 Question Type: MCQ
h(p, q, r, s) = remainder of (p × q)/(r × s) if (p × q) >
In a triangle PQR, PS is the angle bisector of ∠QPR (r × s) or remainder of (r × s)/(p × q) if (r × s) >
and ∠QPS = 60o. What is the length of PS? (p × q)
P Also a function fgh(p, q, r, s) = f (p, q, r, s) × g(p, q, r, s)
× h(p, q, r, s)
Also the same operations are valid with two variable
r q functions of the form f (p, q)
What is the value of fg(h(2,5,7,3), 4,6,8)?
⎛ 21⎞
S Solution: h (2, 5, 7, 3) = remainder of ⎜ ⎟ = 1
Q R ⎝ 10 ⎠
(∵ (r × s) > (p × q))
p
fg (h (2,5,7,3),4,6,8) = fg (1,4,6,8)
(A)
(q + r ) (B)
qr = f (1,4,6,8) × g (1,4,6,8)
qr (q + r ) = max (1, 4, 6, 8) × min (1, 4, 6, 8) = 8 × 1 = 8
( q + r )2
(C) ( q2 + r 2 ) (D)
qr
Hence, the correct Answer is (8).
cii | GATE 2015 Solved Paper CSIT: Set – 3
What will be the total weight of 10 poles each of same 10W = 160 + 2W
weight? 8W = 160
Statements:
W = 20 kg
(I) One fourth of the weight of a pole is 5 kg.
(II) The total weight of these poles is 160 kg more So 10W = 200 kg
than the total weight of two poles. (II) alone also is sufficient to arrive at the answer.
(A) Statement I alone is not sufficient. So, both (I) and (II) alone are sufficient to answer the
(B) Statement II alone is not sufficient. question.
(C) Either I or II alone is sufficient. Hence, the correct option is (C).
(D) Both statements I and II together are not suf-
ficient. Question Number: 10 Question Type: MCQ
Solution: We are asked to find the total height 10 Consider a function f (x) = 1 − |x| on −1 ≤ x ≤ 1. The
notes, each of same height value of x at which the function attains a maximum and
the maximum value of the function are:
From (I) alone we know that one fourth weight of a
pole = 5 kg (A) 0, −1 (B) −1, 0
Let us assume each pole to be of height W units (C) 0, 1 (D) −1, 2
1
W = 5 kg Solution: f (x) is maximum when |x| is minimum i.e.
4 when |x| is zero i.e. when x is zero.
W = 20 Kg Maximum value of f (x) = 1 – 0 = 1. Which occurs at
Weight of each pole = 20K x = 0.
Then, 10 poles = 200 kgs Hence, the correct option is (C).
So, (I) alone can give us the answer (II) alone tells us
let us assume each pole to be of height ‘W’
(B) A cookie gains entry to the user’s work area 128.96.1010 0111.1001 0110
through an HTTP header. 255.255.1111 1110. 0000 0000
(C) A cookie has an expiry date and time. 128.96. 166 .0
(D) Cookies can be used to track the browsing
∴ The next hop will be R2
pattern of a user at a particular site.
i – a, ii – c, iii – e, iv – d
Solution: A cookie is a piece of code which is sent
from a website and stored in web browser. It has the Hence, the correct option is (A).
potential to compromise the security of a user.
Question Number: 14 Question Type: MCQ
Hence, the correct option is (A).
Host A sends a UDP datagram containing 8880 bytes
Question Number: 13 Question Type: MCQ of user data to host B over an Ethernet LAN. Ethernet
Consider the following routing table at an IP router: frames may carry data up to 1500 bytes (i.e., MTU =
1500 bytes). Size of UDP header is 8 bytes and size
Network No. Net Mask Next Hop of IP header is 20 bytes. There is no option field in IP
128.96.170.0 255.255.254.0 Interface 0 header. How many total number of IP fragments will be
128.96.168.0 255.255.254.0 Interface 1 transmitted and what will be the contents of offset field
128.96.166.0 255.255.254.0 R2 in the last fragment?
128.96.164.0 255.255.252.0 R3 (A) 6 and 925 (B) 6 and 7400
0.0.0.0 Default R4 (C) 7 and 1110 (D) 7 and 8880
For each IP address in group I identify the correct Solution: User data = 8880 bytes
choice of the next hop from group II using the entries MTU = 1500 bytes
from the routing table above.
UDP header = 8 bytes
Group I Group II
IP header = 20 bytes
(i) 128.96.171.92 (a) Interface 0
Header length = (20 + 8) = 28 bytes
(ii) 128.96.167.151 (b) Interface 1
(iii) 128.96.163.151 (c) R2 Actual data in each fragment = 1500 – 28 = 1472 bytes
(iv) 128.96.165.121 (d) R3
Data Header Offset
(e) R4
1st fragment 1472 28 0/8 = 0
2 nd
fragment 1472 28 1472/8 = 184
(A) i-a, ii-c, iii-e, iv-d (B) i-a, ii-d, iii-b, iv-e
(C) i-b, ii-c, iii-d, iv-e (D) i-b, ii-c, iii-e, iv-d 2 1472
3rd fragment 1472 28 368
8
Solution: (i) Given IP address 128.96.171.92
3 1472
4th fragment 1472 28 552
Perform AND operation with given masks. If the result 8
gives any specific network number, the next hop of that
4 1472
network will be chosen. 5th fragment 1472 28 736
8
128.96.171.92 5 1472
6th fragment 1472 28 920
255.255.254.0 8
Question Number: 15 Question Type: MCQ (A) Undo: T3, T1; Redo: T2
Assume that the bandwidth for a TCP connection is (B) Undo: T3, T1; Redo: T2, T4
1048560 bits/sec. Let α be the value of RTT in milli- (C) Undo: none; Redo: T2, T4, T3, T1
seconds (rounded off to the nearest integer) after which (D) Undo: T3, T1, T4; Redo: T2
the TCP window scale option is needed. Let β be the
maximum possible window size with window scale Solution: Check point:
option. Then the values of α and β are The automatic recovery processes by identifying a
point at which all completed transactions are guaran-
(A) 63 milliseconds, 65535 × 214 teed have been written to the database device.
(B) 63 milliseconds, 65535 × 216 A check point creates a known good point from
(C) 500 milliseconds, 65535 × 214 which the SQL server database engine can start apply-
(D) 500 milliseconds, 65535 × 216 ing changes contained in the log during recovery after
an unexpected crash.
Solution: In TCP connection, default window size is
Before checkpoint:
64 kilobytes.
→ T4 is committed
If then, Round Trip Time (RTT) is the main factor to
No need to REDO T4
decide TCP throughput between 2 locations.
→ T1 is not committed
If, RTT = 10 msec ⇒ TCP throughput = 52428000 bps Need to UNDO T1
RTT = 20 msec ⇒ TCP throughput = 26214000 bps
After checkpoint:
RTT = 100 msec ⇒ TCP throughput = 5242800 bps
→ T2 is committed, but for recovery, we should
RTT = 200 msec ⇒ TCP throughput = 2621400 bps REDO from the point of ‘checkpoint’.
RTT = 300 msec ⇒ TCP throughput = 1747600 bps → T3 is not committed,
RTT = 500 msec ⇒ TCP throughput = 1048560 bps Need to UNDO.
α = 500 msec Hence, the correct option is (A).
If we are not using TCP window scaling option, TCP
Question Number: 17 Question Type: MCQ
window size will be used as 64 kilobytes ⇒ 65536 bytes.
Consider two relations R1(A, B) with the tuples (1, 5),
Actual window size, using TCP window scaling, is
(3, 7) and R2(A, C) = (1, 7), (4, 9). Assume that R(A, B,
= (window size) ∗ 2(window scale) C) is the full natural outer join of R1 and R2. Consider
= 65535 × 214 the following tuples of the form (A, B, C): a = (1,5,
null), b = (1, null, 7), c = (3, null, 9), d = (4,7,null),
The window scaling option may be sent only once dur- e = (1,5,7), f = (3,7, null), g = (4,null, 9). Which one of
ing a connection by each host, in its SYN packet. The the following statements is correct?
maximum valid scale value is 14 (RFC 1323).
(A) R contains a, b, e, f, g but not c, d.
Hence, the correct option is (C).
(B) R contains all of a, b, c, d, e, f, g.
Question Number: 16 Question Type: MCQ (C) R contains e, f, g but not a, b.
Consider a simple check pointing protocol and the fol- (D) R contains e but not f, g.
lowing set of operations in the log.
Solution: R1
(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4);
(write, T1, z, 5, 7); A C
(checkpoint); 1 7
4 9
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3),
(write, T3, z, 7, 2); R2
If a crash happens now and the system tries to recover A B
using both undo and redo operations. What are the con- 1 5
tents of the undo list and the redo list? 3 7
cvi | GATE 2015 Solved Paper CSIT: Set – 3
R1 FULL OUTER JOIN R2 the average rotational delay and the controller’s transfer
A B C time is 10 times the disk transfer time, the average time
1 5 7 (in milliseconds) to read or write a 512-byte sector of
3 7 NULL the disk is ________.
4 NULL 9 Solution: 60 sec → 15000 rotations
a = (1, 5, Null) Not Present 60
= 4 ms ← 1 rotation
b = (1, Null, 7) Not present 15000
c = (1, 5, 7) present 1
∴ Average rotational delay = × 4 = 2 ms
f = (3, 7, Null) present 2
g = (4, Null, 9) Present Average seek time = 2 × Average rotational delay
Hence, the correct option is (C). = 2 × 2 ⇒ 4 ms
Question Number: 18 Question Type: MCQ 1 sec → 50 × 106 bytes
512
Consider six memory partitions of sizes 200 kB, 400 0.01 ms → ⇒ 512 bytes
kB, 600 kB, 500 kB, 300 kB and 250 kB, where kB 50 × 106
refers to kilobyte. These partitions need to be allotted Transfer time = 10 × 0.01 ms
to four processes of sizes 357 kB, 210 kB, 468 kB and = 0.1 ms
491 kB in that order. If the best fit algorithm is used,
Average time = 4 ms + 0.1 ms + 2 ms
which partitions are not allotted to any process?
= 6.1 ms
(A) 200 kB and 300 kB
Hence, the correct Answer is (6.1 to 6.2).
(B) 200 kB and 250 kB
(C) 250 kB and 300 kB Question Number: 20 Question Type: NAT
A computer system implements 8 kilobyte pages and
(D) 300 kB and 400 kB
a 32-bit physical address space. Each page table entry
Solution: The memory map from the question is contains a valid bit, a dirty bit, three permission bits,
and the translation. If the maximum size of the page
Block 1 - 200 kB
table of a process is 24 megabytes, the length of the vir-
Block 2 - 400 kB tual address supported by the system is _______ bits.
Block 3 - 600 kB
Solution: Page – Table size = (n × e)
Block 4 - 500 kB
n → number of pages
Block 5 - 300 kB
e → page entry size (in bytes)
Block 6 - 250 kB
Page size = 8 kB ⇒ 213
The process P1, P2, P3, P4 requested for sizes 357 kB, given page-entry contains a valid bit, dirty bits, three
210 kB, 468 kB and 491 kB. permission bits and the translation. i.e., 5 bits are
∴ the process P1 is allocated to Block 2, P2 is allocated reserved, the translation requires 19 bits
to Block 6, P3 is allocated to Block 4 and P4 is allocated ⎡ 232 19 ⎤
in Block 3. ⎢frames = 13 ⇒ 2 ⎥
⎣ 2 ⎦
So, Block 1 and Block 5 are not allocated to any pro-
cess, i.e., Block 1 (200 kB) and Block 5 (300 kB) is page entry size = (5 + 19) bits
not allotted. = 24 bits
Hence, the correct option is (A). ⇒ 3 bytes
Question Number: 19 Question Type: NAT Number of pages are
Consider a typical disk that rotates at 15000 rotations n × e = page table size
per minute (RPM) and has a transfer rate of 50 × 106 n × (3) = 24 MB
bytes/sec. If the average seek time of the disk is twice 3n = 24 MB
GATE 2015 Solved Paper CSIT: Set – 3 | cvii
(7) a[t4] = -1
24 × 220
n= (8) j = j + 1
3
(9) if j < = 5 goto (3) → leader
n = 223
(10) i = i + 1 → leader
Number of pages = 223
(11) if i < 5 goto (2) → leader
Virtual address
The basic blocks for the above code.
Page number Page offset
B1 i=1
B2 j=1
B3 t1 = 5 ∗ i
23 13 t2 = t1 + i
t3 = 4 ∗ t2
23 13 t4 = t3
a[t4] = –1
= 23 + 13 j=j+1
= 36 bits
Virtual address = 36 bits B4 if j < = 5 goto 3
(4) t2 = t1 + j
(5) t3 = 4 * t2
(6) t4 = t3
B2
(7) a[t4] = -1
(8) j = j + 1
(9) if j <=5 goto (3)
(10) i=i+1
B3
(11) if i<5 goto (2)
The number of nodes and edges in the control-flow-
graph constructed for the above code, respectively, are
(A) 5 and 7 (B) 6 and 7 B4
(C) 5 and 5 (D) 7 and 8
Solution:
(1) i = 1 B5
(2) j = 1
(3) t1 = 5 * i
(4) t2 = t1 + j
(5) t3 = 4 * t2 B6
(6) t4 = t3
cviii | GATE 2015 Solved Paper CSIT: Set – 3
Solution: Number of min terms The area bounded by the curve f(x), x- axis and the lines
[D1 + AB1 + A1C + AC1D + A1C1 D]1 x = –1 to x = 1
1 1 0 1
If we consider f = D1 + AB1 + A1C + C1D = A = ∫ f ( x ) dx = ∫ x ( ) dx = − ∫ x dx + ∫ x ( ) d
−13 −(1 3)
−13
3 – leaves
foo (B C D E F G H) 2 – (nodes with 2 children)
put char (A) Case 2:
foo (C D E F G H)
put char (B)
foo (D E F G H)
put char (C)
4 – leaves
foo ((space) E F G H) 3(nodes with 2 – children)
put char (D)
∴ For 20 – leaves, the number of nodes having 2 – chil-
It prints in reverse order of the string “A B C D” dren will be 19.
i.e., D C B A Hence, the correct Answer is (19).
Hence, the correct option is (D). Question Number: 56 Question Type: NAT
Consider the following C function
Question Number: 54 Question Type: MCQ
Consider a complete binary tree where the left and the int fun(int n) {
right sub-trees of the root are max-heaps. The lower int x=1, k;
bound for the number of operations to convert the tree if (n==1) return x;
to a heap is for (k=1; k<n; ++k)
x = x + fun(k) * fun(n – k);
(A) (log n) (B) (n) return x;
(C) (n log n) (D) (n2) }
Solution: Left and right sub trees are max-heaps The return value of fun(5) is _____.
cxviii | GATE 2015 Solved Paper CSIT: Set – 3
Solution: Recurrence relation for above function is Solution: Lexical Analyzer is a finite automaton which
if n = 1 is constructed from pattern recognizing rules.
⎧ 1
⎪ n −1 Parsing of string is done using the production trees.
f (n) = ⎨
⎪1 + ∑ f ( k ) ⋅ f ( n − k ) if n >1 Register allocation is similar to that of graph coloring.
⎩ k =1 Expression evaluation is done using post order traversal.
Hence, the correct option is (C).
n 1 2 3 4 5 6
f(n) 1 2 5 15 51 188 Question Number: 60 Question Type: MCQ
In the context of abstract-syntax-tree (AST) and con-
Hence, the correct Answer is (51) trol-flow-graph (CFG), which one of the following is
Question Number: 57 Question Type: MCQ true?
A software requirements specification (SRS) document (A) In both AST and CFG, let node N2 be the suc-
should avoid discussing which one of the following? cessor of node N1. In the input program, the
(A) User interface issues code corresponding to N2 is present after the
code corresponding to N1.
(B) Non-functional requirements
(B) For any input program, neither AST nor CFG
(C) Design specification
will contain a cycle.
(D) Interfaces with third party software
(C) The maximum number of successors of a
Solution: Design specifications are not specified in node in an AST and a CFG depends on the
SRS documents it is done in software design phase. input program.
Hence, the correct option is (C). (D) Each node in AST and CFG corresponds to at
most one statement in the input program.
Question Number: 58 Question Type: MCQ
Consider two decision problems Q1, Q2 such that Q1 Solution: CFG may contain cycles, then option (A) is
reduces in polynomial time to 3-SAT and 3-SAT false.
reduces in polynomial time to Q2. Then which one of The CFG can contain cycle; therefore option (B) is
the following is consistent with the above statement? false.
(A) Q1 is in NP, Q2 is NP-Hard. Single node contains a block of statements, so option
(D) is false.
(B) Q2 is in NP, Q1 is NP-Hard.
The maximum number of successors in AST and CFG
(C) Both Q1 and Q2 are in NP.
depends on the input program.
(D) Both Q1 and Q2 are NP-Hard. Hence, the correct option is (C).
Solution: 3-SAT is a NP-complete problem if Q1 ≤P Question Number: 61 Question Type: MCQ
3 – SAT ≤P Q2 Consider the basic COCOMO model where E is the
then Q1 is in NP, but Q2 is not given in NP. effort applied in person-months, D is the development
Therefore Q2 is in NP-Hard. time in chronological months, KLOC is the estimated
Hence, the correct option is (A). number of delivered lines of code (in thousands) and
ab, bb, cb, db have their usual meanings. The basic
Question Number: 59 Question Type: MCQ COCOMO equations are of the form
Match the following
(A) E = ab(KLOC) exp(bb), D = cb(E) exp(db)
P. Lexical analysis 1. Graph coloring
(B) D = ab(KLOC) exp(bb), E = cb(D) exp(db)
Q. Parsing 2. DFA minimization
R. Register allocation 3. Post-order traversal
(C) E = ab exp(bb), D = cb(KLOC) exp(db)
S. Expression evaluation 4. Production tree (D) E = ab exp(db), D = cb(KLOC) exp(bb)
(A) P-2, Q-3, R-1, S-4 (B) P-2, Q-1, R-4, S-3 Solution: Basic COCOMO model take the form effort
(C) P-2, Q-4, R-1, S-3 (D) P-2, Q-3, R-4, S-1 applied (E) = ab(KLOC)b
GATE 2015 Solved Paper CSIT: Set – 3 | cxix
Development time = Cb(E)db. The constraint that the sum of the accounts x and y
Hence, the correct option is (A). should remain constant is that of
(A) Atomicity (B) Consistency
Question Number: 62 Question Type: MCQ
(C) Isolation (D) Durability
A system has 6 identical resources and N processes
competing for them. Each process can request almost Solution:
2 resources. Which one of the following values of N read (y)
could lead to a deadlock? y = y + 50
(A) 1 (B) 2 Write (y)
(C) 3 (D) 4
read (x)
Solution: When N = 6,
x = x – 50
The system will lead to deadlock, when each process
Write (x)
requests for atmost 2 resources.
Assume that initial balance in each account is 1000
Let us consider 6 processes P1, P2, …., P6
(x + y = 2000)
Process P1 P2 P3 P4 P5 P6 read (x) → 1000 read (y) → 1000
Resources 1 1 1 1 1 1
x = x – 50 → 950 y = y + 50 → 1050
write (x) → 950 write (y) → 1050
As there are only 6 resources, if it allocates one resource 950 1050
to each process, then there are no resources to allocate ∴ x + y = 2000
to complete their request.
The balance in both accounts, after and before per-
Therefore it leads to deadlock, as they wait for a forming transactions is ‘consistent’.
resource which will never be allocated,
Hence, the correct option is (B).
Hence option is matching in the given question.
Question Number: 64 Question Type: NAT
Question Number: 63 Question Type: MCQ
With reference to the B+ tree index of order 1 shown
Consider the following transaction involving two bank below, the minimum number of nodes (including the
accounts x and y. root node) that must be fetched in order to satisfy the
read (x) ; x := x – 50; write (x) ; read(y); y:= y + 50; following query: ‘Get all records with a search key
write(y) greater than or equal to 7 and less than 15’ is ________.
5 13 17
1 3 5 7 9 11 13 15 17
Question Number: 65 Question Type: MCQ bind ( ) will bind the socket to the
Identify the correct order in which a server process address in the Unix domain.
must invoke the function calls accept, bind, listen, and listen ( ) instructs socket to
recv according to UNIX socket API. listen for incoming connections from
client programs.
(A) listen, accept, bind, recv
accept ( ) accepts a connection from
(B) bind, listen, accept, recv a client and returns another socket
(C) bind, accept, listen, recv descriptor,
(D) accept, listen, bind, recv once the connection is set client is
ready to
Solution: The order in which server invokes the func- send( ) and recv ( ).
tion calls are bind, listen, accept and recv.
Hence, the correct option is (B).