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

mcq quizack

The document covers various data structures and algorithms, including external sorting, types of sorting algorithms, and characteristics of stacks, queues, and linked lists. It discusses the efficiency of different data structures for specific tasks, the complexities of operations, and traversal methods. Additionally, it addresses recursion, time complexities, and the implementation details of data structures.

Uploaded by

youssft007777
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

mcq quizack

The document covers various data structures and algorithms, including external sorting, types of sorting algorithms, and characteristics of stacks, queues, and linked lists. It discusses the efficiency of different data structures for specific tasks, the complexities of operations, and traversal methods. Additionally, it addresses recursion, time complexities, and the implementation details of data structures.

Uploaded by

youssft007777
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

External sorting is a way of

sorting data that is too large to fit into RAM✔


sorting data without the usage of a recursive implementation
sorting data outside a specific performance bound

What compares adjacent elements and exchanges them to put an array in order?

Insertion sort
Selection sort
Quicksort
Bubble sort✔

Which represents data as a chain of nodes and provides dynamic growth of data?

Stack
Linked List✔
Sequence
Array

Which of the following data structures is efficient in tree construction?

Queue
Array
Stack
Linked List✔

Which is the most suitable data structure for hierarchical data models?

Priority Queue
Linked List
Tree✔
Array

The smalled element of an array's index is called its:

Lower bound✔
Upper bound
Midpoint
Range
What is the process a procedure goes through when one of the steps of the
procedure involves invoking the procedure itself?

Induction
Recursion✔
Sequencing
Looping

Can a binary tree be implemented using an array?

Yes✔
No

What is the most suitable data structure for a situation where tasks must be
scheduled for execution on a computer and the tasks include system tasks?

Tree
Array
Linked List
Priority Queue✔

Minimum number of queues needed to implement the priority queue?

One.
Two. One queue is used for actual storing of data and another for storing priorities. ✔
Three.
Four.

What is the difference between the stack and queue data structures?

Stack requires recursive search technique; Queue does not.


Stack uses selection sort; Queue uses bubble sort.
Stack is LIFO; Queue is FIFO. ✔
Stack is FIFO; Queue is LIFO.

A(n) ______ is the data structure used more than any other data structure.

Binary Tree
Array✔
Linked List
B-tree
The most common solution to the Towers of Hanoi involves the use of which data
structure

Hash table
Set
Stack✔
Queue

BFS and DFS are two types of

Sorting algorithms
Searching algorithms✔
computational complexity measurements

Which is an ordered collection of elements in which insertions are restricted to the


rear end and deletions are restricted to the front end?

Stack
Binary tree
Queue✔
Array

What is the running time of finding Nth element in array using quick sort? (For
example: Find the 4th smallest element in an unsorted array.)

n!
2^n
n * log(n)✔
n^3
n^2

A stack must always be implemented using an array

False✔
True

Which of the following is NOT a basic function of a linked list?

Deletion of a leaf✔
Creation of a list
Insertion of a node
Deletion of a node
What is the data structure used to perform recursion?
Array
Binary Tree
B-tree
Stack✔

What is the time complexity to compute the average of a N×M matrix?

O(N^2)
It depends on how both N and M vary.
O(N*M)✔
O(N+M)

Which of the following problems has the fastest algorithms?

Find the 2nd largest value in an array


Find the 2nd smallest value in an array
Find the maximum value in an array.✔
Find the median value in an array

In tree there may be more than one path from root to leaf node

False✔
True

The path length from root to farthest leaf node is the ______ of the tree.

Set
Height
Size
Depth✔

What is the correct order for an in-order binary tree traversal?

Right Child - Parent - Left Child


Left Child - Parent - Right Child✔
Parent - Left Child - Right Child
Left Child - Right Child - Parent
Worst case insert for a dynamic array is

O(n^2)
O (1)
O (log n)
O(n)✔

Which is a way of organizing data that considers not only the items stored, but also
their relationship to each other?

Database table
Algorithm
Database
Data Structure✔

Which is the best possible complexity to sort an array?

O(NlogN)✔
O(N*N)
O(1)
O(logN)
O(N)

The path length from a node to the deepest leaf under it is the ---.

Size
Height✔
Depth
Set

What happens if you make a recursive call without making the problem smaller?

The operating system detects the infinite recursion because of the "repeated state"
The program keeps running until you press Ctrl-C
The results are non-deterministic
The run-time stack overflows, halting the program✔
The operation for adding an entry to a stack is traditionally called ________.

add
append
insert
push✔

Which of the following applications may use a stack?

A parentheses balancing program


Keeping track of local variables at run time
Syntax analyzer for a compiler
All of the above✔

What is the value of the post-fix expression 6 3 2 4 + - *?

Something between -15 and -100✔


Something between -5 and -15
Something between 5 and 15
Something between 15 and 100

The minimum number of interchanges needed to convert the array


89,19,14,40,17,12,10,2,5,7,11,6,9,70 into a heap with the maximum element at the
root is:

0
1
2✔
3

In which data structure do the insertion and deletion take place at the same end?

Linked list
Tree
Stack✔
Linked list of stacks
In which dynamically created linked list can the first node be recovered after moving
to the second node?

Simple linked list


Circular linked list
Doubly linked list
Both b and c✔

What is the pre-order traversal equivalent of the following algebraic expression?


[a+(b-c)]*[(d-e)/(f+g-h)]

abc-+de-fg+h-/*
*+a-bc/-de-+f-gh✔
a+*b-/c-d-e+fgh
*+a-bc-/d+e-fgh

What is the maximum number of statements that may be recursive calls in a single
function declaration?

1
2
n (n is the argument)
There is no fixed maximum✔

What is the worst-case scenario for heapsort to sort an array of n elements?

O(log n)
O(n)
O(n log n)✔
O(n2)

The recurrence relation T(n)=mT(n/2)+an2 is satisfied by___

T(n)=O(nm)
T(n)=O(m*log(m))
T(n)=O(n*log(m))✔
T(n)=O(m*log(n))
Consider a linked list of n elements which is pointed by an external pointer. What is
the time taken to delete the element which is a successor of the pointed element by
a given pointer?

O(1)✔
O(log2n)
O(n)
O(n*log2n)

The linked list implementation of sparse matrices is superior to the generalized dope
vector method because it is __________.

conceptually easier and completely dynamic


efficient if the sparse matrix is a band matrix
efficient in accessing an entry
all of these✔

One difference between a queue and a stack is:

Queues require dynamic memory but stacks do not


Stacks require dynamic memory but queues do not
Queues use two ends of the structure but stacks use only one✔
Stacks use two ends of the structure but queues use only one

Where does the push member function place the new entry on the linked list in the
linked list implementation of a queue?

At the head
At the tail✔
After all other entries that are greater than the new entry
After all other entries that are smaller than the new entry

Which term is used to describe an O(n) algorithm?

Constant
Linear✔
Logarithmic
Quadratic
Consider a linked list implementation of a queue with two pointers: front and rear.
The time needed to insert element in a queue of length n is:

O(1)✔
O(log2n)
O(n)
O(n*log2n)

You have implemented a queue with a circular array keeping track of the first, the
last, and the count (the number of items in the array). Suppose the first is zero, and
the last is CAPACITY-1, what can you say about the count?

The count must be zero


The count must be CAPACITY✔
The count can be zero or CAPACITY, but no other value can occur
None of the above

State whether True or False. For all possible inputs, a linear algorithm to solve a
problem must perform faster than a quadratic algorithm to solve the same problem.

True✔
False

If a max heap is implemented using a partially filled array called data, and the array
contains n elements (n > 0), where is the entry with the greatest value?

data[0]✔
data[n-1]
data[n]
data[2*n + 1]

Which of the following lines of the code will delete two successive nodes of a single
linked linear list(with more than two nodes)? Here 'LINK[X]' denotes the address field
of node X.

LINK[X]:=LINK[LINK[X]]
X:=LINK[LINK[X]]
LINK[LINK[X]]:=X
LINK[X]:=LINK[LINK[LINK[X]]]✔
Which operations require linear time for their worst-case behavior in the linked-list
version of a queue?

front
push
empty✔
None of these operations require linear time

Which of the operations is simpler in the doubly linked list than it is in the simple
linked list?

Insertion
Deletion
Both a and b✔
None of the above

Which of the following formulae in big-Oh notation best represents the expression
n2+35n+6?

O(n3)
O(n2)✔
O(n)
O(42)

The operation for removing an entry from a stack is traditionally called _______.

delete
peek
pop✔
remove

Which queue allows insertion and deletion at both ends?

Simple queue
Circular queue✔
Dequeue
Special queue
You have implemented a queue with a linked list keeping track of a front pointer
and a rear pointer. Which of these pointers will you change during an insertion into
a NONEMPTY queue?

Neither of them changes


Only front_ptr changes
Only rear_ptr changes✔
Both change

Which of the following operations is performed more efficiently by the doubly linked
list than by the linear linked list?

Deleting a node the location of which is given✔


Searching an unsorted list for a given item
Inserting a node after the node with a given location
Traversing the list to process each node

Four characters are placed in a queue in the following order: D, C, B, and A. If they
are removed one at a time, what will be the order of their removal?

ABCD
ABDC
DCAB
DCBA✔

What is the meaning of the statement: "Entries in a stack are 'ordered'"?

A collection of stacks can be sorted


Stack entries may be compared with the '<' operation
The entries must be stored in a linked list
There is a first entry, a second entry, and so on✔

Which of the following operations in the simple linked list will modify the beginning
of the linked list?

Deletion of the first node✔


Insertion after the last node
Insertion after the first node
None of the above
You have implemented a queue with a circular array keeping track of the first item,
the last item, and the count (the number of items in the array). Suppose the address
of the first is zero, and that of the last is CAPACITY-1, what can you say about the
count?

The count must be zero


The count must be CAPACITY✔
The count can be zero or CAPACITY, but no other value can occur
None of the above

What will happen if in data structure a pop operation on the stack causes the stack
pointer to move past the origin of the stack?

Overflow
Underflow✔
Null
Garbage collection

Which of these are standard operations of Stack Data Structure?

Push, delete
Insert, pop
Put, extract
Push, pop✔

Suppose we have a circular array implementation of a queue, with ten items in the
queue stored at data[2] through data[11]. The CAPACITY is 42. Where does the
enqueue member function place the new entry in the array?

data[1]
data[2]
data[11]
data[12]✔
You have implemented a queue with a linked list keeping track of a front pointer
and a rear pointer. Which of these pointers will you change during an insertion in
the middle of a NONEMPTY queue?

Neither of them changes


Only front_ptr changes
Only rear_ptr changes
Both change✔

What kind of list is the best to answer questions such as "Which is the item at
position n?"

Lists implemented with an array✔


Doubly-linked lists
Singly-linked lists
Doubly-linked or singly-linked lists are equally good

You might also like