Algorithms Solved MCQs


The search technique for searching a sorted file that requires increased amount of space is

Indexed sequential search
Interpolation search
Sequential search
Tree search
      _____________________________________________________________________________________
A graph in which all nodes are of equal degree is called

Multi graph
Non regular graph
Regular graph
Complete graph
      _____________________________________________________________________________________
The sorting technique where array to be sorted is partitioned again and again in such a way that all elements less than or equal to partitioning element appear before it and those which are greater appear after it, is called

Merge sort
Quick sort
Selection sort
None of these
      _____________________________________________________________________________________
A binary tree with 27 nodes has _______ null branches.

54
27
26
None of the above
      _____________________________________________________________________________________
The postfix form of A*B+C/D is

*AB/CD+
AB*CD/+
A*BC+/D
ABCD+/*
      _____________________________________________________________________________________
A desirable choice for the partitioning element in quick sort is

First element of the list
Last element of the list
Randomly chosen element of the list
Median of the list
      _____________________________________________________________________________________
A search technique where we keep expanding nodes with least accumulated cost so far is called

Hill climbing
Branch and bound
Best first
Divide and conquer
      _____________________________________________________________________________________
Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer?

O (1)
 O (n)
O (log2 n)
O (n log2 n)
      _____________________________________________________________________________________
The goal of hashing is to produce a search that takes

O(1) time
O(n2 ) time
O(log n ) time
O(n log n ) time
      _____________________________________________________________________________________
A BST is traversed in the following order recursively: Right, root, left.The output sequence will be in

Ascending order
Descending order
Bitomic sequence
No specific order
      _____________________________________________________________________________________
The in order traversal of tree will yield a sorted listing of elements of tree in

Binary trees
Binary search trees
Heaps
None of above
      _____________________________________________________________________________________
The upper bound of computing time of m coloring decision problem is

O(nm)
O(nm)
O(nmn)
O(nmmn)
      _____________________________________________________________________________________
One can make an exact replica of a Binary Search Tree by traversing it in

Inorder
Preorder
Postorder
Any order
      _____________________________________________________________________________________
The minimum number of multiplications and additions required to evaluate the polynomial P = 4x3+3x2-15x+45 is

6 & 3
4 & 2
3 & 3
8 & 3
      _____________________________________________________________________________________
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 is not there at all
      _____________________________________________________________________________________
Two isomorphic graphs must have

Equal number of vertices
Same number of edges
Same number of vertices
All of the above
      _____________________________________________________________________________________
The quick sort algorithm exploit _________ design technique

Greedy
Dynamic programming
Divide and Conquer
Backtracking
      _____________________________________________________________________________________
If h is any hashing function and is used to hash n keys in to a table of size m, where n<=m, the expected number of collisions involving a particular key x is

less than 1
less than n
less than m
less than n/2
      _____________________________________________________________________________________
A sort which uses binary tree concept such that any number is larger than all the numbers in the subtree below it,is called

Selection sort
Insertion sort
Heap sort
Quick sort
      _____________________________________________________________________________________
Graphs are represented using

Adjacency tree
Adjacency linked list
Adjacency graph
Adjacency queue
      _____________________________________________________________________________________
The operation of processing each element in the list is known as

Sorting
Merging
Inserting
Traversal
      _____________________________________________________________________________________
The best average behaviour is shown by

Quick Sort
Merge Sort
Insertion Sort
Heap Sort
      _____________________________________________________________________________________
If every node u in G is adjacent to every other node v in G, A graph is said to be

Isolated
Complete
Finite
Strongly Connected
      _____________________________________________________________________________________
A binary tree can easily be converted into q 2-tree

by replacing each empty sub tree by a new internal node
by inserting an internal nodes for non-empty node
by inserting an external nodes for non-empty node
by replacing each empty sub tree by a new external node
      _____________________________________________________________________________________
An algorithm is made up of two independent time complexities f (n) and g (n). Then the complexities of the algorithm is in the order of

f(n) x g(n)
Max ( f(n),g(n))
Min (f(n),g(n))
f(n) + g(n)
      _____________________________________________________________________________________
The time complexity to build a heap of n elements is

0(1)
0(lgn)
0(n)
0(nlgn)
      _____________________________________________________________________________________
Breadth first traversal is a method to traverse

All successors of a visited node before any successors of any of those successors
A single path of the graph as far it can go
Graph using shortest path
None of these
      _____________________________________________________________________________________
Leaves of which of the following trees are at the same level ?

Binary tree
B-tree
AVL-tree
Expression tree
      _____________________________________________________________________________________
The post order traversal of a binary tree is DEBFCA. Find out the preorder traversal.

ABFCDE
ADBFEC
ABDECF
ABDCEF
      _____________________________________________________________________________________
Quick sort is also known as

Merge sort
Heap sort
Bubble sort
None of these
      _____________________________________________________________________________________
A graph in which all nodes are of equal degrees is known as

Complete graph
Regular graph
Non regular graph
Multi graph
      _____________________________________________________________________________________
Preorder is nothing but

Depth first order
Breadth first order
Topological order
Linear order
      _____________________________________________________________________________________
The number of distinct simple graphs with up to three nodes are

15
10
7
9
      _____________________________________________________________________________________
The space factor when determining the efficiency of algorithm is measured by

Counting the maximum memory needed by the algorithm
Counting the minimum memory needed by the algorithm
Counting the average memory needed by the algorithm
Counting the maximum disk space needed by the algorithm
      _____________________________________________________________________________________
Let A be an adjacency matrix of a graph G. The th ij entry in the matrix K A , gives

The number of paths of length K from vertex Vi to vertex Vj.
Shortest path of K edges from vertex Vi to vertex Vj.
Length of a Eulerian path from vertex Vi to vertex Vj.
Length of a Hamiltonian cycle from vertex Vi to vertex Vj.
      _____________________________________________________________________________________
An advantage of chained hash table over the open addressing scheme is

Worst case complexity of search is less
Space used is less
Deletion is easier
None of the above
      _____________________________________________________________________________________
Number of vertices of odd degree in a simple graph is

Always even
Always odd
Either even or odd
Always zero
      _____________________________________________________________________________________
Consider the following pseudo-code :
If (A > B) and (C > D) then
A = A + 1
B = B + 1
Endif
The cyclomatic complexity of the pseudo-code is


2
3
4
5
      _____________________________________________________________________________________
A simple graph in which there exists an edge between pair of vertices is called

Regular graph
Planner graph
Euler graph
Complete graph
      _____________________________________________________________________________________
What is the postfix form of the following prefix expression -A/B*C$DE

ABCDE$*/-
A-BCDE$*/-
ABC$ED*/-
A-BCDE$*/
      _____________________________________________________________________________________
A given connected graph G is a Euler graph , if and only if all vertices of G are of

Same degree
Even degree
Odd degree
Different degree
      _____________________________________________________________________________________
The time factor when determining the efficiency of algorithm is measured by

Counting microseconds
Counting the number of key operations
Counting the number of statements
Counting the kilobytes of algorithm
      _____________________________________________________________________________________
Hashing collision resolution techniques are

Huffman coding, linear hashing
Bucket addressing, Huffman coding
Chaining, Huffman coding
Chaining, Bucket addressing
      _____________________________________________________________________________________
The number of vertices of odd degree in a graph is

Always zero
Either even or odd
Always odd
Always even
      _____________________________________________________________________________________
A sort which relatively passes through a list to exchange the first element with any element less than it and then repeats with a new first element is called

Insertion sort
Selection sort
Heap sort
Quick sort
      _____________________________________________________________________________________
One can convert a binary tree into its mirror image by traversing it in

Inorder
Preorder
Postorder
Any order
      _____________________________________________________________________________________
Every cut set of a connected euler graph

No such characterization
Atleast three edges
An even number of edges
An odd number of edges
      _____________________________________________________________________________________
Previous Post Next Post