

MCQOPTIONS
Saved Bookmarks
This section includes 21 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.
1. |
Consider the following definition in c programming language. Which of the following c code is used to create new node? |
A. | ptr = (NODE*)malloc(sizeof(NODE)); |
B. | ptr = (NODE*)malloc(NODE); |
C. | ptr = (NODE*)malloc(sizeof(NODE*)); |
D. | ptr = (NODE)malloc(sizeof(NODE));View Answer |
Answer» B. ptr = (NODE*)malloc(NODE); | |
2. |
The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used? |
A. | Singly linked list |
B. | Doubly linked list |
C. | Circular doubly linked list |
D. | Array implementation of list |
Answer» D. Array implementation of list | |
3. |
What would be the asymptotic time complexity to find an element in the linked list? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | O(n4) |
Answer» C. O(n2) | |
4. |
What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | O(n3) |
Answer» B. O(n) | |
5. |
In linked list each node contains a minimum of two fields. One field is data field to store the data second field is? |
A. | Pointer to character |
B. | Pointer to integer |
C. | Pointer to node |
D. | Node |
Answer» D. Node | |
6. |
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time? |
A. | I and II |
B. | I and III |
C. | I, II and III |
D. | I, II and IVView Answer |
Answer» C. I, II and III | |
7. |
A linear collection of data elements where the linear node is given by means of pointer is called? |
A. | Linked list |
B. | Node list |
C. | Primitive list |
D. | Unordered list |
Answer» B. Node list | |
8. |
What is the functionality of the following piece of code? |
A. | Find and delete a given element in the list |
B. | Find and return the given element in the list |
C. | Find and return the position of the given element in the list |
D. | Find and insert a new element in the listView Answer |
Answer» D. Find and insert a new element in the listView Answer | |
9. |
Which of these is not an application of a linked list? |
A. | To implement file systems |
B. | For separate chaining in hash-tables |
C. | To implement non-binary trees |
D. | Random Access of elements |
Answer» E. | |
10. |
What is the space complexity for deleting a linked list? |
A. | O(1) |
B. | O(n) |
C. | Either O(1) or O(n) |
D. | O(logn) |
Answer» B. O(n) | |
11. |
What is the functionality of the following code? |
A. | Inserting a node at the beginning of the list |
B. | Deleting a node at the beginning of the list |
C. | Inserting a node at the end of the list |
D. | Deleting a node at the end of the listView Answer |
Answer» D. Deleting a node at the end of the listView Answer | |
12. |
Inserting a node at the beginning of the list$ |
A. | Deleting a node at the beginning of the list |
B. | Inserting a node at the end of the list |
C. | Deleting a node at the end of the list |
Answer» D. | |
13. |
The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used? |
A. | Singly linked list |
B. | Doubly linked list |
C. | Circular doubly linked list |
D. | Array implementation of list |
Answer» D. Array implementation of list | |
14. |
What would be the asymptotic time complexity to insert an element at the second position in the linked list? |
A. | O(1) |
B. | O(n) |
C. | O(n<sup>2</sup>) |
D. | None of the mentioned |
Answer» B. O(n) | |
15. |
What would be the asymptotic time complexity to add an element in the linked list? |
A. | O(1) |
B. | O(n) |
C. | O(n<sup>2</sup>) |
D. | None of the mentioned |
Answer» C. O(n<sup>2</sup>) | |
16. |
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list? |
A. | O(1) |
B. | O(n) |
C. | θ(n) |
D. | θ(1) |
Answer» D. ‚âà√≠‚Äö√†√®(1) | |
17. |
In linked list each node contain minimum of two fields. One field is data field to store the data second field is? |
A. | Pointer to character |
B. | Pointer to integer |
C. | Pointer to node |
D. | Node |
Answer» D. Node | |
18. |
What is the time complexity to count the number of elements in the linked list? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | None of the mentioned |
Answer» C. O(logn) | |
19. |
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. |
A. | time? |
B. | Insertion at the front of the linked list |
C. | Insertion at the end of the linked list |
D. | Deletion of the front node of the linked list |
Answer» C. Insertion at the end of the linked list | |
20. |
What is the time complexity of inserting at the end in dynamic arrays? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | Either O(1) or O(n) |
Answer» E. | |
21. |
Which of the following is not a disadvantage to the usage of array? |
A. | Fixed size |
B. | You know the size of the array prior to allocation |
C. | Insertion based on position |
D. | Accessing elements at specified positions |
Answer» E. | |