๐Ÿงช Data structure MCQ Quiz Hub

Data Structure -Abstract Data Types

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

1. Which of these best describes an array?





โœ… Correct Answer: 2

How do you initialize an array in C?





โœ… Correct Answer: 3

How do you instantiate an array in Java?





โœ… Correct Answer: 3

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





โœ… Correct Answer: 3

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]) } }





โœ… Correct Answer: 1

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]) } }





โœ… Correct Answer: 3

When does the ArrayIndexOutOfBoundsException occur?





โœ… Correct Answer: 2

Which of the following concepts make extensive use of arrays?





โœ… Correct Answer: 4

What are the advantages of arrays?





โœ… Correct Answer: 4

What are the disadvantages of arrays?





โœ… Correct Answer: 2

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





โœ… Correct Answer: 4

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





โœ… Correct Answer: 1

Elements in an array are accessed _____________





โœ… Correct Answer: 1

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 ____________





โœ… Correct Answer: 2

Process of removing an element from stack is called __________





โœ… Correct Answer: 4

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





โœ… Correct Answer: 1

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





โœ… Correct Answer: 1

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





โœ… Correct Answer: 4

Which of the following is not the application of stack?





โœ… Correct Answer: 4

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: (()(())(()))?





โœ… Correct Answer: 3

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?





โœ… Correct Answer: 2

What is the value of the postfix expression 6 3 2 4 + ๏ฟฝ *?





โœ… Correct Answer: 4

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?





โœ… Correct Answer: 4

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





โœ… Correct Answer: 3

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





โœ… Correct Answer: 1

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





โœ… Correct Answer: 2

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





โœ… Correct Answer: 4

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





โœ… Correct Answer: 2

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





โœ… Correct Answer: 4

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





โœ… Correct Answer: 3

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





โœ… Correct Answer: 1

The prefix form of an infix expression (p + q) ๏ฟฝ (r * t) is?





โœ… Correct Answer: 3

Which data structure is used for implementing recursion?





โœ… Correct Answer: 2

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





โœ… Correct Answer: 2

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





โœ… Correct Answer: 1

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.





โœ… Correct Answer: 1

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





โœ… Correct Answer: 3

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?





โœ… Correct Answer: 1

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





โœ… Correct Answer: 4

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





โœ… Correct Answer: 3

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?





โœ… Correct Answer: 2

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?





โœ… Correct Answer: 2

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





โœ… Correct Answer: 1

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)





โœ… Correct Answer: 2

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





โœ… Correct Answer: 3

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?





โœ… Correct Answer: 3

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





โœ… Correct Answer: 1

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





โœ… Correct Answer: 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?





โœ… Correct Answer: 3

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





โœ… Correct Answer: 1

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 _____________





โœ… Correct Answer: 1

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





โœ… Correct Answer: 3

A queue follows __________





โœ… Correct Answer: 1

Circular Queue is also known as ________





โœ… Correct Answer: 1

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?





โœ… Correct Answer: 1

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





โœ… Correct Answer: 3

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





โœ… Correct Answer: 1

Queues serve major role in ______________





โœ… Correct Answer: 3

Which of the following is not the type of queue?





โœ… Correct Answer: 2

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?





โœ… Correct Answer: 1

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





โœ… Correct Answer: 2

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





โœ… Correct Answer: 3

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





โœ… Correct Answer: 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?





โœ… Correct Answer: 3

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?





โœ… Correct Answer: 1

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





โœ… Correct Answer: 4

Linked lists are not suitable for the implementation of ___________





โœ… Correct Answer: 1

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





โœ… Correct Answer: 4

In Linked List implementation a node carries information regarding ___________





โœ… Correct Answer: 1

Linked list data structure offers considerable saving in _____________





โœ… Correct Answer: 3

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





โœ… Correct Answer: 4

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) }





โœ… Correct Answer: 2

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





โœ… Correct Answer: 4