wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Advanced Data Structure

Total questions: 153

Worksheet time: 2hrs 10mins

Name
Class
Date
1.
Which data structure follows LIFO System?
a)
Stack
b)
Queue
c)
Linked List
d)
All
2.
Which data structure follows FIFO System?
a)
Stack
b)
Queue
c)
Array
d)
All of these
3.
Which data structure is the collection of nodes ?
a)
Linked List
b)
Array
c)
Stack
d)
Queue
4.
Which is not a linear data structure ?
a)
Stack
b)
Tree
c)
Linked List
d)
Queue
5.
Which operation is problematic in an array ?
a)
Insertion & Deletion
b)
Updation
c)
Searching
d)
All of these
6.

Array can be classified in how many types ?

a)

1

b)

2

c)

3

d)

More than 4

7.
A linked list have
a)
address
b)
value
c)
Both Address and value
d)
None
8.
In single linked list ,the pointer of last node contains
a)

Null

b)

address of first node

c)

only data value

d)

only address

9.
Which is a Linear data structure?
a)
Linked List
b)
Tree
c)
Graph
d)
All of these
10.

People standing in queue at railway ticket counter is that

a)

Queue

b)

Stack

c)

Array

d)

Tree

11.
Which is not a non-primitive data structure ?
a)
Integer
b)
Array
c)
Character
d)
Float / Real
12.
An stack can be implemented using....
a)

Linked list

b)

Array

c)

Both Array & Linked list

d)

None of these

13.
Undo/Redo is implemented using...
a)
Queue
b)
Tree
c)
Linked List
d)
Stack
14.
Which is the type of an array ?
a)
One dimensional
b)
Two dimensional
c)
Multi Dimensional
d)
All of these
15.
A tree is a
a)
Primitive Data structure
b)
Linear Data Structure
c)
Non - Linear Data Structure
d)
All of these
16.
A node contains
a)
Pointer
b)
Data Value
c)
Both Pointer & Data Value
d)
None of these
17.
A linked list is a collection of
a)
Data
b)
Nodes
c)
Arrays
d)
Pointers
18.
Which data structure is best for storing matrices?
a)
Stack
b)
Array
c)
Tree
d)
Queue
19.
Elements can be removed from a stack from
a)
Top
b)
Bottom
c)
Anywhere like array
20.
Elements are added in queue at
a)

Rear / Back

b)

Front

c)

Both

d)

None

21.

Which of the following are types of data structures?

Select all that are correct.

a)

Arrays

b)

Lists

c)

Records

d)

Tables

e)

Files

22.

Here is a Python list

data = ["Computer", "Science", "is", "awesome"]

Which item has an index of 2?

a)

Computer

b)

Science

c)

is

d)

awesome

23.

Here is a 2-dimensional Python list.

scores = [["Bob", 15] , ["Jane", 32] , ["Dave", 4] , ["Lucy", 19]]

Which data is at index scores[3][1]?

a)

Lucy

b)

19

c)

Dave

d)

4

24.

To store larger sets of data that multiple users can access, we use a

(a)  

25.

To store data from a list into a text file, it will be structured as a ...

a)

record

b)

constant

c)

variable

d)

array

26.

What is the difference between a list and a variable?

a)

The elements in a list can be changed, while a variable cannot.

b)

A list can store multiple items while a variable holds only one.

c)

A list is easier to use than a variable.

d)
A list can only store integers, while a variable can store any data type.
27.

How can data be stored when a program is not running?

a)

Lists

b)

Arrays

c)

Variables

d)

Text files

28.

Which of these statements about record structures is NOT true?

a)

A record structure is a collection of related fields

b)

A field is a variable

c)

Each field in a record can have a different data type

d)

You can create record structures in Python

29.

To find out how many characters are in the string dataStoredHere, which Python function do we use?

a)

len(dataStoredHere)

b)

COUNT(dataStoredHere)

c)

LEN(dataStoredHere)

d)

dataStoredHere.length

30.

Which Python function will convert a string to all upper-case characters?

data = "here is a string"

a)

data.toUpper()

b)

data.upper

c)

upper(data)

d)

data.upper()

31.

The best technique for handling collision is

a)

Separate Chaining

b)

Linear Probing

c)

Double hashing

d)

Quadratic probing

32.

Choose the correct option denoting the most desirous characteristics of a hash function.

a)

It must cause more collisions.

b)

It must cause less collisions.

c)

It must be easy to implement.

d)

It must occupy less space.

33.

People have used the word ________ to mean computer information that is transmitted or stored.

a)

Beta

b)

Data

c)

Database

d)

None of above

34.

_____________ specifies how we enter data into our programs and what type of data we enter.

a)

data type

b)

data

c)

datum

d)

all of above

35.

Array is ___________ data type.

a)

user defined

b)

primary

c)

derived

d)

all of above

36.

A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?

a)

Priority queue

b)

Dequeue

c)

Circular Queue

d)

Queue

37.

Which is the most appropriate data structure for reversing a word?

a)

Stack

b)

Queue

c)

Hashing

d)

Tree

38.

Quick sort follows which type of algorithm

a)

Greed

b)

Top down

c)

Divide and Conquer

d)

Branch and bound

39.

Which sorting algorithm is known for its average time complexity of O(n log n)?

a)

Bubble sort

b)

Insertion sort

c)

Merge sort

d)

Selection sort

40.

What data structure is best suited for implementing undo functionality in a text editor?

a)

Queue

b)

Stack

c)

Linked list

d)

Heap

41.

which of the following are the tree traversal

a)

Hashing

b)

Defense first search

c)

Bottom first search

d)

Depth first search

42.

Which data structure is suitable for implementing a breadth-first search algorithm?

a)

Stack

b)

Queue

c)

Heap

d)

Linked list

43.

What is the best data structure for implementing a priority queue?

a)

Heap

b)

Queue

c)

Stack

d)

Linked list

44.

The prefix form of A-B/ (C * D ^ E) is?

a)

-A/B*C^DE

b)

-A/BC*^DE

c)

-ABCD*^DE

d)

-/*^ACBDE

45.

Minimum nodes possible height for a AVL tree with 16 nodes

a)

2

b)

3

c)

4

d)

Either 3 or 4

46.

In AVL tree, the balance factor of a node is defined as the difference between the heights of its left and right subtrees. What is the range of the balance factor for a node in a balanced AVL tree?

a)

-1 to 1

b)

0 to 2

c)

-2 to 2

d)

1 to 3

47.

Consider the binary tree given : and find the level order

a)

5,3,8,1,4,9,7

b)

5,3,8,1,4,7,9

c)

1,3,4,5,7,8,9

d)

1,4,3,5,8,7,9

48.

Given the following preorder and inorder traversals of a binary tree:

Preorder: M, N, O, P, Q, R, S, T

Inorder: O, P, Q, R, N, T, M, S

Reconstruct the binary tree and determine the number of values after the root node.

a)

1

b)

2

c)

5

d)

4

49.

Consider an undirected graph with weighted edges, where the weights represent the cost of traversal between nodes. You are tasked with finding the path between two nodes with the minimum total cost. Which traversal algorithm is more suitable for this scenario?

a)

BFS

b)

DFS

c)

Both DFS and BFS

d)

It depends on specific graph

50.

Suppose you have a doubly linked list, and you want to delete a node given its pointer. What is the time complexity to delete the node?

a)

O(1)

b)

O(log n)

c)

O(n)

d)

O(n^2)

51.

Consider the following array: [7, 4, 2, 8, 5, 1, 6, 3]. If you use the QuickSort algorithm and choose the pivot as the last element, what will be the array after the first partitioning step?

a)

[2, 4, 1, 3, 5, 7, 6, 8]

b)

[2, 1, 3, 4, 5, 6, 7, 8]

c)

[3, 4, 2, 1, 5, 7, 6, 8]

d)

[7, 4, 2, 8, 5, 1, 6, 3]

52.

You have a hash table with 8 slots and the following hash function: ℎ(K)=(3K+7)mod 8 If you want to search for the key 5, what is the index where it will be located in the hash table?

a)

5

b)

6

c)

8

d)

7

53.

Why is a circular queue preferred in certain applications over a regular queue?

a)

Circular queues have better memory utilization than regular queues.

b)

Circular queues avoid the issue of front and rear pointers reaching the end, making them more efficient for continuous data streams.

c)

Regular queues have faster insertion and deletion operations compared to circular queues.

d)

Circular queues are only used in specialized applications and are not generally preferred.

54.

Select the non-linear data structure from the options below:

a)

Queue

b)

linked list

c)

Array

d)

Tree

55.

Consider an array of integers: [10, 25, 30, 45, 50, 65, 70, 85]. If you are searching for element 10, which searching technique would be most efficient

a)

Linear Search

b)

Binary Search

c)

Hashing

d)

Jump Search

56.

Matrix A - p rows, q columns

Matrix B - s rows, t columns

if ((p !=s) && (q!=t)) - Then what will happen for Addition of Matrix A and B?

(a)  

57.

Consider the following statements in a Queue:

enqueue(8);

enqueue(2);

enqueue(6);

enqueue(4);

dequeue();

enqueue(5);

What is the current size of the queue?

a)

5

b)

6

c)

4

d)

3

58.

If the elements P, W,S,D are placed in a stack and are deleted one at a time, what is the order of removal?

a)

PWSD

b)

PDWS

c)

DWSP

d)

DSWP

59.

Write the postfix notation of the following infix expression.

A+B*C+(D*E+F)*G

(a)  

60.

Write only the function to delete a node at the beginning of a doubly linked list.

4 lines
61.

Queue Implementation using Array. Array name is Queuearray and rear is the current element pointer and "data" is the new item to be added. For adding a new element int the queue, is the following statement correct?

queue[rear] = data;

Queuearray[rear] = data;

a)

True

b)

False

62.

An exam was attended by 80 students. Min marks-0, Max Mark-50. I need to store the frequency of marks >30. What will be the size of the array needed for it?

a)

80

b)

20

c)

30

d)

50

63.

Below is a stack operation

int x = a[top--];

return x;

if top becomes zero, then what is that condition called?

a)

overflow

b)

underflow

c)

pop

d)

push

64.

Write the condition to check whether a queue is full or not?

(rear, front are the pointers, size of the array =MAX)

(a)  

65.

What is the way to increment the rear end of a circular queue?

a)

(Rear+1) mod MAX

b)

Rear mod MAX

c)

(Front+1) mod MAX

d)

(Rear-1) mod MAX

66.

Write the function to insert a node to the beginning of a singly linked list?

4 lines
67.

The front and rear pointers of a queue are monitored in a linked list implementation. During an insertion into a NONEMPTY queue, which of these pointers would change?

a)

Only rear pointer

b)

Only Front pointer

c)

Both Front and Rear

68.

Which of the following statement about binary tree is CORRECT?

a)

Every binary tree is either complete or full

b)

Every complete binary tree is also a full binary tree

c)

Every full binary tree is also a complete binary tree

d)

A binary tree cannot be both complete and full

69.

Which type of traversal of binary search tree outputs the value in sorted order?

a)

Pre-order

b)

Post-order

c)

In-Order

d)

None

70.

A binary search tree is generated by inserting in order the following integers:

50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24


The number of the node in the left sub-tree and right sub-tree of the root, respectively, is

a)

(4, 7)

b)

(7, 4)

c)

(8, 3)

d)

(3, 8)

71.

In delete operation of BST, we need inorder successor (or predecessor) of a node when the node to be deleted has both left and right child as non-empty. Which of the following is true about inorder successor needed in delete operation?

a)

Inorder Successor is always a leaf node

b)

Inorder successor is always either a leaf node or a node with empty left child

c)

Inorder successor may be an ancestor of the node

d)

Inorder successor is always either a leaf node or a node with empty right child

72.

What is the maximum height of any AVL-tree with 7 nodes? Assume that the height of a tree with a single node is 0.

a)

2

b)

3

c)

4

d)

5

73.

In the balanced binary tree in the figure given below, how many nodes will become unbalanced when a node is inserted as a child of the node “g”?

a)

1

b)

3

c)

7

d)

8

74.

Which of the following sequences denotes the post order traversal sequence of the tree?

a)

f e g c d b a

b)

g c b d a f e

c)

g c d b f e a

d)

f e d g c b a

75.

Consider the following operation performed on a stack of size 5.

Push(1);

Pop();

Push(2);

Push(3);

Pop();

Push(4);

Pop();

Pop();

Push(5);

a)

4

b)

3

c)

2

d)

1

76.

Consider the following definition in c programming language.

struct node { int data; struct node next; }

typedef struct node NODE;

NODE *ptr;

Which of the following c code is used to create new node?

a)

ptr = (NODE*)malloc(sizeof(NODE));

b)

ptr = (NODE*)malloc(NODE);

c)

ptr = (NODE*)malloc(sizeof(NODE*));

d)

ptr = (NODE)malloc(sizeof(NODE));

77.

What does the following function do for a given Linked List with first node as head?

void fun1(struct node* head)

{ if(head == NULL)

return;

fun1(head->next);

printf("%d ", head->data); }

a)

Prints all nodes of linked lists

b)

Prints all nodes of linked list in reverse order

c)

Prints alternate nodes of Linked List

d)

Prints alternate nodes in reverse order

78.

What is the output of following function for start pointing to first node of following linked list? 1->2->3->4->5->6

void fun(struct node* start)

{

if(start == NULL)

return;

printf("%d ", start->data);

if(start->next != NULL )

fun(start->next->next);

printf("%d ", start->data);

}

a)

1 4 6 6 4 1

b)

1 3 5 1 3 5

c)

1 2 3 5

d)

1 3 5 5 3 1

79.

Assume that the operators +,-, X are left associative and ^ is right associative.

The order of precedence (from highest to lowest) is ^, X, +, -.

The postfix expression for the infix expression

a + b X c – d ^ e ^ f is?

a)

abc X+ def ^^ –

b)

abc X+ def ^^ –

c)

ab+c Xd – e ^f^

d)

-+aXbc^ ^def

80.

After performing these set of operations, what does the final list look contain? InsertFront(10);

InsertFront(20);

InsertRear(30);

DeleteFront();

InsertRear(40);

InsertRear(10);

DeleteRear();

InsertRear(15);

display();

a)

10 30 10 15

b)

20 30 40 15

c)

20 30 40 15

d)

20 30 40 15

81.

Convert the following infix expressions into its equivalent postfix expressions.

(A + B ⋀D)/(E – F)+G

a)

(A B D ⋀ + E F – / G +)

b)

(A B D +⋀ E F – / G +)

c)

(A B D ⋀ + E F/- G +)

d)

(A B D E F + ⋀ / – G +)

82.

What does the following code do?

public Object function()

{ if(isEmpty())

return -999;

else

{ Object high;

high = q[front];

return high; } }

a)

Dequeue

b)

Enqueue

c)

Return the front element

d)

Return the last element

83.

The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers 1, 2, 3, 4, 5, 6, 7 in the given order. What will be the contents of the list after the function completes execution?

struct node

{

  int value;

  struct node *next;

};

void rearrange(struct node *list)

{

  struct node p, q;

  int temp;

  if ((!list) || !list->next)

      return;

  p = list;

  q = list->next;

  while(q)

  {

     temp = p->value;

     p->value = q->value;

     q->value = temp;

     p = q->next;

     q = p?p->next:0;

  }

}

a)

1,2,3,4,5,6,7

b)

2,1,4,3,6,5,7

c)

1,3,2,5,4,7,6

d)

2,3,4,5,6,7,1

84.

Consider the function f defined below.

struct item

{

  int data;

  struct item * next;

};

 

int f(struct item *p)

{

  return (

          (p == NULL) ||

          (p->next == NULL) ||

          (( P->data <= p->next->data) && f(p->next))

         );

}

a)

not all elements in the list have the same data value

b)

the elements in the list are sorted in non-decreasing order of data value

c)

the elements in the list are sorted in non-increasing order of data value

d)

None of them

85.

You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?

a)

Delete the first element

b)

Insert a new element as a first element

c)

Delete the last element of the list

d)

Add a new element at the end of the list

86.

Let P be a singly linked list. Let Q be the pointer to an intermediate node x in the list. What is the worst-case time complexity of the best known algorithm to delete the node x from the list?

a)

O(n)

b)

O(log2 n)

c)

O(logn)

d)

O(1)

87.

Assume there is a tree in which every node has a value greater than value of any node in its LST but lesser

than any node in its RST. An in order traversal of this tree shall result in

a)

A. a sorted sequence in ascending order

b)

B. a sorted sequence in descending order

c)

C. sequence is sorted only of tree is a complete or full binary tree

d)

D. sequence is not always sorted

88.

Assume an algebric expression E is represented using the binary tree

a)

A. the variable in E forms external nodes and operators in internal nodes

b)

B. the operators in E forms external nodes and variables in internal nodes

c)

C. the variable and operations in E forms internal nodes

d)

D. the variable and operations in E forms external nodes

89.

Balance factor is defined as the

a)

A. Difference between Left sub tree and Right sub tree

b)

B. Difference between the height of Left sub tree and the height of Right sub tree

c)

C. Difference between Right sub tree and Left sub tree

d)

D. Difference between the height of Right sub tree and the height of Left sub tree

90.

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)

A. 2^i

b)

B. 2^(i-1)

c)

C. 2^(i+1)

d)

D. 2^i+1

91.

The maximum number of binary trees that can be formed with three nodes

a)

A. 3

b)

B. 1

c)

C. 5

d)

D. 4

92.

The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of

nodes in a binary tree of height h is:

a)

A. 2^h-1

b)

B. 2^(h-1)-1

c)

C. 2^(h+1)-1

d)

D. 2*(h+1)

93.

The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number of

nodes in a binary tree of height 4 are

a)

A. 31 and 5

b)

B. 32 and 5

c)

C. 15 and 5

d)

D. 15 and 4

94.

When the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree, the CORRECT option is

a)

A. W is an internal node

b)

B. V is a leaf node

c)

C. S is a root node

d)

D. B is a leaf node

95.

When the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree, the CORRECT option is

a)

A. Height of tree is 2

b)

B. Height of tree is 3

c)

C. Height of tree is 4

d)

D. Height of tree is 5

96.

When the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree, the CORRECT option is

a)

A. Balance Factor of node S is -2

b)

B. Balance Factor of node S is +2

c)

C. Balance Factor of node S is -1

d)

D. Balance Factor of node S is +1

97.

When the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree, the CORRECT option is

a)

A. Balance Factor of all nodes are -1, 0 or +1, so the tree is an AVL tree

b)

B. Balance Factor of node S needs to be altered

c)

C. Balance Factor of node M needs to be altered

d)

D. Node S has to be rotated to Right for Height adjustment

98.

Initially the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree. It has been checked and made

to an AVL tree. The CORRECT option is

a)

A. S forms the leaf node

b)

B. S forms the root node

c)

C. S has two children

d)

D. S has only Right child T

99.

Initially the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree. It has been checked and made

to an AVL tree. The CORRECT option is

a)

A. Double rotation (Right, Left) makes the tree into an AVL tree

b)

B. Single Right rotation makes the tree into an AVL tree

c)

C. Single Left rotation makes the tree into an AVL tree

d)

D. Double rotation (Left, Right) makes the tree into an AVL tree

100.

Initially the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree. The CORRECT option is

a)

A. Zig-zag rotation is required to splay the node H

b)

B. Zig-zag rotation is required to splay the node V

c)

C. Zig-zag rotation is required to splay the node W

d)

D. Zig-zag rotation is required to splay the node S

101.

Initially the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree. The CORRECT option is

a)

A. Splaying T requires zig-zag, and zig rotation

b)

B. Splaying T requires zig-zig, and zig rotation

c)

C. After splaying T, height of the tree is 4

d)

D. After splaying T, S takes the position of root

102.

Initially the keys like M, S, G, H, B, V, W, T are inserted into Binary Search Tree. The CORRECT option is

a)

A. After splaying T, the node S forms the Right child of M

b)

B. After splaying T, the node S forms the Left child of V

c)

C. After splaying T, the nodes W, B, H changed their positions

d)

D. After splaying T, the node V takes the position as leaf node

103.

The keys like M, S, G, H, B, V, W, T are inserted into B-tree of order 5. The CORRECT option is

a)

A. Leaf node is split, when key B is inserted

b)

B. Leaf node is split, when key G is inserted

c)

C. Leaf node is split, and B goes to root node

d)

D. Leaf node is split, and G goes to root node

104.

The maximum time taken by linear search algorithm when

a)

A. Search element is in the middle of an array

b)

B. Search element is present as the first item

c)

C. Search element is the maximum of all items

d)

D. Search element is present as the last item

105.

The maximum time taken by binary search algorithm when

a)

A. Search element is in the middle of an array

b)

B. Search element is present as the first item

c)

C. Search element is the maximum of all items

d)

D. Search element is presnt as the last item

106.

Maximum number of comparisons required to search the leaf node of Binary search tree is

a)

A. log n

b)

B. n

c)

C. n+1

d)

D. n-1

107.

The search algorithm(s) which can be implemented using recursive approach is/are

a)

A. Linear search

b)

B. Binary search

c)

C. Both Linear Search and Binary Search

d)

D. No search algorithms

108.

The search algorithm(s) which can be implemented using iterative approach is/are

a)

A. Linear search

b)

B. Binary search

c)

C. Both Linear Search and Binary Search

d)

D. No search algorithms

109.

Identify the correct sequence of sorting algorithms w.r.t their sorting time (increasing order of time taken)

a)

A. Insertion sort, Shell sort, Bubble sort

b)

B. Bubble sort, Insertion sort, Shell sort

c)

C. Shell sort, Insertion sort, Bubble sort

d)

D. Insertion sort, Bubble sort, Shell sort

110.

The algorithm scans the list by swapping the entries whenever pair of adjacent keys are out of desired order

a)

A. Insertion sort

b)

B. Quick sort

c)

C. Selection sort

d)

D. Bubble sort

111.

Q1. 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. Post order

traversal is

a)

A. B C K M V S L G

b)

B. B C M V K S L G

c)

C. B C K M S V L G

d)

D. B C K L S M V G

112.

Select the examples of non linear data structures

a)

Google map

b)

Stack of plates

c)

Family Tree

d)

Train

113.

The index of last element in the array is 10,then what will be the size of array

a)

10

b)

11

c)

9

d)

12

114.

(a)   data structures arrange element in sequential manner

115.

Give any one real time example for Array

4 lines
116.

Youtube downloader uses which data structure

a)

stack

b)

queue

c)

linked list

d)

tree

117.

Which data structures used in operating system for job scheduling

a)

stack

b)

queue

c)

tree

d)

linked list

118.

Music player is an example of which data structures

a)

stack

b)

queue

c)

linked list

d)

graph

119.

To store data in the linked list contiguous memory location is essential

a)

True

b)

False

120.

Expansion of ADT

(a)  

121.

What is meant by data structures

4 lines
122.

Queue is a

a)

Non-linear data structure

b)

linear data structure

123.

Queue follows

a)

FIFO

b)

LIFO

c)

None of these

124.

In queue, an element can be inserted in location pointed by

a)

top

b)

front (or head)

c)

rear (or tail)

d)

none of the above

125.

In queue, an element can be deleted in location pointed by

a)

top

b)

front (or head)

c)

rear (or tail)

d)

none of the above

126.

In ordinary queue, priority of every element

a)

can be different

b)

is same

c)

none of the above

127.

In priority queue, a priority is assigned to every element

a)

False

b)

True

128.

In a double-ended queue, an element can be inserted in

a)

front end

b)

rear end

c)

either front or rear end

129.

Dequeue refers to

a)

deletion from queue

b)

double ended queue

c)

demand queue

d)

none of the above

130.

Is it possible to create a doubly linked list using only one pointer with every node.

a)

Not Possible

b)

Yes, possible by storing XOR of addresses of previous and next nodes.

c)

Yes, possible by storing XOR of current node and next node

d)

Yes, possible by storing XOR of current node and previous node

131.

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. Use following two steps (a) Copy the data of next of X to X. (b) Delete next of X.

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. Use following two steps (a) Copy the data of next of X to X. (b) Delete next of X

132.

You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?

a)

Delete the first element

b)

Insert a new element as a first element

c)

Delete the last element of the list

d)

Add a new element at the end of the list

133.

Let P be a singly linked list. Let Q be the pointer to an intermediate node x in the list. What is the worst-case time complexity of the best known algorithm to delete the node x from the list?

a)

O(n)

b)

O(log2 n)

c)

O(logn)

d)

O(1)

134.

N items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed. An algorithm performs the following operations on the list in this order: Θ(N) delete, O(log N) insert, O(log N) find, and Θ(N) decrease-key What is the time complexity of all these operations put together

a)

O(Log^(2)N)

b)

O(N)

c)

O(N^2)

d)

Θ(N^2 Log N)

135.

The concatenation of two lists is to be performed in O(1) time. Which of the following implementations of a list should be used?

a)

singly linked list

b)

doubly linked list

c)

circular doubly linked list

d)

array implementation of lists

136.

Suppose there are two singly linked lists both of which intersect at some point and become a single linked list. The head or start pointers of both the lists are known, but the intersecting node and lengths of lists are not known. What is worst case time complexity of optimal algorithm to find intersecting node from two intersecting linked lists?

a)

Θ(n*m), where m, n are lengths of given lists

b)

Θ(n^2), where m>n and m, n are lengths of given lists

c)

Θ(m+n), where m, n are lengths of given lists

d)

Θ(min(n, m)), where m, n are lengths of given lists

137.

In a doubly linked list, the number of pointers affected for an insertion operation will be

a)

4

b)

0

c)

1

d)

None of these

138.

Consider an implementation of unsorted single linked list. Suppose it has its representation with a head and a tail pointer (i.e. pointers to the first and last nodes of the linked list). Given the representation, which of the following operation can not be implemented in O(1) time ?

a)

Insertion at the front of the linked list.

b)

Insertion at the end of the linked list.

c)

Deletion of the front node of the linked list.

d)

Deletion of the last node of the linked list.

139.

What is a hash table?

a)

a) A structure that maps values to keys

b)

b) A structure that maps keys to values

c)

c) A structure used for storage

d)

d) A structure used to implement stack and queue

140.

If several elements are competing for the same bucket in the hash table, what is it called?

a)

a) Diffusion

b)

b) Replication

c)

c) Collision

d)

d) Duplication

141.

Which of the following is not a technique to avoid a collision?

a)

a) Make the hash function appear random

b)

b) Use the chaining method

c)

c) Use uniform hashing

d)

d) Increasing hash table size

142.

A technique for direct search is

a)

a) Binary Search

b)

b) Linear Search

c)

c) Tree Search

d)

d) Hashing

143.

The goal of hashing is to produce a search that takes

a)

a) O(1) time

b)

b) O(n2 )time

c)

c) O(log n ) time

d)

d) O(n log n ) time

144.

Which of the following statement(s) is TRUE?

I. A hash function takes a message of arbitrary length and generates a fixed length code.

II. A hash function takes a message of fixed length and generates a code of variable length.

III. A hash function may give the same hash value for distinct messages.

a)

I only

b)

II and III only

c)

I and III only

d)

II only

145.

What is direct addressing?

a)

A. Distinct array position for every possible key

b)

B. Fewer array positions than keys

c)

C. Fewer keys than array positions

d)

D. None of the mentioned

146.

What can be the techniques to avoid collision?

a)

A. Make the hash function appear random

b)

B. Use the chaining method

c)

C. Use uniform hashing

d)

D. All of the mentioned

147.

In linear probing, the cost of an unsuccessful search can be used to compute the average cost of a successful search.

a)

True

b)

False

148.

Which of the following algorithms solves the all-pair shortest path problem?

a)

a. Floyd's algorithm

b)

b. Prim's algorithm

c)

c. Dijkstra's algorithm

d)

d. Warshall's algorithm

149.

The minimum number of colors needed to color a graph having n (>3) vertices and 2 edges is

a)

1

b)

2

c)

3

d)

4

150.

Let G = (V, E) be any connected undirected edge-weighted graph. The weights of the edges in E are positive any distinct. Consider the following statements:

I. Minimum Spanning Tree of G is always unique.

II. Shortest path between any two vertices of G is always unique.

Which of the above statements is/are necessarily true?

a)

a.I only

b)

b.II only

c)

c.both I and II

d)

d.neither I and II

151.

The maximum degree of any vertex in a simple graph with n vertices is

a)

a.n–1

b)

b.n+1

c)

c.2n–1

d)

d.n

152.

In binary tree nodes with 2 children are called ……..

a)

A. Interior node

b)

B. Domestic node

c)

C. Internal node

d)

D. Inner node

153.

A vertex of Out-degree zero in a directed graph is called a/an

a)

(A) Root vertex

b)

(B) Isolated vertex

c)

(C) Sink

d)

(D) Articulation point