

MCQOPTIONS
Saved Bookmarks
This section includes 24 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. |
In the above question would using arrays and swaping of elements in place of xor linked list would have been more efficient? |
A. | no not all |
B. | yes arrays would have been better than xor lists |
C. | both would be same in efficiency |
D. | can’t say |
Answer» C. both would be same in efficiency | |
2. |
Given 10,8,6,7,9swap the above numbers such that finally you got 6,7,8,9,10so now reverse 109,7,6,8,10now reverse 98,6,7,9,107,6,8,9,106,7,8,9,10at this point 6 is ahead so no more reversing can be done so stop.To implement above algorithm which datastructure is better and why ? |
A. | linked list. because we can swap elements easily |
B. | arrays. because we can swap elements easily |
C. | xor linked list. because there is no overhead of pointers and so memory is saved |
D. | doubly linked list. because you can traverse back and forth |
Answer» D. doubly linked list. because you can traverse back and forth | |
3. |
What’s wrong with this code which returns xor of two nodes address ? |
A. | nothing wrong. everything is fine |
B. | type casting at return is missing |
C. | parameters are wrong |
D. | total logic is wrongView Answer |
Answer» C. parameters are wrong | |
4. |
Which of the following statements are true?i) practical application of XOR linked lists are in environments with limited space requirements, such as embedded devices.ii)xor lists are not suitable because most garbage collectors will fail to work properly with classes or structures that don’t contain literal pointersiii)in order to calculate the address of the next node you need to remember the address of the previous nodeiv)xor lists are much efficient than single, doubly linked lists and arrays |
A. | i, ii, iii, iv |
B. | i, ii, iii |
C. | i, ii |
D. | i |
Answer» C. i, ii | |
5. |
Which of the following is not the properties of XOR lists? |
A. | X⊕X = 0 |
B. | X⊕0 = X |
C. | (X⊕Y)⊕Z = X⊕(Y⊕Z) |
D. | X⊕0 = 1 |
Answer» E. | |
6. |
Which of the following is an advantage of XOR list? |
A. | Almost of debugging tools cannot follow the XOR chain, making debugging difficult |
B. | You need to remember the address of the previously accessed node in order to calculate the next node’s address |
C. | In some contexts XOR of pointers is not defined |
D. | XOR list decreases the space requirement in doubly linked list |
Answer» E. | |
7. |
What does a xor linked list have? |
A. | every node stores the XOR of addresses of previous and next nodes |
B. | actuall memory address of next node |
C. | every node stores the XOR of addresses of previous and next two nodes |
D. | every node stores xor 0 and the current node address |
Answer» B. actuall memory address of next node | |
8. |
What is xor linked list? |
A. | uses of bitwise XOR operation to decrease storage requirements for doubly linked lists |
B. | uses of bitwise XOR operation to decrease storage requirements for linked lists |
C. | uses of bitwise operations to decrease storage requirements for doubly linked lists |
D. | just another form of linked list |
Answer» B. uses of bitwise XOR operation to decrease storage requirements for linked lists | |
9. |
In a doubly linked list, the number of pointers affected for an insertion operation will be |
A. | 4 |
B. | 0 |
C. | 1 |
D. | Depends upon the nodes of the doubly linked list |
Answer» E. | |
10. |
Consider a singly linked list of the form where F is a pointer to the first element in the linked list and L is the pointer to the last element in the list. The time of which of the following operations depends on the length of the list? |
A. | Delete the last element of the list |
B. | Delete the first element of the list |
C. | Add an element after the last element of the list t |
D. | Interchange the first two elements of the list |
Answer» B. Delete the first element of the list | |
11. |
Following declaration of an array of struct, assumes size of byte, short, int and long are 1, 2, 3 and 4 respectively. Alignment rule stipulates that n-type field must be located at an address divisible by n. the fields in a struct are not rearranged, padding is used to ensure alignment. All elements of array should be of same size.Struct complx Short s Byte b Long l Int iEnd complxComplx C[10]Assuming C is located at an address divisible by 8, what is the total size of C, in bytes? |
A. | 150 |
B. | 160 |
C. | 200 |
D. | 240 |
Answer» C. 200 | |
12. |
Consider the C code fragment given below. typedef struct node {int data; node* next;} node;void join (node* m, node* n) {node* p = n;while (p- >next! = NULL) {p = p - > next;}p - > next = m;}Assuming that m and n point to valid NULL-terminated linked lists, invocation of join will |
A. | append list m to the end of list n for all inputs |
B. | either cause a null pointer dereference or append list m to the end of list n |
C. | cause a null pointer dereference for all inputs. |
D. | append list n to the end of list m for all inputs |
Answer» C. cause a null pointer dereference for all inputs. | |
13. |
Consider a single linked list where F and L are pointers to the first and last elements respectively of the linked list. The time for performing which of the given operations depends on the length of the linked list ? |
A. | Delete the first element of the list |
B. | Interchange the first two elements of the list |
C. | Delete the last element of the list |
D. | Add an element at the end of the list |
Answer» B. Interchange the first two elements of the list | |
14. |
N items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed.An algorithm performs the following operations on the list in this order: Θ(N) delete, O(log N) insert, O(log N) find, and Θ(N) decrease-key. What is the time complexity of all these operations put together? |
A. | O(log2N) |
B. | O(N) |
C. | O(N2) |
D. | Θ (N2log N) |
Answer» D. Θ (N2log N) | |
15. |
Polynomial addition is implemented using _______ data structure. |
A. | Queue |
B. | Linked list |
C. | Trees |
D. | Stack |
Answer» C. Trees | |
16. |
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote the number of nodes in the queue. Let enqueue be implemented by inserting a new node at the head, and dequeue beimplemented by deletion of a node from the tail.Which one of the following is the time complexity of the most time-efficient implementation of enqueue and dequeue, respectively, for this data structure? |
A. | θ(1), θ(1) |
B. | θ(1), θ(n) |
C. | θ(n), θ(1) |
D. | θ(n), θ(n) |
Answer» C. θ(n), θ(1) | |
17. |
In a circularly linked list organization, insertion of a record involves the modification of |
A. | No pointer |
B. | 1 pointer |
C. | 2 pointers |
D. | 3 pointers |
Answer» D. 3 pointers | |
18. |
everything is fin? |
A. | type casting at return is missing |
B. | parameters are wrong |
C. | total logic is wrong |
Answer» D. | |
19. |
Which of the following statements are true ? |
A. | practical application of XOR linked lists are in environments with limited space requirements, such as embedded devices. |
B. | xor lists are not suitable because most garbage collectors will fail to work properly with classes or structures that don’t contain literal pointers |
C. | in order to calculate the address of the next node you need to remember the address of the previous node |
D. | xor lists are much efficient than single, doubly linked lists and arrays |
Answer» C. in order to calculate the address of the next node you need to remember the address of the previous node | |
20. |
What are the important properties of xor lists |
A. | X‚äïX = 0 |
B. | X‚äï0 = X |
C. | (X‚äïY)‚äïZ = X‚äï(Y‚äïZ) |
D. | All of the mentioned |
Answer» E. | |
21. |
Disadvantages of xor lists |
A. | Almost of debugging tools cannot follow the XOR chain, making debugging difficult |
B. | You need to remember the address of the previously accessed node in order to calculate the next node’s address |
C. | In some contexts XOR of pointers is not defined |
D. | All of the mentioned |
Answer» E. | |
22. |
What does first and last nodes of a xor linked lists contain ? (let address of first and last be A and B) |
A. | NULL xor A and B xor NULL |
B. | NULL and NULL |
C. | A and B |
D. | NULL xor A and B |
Answer» B. NULL and NULL | |
23. |
What does a xor linked list have ? |
A. | every node stores the XOR of addresses of previous and next nodes |
B. | actuall memory address of next node |
C. | every node stores the XOR of addresses of previous and next two nodes |
D. | every node stores xor 0 and the current node address |
Answer» B. actuall memory address of next node | |
24. |
What is xor linked list ? |
A. | uses of bitwise XOR operation to decrease storage requirements for doubly linked lists |
B. | uses of bitwise XOR operation to decrease storage requirements for linked lists |
C. | uses of bitwise operations to decrease storage requirements for doubly linked lists |
D. | just another form of linked list |
Answer» B. uses of bitwise XOR operation to decrease storage requirements for linked lists | |