DBMS Assignment Week 0

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Database Management System: Assignment 0

Total Marks : 20

June 2, 2022

Question 1
The power set of a set S contains 256 members/elements. How many elements are present in
S? Marks: 1 MCQ

a) 5

b) 6

c) 7

d) 8

Answer: d)
Explanation: The formula for the number of elements in a power set P of S is | P (S) |= 2|S| .
Hence, option (d) is correct.

1
Question 2
Which of the following correctly define the sets A and B if A × B contains {1,5} but not {5,1}?
× denotes the Cartesian product. Marks: 1 MCQ

a) A={1,2,5} B={2,1,5}

b) A={1,2,5} B={2,3,5}

c) A={3,6,5} B={1,3,5}

d) A={1,2,3} B={2,3,4}

Answer: b)
Explanation: Cartesian product is defined as A × B = {(a, b) : a ∈ A ∧ b ∈ B}. Hence, option
(b) is correct.

2
Question 3
Consider the following table:

A B C
0 0 1
0 1 0
1 0 0
1 1 0

Which of the following is correct? Marks: 1 MCQ

a) C = ¬A∨¬B

b) C = ¬A∧¬B

c) C = ¬(A∧B)

d) C = A∧¬B

Answer: b)
Explanation: According to the rules of Boolean algebra, C is the logical AND between the
negation of A and negation of B. Hence, option (b) is correct.

3
Question 4
The relation R = {(8, 9),(9, 10), (11, 11)} on the set {8, 9, 10, 11} is not symmetric.
Which of the following elements will not be present in the symmetric closure of R?
Marks: 1 MCQ

a) (10, 9)

b) (9, 8)

c) (11, 11)

d) (10, 11)

Answer: d)
Explanation: The symmetric closure of R is: Rs = {(8, 9), (9, 10), (11, 11), (9, 8), (10, 9)}.
Hence, option (d) is correct.

4
Question 5
Which of the following is a tautology? Marks: 1 MCQ

a) (B → (B ∧ A)) ∨ A

b) (B → (B ∧ A)) ∨ B

c) (B → (B ∧ A)) ∧ B

d) (B → (B ∧ A)) ∧ A

Answer: b)
Explanation: From the truth table, it can be shown that option (b) is a tautology.

5
Question 6
In a stack, four numbers 1, 2, 3, 4 can be pushed or popped in any random order. Each
number can be pushed or popped multiple times. Popping a number prints it. The sequence
of operations performed on the stack is Push → Push → Pop → Push → Pop → Pop →
Push → Pop → Push. This sequence printed the numbers 1, 1, 3, 2 in that order. Which
number was pushed first? Marks: 1 MCQ

a) 1

b) 2

c) 3

d) 4

Answer: c)
Explanation: 2 Pushes are followed by a Pop that prints 1. Hence, the second number pushed
is 1. Then, one push is followed by two pops that print 1, 3. Hence, the third number pushed
is 1 and the first number pushed is 3. Hence, option (c) is correct.

6
Question 7
Consider the set S={1, 2, 3} and the set T={(a,b): a, b ∈ S and (a+b)>4}. What is
n(T)? Marks: 1 MCQ

a) 3

b) 4

c) 5

d) 6

Answer: a)
Explanation: T={(2,3), (3,2), (3,3)}. Hence, option (a) is correct.

7
Question 8
A = {-4, -2, 0, 2, 4} and f:A→ Z given by f(x) = x2 − x − 5. What is (are) the pre-image(s)
of 1?
Marks: 1 MCQ

a) −4

b) −2

c) 2

d) 4

Answer: b)
Explanation: f(-2)= 4 + 2 - 5 = 1 . Hence, option b) is correct.

8
Question 9
Let a relation R in the set R of real numbers be defined as (a,b) ∈ R if and only if for all a, b
∈ R, (a+b)>0. Which of the following is TRUE about the relation R? Marks: 1 MCQ

a) Reflexive relation

b) Symmetric relation

c) Transitive relation

d) Equivalence relation

Answer: b)
Explanation: R is not reflexive as for some a∈ R (a+a)≤ 0.
R is symmetric: (a+b) > 0 implies (b+a) > 0.
R is not transitive: (-1, 2) ∈ R; (2, -1) ∈ R. But (-1, -1) ∈
/ R.
Hence, option (b) is correct.

9
Question 10
Characters ‘O’, ‘P’, and ‘T’ are pushed into a stack in that order but these three PUSH operations
are intermixed with POP operations as well. Whenever a character is popped, it is printed.
Which of the following permutation cannot be printed by such PUSH and POP operations?
Marks: 1 MCQ

a) TOP

b) POT

c) OPT

d) OTP

Answer: a)
Explanation: To pop ‘T’ first from the stack, it has to be pushed. So, PUSH(O), PUSH(P),
PUSH(T) must be performed before the first POP operation. Once, we do that, ‘P’ appears
at the top of the stack. So, the next POP operation cannot print ‘O’.
Hence, option (a) is correct.

10
Question 11
Which one of the following is the most appropriate logical formula to represent the statement?
“Platinum or gold jewellery are expensive”.
The following predicates are used: P(x): x is a platinum jewellery, G(x): x is a gold jewellery,
E(x): x is expensive. Marks: 1 MCQ

a) ∀x(E(x) → (P (x) ∧ G(x)))

b) ∀x((P (x) ∨ G(x)) → E(x))

c) ∀x((P (x) ∧ G(x)) → E(x))

d) ∃x((P (x) ∨ G(x)) → E(x))

Answer: b)
Explanation: For all jewellery, if it is a platinum jewellery or a gold jewellery, it is expensive.
So, option (b) is correct.

11
Question 12
Let a function f: R→ R be given by f(x) = 3x2 − 2. Which of the following statements is (are)
true? Marks: 1 MCQ

a) Function f(x) is both one-one and onto.

b) Function f(x) is a one-one function but not onto.

c) It is an onto function but not one-one.

d) It is neither one-one nor onto.

Answer: d)

Explanation: By the given function, f(1)=1 and f(-1)=1. Hence it is not one-one.
f(x)=3x2 − 2. f: R → R. Consider a real number -3. But there is no real value of x for which
f(x) can be -3.

12
Question 13
Consider the following propositions.
p: Water logging causes roadblock.
q: Landslide causes roadblock.
r: Rescue teams are sent.
Consider the statement : ‘‘If Water logging causes roadblock or landslide causes
roadblock, then rescue teams are sent."
Which of the following is equivalent to the inverse of the statement?
Marks: 1 MCQ

a) ¬p ∧ ¬q → ¬r

b) ¬p ∨ ¬q → ¬r

c) ¬r → ¬p ∧ ¬q

d) ¬p → ¬q ∨ ¬r

Answer: a)
Explanation: According to the syntax and semantics of the Propositional Logic.

13
Question 14
What is the recurrence relation for the worst-case time complexity of the binary search algo-
rithm for a sorted linked list of n numbers?
Marks: 1 MCQ

a) T(n) = T(n-1) + O(n).

b) T(n) = T(n/2) + O(n).

c) T(n) = T(n-1) + O(1).

d) T(n) = T(n/2) + O(1).

Answer: b)
Explanation: Recurrence relation for the binary search algorithm in a sorted array is T(n)
= T(n/2) + O(1).
If we use a sorted linked list, the pointer to the middle element can be found out in only O(n)
time.
So, the recurrence relation becomes: T(n) = T(n/2) + O(n). Hence, option b) is correct.

14
Question 15
Marks: 1 MCQ
Let A= {1, 2, 3} and B={p, q, r, s} be two sets.
Find out the number of elements contained in the power set of (A × B), where × defines
cartesian product.

a) (3×4)

b) (3+4)

c) 2(3×4)

d) 2(3+4)

Answer: c)
Explanation: Cardinality of set A is 3 and set B is 4.
The cardinality of set (A × B): (3×4).
The number of elements contained in the power set of (A × B): 2(3×4) .
Hence, option c) is correct.

15
Question 16
What will be the Least Significant Bit (LSB) when an ODD decimal number is converted into
its binary equivalent? Marks: 1 MCQ

a) 1

b) 0

c) 0 or 1

d) 2

Answer: a)
Explanation: If we divide any odd integer by 2, the remainder is 1. In the process of decimal
to binary conversion, this remainder becomes the LSB.
Hence, option a) is correct.

16
Question 17
Marks: 1 MSQ
Let A= {1, 2} and B={p, q} be two sets.
Which of the following pairs will not be included in (A × B), where × defines cartesian
product.

a) (1, p)

b) (p, 1)

c) (2, 2)

d) (2, q)

Answer: b), c)
Explanation: Cartesian Product operation on two sets returns a set of ordered pairs.
Incase, of Ordered Pair: (1, p) 6= (p, 1)
A × B = {(a, b) : a ∈ A and b ∈ B}
The Cartesian product between A and B will contain the following pairs: {(1, p), (2, p),(1, q),
(2, q)}
Hence, options b) and c) are correct.

17
Question 18
Marks: 1 MCQ
Consider the following binary search tree:

What will be the correct position, if we insert 16 in the given binary search tree?

a) Left child of node labeled 25

b) Left child of node labeled 18

c) Right child of node labeled 13

d) Right child of node labeled 8

Answer: b)
Explanation: Inserted item 16 is greater than 15 but less than 20.
Again, 16 is less than of left child node(18) of labelled node 20. So it will be inserted at the
left child node of labelled node 18.
Hence, option b) is correct.

18
Question 19
Marks: 1 MCQ
Suppose the numbers 10, 50, 20, 25, 30, 45, 35, 40, 60, 15 are inserted in that order into
an initially empty binary search tree. What is the in-order traversal sequence of the
resultant tree?

a) 10, 50, 20, 15, 25, 30, 45, 35, 40, 60

b) 10, 50, 20, 15, 25, 30, 35, 40, 45, 60

c) 10, 15, 20, 25, 30, 35, 40, 45, 50, 60

d) 10, 15, 20, 30, 25, 35, 40, 45, 50, 60

Answer: c)
Explanation: In-order traversal of a binary search tree(BST) gives elements in in-
creasing sorted order. Hence, option c) is correct.

19
Question 20
Marks: 1 MCQ
Consider the following array of ten integers:
20, 15, 5, 10, 25, 50, 30, 45, 40, 35
What will be the contents of this array after the 1st pass of bubble sort (sorting from smallest
to largest)?

a) 15, 5, 10, 20, 25, 30, 45, 50, 40, 35

b) 15, 5, 10, 20, 25, 30, 45, 40, 50, 35

c) 15, 5, 10, 25, 20, 30, 45, 40, 35, 50

d) 15, 5, 10, 20, 25, 30, 45, 40, 35, 50

Answer: d)
Explanation: First Pass:
(20, 15, 5, 10, 25, 50, 30, 45, 40, 35): Need swap because 20>15
(15, 20, 5, 10, 25, 50, 30, 45, 40, 35): Need swap because 20>5
(15, 5, 20, 10, 25, 50, 30, 45, 40, 35): Need swap because 20>10
(15, 5, 10, 20, 25, 50, 30, 45, 40, 35): No swap because 20<25
(15, 5, 10, 20, 25, 50, 30, 45, 40, 35): No swap because 25<50
(15, 5, 10, 20, 25, 50, 30, 45, 40, 35): Need swap because 50>30
(15, 5, 10, 20, 25, 30, 50, 45, 40, 35): Need swap because 50>45
(15, 5, 10, 20, 25, 30, 45, 50, 40, 35): Need swap because 50>40
(15, 5, 10, 20, 25, 30, 45, 40, 50, 35): Need swap because 50>35
(15, 5, 10, 20, 25, 30, 45, 40, 35, 50)
After first pass, the array will be: (15, 5, 10, 20, 25, 30, 45, 40, 35, 50)
Hence, option d) is correct.

20

You might also like