GATE 2017 (Session 1) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2017 (Session 1)

64 questions

MCQ 44 · NAT 201-mark 30 · 2-mark 34

Questions 51–55 of 64

Q52Transaction2 marksMCQ−0.67 if wrong
In a database system, unique time stamps are assigned to each transaction using Lamport's logical clock . Let TS(T1T_{1}) and TS(T2T_{2}) be the timestamps of transactions T1T_{1} and T2T_{2} respectively. Besides, T1T_{1} holds a lock on the resource R, and T2T_{2} has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
if TS(T2) < TS(T1) then
    T1 is killed
else T2 waits.

Assume any transactions that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?

Q53Parsing2 marksNAT
Consider the following grammar:

stmt→\rightarrow if expr then expr else expr; stmt| O˙\dot{O}
expr→\rightarrowterm relop term|term
term→\rightarrow id|number
id→\rightarrowa|b|c
number→\rightarrow [0-9]

where relop is a relational operator (e.g <,>\lt ,\gt,...), O˙\dot{O} refers to the empty statement, and if ,then, else are terminals.

Consider a program P following the above grammar containing ten if terminals. The number of control flow paths in P is ____________. For example the program

if e1e_1 then e2e_2 else e3e_3

has 2 control flow paths e1→e2e_{1} \rightarrow e_{2} and e1→e3e_{1} \rightarrow e_{3}.

Q54Network Security2 marksNAT
In a RSA cryptosystem a participant A uses two prime numbers p=13 and q=17 to generate her public and private keys. If the public key of A is 35. Then the private key of A is __________.

Q56Relational Algebra2 marksNAT
Consider a database that has the relation schema CR (StudentName, CourseName). An instance of the schema CR is as given below.
CRStudentNameCourseName SACA SACB SACC SBCB SBCC SCCA SCCB SCCC SDCA SDCB SDCC SDCD SECD SECA SECB SFCA SFCB SFCC
The following query is made on the database

T1←πCourseName(σStudentName=′SA′(CR))T1\leftarrow \pi _{CourseName}(\sigma _{StudentName='SA'}(CR))
T2←CR÷T1T2\leftarrow CR\div T1

The number of rows in T2 is ____________.