NEW
Font size
WorksheetsQuantitative Aptitude Series
Total questions: 20
Worksheet time: 20mins
Which of the following is not a valid declaration in C?
1.short int x;
2.signed short x;
3.short x;
4.unsigned short x;
3 and 4
1
2
All are valid
void swap ( int x, int y )
{
int tmp;
tmp = x;
x = y;
y = tmp;
}
Ques: In order to exchange the values of two variables a and b:
Call swap (a, b)
Call swap (&a, &b)
swap(a, b) cannot be used as it does not return any value
swap(a, b) cannot be used as the parameters passed by value
What will be the output of the following code?
#include
int main()
{
int any = ' ' * 10;
printf("%d", any);
return 0;
}
340
320
300
360
Predict the output of the following pseudo-code?
int main()
{
float i;
i = 1;
printf("%d",i);
return 0;
}
1.000000
1
Error
Garbage Value
Predict the Output for the following code?
int main()
{
typedef int num;
num bunk = 0.00;
printf("%d", bunk);
return 0;
}
0.0
0
logical Error
None
What is the time complexity for the following code
sum =0
for(i=1;i<=n;i*=2)
for(j=1;j<=n;j++)
sum++;
O(n^2)
O(nlogn)
O(n)
O(n(logn(logn)))
Consider the following functions from positive integers t real numbers
10 , √n , n , log₂(n) ,100/n;
The CORRECT arrangement of the above functions in increasing order of asymptotic complexity is:
log₂(n),100/n,10,√n,n
100/n,10,log₂(n), √n,n
10,100/n,√n,log₂(n),n
l00/n,log₂(n),10,√n,n
.Which of the following sorting algorithms provide the best time complexity in the worst-case scenario?
Merge Sort
Quick Sort
Bubble Sort
Selection Sort
In the linked list implementation of queue, where will the new element be inserted?
At the middle position of the linked list
At the head position of the linked list
At the tail position of the linked list
None of the above
In the Deque implementation using singly linked list, what would be the time complexity of deleting an element from the rear end?
O(1)
O(n2)
O(n)
O(nlogn)
In a circular queue implementation using array of size 5, the array index starts with 0 where front and rear values are 3 and 4 respectively.
Determine the array index at which the insertion of the next element will take place.
5
0
1
2
What would be the output after performing the following operations in a Deque?
Insertfront(10);
Insertfront(20);
Insertrear(30);
Insertrear(40);
Deletefront();
Insertfront(50);
Deleterear();
Display();
10, 20, 30
50, 10, 30
40, 20, 30
None of the above
Time complexity of merge sort is
O(logn)
O(nlogn)
O(n)
O(n^2)
Time complexity of insertion sort algorithm in best case is
O(logn)
O(nlogn)
O(n)
O(n^2)
What is the time complexity for the following code
for (int i = 2; i * i <= N; i++) {
if (N % i == 0) {
isPrime = false;
}
}
O(n^2)
O(nlogn)
O(√n)
O(n)
The number of edges from the root to the node is called _______ of the tree.
Height
Depth
Length
Width
What is the average case time complexity for finding the height of the binary tree ?
O(log log n)
O(n log n)
O(n)
O(log n)
A binary tree in which all the leaves are on the same level is called as :
Complete binary tree
Strictly binary tree
Binary Search tree
Full Binary tree
Which one of the following is an application of Stack Data Structure?
Managing function calls
The stock span problem
Arithmetic expression evaluation
All of the above
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
Insertion Sort
Quick Sort
Heap Sort
Merge Sort
