131
79.6k

550+ Data Structures (DS) Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) , Information Technology Engineering (IT) , Bachelor of Science in Computer Science FY (BSc CS) , Bachelor of Science in Information Technology FY (BSc IT) , Bachelor of Computer Applications (BCA) .

Chapters

Chapter: Linear Data Structures - List
1.

Which of these best describes an array?

A. A data structure that shows a hierarchical behaviour
B. Container of objects of similar types
C. Arrays are immutable once initialised
D. Array is not a data structure
Answer» B. Container of objects of similar types
2.

How do you initialize an array in C?

A. int arr[3] = (1,2,3);
B. int arr(3) = {1,2,3};
C. int arr[3] = {1,2,3};
D. int arr(3) = (1,2,3);
Answer» C. int arr[3] = {1,2,3};
3.

How do you instantiate an array in Java?

A. int arr[] = new int(3);
B. int arr[];
C. int arr[] = new int[3];
D. int arr() = new int(3);
Answer» C. int arr[] = new int[3];
4.

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

A. int[] arr;
B. int arr[[]];
C. int[][]arr;
D. int[[]] arr;
Answer» C. int[][]arr;
5.

When does the ArrayIndexOutOfBoundsException occur?

A. Compile-time
B. Run-time
C. Not an error
D. Not an exception at all
Answer» B. Run-time
6.

Which of the following concepts make extensive use of arrays?

A. Binary trees
B. Scheduling of processes
C. Caching
D. Spatial locality
Answer» D. Spatial locality
7.

What are the advantages of arrays?

A. Objects of mixed data types can be stored
B. Elements in an array cannot be sorted
C. Index of first element of an array is 1
D. Easier to store elements of same data type
Answer» D. Easier to store elements of same data type
8.

What are the disadvantages of arrays?

A. Data structure like queue or stack cannot be implemented
B. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size
C. Index value of an array can be negative
D. Elements are sequentially accessed
Answer» B. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size
9.

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

A. 15
B. 19
C. 11
D. 60
Answer» D. 60
10.

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

A. 0
B. -1
C. 2
D. 1
Answer» A. 0
11.

Elements in an array are accessed

A. randomly
B. sequentially
C. exponentially
D. logarithmically
Answer» A. randomly
12.

Which of the following is not a disadvantage to the usage of array?

A. Fixed size
B. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size
C. Insertion based on position
D. Accessing elements at specified positions
Answer» D. Accessing elements at specified positions
13.

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» D. Either O(1) or O(n)
14.

Which of these is not an application of 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» D. Random Access of elements
15.

Which of the following is false about a doubly linked list?

A. We can navigate in both the directions
B. It requires more space than a singly linked list
C. The insertion and deletion of a node take a bit longer
D. Implementing a doubly linked list is easier than singly linked list
Answer» D. Implementing a doubly linked list is easier than singly linked list
16.

What is the worst case time complexity of inserting a node in a doubly linked list?

A. O(nlogn)
B. O(logn)
C. O(n)
D. O(1)
Answer» C. O(n)
17.

Which of the following application makes use of a circular linked list?

A. Undo operation in a text editor
B. Recursive function calls
C. Allocating CPU to resources
D. Implement Hash Tables
Answer» C. Allocating CPU to resources
18.

Which of the following is false about a circular linked list?

A. Every node has a successor
B. Time complexity of inserting a new node at the head of the list is O(1)
C. Time complexity for deleting the last node is O(n)
D. We can traverse the whole circular linked list by starting from any point
Answer» B. Time complexity of inserting a new node at the head of the list is O(1)
19.

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» A. Linked list
20.

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» C. Pointer to node
21.

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» C. θ(n)
22.

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» C. Circular doubly linked list
23.

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));
Answer» A. ptr = (NODE*)malloc(sizeof(NODE));
Chapter: Linear Data Structures -Stacks and Queues
24.

Process of inserting an element in stack is called

A. Create
B. Push
C. Evaluation
D. Pop
Answer» B. Push
25.

Process of removing an element from stack is called

A. Create
B. Push
C. Evaluation
D. Pop
Answer» D. Pop
26.

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

A. Underflow
B. Empty collection
C. Overflow
D. Garbage Collection
Answer» A. Underflow
27.

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

A. Overflow
B. Crash
C. Underflow
D. User flow
Answer» A. Overflow
28.

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

A. A collection of stacks is sortable
B. Stack entries may be compared with the ‘<‘ operation
C. The entries are stored in a linked list
D. There is a Sequential entry that is one by one
Answer» D. There is a Sequential entry that is one by one
29.

Which of the following is not the application of stack?

A. A parentheses balancing program
B. Tracking of local variables at run time
C. Compiler Syntax Analyzer
D. Data Transfer between two asynchronous process
Answer» D. Data Transfer between two asynchronous process
30.

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?

A. 1
B. 2
C. none
D. none
Answer» B. 2
31.

What is the value of the postfix expression 6 3 2 4 + – *?

A. 1
B. 40
C. 74
D. -18
Answer» D. -18
32.

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

A. AB+ CD*E – FG /**
B. AB + CD* E – F **G /
C. AB + CD* E – *F *G /
D. AB + CDE * – * F *G /
Answer» C. AB + CD* E – *F *G /
33.

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

A. Stack
B. Queue
C. Array
D. Tree
Answer» A. Stack
34.

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

A. Linked List
B. Stack
C. Queue
D. Tree
Answer» B. Stack
35.

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

A. Heap
B. Binary Tree
C. Array
D. Stack
Answer» D. Stack
36.

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

A. *AB/CD+
B. AB*CD/+
C. A*BC+/D
D. ABCD+/*
Answer» B. AB*CD/+
37.

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

A. Branch
B. Tree
C. Queue
D. Stack
Answer» D. Stack
38.

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

A. -/*^ACBDE
B. -ABCD*^DE
C. -A/B*C^DE
D. -A/BC*^DE
Answer» C. -A/B*C^DE
39.

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

A. X
B. X+S
C. S
D. none
Answer» A. X
40.

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

A. + pq – *rt
B. – +pqr * t
C. – +pq * rt
D. – + * pqrt
Answer» C. – +pq * rt
41.

Which data structure is used for implementing recursion?

A. Queue
B. Stack
C. Array
D. List
Answer» B. Stack
42.

When an operand is read, which of the following is done?

A. It is placed on to the output
B. It is placed in operator stack
C. It is ignored
D. Operator stack is emptied
Answer» A. It is placed on to the output
43.

What should be done when a left parenthesis ‘(‘ is encountered?

A. It is ignored
B. It is placed in the output
C. It is placed in the operator stack
D. The contents of the operator stack is emptied
Answer» C. It is placed in the operator stack
44.

Which of the following is an infix expression?

A. (a+b)*(c+d)
B. ab+c*
C. +ab
D. abc+*
Answer» A. (a+b)*(c+d)
45.

What is the time complexity of an infix to postfix conversion algorithm?

A. O(N log N)
B. O(N)
C. O(N2)
D. O(M log N)
Answer» B. O(N)
46.

Which of the following statement is incorrect with respect to infix to postfix conversion algorithm?

A. operand is always placed in the output
B. operator is placed in the stack when the stack operator has lower precedence
C. parenthesis are included in the output
D. higher and equal priority operators follow the same condition
Answer» C. parenthesis are included in the output
47.

In infix to postfix conversion algorithm, the operators are associated from?

A. right to left
B. left to right
C. centre to left
D. centre to right
Answer» B. left to right
48.

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 a ?

A. Queue
B. Stack
C. Tree
D. Linked list
Answer» A. Queue
49.

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

A. Stack
B. Array
C. Queue
D. Tree
Answer» C. Queue
50.

A queue follows

A. FIFO (First In First Out) principle
B. LIFO (Last In First Out) principle
C. Ordered array
D. Linear tree
Answer» A. FIFO (First In First Out) principle

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.