wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Technical Assessment

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

What sorting algorithm is this?

a)

Bubble Sort

b)

Insertion Sort

c)

Selection Sort

d)

None of the above

2.
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
3.

Predict the output of following program?

#include <stdio.h>

//Assume base address of “TechnoBoom” to be 1000

int main()

{

printf(6+ “TechnoBoom”);

return 0;

}

a)

TechnoBoom

b)

1006

c)

Boom

d)

Compile-time error

4.

Predict the output of the following code

//filename Test.java

class Test{

public static void main(String[] args){

for(int i=0;1;i++){

System.out.print("TechnoBoom");

break;

}

}

}

a)

TechnoBoom

b)

Compile time error

c)

T

d)

None of these

5.
Which type of sort algorithm is this?
a)
Bubble
b)
Merge
c)
Insertion
6.

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)

7.

What sorting algorithm is this?

a)

Merge Sort

b)

Heap Sort

c)

Quicksort

d)

Bubble Sort

8.

What sorting algorithm is this?

a)

Insertion Sort

b)

Selection Sort

c)

Quicksort

d)

Bubble Sort

9.

Which sorting algorithm is this?

a)

Quicksort

b)

Divide Sort

c)

Merge Sort

d)

Match Sort

10.
What is the maximum number of comparisons if there are 5 elements to sort?
a)
10
b)
2
c)
5
d)
20
11.

Choose a CORRECT statement about pivot in quick sort method.

a)

A pivot divides the list evenly.

b)

A pivot can be chosen randomly.

c)

A pivot is chosen by using a fixed formula

d)

A pivot makes the searching method becomes slow

12.

Which of the following is NOT a stable sorting algorithm in its typical implementation.

a)

Insertion sort

b)

Bubble sort

c)

Merge sort

d)

Quick sort

13.

Use the following file to predict the output of the code.

'test.txt' content:

aaa

bbb

ccc

ddd

eee

fff

ggg

CODE:

f=open("test.txt","r")

print(f.readline(3))

f.close()

a)

bbb

b)

Syntax Error

c)

aaa

d)

eee

14.

What is the best time complexity of Bubble Sort?

a)

N2

b)

N*log(N)

c)

N

d)

N*(logN)2

15.

What is the time complexity of the following code?

int count(int n)

{

int i, j, k=0;

for( i=n/2 ; i<=n ; i++){

for( j=2 ; j<=n ; j=j*2){

k=k + n/2;

}

}

a)

O(n)

b)

O(n2)

c)

O(n*logn)

d)

O(n*logn*logn)

16.

What would be the Asymptotic Time Complexity?

a)

O(n)

b)

O(N*log(N))

c)

O(N*N)

d)

O(N*Sqrt(N))

17.

What are the two main measures for the efficiency of an algorithm?

a)

Data and Space

b)

Complexity and Capacity

c)

Processor and Memory

d)

Time and Space

18.

Quick Sort Algorithm is an example of

a)

Dynamic programming

b)

Divide and conquer

c)

Greedy approach

d)

Improved Binary Search

19.

Time required to merge two sorted lists of size m and n, is

a)

O(m/n)

b)

O(m*logn)

c)

O(m+n)

d)

O(n*logm)

20.

What is the output

public class MySelectionSort{

public static int[] doSelectionSort(int[] arr){

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

{

int index=i;

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

if(arr[j] < arr[index])

index=j;

int smallNumber = arr[index];

arr[index] = arr[i];

arr[i] = smallNumber;

}

return arr;

}

public static void main(String a[]){

int[] arr1={10, 34, 2, 56 , 7, 67, 88, 42};

int[] arr2=doSelectionSort(arr1);

for(int i:arr2){

System.out.print(i);

System.out.print(", ");

}

}

}

a)

2, 7, 10, 34, 42, 56, 67, 88

b)

88, 67, 56, 42, 34, 10, 7, 2

c)

34, 56, 67, 88, 2, 7, 42, 10

d)

2, 7, 10, 34, 42, 56, 67, 88,