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

CSE-205

MTE SAMPLE PAPER


SET-1
UNIT-1
1) The __ notation is used when the function g(n)
defines a lower bound for the function f(n).
(a) Omega
(b) Big O
(c) Theta
(d) Little Oh

Ans- A

2) In complexity theory, __ case refers

to the expected value of f(n).

(a) Average

(b) Best

(c) Worst

(d) Good

Ans- A

3) The time complexity of binary search is given by


_____
a) constant
www.cgpabooster.in
Academic Lab: CGPA Booster
b) quadratic
c) exponential
d) none of the mentioned
View Answer

Answer: d

4) What is the best case and worst case complexity of


ordered linear search?
A) O(nlogn), O(logn)
B) O(logn), O(nlogn)
C) O(n), O(1)
D) O(1), O(n)

Ans-D

5) In the following scenarios, when will you use selection


sort?
a) The input is already sorted
b) A large file has to be sorted
c) Large values need to be sorted with small keys
d) Small values need to be sorted with large keys

Ans- C

6) How many total swap operations are performed to get


sorted array using bubble sort. Input array is (82 96 39
58 51)?
(a) 4
(b) 3
(c) 6
www.cgpabooster.in
Academic Lab: CGPA Booster
(d) 5

Ans- B

7) Consider a two dimensional array A[20][10]. Assume


4 words per memory cell, the base address of array A is
10, elements are stored in row-major order and first
element is A[0][0] What is the address of A[11][5] ?

(a)470

(b)594

(c)570

(d)494

Ans- A

8) What will be the number of passes to sort the


elements using insertion sort?
14, 12,16, 6, 3, 10
a) 6
b) 5
c) 7
d) 1
View Answer

Answer: b

www.cgpabooster.in
Academic Lab: CGPA Booster
9) For many problems such as sorting, there are many
choices of algorithms to use, some of which are
extremely_____.
a.
Space efficient
b.
Time efficient
c.
Both (a) and (b)
d.
None of the above

Answer: (c).

10) Select the appropriate code that performs bubble


sort.
a)
for(int j=arr.length-1; j>=0; j--)
{
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
}
}
}
b)
for(int j=arr.length-1; j>=0; j--)
www.cgpabooster.in
Academic Lab: CGPA Booster
{
for(int k=0; k<j; k++)
{
if(arr[k] < arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
}
}
}
c)
for(int j=arr.length; j>=0; j--)
{
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+1])
{
int temp = arr[k];
arr[k] = arr[k+1];
arr[k+1] = temp;
}
}
}
d)
for(int j=arr.length; j>=0; j--)
{
for(int k=0; k<j; k++)
{
if(arr[k] > arr[k+2])
{
int temp = arr[k];
www.cgpabooster.in
Academic Lab: CGPA Booster
arr[k] = arr[k+1];
arr[k+1] = temp;
}
}
}
View Answer
Answer: a
UNIT-2

1) What is the functionality of the following piece of


code?

public int function(int data)


{
Node temp = head;
int var = 0;
while(temp != null)
{
if(temp.getData() == data)
{
return var;
}
var = var+1;
temp = temp.getNext();
}
return Integer.MIN_VALUE;
}
A. Find and delete a given element in the list
B. Find and return the given element in the list

www.cgpabooster.in
Academic Lab: CGPA Booster
C. Find and return the position of the given element in
the list
D. Find and insert a new element in the list
View Answer

Ans : C

2) In the worst case, the number of comparisons needed


to search a singly linked list of length n for a given
element is

A. log 2 n
B. n/2
C. log 2 n – 1
D. n
View Answer

Ans : D

3) In circular linked list, insertion of node requires


modification of?

A. One pointer
B. Two pointer
C. Three pointer
D. None
View Answer

Ans : B

www.cgpabooster.in
Academic Lab: CGPA Booster
4) Consider an implementation of unsorted singly linked
list. Suppose it has its representation with a head
pointer only.
Given the representation, which of the following
operation can be implemented in O(1) time?

i) Insertion at the front of the linked list


ii) Insertion at the end of the linked list
iii) Deletion of the front node of the linked list
iv) Deletion of the last node of the linked list

A. I and II
B. I and III
C. I, II and III
D. I, II and IV
View Answer

Ans : B

5) In Linked List implementation, a node carries


information regarding

A. Data
B. Link
C. Data and Link
D. None of the mentioned
View Answer

Ans : B

www.cgpabooster.in
Academic Lab: CGPA Booster
6) Given pointer to a node X in a singly linked list. Only
one pointer is given, pointer to head node is not given,
can we delete the node X from given linked list?

A. Possible if X is not last node


B. Possible if size of linked list is even
C. Possible if size of linked list is odd
D. Possible if X is not first node
View Answer

Ans : A

7) What is the space complexity for deleting a linked


list?
a) O(1)
b) O(n)
c) Either O(1) or O(n)
d) O(logn)
View Answer

Answer: a

8) Which of the following is false about a circular linked


list?
a) Every node has a successor
b) Time complexity of inserting a new node at the head
of the list is O(1)
c) Time complexity for deleting the last node is O(n)
d) We can traverse the whole circular linked list by
starting from any point
View Answer

www.cgpabooster.in
Academic Lab: CGPA Booster
Answer: b

9) A ..... list is a header list where the node points back


to the header node.

A. Circular header

B. Grounded header

C. Two way header

D. One way header

Ans- A

10) In a two-way lists each node is divided into


.......parts.

A. 1

B. 2

C. 3

D. 4

Ans- C

www.cgpabooster.in
Academic Lab: CGPA Booster
UNIT-3

1) Before inserting into stack one must check the


condition ..........

A. Overflow

B. Underflow

C. Maximum elements

D. Existing elements

Ans- A. Overflow

2) The another name of dequeue is.........

A. divided queue

B. distributed queue

C. double ended queue

D. design queue

Ans- C. double ended queue

3) Before deletion condition into stack ...... has to be


checked.

A. Overflow
www.cgpabooster.in
Academic Lab: CGPA Booster
B. Underflow

C. Maximum elements

D. Existing elements

Ans- B. Underflow

4) Which of the following name does not relate to


stacks?

A. FIFO lists

B. LIFO list

C. piles

D. push-down lists

Ans- A. FIFO lists

5) The condition........ indicate the queue is empty.


A. Front=Null

B. Null=Front

C. Front=Rear

D. Rear=Null

Ans- A. Front-Null
www.cgpabooster.in
Academic Lab: CGPA Booster
6) Which of the following is not the type of queue?

A. Ordinary queue

B. Special queue

C. Priority queue

D. Circular queue

Ans- B. Special queue

7) The queue in which the insertion takes place in the


first position after of last element is a ........

A. priority

B. dequeue

C. circular

D. linked

Ans- C. circular

8) Reversing a great deal of space for each stack in


memory will ...........
A. Decrease the numbers of times overflow may occur

B. Increase the numbers of times overflow may occur

www.cgpabooster.in
Academic Lab: CGPA Booster
C. Increase the number of times underflow may occur

D. Increase the number of times underflow may occur

Ans- 20) A. Decrease the numbers of times overflow


may occur

9) The deletion operation in stack is called.....


A. insert

B. push

C. pop

D. top

Ans- C. pop

10) Link fields holds pointers to the ......... elements in


the linked representation of stack.

A. Neighboring

B. Last

C. First

D. Middle

Ans- A. Neighboring

www.cgpabooster.in
Academic Lab: CGPA Booster

You might also like