0% found this document useful (0 votes)
21 views

Data Structure (CS-201 & CS-202) Quiz

Vfdh

Uploaded by

2Ø GÜNS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Data Structure (CS-201 & CS-202) Quiz

Vfdh

Uploaded by

2Ø GÜNS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Data Structure (CS-

201 & CS-202) Quiz


03/11/2023

[email protected] Switch account

Draft saved

* Indicates required question

Email *

[email protected]

State True or False. *


i) Binary search is used for searching in
a sorted array.
ii) The time complexity of binary search
is O(logn).

True, False

False, True

False, False

True, True

Selection sort first finds the .......... *


element in the list and put it in the first
position.

Middle element

Largest element

Last element

Smallest element

For the tree below, write the pre-order *


traversal.

2, 7, 2, 6, 5, 11, 5, 9, 4

2, 7, 5, 2, 6, 9, 5, 11, 4

2, 5, 11, 6, 7, 4, 9, 5, 2

2, 7, 5, 6, 11, 2, 5, 4, 9

Which of the following data structures is *


best to be used for parentheses
matching?

n-ary tree

queue

priority queue

stack

For the tree below, write the level-order *


traversal.

2, 7, 2, 6, 5, 11, 5, 9, 4

2, 7, 5, 2, 11, 9, 6, 5, 4

2, 5, 11, 6, 7, 4, 9, 5, 2

2, 7, 5, 6, 11, 2, 5, 4, 9

The concatenation of two list can *


performed in O(1) time. Which of the
following variation of linked list can be
used?

Singly linked list

Doubly linked list

Circular doubly linked list

Array implementation of list

What is the maximum possible number *


of edges in a directed graph with no self
loops having 8 vertices?

28

64

256

56

The complexity of selection sort is ....... *

O(n)

O(n2)

O(n logn)

O(logn)

Dijkstra’s Algorithm will work for both *


negative and positive weights?

True

False

The spanning tree of connected graph *


with 10 vertices contains ..............

9 edges

11 edges

10 edges

9 vertices

Roll No: *

22bec080

In linked list each node contain *


minimum of two fields. One field is data
field to store the data second field is?

Pointer to character

Pointer to integer

Pointer to node

Node

In a stack, if a user tries to remove an *


element from empty stack it is called
_________

UnderRow

Empty collection

OverRow

Garbage Collection

A graph is a tree if and only if graph is *

Directed graph

Contains no cycles

Planar

Completely connected

Worst-case Complexity of linear search *


algorithm is .........

O(n)

O(logn)

O(n2)

O(n logn)

The worst-case complexity of insertion *


sort algorithm is

O(n)

O(log n)

O(n2)

O(n log n)

What would be the asymptotic time *


complexity to insert an element at the
second position in the linked list?

O(1)

O(n)

O(n2)

O(n3)

In ……………, search start at the beginning *


of the list and check every element in the
list.

Linear search

Binary search

Hash Search

Binary Tree search

Linked list is considered as an example *


of ___________ type of memory
allocation.

Dynamic

Static

Compile time

Heap

Process of inserting an element in stack *


is called ____________

Create

Push

Evaluation

Pop

For the tree below, write the in-order *


traversal.

6, 2, 5, 7, 11, 2, 5, 9, 4

6, 5, 2, 11, 7, 4, 9, 5, 2

2, 7, 2, 6, 5, 11, 5, 9, 4

2, 7, 6, 5, 11, 2, 9, 5, 4

Pushing an element into stack already *


having five elements and stack size of 5,
then stack becomes

OverRow

Crash

UnderRow

User Row

What are the disadvantages of arrays? *

Data structure like queue or stack


cannot be implemented

There are chances of wastage of


memory space if elements inserted in
an array are lesser than the allocated
size

Index value of an array can be negative

Elements are sequentially accessed

Which of the following is not the *


required condition for binary search
algorithm?

The list must be sorted

There should be the direct access to the


middle element in any sub list

There must be mechanism to delete


and/or insert elements in list

None of above

Find the error (if any) in the following *


code snippet for pop operation.

void pop() //removing an element from a


stack
{
printf(“%s”, stack[top++]);
}

run time error

compile time error

pop operation is performed, but top


moved in wrong direction

pop operation is performed properly

Linked lists are not suitable to for the *


implementation of?

Insertion sort

Radix sort

Polynomial manipulation

Binary search

The pre-order and in-order are traversals *


of a binary tree are T M L N P O Q and L
M N T O P Q. Which of following is post-
order traversal of the tree?

LNMOQPT

NMOPOLT

LMNOPQT

OPLMNQT

Which matrix has most of the elements *


(not all) as Zero?

Identity Matrix

Unit Matrix

Sparse Matrix

Zero Matrix

What would be the asymptotic time *


complexity to find an element in the
linked list?

O(1)

O(n)

O(n2)

O(n4)

Array implementation of Stack is not *


dynamic, which of the following
statements supports this argument?

space allocation for array is `xed and


cannot be changed during run-time

user unable to give the input for stack


operations

a runtime exception halts execution

improper program compilation

How do you initialize an array in C? *

int arr[3] = (1,2,3);

int arr(3) = {1,2,3};

int arr[3] = {1,2,3};

int arr(3) = (1,2,3);

Which of the following properties are *


obeyed by all three tree – traversals?

Left subtrees are visited before right


subtrees

Right subtrees are visited before left


subtrees

Root node is visited before left subtree

Root node is visited before right subtree

The maximum number of nodes in a tree *


for which post-order and pre-order
traversals may be equal is ______

any number

Worst-case complexity of bubble sort *


algorithm is .....

O(n)

O(logn)

O(n2)

O(n logn)

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?

Delete the `rst element

Insert a new element as a `rst element

Delete the last element of the list

Add a new element at the end of the list

Consider the following data and specify *


which one is Preorder Traversal
Sequence, Inorder and Postorder
sequences.
S1: N, M, P, O, Q
S2: N, P, Q, O, M
S3: M, N, O, P, Q

S1 is preorder, S2 is inorder and S3 is


postorder

S1 is inorder, S2 is preorder and S3 is


postorder

S1 is inorder, S2 is postorder and S3 is


preorder

S1 is postorder, S2 is inorder and S3 is


preorder

If queue is implemented using arrays, *


what would be the worst run time
complexity of enqueue and dequeue
operations?

Ο(n), Ο(n)

Ο(n), Ο(1)

Ο(1), Ο(n)

Ο(1), Ο(1)

The worst case occur in linear search *


algorithm when .......

Item is somewhere in the middle of the


array

Item is not in the array at all

Item is the last element in the array

Item is the last element in the array or


item is not there at all

What is the maximum height of an AVL *


tree with p nodes?

log(p)

log(p)/2

p⁄2

For a given graph G having v vertices *


and e edges which is connected and has
no cycles, which of the following
statements is true?

v=e

v = e+1

v+1=e

None of the mentioned

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

I and II

I and III

I, II and III

I, II and IV

In Breadth First Search of Graph, which *


of the following data structure is used?

Stack.

Queue.

Linked List.

None of these

Consider the following data. The pre *


order traversal of a binary tree is A, B, E,
C, D. The in order traversal of the same
binary tree is B, E, A, D, C. The level order
sequence for the binary tree is _________

You might also like