NEW
Font size
S
M
L
XL
Worksheetscoding skills (ISCP 02) Tuesday slot1 (9am - 11:00am) CSE A & C
Total questions: 20
Worksheet time: 20mins
Name
Class
Date
1.
The postfix form of A*B+C/D is?
a)
*AB/CD+
b)
AB*CD/+
c)
A*BC+/D
d)
ABCD+/*
2.
How many variables are required to implement queue using arrays?
a)
1
b)
2
c)
3
d)
4
3.
Which of the data structure follows FIFO principle?
a)
Stack
b)
Queue
c)
Linked list
d)
Tree
4.
If REAR, FRONT are the queue variables, then identify correct statement while deleting a value
a)
FRONT=FRONT+1
b)
REAR=REAR+1
c)
REAR=REAR-1
d)
FRONT=FRONT-1
5.
If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, in what order will they be removed?
a)
ABCD
b)
DCBA
c)
DCAB
d)
ABDC
6.
Complexity of linear search if the element to be searched is at index 0 in the array
a)
O(n)
b)
O(n*n)
c)
O(1)
d)
O(nlogn)
7.
In the following Code Snippet, if you apply this linear search code to an array of 15 elements and the target is found at the 5th position, what value will be returned?
int linearSearch(int arr[], int n, int target) {
for (int i = 0; i < n; i++) {
if (arr[i] == target)
return i;
}
return -1;
}
a)
0
b)
1
c)
4
d)
5
8.
If elements are inserted in the order 10,20,30,40 then which element is deleted first?
a)
10
b)
20
c)
30
d)
40
9.
int binarySearch(int arr[], int n, int target) {
int left = 0;
int right = n - 1;
int iterations = 0;
while (left <= right) {
int mid = left + (right - left) / 2;
iterations++;
if (arr[mid] == target)
return iterations;
else if (arr[mid] < target)
left = mid;
else
right = mid;
}
return -1;
}
In Code Snippet, if you apply this binary search code to a sorted array with 16 elements and the target is found, how many iterations will be made?
a)
4
b)
5
c)
3
d)
2
10.
What is the best case complexity of quick sort?
a)
O(nlogn)
b)
O(n**2)
c)
O(n)
d)
O(n**3)
11.
The complexity of selection sort algorithm is …..
a)
O(n**2)
b)
O(nlogn)
c)
O(n)
d)
O(logn)
12.
Is normal quick sort algorithm stable sorting algorithm?
a)
no
b)
yes
c)
can't say
d)
all of the above
13.
………… is the method used by card sorter.
a)
Radix sort
b)
Insertion
c)
Heap
d)
Quick
14.
The process of deleting an element from a stack is called?
a)
pop operation
b)
push operation
c)
underflow operation
d)
enqueue operation
15.
Which of the following queue is useful to use memory effectively?
a)
Linear queue
b)
Circular queue
c)
Priority queue
d)
None
16.
Time Complexity of Partition in quick sort is ……..
a)
O(n)
b)
O(1)
c)
O(logn)
d)
O(n**2)
17.
Which of the following sorting algorithms is efficient?
a)
Bubble sort
b)
Insertion sort
c)
Selection
d)
heap sort
18.
Which of the following sorting algorithm is of divide and conquer technique?
a)
Bubble sort
b)
Quick sort
c)
Insertion sort
d)
Selection sort
19.
Maximum possible number of swappings in selection sort on an n elemented integer array?
a)
n*(n+1)/2
b)
n*(n-1)/2
c)
n*(n+1)*(n+2)/2
d)
n
20.
Consider Stack is implemented using the array.
#define MAX 10
struct STACK
{
int arr[MAX]
int top = ___________;
}
What will be the initial value with which top is initialized.
a)
Garbage
b)
1
c)
-1
d)
0
Reset
