Computer Science Engineering (Test 5)

Tancet Anna University : Cse, It Computer Science Engineering And Information Technology

| Home | | Tancet Anna University | | Cse, It Computer Science Engineering And Information Technology | | Computer Science Engineering |

Computer Science Engineering

Computer Science Engineering
| Digital Logic | | Computer Organization and Architecture | | Programming and Data Structures | | Algorithms | | Theory of Computation | | Compiler Design | | Operating System | | Databases | | Computer Networks |
Q.1
In the IPv4 addressing format, the number of networks allowed under Class C addresses is
A. 214
B. 27
C. 221
D. 224
Answer : Option C
Explaination / Solution:

For class C address, size of network field is 24 bits. But first 3 bits are fixed as 110; hence total number of networks possible is 221

Workspace
Report
Q.2
 Consider the following sequence of micro–operations
MBR ← PC 
MAR ← X
PC ← Y
Memory ← MBR
Which one of the following is a possible operation performed by this sequence?  
A. Instruction fetch
B. Operand fetch
C. Conditional branch
D. Initiation of interrupt service
Answer : Option D
Explaination / Solution:

PC content is stored in memory via MBR and PC gets new address from Y. It represents a function call (routine), which is matching with interrupt service initiation

Workspace
Report
Q.3
Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O1, . . . , OK}. This is done in the following manner:
Step 1. T acquires exclusive locks to O1, . . . , Ok in increasing order of their addresses. 
Step 2. The required operations are performed. 
Step 3. All locks are released. 
This protocol will
A. guarantee serializability and deadlock-freedom
B. guarantee neither serializability nor deadlock-freedom
C. guarantee serializability but not deadlock-freedom
D. guarantee deadlock-freedom but not serializability
Answer : Option A
Explaination / Solution:

2PL ensures serializability and here as we are following linear order in acquiring the locks there will not be any deadlock.

Workspace
Report
Q.4
Suppose computers A and B have IP addresses 10.105.1.113 and 10.105.1.91 respectively and they both use the same net mask N. Which of the values of N given below should not be used if A and B should belong to the same network?
A. 255.255.255.0
B. 255.255.255.128
C. 255.255.255.192
D. 255.255.255.224
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Topic: Databases Tag: CS GATE 2011
Q.5
Consider a relational table r with sufficient number of records, having attributes A1, A2,…, An and let 1 ≤ p ≤ n. Two queries Q1 and Q2 are given below.

The database can be configured to do ordered indexing on Ap or hashing on Ap
Which of the following statements is TRUE? 
A. Ordered indexing will always outperform hashing for both queries
B. Hashing will always outperform ordered indexing for both queries
C. Hashing will outperform ordered indexing on Q1, but not on Q2
D. Hashing will outperform ordered indexing on Q2, but not on Q1.
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Topic: Databases Tag: CS GATE 2013
Q.6
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.7
 Consider the decision problem 2CNFSAT defined as follows:
{ φ | φ is a satisfiable propositional formula in CNF with at most two literal per clause}
For example,  is a Boolean formula and it is in 2CNFSAT.
The decision problem 2CNFSAT is
A. NP-Complete.
B. solvable in polynomial time by reduction to directed graph reachability.
C. solvable in constant time since any input instance is satisfiable.
D. NP-hard, but not NP-complete.
Answer : Option B
Explaination / Solution:

2 SAT is in P. This we can prove by reducing 2 SAT to directed graph reachability problem which is known to be in P. 
Procedure for reducing 2 SAT to reachability problem:
1. Let ϕ be CNF with clauses of length 2 and let P be the set of propositional variables(literals) in ϕ
2. Build a graph G=(V,E) with V= P { p|p P} ∪ ¬ ∈ and (x, y E )∈ iff there is a clause in ϕ that is equivalent to x y → (all the clauses are converted to equivalent implications and the graph built is called as implication graph)
3. Observe that ϕ is unsatisfiable iff there is a p P ∈ such that there is both a path from p to to ¬p and from ¬p to p in G.
This condition can be tested by running the reachability algorithm several times.

Workspace
Report
Q.8
In a database system, unique time stamps are assigned to each transaction using Lamport’s logical clock . Let TS(T1) and TS(T2) be the timestamps of transactions T1 and T2 respectively. Besides, T1 holds a lock on the resource R, and T2 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
Tis killed
else Twaits.
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? 
A. The database system is both deadlock-free and starvation- free.
B. The database system is deadlock- free, but not starvation-free.
C. The database system is starvation-free but not deadlock- free.
D. The database system is neither deadlock- free nor starvation-free.
Answer : Option A
Explaination / Solution:

Elder kills younger and youngers waits on elder. So both are not waiting for each other. Hence no deadlock and there won’t be any starvation as well because the transaction who got killed will be starting with same time stamp. 

Workspace
Report
Q.9
Consider a 4-way set associative cache (initially empty) with total 16 cache blocks. The main memory consists of 256 blocks and the request for memory blocks is in the following order: 0,255,1,4,3,8,133,159,216,129,63,8,48,32, 73, 92,155 Which one of the following memory block will not be in cache if LRU replacement policy is used?
A. 3
B. 8
C. 129
D. 216
Answer : Option D
Explaination / Solution:
No Explaination.


Workspace
Report
Q.10
The amount of ROM needed to implement a 4 bit multiplier is
A. 64 bits
B. 128 bits
C. 1 kbits
D. 2 kbits
Answer : Option D
Explaination / Solution:

For a 4 bit multiplier there are 24 × 24 = 28 = 256 combinations. 
Output will contain 8 bits. 
So the amount of ROM needed is 28 ×8 bits = 2Kbits

Workspace
Report


CSE, IT Computer Science Engineering and Information Technology