# CS GATE 2015 (Test 2)

Tag: cs gate 2015
Topic: Databases Tag: CS GATE 2015
Q.1
Consider the following transaction involving two bank account x and y. read (x) ; x : = x – 50; write (x) ; read (y); y : = y + 50 ; write (y) The constraint that the sum of the accounts x and y should remain constant is that of
A. Atomicity
B. Consistency
C. Isolation
D. Durability
Explaination / Solution:

The consistency property ensures that the database remains in a consistent state before the (start of the transaction and after the transaction is over. Here sum of the accounts x & y should remain same before & after execution of the given transactions which refers to the consistency of the sum.

Workspace
Report
Topic: Databases Tag: CS GATE 2015
Q.2
Consider the following two statements.
S1 : if a candidate is known to be corrupt, then he will not be elected
S2 : if a candidate is kind, he will be elected
Which one of the following statements follows from S1 and S2 per sound interference rules of logic?
A. If a person is known to corrupt, he is kind
B. If a person is not known to be corrupt, he is not kind
C. If a person is kind, he is not known to be corrupt
D. If a person is not kind, he is not known to be corrupt
Explaination / Solution:

Let P: candidate known to be corrupt q: candidate will be elected r: candidate is kind S1 = p ⟶ ~ q = q ⟶~p S2 = r ⟶ q i.e., If a person is kind, he is not known to be corrupt Option is C

Workspace
Report
Topic: Databases Tag: CS GATE 2015
Q.3
Which one of the following well formed formulae is tautology?
A. ∀x ∃y R(x,y) ↔ ∃y ∀x R(x, y)
B. (∀x [∃y R(x,y) → S(x,y)]) → ∀x ∃y S(x, y)
C. [∀x ∃y (P(x,y) → R(x,y)] ↔ [∀x ∃y (¬P(x, y)∨R(x,y)]
D. ∀x ∃y P(x,y) → ∀x ∀y P(y,x)
Explaination / Solution:

Workspace
Report
Q.4
Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIX socket APL
A. listen, accept, bind recv
B. bind, listen, accept, recv
C. bind, accept, listen, recv
D. accept, listen, bind recv
Explaination / Solution:

The correct order in which a server process must invoke the function calls is bind, listen, accept and recv. First three are used in connection establishment phase and recv is used in data transfer phase.

Workspace
Report
Q.5
Which one of the following statements is NOT correct about HTTP cookies?
A. A cookie is a piece of code that has the potential to compromise the security of an internet user
B. A cookie gains entry to the user‟s work area through an HTTP header
C. A cookie has an expiry date and time
D. Cookies can be used to track the browsing pattern of a user at a particular site
Explaination / Solution:

(A) is correct
(B) Option B is false
(C) Option C is correct
(D) Option D is correct

Workspace
Report
Q.6
Consider six memory partitions of sizes 200 KB, 400 KB, 600 KB, 500 KB, 300 KB and 250 KB, where KB refers to kilobyte. These partitions need to be allotted to four processes of sizes 357 KB, 210KB, 468 KB and 491 KB in that order. If the best fit algorithm is used, which partitions are NOT allotted to any process?
A. 200KB and 300 KB
B. 200KB and 250 KB
C. 250KB and 300 KB
D. 300KB and 400 KB
Explaination / Solution:

Workspace
Report
Q.7
Match the following:

A. P - 2, Q - 3, R - 1, S - 4
B. P - 2, Q - 1, R - 4, S - 3
C. P - 2, Q - 4, R - 1, S - 3
D. P - 2, Q - 3, R - 4, S - 1
Explaination / Solution:

Lemical Analyzer uses DFA to recognize the longest possible input sequence that makes up a token. Parser takes input in the form of tokens and usually builds a data structure in the form of parse tree. Here parse tree can be termed as a Production tree as parser uses production of the grammar to check whether generated tokens form a meaningful compression). Register allocation can be reduced to K-colouring problem where K is the number of registers available on the target architecture. Post order traversal of expression tree gives postfix notation for a given expression & this post fix notation can be evaluated using stack.

Workspace
Report
Q.8
Consider the following statements
I. The complement of every Turing decidable language is Turing decidable
II. There exists some language which is in NP but is not turing decidable
III. If L is a language in NP, L is turing decidable
Which of the above statements is/are true?
A. Only II
B. Only III
C. Only I and II
D. Only I and III
Explaination / Solution:

Turing decidable  Recursive language
Turing recognizable  Recursive enumerable language
I) Complement of turning decidable language is decidable which is true.
III) True ( Theorem ) Which violates (II) hence key is D

Workspace
Report
Q.9
Consider the alphabet ∑ = {0.1}, the null/empty string λ and the sets of strings X0 , X1 , and X2 generated by the corresponding non-terminals of regular grammar. X0, X1, and X2 are related as follows:
X0 = 1X1
X1 = 0X1 + 1X2
X2 = 0X1 + {λ}
Which one of the following choices precisely represents the strings in X0

A. 10(0*+(10)*)1
B. 10(0*+(10)*)*1
C. 1(0+10)*1
D. 10(0+10*)*1+110(0+10)*1
Explaination / Solution:
No Explaination.

Workspace
Report
Q.10
Which of the following languages is/are regular?

A. Land Lonly
B. Lonly
C. Land L3only
D. Lonly