CS and IT GATE 2014 Set-3 Questions with Answer

Ques 27 Data Structures and Algorithms


Consider a hash table with 100 slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first 3 slots are unfilled after the first 3 insertions?

A

(97 x 97 x 97)/100³

B

(99 x 98 x 97)/100³

C

(97 x 96 x 95)/100³

D

(97 x 96 x 95)/(3! x 100³)



Ques 28 Data Structures and Algorithms


Consider the pseudocode given below. The function DoSomething() takes as argument a pointer to the root of an arbitrary tree represented by the leftMostChild-rightSibling representation. Each node of the tree is of type treeNode.
typedef struct treeNode* treeptr;
struct treeNode
{
treeptr leftMostChild, rightSibling;
};
int DoSomething (treeptr tree)
{
int value = 0;
if (tree != NULL) {
if (tree->leftMostChild == NULL)
value = 1;
else
value = DoSomething(tree->leftMostChild) + DoSomething(tree->rightSibling);
}
return (value);
}
When the pointer to the root of a tree is passed as the argument to DoSomething, the value returned by the function corresponds to the number of

A

internal nodes in the tree.

B

leaves in the tree.

C

nodes in the tree.

D

levels in the tree.



Ques 29 Data Structures and Algorithms


Consider the C function given below. Assume that the array listA contains n (> 0) elements, sorted in ascending order.
int ProcessArray(int *listA, int x, int n)
{
int i, j, k;
i = 0;
j = n - 1;
do {
k = (i + j)/2;
if (x <= listA[k])
j = k - 1;
if (listA[k] <= x)
i = k + 1;
} while (i <= j);
if (listA[k] == x)
return (k);
else
return -1;
}
Which one of the following statements about the function ProcessArray is CORRECT?

A

It will run into an infinite loop when x is not in listA.

B

It is an implementation of binary search.

C

It will always find the maximum element in listA.

D

It will return -1 even when x is present in listA.



Ques 30 Database Management Systems


What is the optimized version of the relation algebra expression πA₁ (πA₂ (σF₁ (σF₂ (r)))), where A₁, A₂ are sets of attributes in r with A₁ ⊆ A₂ and F₁, F₂ are Boolean expressions based on the attributes in r?

A

πA₁ (σ(F₁∧F₂) (r))

B

πA₁ (σ(F₁∨F₂) (r))

C

πA₂ (σ(F₁∧F₂) (r))

D

πA₂ (σ(F₁∨F₂) (r))



Ques 31 Database Management Systems


A prime attribute of a relation scheme R is an attribute that appears

A

in all candidate keys of R.

B

in some candidate key of R.

C

in a foreign key of R.

D

only in the primary key of R.



Ques 32 Database Management Systems


Consider the transactions T₁, T₂, and T₃ and the schedules S₁ and S₂ given below.
T₁: r₁(X); r₁(Z); w₁(X); w₁(Z)
T₂: r₂(Y); r₂(Z); w₂(Z)
T₃: r₃(Y); r₃(X); w₃(Y)
S₁: r₁(X); r₃(Y); r₃(X); r₂(Y); r₂(Z); w₃(Y); w₂(Z); r₁(Z); w₁(X); w₁(Z)
S₂: r₁(X); r₃(Y); r₂(Y); r₃(X); r₁(Z); r₂(Z); w₃(Y); w₁(X); w₂(Z); w₁(Z)
Which one of the following statements about the schedules is TRUE?

A

Only S₁ is conflict-serializable.

B

Only S₂ is conflict-serializable.

C

Both S₁ and S₂ are conflict-serializable.

D

Neither S₁ nor S₂ is conflict-serializable.



Ques 33 Database Management Systems


Consider the relational schema given below, where empId of the relation dependent is a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation.
employee (empId, empName, empAge)
dependent (depId, empId, depName, depAge)
Consider the following relational algebra query:
πempId (employee) – πempId (employee ⋈(empId = eID)∧(empAge ≤ depAge) dependent)
The above query evaluates to the set of empIds of employees whose age is greater than that of

A

some dependent.

B

all dependents.

C

some of his/her dependents.

D

all of his/her dependents.



Ques 34 Database Management Systems


Consider the following relational schema:
employee (empId, empName, empDept)
customer (custId, custName, salesRepId, rating)
salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return?
SELECT empName
FROM employee E
WHERE NOT EXISTS
(SELECT custId
FROM customer C
WHERE C.salesRepId = E.empId
AND C.rating <> 'GOOD');

A

Names of all the employees with at least one of their customers having a 'GOOD' rating.

B

Names of all the employees with at most one of their customers having a 'GOOD' rating.

C

Names of all the employees with none of their customers having a 'GOOD' rating.

D

Names of all the employees with all their customers having a 'GOOD' rating.



Ques 35 Database Management Systems


The following functional dependencies hold for relations R(A, B, C) and S(B, D, E):
B → A,
A → C
The relation R contains 200 tuples and the relation S contains 100 tuples. What is the maximum number of tuples possible in the natural join R ⋈ S?

A

100

B

200

C

300

D

2000



Ques 36 Database Management Systems


Consider the following four schedules due to three transactions (indicated by the subscript) using read and write on a data item x, denoted by r(x) and w(x) respectively. Which one of them is conflict serializable?

A

r₁(x); r₂(x); w₁(x); r₃(x); w₂(x)

B

r₂(x); r₁(x); w₂(x); r₃(x); w₁(x)

C

r₃(x); r₁(x); r₂(x); w₂(x); w₁(x)

D

r₁(x); w₁(x); r₃(x); r₂(x); w₂(x)



Ques 37 Digital Logic


Consider the following minterm expression for F:
F(P, Q, R, S) = Σ(0, 2, 5, 7, 8, 10, 13, 15)
The minterms 2, 7, 8 and 13 are 'do not care' terms. The minimal sum-of-products form for F is

A

Q̅S̅ + Q̅S

B

Q̅S̅ + QS

C

Q̅R̅S̅ + Q̅RS̅ + QRS

D

P̅Q̅S̅ + P̅QS + PQS + PQ̅S̅



Ques 38 Digital Logic


Consider the following combinational function block involving four Boolean variables x, y, a, b where x, a, b are inputs and y is the output.
f(x, y, a, b)
{
if (x is 1)
y = a;
else
y = b;
}
Which one of the following digital logic blocks is the most suitable for implementing this function?

A

Full adder

B

Priority encoder

C

Multiplexor

D

Flip-flop



Ques 39 Digital Logic


The above synchronous sequential circuit built using JK flip-flops is initialized with Q2Q1Q0 = 000. The state sequence for this circuit for the next 3 clock cycles is

A

001, 010, 011

B

111, 110, 101

C

100, 110, 111

D

100, 011, 001



Unique Visitor Count

Total Unique Visitors

Loading......