
DSA Quiz
Authored by HITESH AHUJA
Computers
University
Used 9+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How is the 2nd element in an array accessed based on pointer notation?
*a + 2
*(a + 2)
*(*a + 2)
&(a + 2)
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of the following is example of in-place algorithm?
Bubble Sort
Merge Sort
Insertion Sort
All of the above
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
The data structure required to check whether an expression contains a balanced parenthesis is?
Stack
Queue
Array
All of the above
Answer explanation
Explanation: The stack is a simple data structure in which elements are added and removed based on the LIFO principle. Open parenthesis is pushed into the stack and a closed parenthesis pops out elements till the top element of the stack is its corresponding open parenthesis. If the stack is empty, parenthesis is balanced otherwise it is unbalanced
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
When does the ArrayIndexOutOfBoundsException occur?
Compile-time
Run-time
Not an error
Not an exception at all
Answer explanation
Explanation: ArrayIndexOutOfBoundsException is a run-time exception and the compilation is error-free.
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the speciality about the inorder traversal of a binary search tree?
It traverses in a non increasing order
It traverses in an increasing order
It traverses in a random fashion
It traverses based on priority of the node
Answer explanation
Explanation: As a binary search tree consists of elements lesser than the node to the left and the ones greater than the node to the right, an inorder traversal will give the elements in an increasing order.
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the time complexity of inserting at the end in dynamic arrays?
O(1)
O(n)
O(logn)
Either O(1) or O(n)
Answer explanation
Explanation: Depending on whether the array is full or not, the complexity in dynamic array varies. If you try to insert into an array that is not full, then the element is simply stored at the end, this takes O(1) time. If you try to insert into an array which is full, first you will have to allocate an array with double the size of the current array and then copy all the elements into it and finally insert the new element, this takes O(n) time.
5.
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
The following formula will produce
Fn = Fn-1 + Fn-2
Armstrong Number
Fibonacci Series
Euler Number
Prime Number
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?