0% found this document useful (0 votes)
31 views12 pages

Sample Viva Questions and Answers

The document provides a series of sample viva questions and answers related to algorithms and their complexities in computing. Key topics include definitions of algorithms, time complexity, examples of different complexity classes, and comparisons of sorting algorithms such as Quick Sort and Bubble Sort. It also discusses factors affecting sorting efficiency and the importance of Big O notation in algorithm analysis.

Uploaded by

Renuka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views12 pages

Sample Viva Questions and Answers

The document provides a series of sample viva questions and answers related to algorithms and their complexities in computing. Key topics include definitions of algorithms, time complexity, examples of different complexity classes, and comparisons of sorting algorithms such as Quick Sort and Bubble Sort. It also discusses factors affecting sorting efficiency and the importance of Big O notation in algorithm analysis.

Uploaded by

Renuka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Sample Viva Questions and Answers

1) Explain what is an algorithm in computing?


An algorithm is a well-defined computational procedure that take some value as input
and generate
some value as output. In simple words, it’s a sequence of computational steps that converts input
into the output.
2) Explain what is time complexity of Algorithm?
Time complexity of an algorithm indicates the total time needed by the program to run tocompletion. It is usually
expressed by using the
big O notation.

3) The main measure for efficiency algorithm are-Time and space


4.
The time complexity of following code:int a = 0;for (i = 0; i < N; i++) {for (j = N; j > i; j--) {a =
a + i + j;}
}Ans O(n*n)
5) What does the algorithmic analysis count?
6) The number of arithmetic and the operations that are required to run the program

7) Examples of O(1) algorithms are______________AMultiplying two numbers.B assigning


some value to a variableC displaying some integer on console

8) Examples of O(n2) algorithms are______________.AAdding of two MatricesB Initializing all


elements of matrix by zero

9) The complexity of three algorithms is given as: O(n), O(n2) and O(n3). Which shouldexecute
slowest for large value of n?All will execute in same time.
10) In quick sort, the number of partitions into which the file of size n is divided by a
selectedrecord is 2.

The three factors contributing to the sort efficiency considerations are the efficiency incoding,
machine run time and the space requirement for running the procedure.
11) How many passes are required to sort a file of size n by bubble sort method?

N-112) How many number of comparisons are required in insertion sort to sort a file if the fileis
sorted in reverse order?

A. N2

13) How many number of comparisons are required in insertion sort to sort a file if the
fileis already sorted? N-1

14) In quick sort, the number of partitions into which the file of size n is divided by a
selectedrecord is 2
15) The worst-case time complexity of Quick Sort is________.O(n2)
16)The worst-case time complexity of Bubble Sort is________.O(n2)
17) The worst-case time complexity of Merge Sort is________.O(n log n)
18)The algorithm like Quick sort does not require extra memory for carrying out the
sortingprocedure. This technique is called __________.in-place
19)Which of the following sorting procedures is the slowest?A. Quick sort

B. Heap sortC. Shell sortD. Bubble sort


20) The time factor when determining the efficiency of algorithm is measured by Countingthe
number of key operations

21)The concept of order Big O is important because

A. It can be used to decide the best algorithm that solves a given problem

22) The running time of insertion sort is


A.O(n^2)

23) A sort which compares adjacent elements in a list and switches where necessary is ____.A.

insertion sort
24) The correct order of the efficiency of the following sorting algorithms according to
theiroverall running time comparison isbubble>selection>insertion

25) The total number of comparisons made in quick sort for sorting a file of size n, isA. O(n log
n)

26)Quick sort efficiency can be improved by adoptingA. non-recursive method

27)For the improvement of efficiency of quick sort the pivot can be ______________.
“the mean element”

You might also like