Computer Science Engineering - Online Test

Q1. Which of the following concurrency control protocols ensure both conflict serializability and freedom from deadlock? I. 2-phase locking II. Time-stamp ordering
Answer : Option A
Explaination / Solution:
No Explaination.


Q2. Which of the following statements are true? 
 I. Shortest remaining time first scheduling may cause starvation 
 II. Preemptive scheduling may cause starvation 
 III. Round robin is better than FCFS in terms of response time
Answer : Option B
Explaination / Solution:
No Explaination.


Q3. 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

Answer : Option C
Explaination / Solution:
No Explaination.


Q4. Which one of the following is NOT a part of the ACID properties of database transactions?
Answer : Option D
Explaination / Solution:

‘D’ means durability not deadlock freedom.

Q5.  Consider the following transactions with data items P and Q initialized to zero:
T1 : read (P) ;
       read (Q) ;
       if P = 0 then Q : = Q + 1 ;
       write (Q).
T2 : read (Q) ;
       read (P)
       if Q = 0 then P : = P + 1 ;
       write (P). 
Any non-serial interleaving of T1 and T2 for concurrent execution leads to
Answer : Option B
Explaination / Solution:

Let S be a non-serial schedule, without loss of generality assume that T1 has started earlier than T2. The first instruction of T1 is read(P) and the last instruction of T2 is write(P), so the precedence graph for S has an edge from T1 to T2, now since S is a non-serial schedule the first instruction of T2(read(Q)) should be executed before last instruction of T1(write(Q)) and since read and write are conflicting operations, the precedence graph for S also contains an edge from T2 to T1, So we will have a cycle in the precedence graph which implies that any non serial schedule with T1 as the earliest transaction will not be conflict serializable. In a similar way we can show that if T2 is the earliest transaction then also the schedule is not conflict serializable.

Q6. What is the appropriate pairing of items in the two columns listing various activities encountered in a software li fe cycle? 
P. Requirements Capture   1. Module Development and Integration 
 Q. Design                          2. Domain Analysis 
 R. Implementation             3. Structural and Behavioral Modeling 
 S. Maintenance                 4. Performance Tuning 
Answer : Option B
Explaination / Solution:
No Explaination.


Q7. The program below uses six temporary variables a, b, c, d, e, f. 
a = 1
b = 10
c = 20
d = a + b
e = c + d
f = c + e
b = c + e
e = b + f
d = 5 + e
return d + f
Assuming that all operations take their operands from registers, what is the minimum number of registers needed to execute thi s program without spilling? 
Answer : Option C
Explaination / Solution:
No Explaination.


Q8. Which of the following languages is/are regular?

Answer : Option A
Explaination / Solution:


Hence m ≠ n, that mean n is greater than m, or m is greater than n. So we need memory, so we can‟t draw DfA for it.


Q9.  A database of research articles in a journal uses the following schema. (VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, YEAR, PRICE) 
The primary key is (VOLUME, NUMBER, STARTPAGE, ENDPAGE) and the following functional dependencies exist in the schema.
(VOLUME, NUMBER, STARTPAGE, ENDPAGE)  → TITLE 
(VOLUME, NUMBER                                              → YEAR 
(VOLUME, NUMBER, STARTPAGE, ENDPAGE)  → PRICE
The database is redesigned to use the following schemas. 
(VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, PRICE) (VOLUME, NUMBER, YEAR) 
Which is the weakest normal form that the new database satisfies, but the old one does not?
Answer : Option A
Explaination / Solution:

candidate key is (volume, number, start page, end page) (Volume number) → year is a partial dependency. So original table is in 1NF but not in 2NF

Q10. Consider an undirected random graph of eight vertices. The probability that there is an edge between a pair of vertices is ½. What is the expected number of unordered cycles of length three?
Answer : Option C
Explaination / Solution:

P(edge) = 1/2
Number of ways we can choose the vertices out of 8 is 
(Three edges in each cycle) 
Expected number of unordered cycles of length 3 =