0% found this document useful (0 votes)
36 views13 pages

Capstone Final Questions

Uploaded by

nandhini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views13 pages

Capstone Final Questions

Uploaded by

nandhini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

1. The items 1, 2, 3, 4, 5, 6, 7 forms the minHeap.

After performing a deleteMin() operations, where


would 7 be placed?
A. Right of 4
B. Left of 4
C. Right of 3
D. Left of 3
2. When the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree, the CORRECT option
is
A. W is an internal node
B. V is a leaf node
C. S is a root node
D. B is a leaf node
3. Assume the level of root node is 1 and the levels of left and right children of root is 2. The
maximum number of nodes on level i of a binary tree is
A. 2^i
B. 2^(i-1)
C. 2^(i+1)
D. 2^i+1
4. The inorder traversal of binary tree is: B C G K L M S V. The preorder is: G C B L K S M V. Postorder
traversal is
A) B C K M V S L G
B) B C M V K S L G
C) B C K M S V L G
D) B C K L S M V G
5. The keys like M, S, G, H, B, V, W, T are inserted into B-tree of order 5. The CORRECT option is
A. Leaf node is split, when key B is inserted
B. Leaf node is split, when key G is inserted
C. Leaf node is split, and B goes to root node
D. Leaf node is split, and G goes to root node
6. A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are
performed efficiently. Which one of the following statements is CORRECT (n refers to the number of
items in the queue)?
(A) Both operations can be performed in O(1) time
(B) At most one operation can be performed on O(1) time but the worst-case time for the other
operation will be Ω(n)
(C) The worst-case time complexity for both operations will be Ω(n)
(D) Worst case time complexity for both operations will be Ω(log n)

( )
1

7. For parameters 𝑎 and 𝑏, both of which are 1, 𝑇(𝑛) = 𝑇 𝑛 𝑎 + 1, and 𝑇(𝑏) = 1.


Then 𝑇(𝑛) is

A. Θ(𝑛) .
B. Θ(𝑛) .
C. Θ(𝑛)
D. Θ(𝑛)
8. Let A be a square matrix of size n x n. Consider the following program. What is the expected
output?

C = 100
for i = 1 to n do
for j = 1 to n do
{
Temp = A[i][j] + C
A[i][j] = A[j][i]
A[j][i] = Temp - C
}
for i = 1 to n do
for j = 1 to n do
Output(A[i][j]);
A. The matrix A itself
B. Transpose of matrix A
C. Adding 100 to the upper diagonal elements and subtracting 100 from diagonal elements of
A
D. None of the above

9. Let 𝐺 be any connected, weighted, undirected graph.


I. 𝐺 has a unique minimum spanning tree, if no two edges of 𝐺 have the same weight.
II. 𝐺 has a unique minimum spanning tree, if, for every cut of 𝐺, there is a unique
minimum-weight edge crossing the cut.
Which of the above two statements is/are TRUE?
(A) I only
(B) II only
(C) Both I and II
(D) Neither I nor II
10. What is the worst-case time complexity of inserting n2 elements into an AVL tree with n
elements initially?

(A) Θ(n4)
(B) Θ(n2)
(C) Θ(n2 log n)
(D) Θ(n3)
11. What’s the solution to the recurrence relation 𝑇(𝑛) = 𝑇 ( )+ 1
𝑛
2

A. Θ(𝑛)
B. Θ(log 𝑙𝑜𝑔 𝑛)
C. Θ(log 𝑙𝑜𝑔 log 𝑙𝑜𝑔 𝑛)
D. Θ(𝑛 log 𝑙𝑜𝑔 𝑛)

12. The value of j at the end of the execution of the following C program.
int incr (int i) {
static int count = 0;

count = count + i;

return (count); }

main () {

int i,j;

for (i = 0; i <=4; i++)

j = incr(i);

A. 10
B. 4
C. 6
D. 7

13. Which of the following is TRUE?


(A) Every relation in 2NF is also in BCNF
(B) A relation R is in 3NF if every non-prime attribute of R is fully functionally dependent on every
key of R
(C) Every relation in BCNF is also in 3NF
(D) No relation can be in both BCNF and 3NF

14.

The minimum number of tables needed to represent M, N, P, R1, R2 is


(a) 2 (b) 3 (c) 4 (d) 5
Follow the rules for converting the ERD to Tables and solve
15. In the relation scheme R (A, B, C, D, E, H) upon which the functional dependencies are {A–>B,
BC–>D, E–>C, D–>A}, which are the candidate keys of R?
(A) AE, BE, DEAE, BE
(B) AE, BE
(C) AEH, BEH, BCH
(D) AEH, BEH, DEH
16. The following table has two attributes A and C where A is the primary key and C is the foreign

key referencing A with on-delete cascade.

The set of all tuples that must be additionally deleted to preserve referential integrity when the
tuple (2,4) is deleted is:

1. (3,4) and (6,4)


2. (5,2) and (7,2)
3. (5,2),(7,2) and (9,5)
4. (3,4),(4,3) and (6,4)

17.

Which of the following is a correct attribute set for one of the tables for the correct answer to the
above question?
(a) {M1, M2, M3, P1}
(b) {M1, P1, N1, N2}
(c) {M1, P1, N1}
(d) {M1, P1}
18. A relational schema for a train reservation database is given below.
Passenger (pid, pname, age)
Reservation (pid, class, tid)
Table: Passenger
pid pname age
-----------------
0 Sachin 65
1 Rahul 66
2 Sourav 67
3 Anil 69

Table : Reservation
pid class tid
---------------
0 AC 8200
1 AC 8201
2 SC 8201
5 AC 8203
1 SC 8204
3 AC 8202
What pids are returned by the following SQL query for the above instance of the tables?
SELECT pid
FROM Reservation ,
WHERE class ‘AC’ AND
EXISTS (SELECT *
FROM Passenger
WHERE age > 65 AND
Passenger. pid = Reservation.pid)
(A) 1, 0
(B) 1, 2
(C) 1, 3
(S) 1, 5

19. Which of the following is incorrect about an ER Model.


(a) An attribute of an Entity can have more than one value.
(b) An attribute of an entity can be composite.
(c) In a row of a relational table an attribute can have more than one value.
(d) In a row of a relational table an attribute can have exactly one value or NULL.
20. An unordered list contains 𝑛 distinct elements. The number of comparisons to find an element
in this list that is neither maximum nor minimum is

A) Θ(𝑛log𝑛)
B) Θ(𝑛)
C) Θ(log𝑛)
D) Θ(1)
21. Which one of the following is the recurrence equation for the worst case time complexity of the
Quicksort algorithm for sorting n ( ≥2 ) numbers? In the recurrence equations given in the
options below, c is a constant.
a) T(n) = 2T(n/2) + cn
b) T(n) = T(n - 1) + T(1) + cn
c) T(n) = 2T(n - 1) + cn
d) T(n) = T(n/2) + cn

22. Let S be an NP-complete problem and Q and R be two other problems not known to be in NP. Q
is polynomial time reducible to S and S is polynomial-time reducible to R. Which one of the
following statements is true?
a) R is NP-complete
b) R is NP-hard
c) Q is NP-complete
d) Q is NP-hard
23. Consider the following C functions:

int f1(int n){


if(n == 0 || n == 1){
return n;
}
return (2 * f1(n - 1) + 3 * f1(n - 2));
}
int f2(int n){
int i;
int X[N], Y[N], Z[N];
X[0] = Y[0] = Z[0] = 0;
X[1] = 1; Y[1] = 2; Z[1] = 3;
for(i = 2; i<= n; i++){
X[i] = Y[i - 1] + Z[i - 2];
Y[i] = 2 * X[i];
Z[i] = 3 * X[i];
}
return X[n];
}
The returning time of f1(n) and f2(n) are
A) Θ(𝑛)𝑎𝑛𝑑Θ(𝑛)
B) Θ(2 n)𝑎𝑛𝑑Θ(𝑛)

C) Θ(𝑛)𝑎𝑛𝑑Θ(2𝑛)

D) Θ(2n)𝑎𝑛𝑑Θ(2𝑛)
24. Ram and Shyam have been asked to show that a certain problem Π is NP-complete. Ram shows a
polynomial time reduction from the 3-SAT problem to Π, and Shyam shows a polynomial time
reduction from Π to 3-SAT. Which of the following can be inferred from these reductions ?
A) Π is NP-hard but not NP-complete
B) Π is in NP, but is not NP-complete
C) Π is NP-complete
D) Π is neither NP-hard, nor in NP

25. In the following C function, let n , m.

int gcd(n,m)

if (n % m == 0) return m;

n = n % m;

return gcd(m,n);

How many recursive calls are made by this function?

26. The time complexity of the following C function is (assume n > 0)

int recursive(int n){


if(n == 1){

return (1);

return (recursive(n - 1) + recursive(n - 1));

A )O(n)
B) O(n log n)
C) O(n2)
D) O(2n)

27.The running time of an algorithm is represented by the following recurrence relation:

Which one of the following represents the time complexity of the algorithm?
A) Θ(𝑛)
B) Θ(𝑛log𝑛)
C) Θ(𝑛2)
2
D) Θ(𝑛 log𝑛)

28.Consider the following graph:


Which one of the following is NOT the sequence of edges added to the minimum spanning tree using
Kruskal’s algorithm?
A (b,e)(e,f)(a,c)(b,c)(f,g)(c,d)
B(b,e)(e,f)(a,c)(f,g)(b,c)(c,d)
C(b,e)(a,c)(e,f)(b,c)(f,g)(c,d)
D(b,e)(e,f)(b,c)(a,c)(f,g)(c,d)

29. The graph shown below has 8 edges with distinct integer edge weights. The minimum spanning
tree (MST) is of weight 36 and contains the edges: {(A, C), (B, C), (B, E), (E, F), (D, F)}. The edge
weights of only those edges which are in the MST are given in the figure shown below. The
minimum possible sum of weights of all 8 edges of this graph is ___________.
30. Identify the correct sequence in which the following packets are transmitted on the
network by a host when a browser requests a web page from a remote server, assuming
that the host has just been restarted
a. HTTP GET request, DNS query, TCP SYN
b. DNS query, HTTP GET request, TCP SYN
c. DNS query, TCP SYN, HTTP GET request
d. TCP SYN, DNS query, HTTP GET request
31. If an Internet Service Provider (ISP) has the following chunk of CIDR-based IP
addresses available with it:245.248.128.0/20 and the ISP wants to give half of this chunk of
address to Organization A, and a quarter to Organization B, while retaining the remaining
with itself. Then, which among the following is a valid allocation of addresses to A and B?
a. 245.248.132.0/22 and 245.248.132.0/21
b. 245.248.136.0/21 and 245.248.128.0/22
c. 245.248.128.0/21 and 245.248.128.0/22
d. 245.248.136.0/22 and 245.248.132.0/21

32. Which of the following statements is NOT true about Ring topology ?
a. The data flows in anti-clockwise direction
b. The data flows in endless loop
c. It has not terminated end
d. It is unidirectional

33. Which of the following fields in an IP header is/are always modified by any router
before it forwards the IP packet?
a. Source IP address
b. TTL
c. Protocol
d. Header Checksum

34. Which of the following is/are example(s) of stateful application layer protocols?

a. I and II only
b. II and III only
c. II and IV only
d. IV only
35. Consider the following sequence of instructions to be executed in a pipelined processor: [GATE
CSE 2024]
I1: DIV R3, R1, R2
I2: SUB R5, R3, R4
I3: ADD R3, R5, R6
I4: MUL R7, R3, R8
Which of the following statements is/are TRUE?
a) There is a RAW dependency on R3 between I1 and I2
b) There is a WAR dependency on R3 between I1 and I3
c) There is a RAW dependency on R3 between I2 and I3
d) There is a WAW dependency on R3 beteween I3 and I4,
36. For computers based on three-address instruction formats, each address field can be
used to specify which of the following:
(S1) A memory operand
(S2) A processor register
(S3) An implied accumulator register
a)Either S1 or S2
b)Either S2 or S3
c)Only S2 and S3
d)all of S1,S2 and S3.
37. The decimal value 0.5 in IEEE single precision floating point representation has [GATE
CSE 2012]
a) fraction bits of 0000…00000 and exponent value of 0
b) fraction bits of 0000…00000 and exponent value of -1
c) fraction bits of 1000…00000 and exponent value of 0
d) no exact representation
38. Consider functions Function_1 and Function_2 expressed in pseudocode as follows:

1. Function_1 | Function_2
2. while n > 1 do | for i = 1 to 100 * n do
3. for i = 1 to n do | x = x + 1;
4. x = x + 1; | end for
5. end for |
6. n = ⌊n/2⌋; |
7. end while |

Let F1(N) and F2(N) denote the number of times the statement “x = x + 1” is executed
in Function_1 and Function_2, respectively.
Which of the following statements is/are TRUE?

39. The number of distinct minimum-weight spanning trees of the following graph is

A. 6
B. 9
C. 12
D. 4

40. In 2′s complement addition, the overflow [GATE CSE 2002]


a) Is flagged whenever there is a carry from sign bit addition
b) Cannot occur when a positive value is added to negative value
c) Is flagged when the carries from sign bit and previous bit match
d) None of the above

You might also like