A strong hold on data structures enables you to handle data in the most efficient way. Therefore, Data structures are the core of software engineering and is essential to crack job interviews. Regardless of the technology you are working on, whether it is Artificial Intelligence, Machine Learning, Data Science etc. Data structures will assist you in achieving well-optimized and effective results. Some of the Important Data Structure Placement Questions and Answers are as follows:-
Basic Data Structure Placement Questions
Q1. The fetch method of Sparse Array class is called , the row specified by row_index makes it an array and the col_index denotes the specified position. What is the worst case time complexity of deleting a node in Singly Linked list?
O (n)
O (n2)
O (nlogn)
O (1)
Correct Answer B
Explanation: The above problem can be solved by the algorithm i.e. Container loading problem which is a type of greedy approach.
Q2.This code is only retrieving the top element, note that it is not equivalent to pop operation as you are not setting the ‘next’ pointer point to the next node in sequence. What is the meaning of 'stackoverflow' ?
removing items from an empty stack
index out of bounds exception
accessing item from an undefined stack
adding items to a full stack
Correct Answer: D
Explanation: Adding items to a full stack is termed as stack underflow
Q3. Spanning tree of a graph have.....
same number of vertices but not edges.
depends upon algorithm being used.
same number of edges and vertices.
same number of edges and but not vertices.
Correct Answer: A
Explanation: Spanning tree of a graph have same number of vertices but not edges.
Q4. Spanning tree of a graph have same number of vertices and minimum possible number of edges. Which data structure is used for parentheses matching?
b‐tree
graph
Heap
Stack
Correct Answer: D Explanation: Stack is used for parentheses matching.
Q5 For every opening brace, push it into the stack, and for every closing brace, pop it off the stack. Do not take action for any other character. In the end, if the stack is empty, then the input has balanced parentheses. If a queue is implemented using an array of size MAXIMUM, gets full when
Rear = MAXIMUM – 1
Front = (rear + 1)
Front = rear + 1‐MAXIMUM
Rear = front
Answer: A
Q6. It is an 0‐index array therefore index 5 gives Array Index Out Of Bounds Exception. What is the size of the array arr[100]?(Assuming integer is of 4 bytes)
100
4
400
25
Correct Answer: C
Explanation:
Since there are 100 integer elements and each integer is of 4bytes, we get 100*4 = 400bytes
Q7 .This program will add the new node at the front of the linked list by pointing next pointer of new node to the head and then moving the head to point to the new node. A dynamic array is?
The memory to the array is allocated at runtime
An array which is reallocated every time whenever new elements have to be added
A variable size data structure
An array which is created at runtime.
Correct Answer: C
Explanation:
It is a varying‐size list data structure that allows items to be added or removed, it may use a fixed sized array at the back end.
Q8 Application of queue data structure is___
When a resource is shared among multiple consumers.
When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes
Load Balancing
All of the above
Correct Answer: D Explanation: Application of queue data structure is: 1) when a resource is shared among multiple consumers. 2) When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes. 3) Load Balancing
Q9 What is the time complexity for inserting/deleting an element in the array?
O(1)
O(n)
O(logn)
O(nlogn)
Correct Answer: B Explanation: The time complexity for inserting/deleting an element in the array is O(n)
Q10 All the other elements will have to be moved, hence O(n). Which of the following don’t use matrices?
Graph theory
Sorting numbers
In solving linear equations
Image processing
Correct Answer: B Explanation: Sorting numbers don’t use matrices.
For more Data Structure questions and answers download our free handbook below.
Mobiprep handbooks are free downloadable placement preparation resources that can help you ace any company placement process. We have curated a list of the 40 most important MCQ questions with detailed explanations to ensure the best placement preparation.
תגובות