quiz paper
quiz paper
quiz paper
Which of the following is a correct attribute set (a) D1 is a lossless decomposition, but D2 is a
for one of the tables for the minimum number lossy decomposition.
of tables needed to represent M, N, P, R1 and (b) D1 is a lossy decomposition, but D2 is a
R2 lossless decomposition.
(a) {M1, M2, M3, P1} (c) Both D1 and D2 are lossless
(b) {M1, P1, N1, N2} decompositions.
(c) {M1, P1, N1} (d) Both D1 and D2 are lossy decompositions.
If a relational model is derived from the above Registration (rollno, courseid, credit) Non-trivial
ER model, then the minimum number of functional dependencies: rollno, courseid →
relations that would be generated if all the credit courseid → credit Which one of the
relations are in 3 NF is__________.
relational schemas above is in 3 NF but not in (b) D1 is a lossy decomposition, but D2 is a
BCNF? lossless decomposition.
(VOLUME, NUMBER, STARTPAGE, ENDPAGE, S: R4(x)R2(x) R3(x) R1(y) W1(y) W2(x) W3(y) R4(y)
TITLE, YEAR, PRICE) Which one of the following serial schedules is
conflict equivalent to S ?
The primary key is (VOLUME, NUMBER,
STARTPAGE, ENDPAGE) and the following (a) T1 → T3 → T4 → T2
functional dependencies exist in the schema.
(b) T1 → T4 → T3 → T2
(VOLUME, NUMBER, STARTPAGE, ENDPAGE) →
(c) T4 → T1 → T3 → T2
TITLE
(d) T3 → T1 → T4 → T2
(VOLUME, NUMBER) → YEAR
9. Consider the following directed graph:
(VOLUME, NUMBER, STARTPAGE, ENDPAGE) →
PRICE
D2: R = [(P, Q, S); (T, X); (Q, Y); (Y, Z, W)] (c) ΠeId (ΠeId, bId (Own)/ΠbId (Own))
Which one of the following options is correct? (d) Π_eld ((ΠeId (Own)×ΠbId (Own))/Π_bld
(Brand)).
(a) D1 is a lossless decomposition, but D2 is a
lossy decomposition.
11. Consider the following relation A, B and C: (b) Employee numbers of only those employees
whose age is more than the age of exactly one
other employee
(a) 7
(b) 4
(c) 5
(d) 9
char d = (a | b) - '-’;
char e = (a ^ b) + '+’;
return 0; }
(b) b != 0
22. Consider the following pseudo code. What
(c) b>(a+1)
is the total number of multiplications to be
(d) b !=a performed?
int c; D=D * 3
count += v&1;
printf (‘’%d\n‘’, x); } 26. What is the value printed by the following C
program?
(a) 41 (a) –9
(b) 52 (b) 5
(c) 63 (c) 15
25.What will be the output of the following C Common Data for next two questions:
program?
Consider the following C program that attempts
void count (int n ) { to
d++; 2. int i, j, k;
void main(){ 5. k = (i + j) / 2;
8. if (Y[k]==x)
31. What is the worst case time complexity of
printf("x is in the array ") ;
inserting n elements into an empty linked list, if
9. else the linked list needs to be maintained in sorted
order?
printf ("x is not in the array");
(a) Ѳ(n)
10. }
(b) Ѳ(n log n)
27.On which of the following contents of Y and x
does (c) Ѳ(n2)
(a) Y is [1 2 3 4 5 6 7 8 9 10] and x < 10 32. Consider the problem of reversing a singly
linked
(b) Y is [1 3 5 7 9 11 13 15 17 19] and x < 1
(d) Y is [2 4 6 8 10 12 14 16 18 20] and 2 < x < 20 list. To take an example, given the linked list
and x is even below,the reversed linked list should look like
(d) change line 7 to: while ((Y[k] = = x) &&(i < j)); (c) The best algorithm for the problem takes
Ѳ(n2) time in the worst case.
30. Let SLLdel be a function that deletes a node (d) It is not possible to reverse a singly linked
in a singly-linked list given a pointer to the node list in O(1) space.
and a pointer to the head of the list. Similarly, 34. Suppose, a stack implementation supports
let DLLdel be another function that deletes a an instruction REVERSE, which reverses the
node in a doubly order of elements on the stack, in addition to
Let n denote the number of nodes in each of the the PUSH and POP instructions. Which one of
linked lists. Which one of the following choices the following statements is TRUE (with respect
is TRUE about the worst-case time complexity to this modified stack)?
of SLLdel and DLLdel? (a) A queue cannot be implemented using this
(a) SLLdel is O(1) and DLLdel is O(n) stack.
(b) Both SLLdel and DLLdel are O(log(n)) (b) A queue can be implemented where
ENQUEUE takes a single instruction and
(c) Both SLLdel and DLLdel are O(1) DEQUEUE takes sequence of two instructions.
(c) A queue can be implemented where 5. First, the 3rd least significant bit is
ENQUEUE takes a sequence of three used to divide the keys into left and right
instructions and subtrees.
(a) 4 (b) 5
37. Which one of the following sequences when can cause the above state of the hash table
stored (assume
p = 0;
++q;
return q;
(a) The graph does not have any topological for (i = 1; i ≤n; i ++)
ordering.
{
(b) Both PQRS and SRQP are topological
X[i] = Y[i – 1] + Z [i – 2];
orderings.
Y[i] = 2* X[i];
(c) Both PSRQ and SPRQ are topological
orderings. Z[i] = 3*X[i];
(d) PSRQ is the only topological ordering. }
return X[n];
47. Define Rn to be the maximum amount }
earned by cutting a rod of length n meters into
one or more pieces of integer length and selling The running time of f1(n) and f2(n) are
them. For i > 0, let p[i] denote the selling price (a) Θ(n) and Θ(n)
of a rod whose length is i meters. Consider the
array of prices: (b) Θ(2n) and Θ(n)
int i;