InfyTQ Algorithms Quiz 1

Question 1

Time: 00:00:00
 In ordered linear search what are the best case and worst case complexity?

O(nlogn), O(logn)

O(nlogn), O(logn)

O(logn), O(nlogn)

O(logn), O(nlogn)

O(n), O(1)

O(n), O(1)

O(1), O(n)

O(1), O(n)

Question 2

Time: 00:00:00
From the given statements which one is a disadvantage of linear search?

Requires more space

Requires more space

Greater time complexities compared to other searching algorithms

Greater time complexities compared to other searching algorithms

Not easy to understand

Not easy to understand

Not easy to implement

Not easy to implement

Question 3

Time: 00:00:00
 Speed difference execution of linear search(recursive) vs linear search(iterative)?

Both execute at the same speed

Both execute at the same speed

Linear search(recursive) is faster

Linear search(recursive) is faster

Linear search(Iterative) is faster

Linear search(Iterative) is faster

Can't be said

Can't be said

Question 4

Time: 00:00:00
From the given following statements which one is not the application of binary search?

To find the lower/upper bound in an ordered sequence

To find the lower/upper bound in an ordered sequence

Union of intervals

Union of intervals

Debugging

Debugging

To search in an unordered list

To search in an unordered list

Question 5

Time: 00:00:00
In bubble sort and selection sort the number of iterations in the given array is arr = {3,4,5,2,1} will be:

5 and 4

5 and 4

4 and 5

4 and 5

2 and 4

2 and 4

2 and 5

2 and 5

Question 6

Time: 00:00:00
External sorting algorithm?

The algorithm that uses tape or disk during the sort

The algorithm that uses tape or disk during the sort

The algorithm that uses main memory during the sort

The algorithm that uses main memory during the sort

The algorithm that involves swapping

The algorithm that involves swapping

The algorithm that is considered ‘in place’

The algorithm that is considered ‘in place’

Question 7

Time: 00:00:00
Find the suitable modulo value for the given pattern of the length-5 window.

Pattern is : 4 3 2 5 0

13

13

14

14

12

12

11

11

Question 8

Time: 00:00:00
True regarding Euclid’s algorithm is that it calculates

GCD of two numbers

GCD of two numbers

GCD of more than three numbers

GCD of more than three numbers

LCM of two numbers

LCM of two numbers

LCM of more than two numbers

LCM of more than two numbers

Question 9

Time: 00:00:00
Choose the correct recurrence relation used in Strassen’s algorithm is:

 7T(n/2) + Theta(n^2)

 7T(n/2) + Theta(n^2)

8T(n/2) + Theta(n^2)

8T(n/2) + Theta(n^2)

7T(n/2) + O(n^2)

7T(n/2) + O(n^2)

8T(n/2) + O(n^2)

8T(n/2) + O(n^2)

Question 10

Time: 00:00:00
correct formula to generate random numbers between range(lower, upper) using rand() function:

rand() % (upper – lower)

rand() % (upper – lower)

rand() + lower

rand() + lower

(rand()%(upper-lower)) + lower

(rand()%(upper-lower)) + lower

(rand()%(upper-lower+1)) + lower

(rand()%(upper-lower+1)) + lower

null
null