🧪 Data structure MCQ Quiz Hub

Data Structure -Abstract Data Types

Choose a topic to test your knowledge and improve your Data structure skills

1. 1. Which of these best describes an array?




2. How do you initialize an array in C?




3. How do you instantiate an array in Java?




4. Which of the following is the correct way to declare a multidimensional array in Java?




5. What is the output of the following Java code? public class array { public static void main(String args[]) { int []arr = {1 2 3 4 5} System.out.println(arr[2]) System.out.println(arr[4]) } }




6. What is the output of the following Java code? public class array { public static void main(String args[]) { int []arr = {1 2 3 4 5} System.out.println(arr[5]) } }




7. When does the ArrayIndexOutOfBoundsException occur?




8. Which of the following concepts make extensive use of arrays?




9. What are the advantages of arrays?




10. What are the disadvantages of arrays?




11. Assuming int is of 4bytes what is the size of int arr[15] ?




12. In general the index of the first element in an array is __________




13. Elements in an array are accessed _____________




14. This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on Stack Operations � 1 . 1. Process of inserting an element in stack is called ____________




15. Process of removing an element from stack is called __________




16. In a stack if a user tries to remove an element from an empty stack it is called _________




17. Pushing an element into stack already having five elements and stack size of 5 then stack becomes ___________




18. Entries in a stack are ordered . What is the meaning of this statement?




19. Which of the following is not the application of stack?




20. Consider the usual algorithm for determining whether a sequence of parentheses is balanced. The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(()))?




21. Consider the usual algorithm for determining whether a sequence of parentheses is balanced. Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order). The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?




22. What is the value of the postfix expression 6 3 2 4 + � *?




23. Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm to convert the expression from infix to postfix notation. The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion of this expression?




24. 1. The postfix form of the expression (A+ B)*(C*D- E)*F / G is?




25. The data structure required to check whether an expression contains a balanced parenthesis is?




26. What data structure would you mostly likely see in non recursive implementation of a recursive algorithm?




27. The process of accessing data stored in a serial access memory is similar to manipulating data on a ________




28. The postfix form of A*B+C/D is?




29. Which data structure is needed to convert infix notation to postfix notation?




30. The prefix form of A-B/ (C * D ^ E) is?




31. What is the result of the following operation? Top (Push (S X))




32. The prefix form of an infix expression (p + q) � (r * t) is?




33. Which data structure is used for implementing recursion?




34. 1. The result of evaluating the postfix expression 5 4 6 + * 4 9 3 / + * is?




35. Convert the following infix expressions into its equivalent postfix expressions. (A + B ?D)/(E � F)+G




36. Convert the following Infix expression to Postfix form using a stack. x + y * z + (p * q + r) * s Follow usual precedence rule and assume that the expression is legal.




37. Which of the following statement(s) about stack data structure is/are NOT correct?




38. Consider the following operation performed on a stack of size 5. Push(1) Pop() Push(2) Push(3) Pop() Push(4) Pop() Pop() Push(5) After the completion of all operation the number of elements present in stack is?




39. Which of the following is not an inherent application of stack?




40. The type of expression in which operator succeeds its operands is?




41. Assume that the operators + - X are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^ X + -. The postfix expression for the infix expression a + b X c � d ^ e ^ f is?




42. If the elements A B C and D are placed in a stack and are deleted one at a time what is the order of removal?




43. A linear collection of data elements where the linear node is given by means of pointer is called?




44. 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? i) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked list a)




45. In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?




46. 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?




47. What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?




48. What would be the asymptotic time complexity to find an element in the linked list?




49. The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?




50. Which of the following c code is used to create new node?




51. A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as _____________




52. The data structure required for Breadth First Traversal on a graph is?




53. A queue follows __________




54. Circular Queue is also known as ________




55. If the elements A B C and D are placed in a queue and are deleted one at a time in what order will they be removed?




56. A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?




57. A normal queue if implemented using an array of size MAX_SIZE gets full when?




58. Queues serve major role in ______________




59. Which of the following is not the type of queue?




60. This set of Data Structure Interview Questions & Answers focuses on Singly Linked List Operations � 1 . 1. A linear collection of data elements where the linear node is given by means of pointer is called?




61. 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? i) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked list a) b) c) I II and III d) I II and IV




62. In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?




63. What would be the asymptotic time complexity to find an element in the linked list?




64. The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?




65. Consider the following definition in c programming language. struct node { int data struct node * next } typedef struct node NODE NODE *ptr Which of the following c code is used to create new node?




66. What kind of linked list is best to answer questions like What is the item at position n?




67. Linked lists are not suitable for the implementation of ___________




68. Linked list is considered as an example of ___________ type of memory allocation.




69. In Linked List implementation a node carries information regarding ___________




70. Linked list data structure offers considerable saving in _____________




71. Which of the following points is/are not true about Linked List data structure when it is compared with an array?




72. What does the following function do for a given Linked List with first node as head? void fun1(struct node* head) { if(head == NULL) return fun1(head->next) printf("%d " head->data) }




73. Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?