CS GATE 2013 (Test 4)



Tag: cs gate 2013
Q.1
Choose the grammatically INCORRECT sentence:
A. He is of Asian origin
B. They belonged to Africa
C. She is an European
D. They migrated from India to Australia
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.2
The transport layer protocols used for real time multimedia, file transfer, DNS and email, respectively are
A. TCP, UDP, UDP and TCP
B. UDP, TCP, TCP and UDP
C. UDP, TCP, UDP and TCP
D. TCP, UDP, TCP and UDP
Answer : Option C
Explaination / Solution:

Real time multimedia needs connectionless service, so under lying transport layer protocol used is UDP File transfer rums over TCP protocol with port no-21 DNS runs over UDP protocol within port no-53 Email needs SMTP protocol which runs over TCP protocol within port no – 25

Workspace
Report
Topic: Databases Tag: CS GATE 2013
Q.3
An index is clustered, if
A. it is on a set of fields that form a candidate key
B. it is on a set of fields that include the primary key
C. the data records of the file are organized in the same order as the data entries of the index
D. the data records of the file are organized not in the same order as the data entries of the index
Answer : Option C
Explaination / Solution:

Clustered index is built on ordering non key field and hence if the index is clustered then the data records of the file are organized in the same order as the data entries of the index.

Workspace
Report
Q.4
Three concurrent processes X, Y, and Z execute three different code segments that access and update certain shared variables. Process X executes the P operation (i.e., wait) on semaphores a, b and c; process Y executes the P operation on semaphores b, c and d; process Z executes the P operation on semaphores c, d, and a before entering the respective code segments. After completing the execution of its code segment, each process invokes the V operation (i.e., signal) on its three semaphores. All semaphores are binary semaphores initialized to one. Which one of the following represents a deadlock-free order of invoking the P operations by the processes?
A. X : P (a) P (b) P (c) Y : P (b) P (c) P (d) 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)
Answer : Option B
Explaination / Solution:

Suppose X performs P(b) and preempts, Y gets chance, but cannot do its first wait i.e., P(b), so waits for X, now Z gets the chance and performs P(a) and preempts, next X gets chance. X cannot continue as wait on ‘a’ is done by Z already, so X waits 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 options (A),(C) and (D) we can easily find circular wait, thus deadlock

Workspace
Report
Q.5
What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A → ∈ and A → a) to parse a string with n tokens?
A. n/2
B. n-1
C. 2n-1
D. 2n
Answer : Option B
Explaination / Solution:

To have maximum number of reduce moves, all the productions will be of the typeA→αβ (where α and β could be terminals or non-terminals). Consider the following illustration then: 


Workspace
Report
Q.6
Consider the following languages

Which one of the following statements is FALSE? 
A. L2 is context–free 
B. L1 ∩ Lis context–free
C.  Complement of L2  is recursive
D. Complement of L1 is context–free but not regular
Answer : Option D
Explaination / Solution:



Workspace
Report
Q.7
Which of the following statements are TRUE?
(1) The problem of determining whether there exists a cycle in an undirected graph is in P. 
(2) The problem of determining whether there exists a cycle in an undirected graph is in NP. 
(3) If a problem A is NP-Complete, there exists a non-deterministic polynomial time algorithm to solve A.
A. 1,2 and 3
B. 1 and 2 only
C. 2 and 3 only
D. 1 and 3 only
Answer : Option A
Explaination / Solution:

1. Cycle detection using DFS: O(V + E) = O(V2)and it is polynomial problem 
2. Every P-problem is NP(since P ⊂ NP)
3. NP-complete ∈ NP
Hence, NP-complete can be solved in non-deterministic polynomial time

Workspace
Report
Q.8
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
A. 10,20,15,23,25,35,42,39,30
B. 15,10,25,23,20,42,35,39,30
C. 15,10,23,25,20,35,42,39,30
D. 15,20,10,23,25,42,35,39,30
Answer : Option D
Explaination / Solution:

Pr eorder :30,20,10,15,25,23,39,35,42 
Inorder :10,15,20,23,25,30,35,39,42


Workspace
Report
Q.9
The line graph L(G) of a simple graph G is defined as follows:
• There is exactly one vertex v(e) in L(G) for each edge e in G.
• For any two edges e and e’ in G, L(G) has an edge between v(e) and v(e’), if and only if e and e’ are incident with the same vertex in G.
Which of the following statements is/are TRUE?
(P) The line graph of a cycle is a cycle.
(Q) The line graph of a clique is a clique.
(R) The line graph of a planar graph is planar.
(S) The line graph of a tree is a tree.
A. P only
B. P and R only
C. R only
D. P, Q and S only
Answer : Option A
Explaination / Solution:

P) The line graph of a cycle is a cycle 

R) Line graph of planar graph need not be planar always. Consider the following example. Consider the following planar graph (star graph)

S) Hence line graph of planar graph need not be planar(Here we got K5 which is not planar).

The line graph of a tree need not be tree. 

Workspace
Report
Q.10
A RAM chip has a capacity of 1024 words of 8 bits each (1K × 8) . The number of 2 × 4 decoders with enable line needed to construct a 16K × 16 RAM from 1K × 8 RAM is
A. 4
B. 5
C. 6
D. 7
Answer : Option B
Explaination / Solution:

RAM chip size = 1k × 8 [1024 words of 8 bits each]
RAM to construct = 16k × 16
Number of chips required = (16k × 16)/(1k × 8) = 16 × 2 [16 chips vertically with each having 2 chips horizontally] 
So to select one chip out of 16 vertical chips, we need 4 x 16 decoder. 
Available decoder is – 2 x 4 decoder 
To be constructed is 4 x 16 decoder 

So we need 5, 2 x 4 decoder in total to construct 4 x 16 decoder. 

Workspace
Report