wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DAA KCS 503 Tutorial Quiz

Total questions: 77

Worksheet time: 3hrs 0mins

Name
Class
Date
1.

Which sorting algorithm makes one swap per pass (possibly swapping an element with itself)?

a)

Selection Sort

b)

Bubble Sort

c)

Insertion Sort

2.

Which sorting algorithm may make multiple swaps per pass?

a)

Bubble Sort

b)

Selection Sort

c)

Insertion Sort

3.

Which sorting algorithm shifts elements instead of swapping elements if needed in each pass.

a)

Bubble Sort

b)

Selection Sort

c)

Insertion Sort

4.

How many passes will both the selection and insertion sorts make?

a)

N

b)

N-1

c)

N+1

d)

(N+1)/2

5.

The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list?
 
4    5    9    6    2    7

4    5    6    2    7    9 
4    5    2    6    7    9

a)

Bubble Sort

b)

Selection Sort

c)

Insertion Sort

6.

The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list?
 
4    8    6    2    5    7 
4    8    6    2    5    7 
4    6    8    2    5    7

a)

Bubble Sort

b)

Selection Sort

c)

Insertion Sort

7.

The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list?
 
4    8    3    9    2    6 
2    8    3    9    4    6
2    3    8    9    4    6

a)

Bubble Sort

b)

Selection Sort

c)

Insertion Sort

8.

We are sorting the following list in ascending order:
 
1    4    2    9    3    8    5
 
What does the list look like after one pass of the bubble sort algorithm. 

a)

1 2 4 3 8 5 9

b)

1 4 2 5 3 8 9

c)

4 2 9 3 8 5 1

9.

We are sorting the following list in descending order:
 
1    4    2    9    3    8    5
 
What does the list look like after one pass of the selection sort algorithm.

a)

1 4 2 9 3 8 5

b)

9 4 2 1 3 8 5

c)

4 2 9 3 8 5 1

10.

We are sorting the following list in ascending order:
 
1    4    2    9    3    8    5
 
What does the list look like after one pass of the insertion sort algorithm. 

a)

1 4 2 9 3 8 5

b)

4 2 9 3 8 5 1

c)

4 1 2 9 3 8 5

11.

Which of the following is not a stable sorting algorithm?

a)

a) Insertion sort

b)

b) Selection sort

c)

c) Bubble sort

d)

d) Merge sort

12.

Which of the following is a stable sorting algorithm?

a)

a) Merge sort

b)

b) Typical in-place quick sort

c)

c) Heap sort

d)

d) Selection sort

13.

Running merge sort on an array of size n which is already sorted is

a)

a) O(n)

b)

b) O(nlogn)

c)

c) O(n2)

d)

d) None

14.

Which of the following is not a non comparison sort?

a)

a) Counting sort

b)

b) Bucket sort

c)

c) Radix sort

d)

d) Shell sort

15.

The time complexity of heap sort in worst case is

a)

a) O(logn)

b)

b) O(n)

c)

c) O(nlogn)

d)

d) O(n2)

16.

If the given input array is sorted or nearly sorted, which of the following algorithm gives the best performance?

a)

a) Insertion sort

b)

b) Selection sort

c)

c) Quick sort

d)

d) Merge sort

17.

Which of the following algorithm pays the least attention to the ordering of the elements in the input list?

a)

a) Insertion sort

b)

b) Selection sort

c)

c) Quick sort

d)

d) None

18.

Time complexity of bubble sort in best case is

a)

a) θ (n)

b)

b) θ (nlogn)

c)

c) θ (n2)

d)

d) θ (n(logn) 2)

19.

Which of the following is not an in-place sorting algorithm?

a)

a) Selection sort

b)

b) Heap sort

c)

c) Quick sort

d)

d) Merge sort

20.

The data structure used for Depth First Algorithm is

a)

STACK

b)

QUEUE

c)

BOTH STACK & QUEUE

d)

NONE OF THESE

21.

In linear Search Algorithm basic operation is

a)

Element Comparison with key Element

b)

Increment operation

c)

Decrement Operation

d)

None of these

22.

Efficiency of an Algorithm is decided by the

a)

Number of times the basic operation is executed

b)

Time taken for executing the program

c)

Number of instructions in the program

d)

All of these

23.

Worst case efficiency of Binary Search is

a)

O(n)

b)

O(n log n)

c)

O(Log n)

d)

O(n2)

24.

Heap should satisfy

a)

Shape Property

b)

Parental Dominance Property

c)

Both Shape and Parental Dominance Property

d)

None of these

25.

Which of the following algorithm does not use greedy technique

a)

Prims Algorithm-

b)

Kruskals Algorithm

c)

Dijkstras Algorithm

d)

Floyds Algorithm

26.

A greedy algorithm can be used to solve all the dynamic programming problems.

a)

True

b)

False

27.

Read the following statements carefully, and choose the correct answer:

I. For the Backtracking algorithms stack data structure is used.

II. For the Branch-and-bound algorithms queue data structure is used.

a)

(I) is FALSE but (II) is TRUE

b)

(I) and (II) both are FALSE

c)

(I) is TRUE but (II) is FALSE

d)

(I) and (II) both are TRUE

e)

(II) is TRUE and (I) can’t be defined.

28.

"Both LIFO branch and bound strategy and backtracking leads to depth first search.-"The statement is true/false?

(a)  

29.

The algorithm is part of the blueprint or plan for the ________

a)

Computer Program

b)

Program

c)

Algorithm

d)

FLowchart

30.

The algorithm should terminate after the ________ number of steps.

a)

Infinite

b)

Finite

c)

Both a and b

31.

The instructions which are used in algorithm should be clear and ______

a)

Ambigious

b)

Unambiguous

c)

Both a and b

d)

None

32.

______ is the key features of algorithm

a)

Decision

b)

Sequence

c)

Both and b

d)

None

33.

Repitition is also known as

a)

Iteration or looping

b)

Condition

c)

Unconditional

d)

None

34.

Identify the processes is the strategy for designing _______

a)

Flowchart

b)

Program

c)

Algorithm

d)

None

35.

____________ is the process of executing programs on sample data sets to determine if faulty results occur

a)

Profiling

b)

Debugging

c)

Searching

d)

None

36.

What are the strategy for designing algorithm is

a)

Investigation step

b)

Preliminary step

c)

Refining step

d)

None

37.

Each and every instruction should simple and very basic

a)

Effectiveness

b)

Definiteness

c)

Finiteness

d)

Infiniteness

38.

........................... , ........................ and ...........................are the different ways in which an algorithm can be specified.

a)

Asymptotic Notations, Flowchart, Pseudocode

b)

English like statements, Flowchart, Pseudocode

c)

English like statements,Sets, Pseudsocode

d)

None of the above

39.

Algorithm can be represented graphically using...........................

a)

barchart

b)

Graph

c)

Pie chart

d)

Flowchart

40.

...............................is defined as step by step procedure for solving a particular problem

a)

Space complexity

b)

Time complexity

c)

Performance Analysis

d)

Algorithm

41.

An Algorithm's performance an be analysed by using............................

a)

Time complexity

b)

Space Complexity

c)

Number of inputs

d)

Time and space complexity

42.

..............................is defined as the amount of Computer time required to complete the execution of a program/problem

a)

Space Complexity

b)

Time complexity

c)

CPU Time

d)

None of these

43.

Upper bound running time complexity of an algorithm is also called as.....................

a)

Best case time complexity

b)

Worst case time complexity

c)

Average case time complexity

d)

None of these

44.

.......................is the amount of computer memory required to the execute the program /problem.

a)

Time complexity

b)

Space complexty

c)

Memory complexity

d)

None of these

45.

Lower bound running time complexity of an algorithm is also called as.................

a)

Best case time complexty

b)

Worst case time complexity

c)

Average case time complexity

d)

None of these

46.

............................Notation is used to represent strict upper bound running time complexity of an algotihm

a)

Big-oh

b)

Big-Omega

c)

Theta

d)

None of these

47.

............................Notation is used to represent strict lower bound running time complexity of an algorithm.

a)

Big-Oh

b)

Big-Omega

c)

Theta

d)

None of these

48.

.................................notation denotes Average case Time complexity

a)

Big-Oh

b)

Big Omega

c)

Theta

d)

None of these

49.

........................................Notations are called as Asymptotic Notations.

a)

Big-oh

b)

Big-Omega

c)

little-Theta

d)

little-oh

e)

theta

50.

......................is used to represent strict upper bound running time complexity where as.................is used to represent upper bound running time complexity of an algorithm.

a)

Big-oh,little-oh

b)

little-oh,Big-oh

c)

Big-oh,small-oh

d)

small-oh,Big-oh

51.

......................is used to represent strict lower bound running time complexity where as.................is used to represent lower bound running time complexity of an algorithm.

a)

Big-Omega,small-omega

b)

Big-Omega,little-omega

c)

lttle-omega,Big-omega

d)

small-omega,Big-Omega

52.

Let f(n) and g(n) be two non-negative functions,f(n)=O(g(n)) if and only if..........................

a)

f(n)<=c*g(n)

b)

f(n)>=c*g(n)

c)

f(n)<c*g(n)

d)

f(n)<c*g(n)

53.

Let f(n) and g(n) be two non-negative functions,f(n)= ω\omega  (g(n)) if and only if..........................


a)

f(n)<=c*g(n)

b)

f(n)>=c*g(n)

c)

f(n)<c*g(n)

d)

f(n)<c*g(n)

54.

Let f(n) and g(n) be two non-negative functions,f(n)=  θ\theta  (g(n)) if and only if..........................

a)

c1*g(n)<=f(n)<=c2*g(n)

b)

c1*g(n)>=f(n)>=c2*g(n)

c)

c1*g(n)<f(n)<c2*g(n)

d)

c1*g(n)>f(n)>c2*g(n)

55.

...................................are the characteristics of an algorithm

a)

Input

b)

infiniteness

c)

Effectiveness

d)

output

e)

finiteness

56.

Find the time complexity for the following algorithm using step count method.

Algorithm sum(a,n)

{

nsum=0;

for(i=1;i<=n;i++)

{

nsum=nsum+a[i];

}

}

a)

2n+2 units

b)

2n+1 units

c)

n+1 units

d)

n+2 units

57.

Find the space complexity for the following algorithm

Algorithm sum(a,b,c)

{

a=10;

b=20;

c=30;

d=a+b+c;

}

a)

3 units

b)

4 units

c)

5 units

d)

6 units

58.

What does the following piece of code do?

for (int i = 0; i < arr.length-1; i++) {

for (int j = i+1; j < arr.length; j++) {

if( (arr[i].equals(arr[j])) && (i != j) ) {

System.out.println(arr[i]);

}

}

}

a)

Print the duplicate elements in the array

b)

Print the element with maximum frequency

c)

Print the unique elements in the array

d)

Prints the element with minimum frequnecy

59.
Which of the following is a disadvantage of linear search?
a)
Requires more space
b)
Greater time complexities compared to other searching algorithms
c)
Not easy to understand
d)
Not easy to implement
60.
For the following question, how will the array elements look like after second pass? 34, 8, 64, 51, 32, 21
a)
8, 21, 32, 34, 51, 64
b)
8, 32, 34, 51, 64, 21
c)
8, 34, 51, 64, 32, 21
d)
8, 34, 64, 51, 32, 21
61.
Choose the incorrect statement about merge sort from the following?
a)
it is a comparison based sort
b)
it is an adaptive algorithm
c)
it is not an in place algorithm
d)
it is stable algorithm
62.
Which is the safest method to choose a pivot element in quick sort?
a)
choosing a random element as pivot
b)
choosing the first element as pivot
c)
choosing the last element as pivot
d)
median-of-three partitioning method
63.
The given array is arr = {2,3,4,1,6}. What are the pivots that are returned as a result of subsequent partitioning?
a)
1 and 3
b)
3 and 1
c)
2 and 6
d)
6 and 2
64.
Apply Quick sort on a given sequence 7 11 14 6 9 4 3 12. What is the sequence after first phase, pivot is first element?
a)
6 4 3 7 11 9 14 12
b)
6 3 4 7 9 14 11 12
c)
7 6 14 11 9 4 3 12
d)
7 6 4 3 9 14 11 12
65.
Depth First Search is equivalent to which of the traversal in the Binary Trees?
a)
Pre-order Traversal
b)
Post-order Traversal
c)
Level-order Traversal
d)
In-order Traversal
66.
In BFS, how many times a node is visited?
a)
Once
b)
Twice
c)
Equivalent to number of indegree of the node
d)
Thrice
67.
Consider the following graph. Using Kruskal’s algorithm, which edge will be selected first?
a)
GF
b)
DE
c)
BE
d)
BG
68.
Consider the given graph.What is the weight of the minimum spanning tree using the Prim’s algorithm,starting from vertex a?
a)
23
b)
28
c)
27
d)
11
69.
How many edges will a tree consisting of N nodes have?
a)
Log(N)
b)
N
c)
N-1
d)
N+1
70.

A and B can complete a work in 6 days.A can alone do it in 10 days.Then B can alone do the work in how many days?

a)

13.75 days

b)

14 days

c)

15 days

d)

16 days

71.

If two dice are thrown together,then the probability of getting an even number on one die and an odd number on other die is

a)

1/4

b)

1/2

c)

3/4

d)

3/5

72.

Pointing to a girl in a photograph,Arun said "Her mother's brother is the only son of my mother's father".How is the girl's mother related to Arun?

a)

Mother

b)

Sister

c)

Aunt

d)

Grandma

73.

A man walked 2 km west of his house and then he turned south covering 4 km.Finally,he moved 3 km towards east and then he again 1 km west.How far is he from his initial position?

a)

10 km

b)

9 km

c)

2 km

d)

4 km

74.

Find the odd man out

a)

carrot

b)

cucumber

c)

onion

d)

beetroot

75.

Fill the series 17,32,19,29,21,26,23,__,__

a)

25,25

b)

20,22

c)

23,25

d)

25,22

76.

How is my father's mother's only daughter in law's sister related to me?

a)

Aunt

b)

sister

c)

cousin

d)

mother

77.

Eleven friends M, N, O, P, Q, R, S, T, U, V and W are sitting in the first row of the stadium watching a cricket match.

T is to the immediate left of P and third to the right of U. V is the immediate neighbour of M and N and third to the left of S. M is the second to the right of Q, who is at one of the ends. R is sitting next to the right of P and P is second to the right of O. Who is sitting in the center of the row?

a)

U

b)

V

c)

Q

d)

W