NEW
Font size
WorksheetsTechnical Assessment
Total questions: 20
Worksheet time: 20mins
What sorting algorithm is this?
Bubble Sort
Insertion Sort
Selection Sort
None of the above
4 8 3 9 2 6
2 8 3 9 4 6
2 3 8 9 4 6
Predict the output of following program?
#include <stdio.h>
//Assume base address of “TechnoBoom” to be 1000
int main()
{
printf(6+ “TechnoBoom”);
return 0;
}
TechnoBoom
1006
Boom
Compile-time error
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;
}
}
}
TechnoBoom
Compile time error
T
None of these
The time complexity of heap sort in worst case is
a) O(logn)
b) O(n)
c) O(nlogn)
d) O(n2)
What sorting algorithm is this?
Merge Sort
Heap Sort
Quicksort
Bubble Sort
What sorting algorithm is this?
Insertion Sort
Selection Sort
Quicksort
Bubble Sort
Which sorting algorithm is this?
Quicksort
Divide Sort
Merge Sort
Match Sort
Choose a CORRECT statement about pivot in quick sort method.
A pivot divides the list evenly.
A pivot can be chosen randomly.
A pivot is chosen by using a fixed formula
A pivot makes the searching method becomes slow
Which of the following is NOT a stable sorting algorithm in its typical implementation.
Insertion sort
Bubble sort
Merge sort
Quick sort
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()
bbb
Syntax Error
aaa
eee
What is the best time complexity of Bubble Sort?
N2
N*log(N)
N
N*(logN)2
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;
}
}
O(n)
O(n2)
O(n*logn)
O(n*logn*logn)
What would be the Asymptotic Time Complexity?
O(n)
O(N*log(N))
O(N*N)
O(N*Sqrt(N))
What are the two main measures for the efficiency of an algorithm?
Data and Space
Complexity and Capacity
Processor and Memory
Time and Space
Quick Sort Algorithm is an example of
Dynamic programming
Divide and conquer
Greedy approach
Improved Binary Search
Time required to merge two sorted lists of size m and n, is
O(m/n)
O(m*logn)
O(m+n)
O(n*logm)
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(", ");
}
}
}
2, 7, 10, 34, 42, 56, 67, 88
88, 67, 56, 42, 34, 10, 7, 2
34, 56, 67, 88, 2, 7, 42, 10
2, 7, 10, 34, 42, 56, 67, 88,
