Advertising

Data Structure MCQ (Multiple Choice Questions)

Data Structure MCQ (Multiple Choice Questions)

1. Which of the following is/are the levels of implementation of the data structure

a. Abstract level
b. Application level
c. Implementation level
d. All of the above

2. A binary search tree whose left and right subtree differ in height by at most 1 unit is called ……

a. AVL tree
b. Red-black tree
c. Lemma tree
d. None of the above

3. ……………….. level is where the model becomes compatible executable code

a. Abstract level

b. Application level
c. Implementation level
d. All of the above

4. Stack is also called as

a. Last in, first out
b. First in, last out
c. Last in, last out
d. First in, first out

5. Which of the following is accurate about the characteristics of abstract data types?

i) It exports a type.

ii) It exports a set of operations

a. True, False
b. False, True
c. True, True
d. False, False

6. …………… is not the component of data structure.

a. Operations

b. Storage Structures

c. Algorithms

d. None of the above

7. Which of the following is not part of the ADT description?

a. Data

b. Operations

c. Both of the above

d. None of the above

8. Inserting an item into the Stack when the Stack is not complete is called …………. Operation and Deletion of an item from the Stack when the Stack is not empty is called ………..operation.

a. push, pop

b. pop, push

c. insert, delete

d. delete, insert

9. ……………. Is a pile in which items are added at one end and removed from the other.

a. Stack

b. Queue

c. List

d. None of the above

10. ………… is very useful when data have to be stored and retrieved in reverse order.

a. Stack

b. Queue

c. List

d. Link list

11. Which data structure allows deleting data elements from and inserting at the rear?

a. Stacks

b. Queues

c. Dequeues

d. Binary search tree

12. Which data structures can’t store the non-homogeneous data elements?

a. Arrays

b. Records

c. Pointers

d. Stacks

13. A ……. is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out.

a. Queue linked List

b. Stacks linked List

c. Both of them

d. Neither of them

14. Which of the following is a non-linear data structure?

a. Stacks

b. List

c. Strings

d. Trees

15. Herder node is used as Sentinel in …..

a. Graphs

b. Stacks

c. Binary Tree

d. Queues

16. Which of these best describes an array?
a. A data structure that shows a hierarchical behavior
b. Container of objects of similar types
c. Arrays are immutable once initialized
d. Array is not a data structure

17. 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);

18. 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);

19. When does the ArrayIndexOutOfBoundsException occur?
a. Compile-time
b. Run-time
c. Not an error
d. Not an exception at all
20. Which of the following concepts makes extensive use of arrays?
a. Binary trees
b. Scheduling of processes
c. Caching
d. Spatial locality

21. 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 the first element of an array is 1
d. Easier to store elements of the same data type
22. What are the disadvantages of arrays?
a. Data structures 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

23. Assuming int is of 4bytes, what is the size of int arr[15];?
a. 15
b. 19
c. 11
d. 60

24. In general, the Index of the first element in an array is __________
a. 0
b. -1
c. 2
d. 1
25. Elements in an array are accessed _____________
a. randomly
b. sequentially
c. exponentially
d. logarithmically

26. The process of inserting an element in a Stack is called ____________
a. Create
b. Push
c. Evaluation
d. Pop
27. The process of removing an element from the Stack is called __________
a. Create
b. Push
c. Evaluation
d. Pop
28. In a stack, if a user tries to remove an element from an empty stack, it is called _________
a. Underflow
b. Empty collection
c. Overflow
d. Garbage Collection

29. Pushing an element into a Stack already having five elements and a stack size of 5, then the Stack becomes ___________
a. Overflow
b. Crash
c. Underflow
d. User flow
30. 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

31. In a queue, the initial values of front pointer f rare pointer r should be …….. and ……….. respectively.

a. 0 and 1

b. 0 and -1

c. -1 and 0

d. 1 and 0

32. In a circular queue, the value of r will be.

a. r=r+1

b. r=(r+1)% [QUEUE_SIZE – 1]

c. r=(r+1)% QUEUE_SIZE

d. r=(r-1)% QUEUE_SIZE

33. Which of the following statements is true?

i.)Using singly linked lists and circular Lists, it is not possible to traverse the List backward.

ii) To find the predecessor, traversing the List from the first node is required in case of a singly linked List.

a. i-only

b. ii-only

c. Both i and ii

d. None of both

34. The advantage of …………….. is that they solve the problem of sequential storage representation. However, the disadvantage is that they are sequential lists.

a. Lists

b. Linked Lists

c. Trees

d. Queues

35. What will be the value of the top if there is a size of Stack STACK_SIZE is 5

a. 5

b. 6

c. 4

d. None

36. ………… is not the operation that can be performed on Queue.

a. Insertion

b. Deletion

c. Retrieval

d. Traversal

37. There is an extra element at the head of the List called a ……….

a. Antinel

b. Sentinel

c. List header

d. List head

38. A graph is a collection of nodes called ………. And line segments called arcs or ……….. that connect a pair of nodes.

a. vertices, edges

b. edges, vertices

c. vertices, paths

d. graph node, edges

39. A ……….. is a graph with weighted costs associated with its edges.

a. Network

b. Weighted graph

c. Both A and B

d. None A and B

40. the binary search method generally needs no more than ……………. comparisons.

a. [log2n]-1

b. [logn]+1

c. [log2n]

d. [log2n]+1

41. Which of the following is not the type of Queue?

a. Ordinary Queue

b. Single-ended Queue

c. Circular Queue

d. Priority queue

42. The property of a binary Tree is

a. The first subset is called the left subtree

b. The second subtree is called the right subtree

c. The root cannot contain NULL

d. The right subtree can be empty

43. State true or false.

i). The degree of the root node is always zero.

i) Nodes, not root and leaf, are called internal nodes.

a. True, True

b. True, False

c. False, True

d. False, False

44. Any node is the path from the root to the node is called

a. Successor node

b. Ancestor node

c. Internal node

d. None of the above

45. State true or false.

i) A node is a parent if it has successor nodes.

ii) A node is a child node if our degree is one.

a. True, True

b. True, False

c. False, True

d. False, False

46. What is a bit array?
a. Data structure for representing arrays of records
b. Data structure that compactly stores bits
c. An array in which most of the elements have the same value
d. Array in which elements are not present in continuous locations
47. Which bitwise operations will you use to set a particular bit to 1?
a. OR
b. AND
c. XOR
d. NOR
48. Which bitwise operations will you use to set a particular bit to 0?
a. OR
b. AND
c. XOR
d. NAND

49. Which bitwise operations will you use to toggle a particular bit?
a. OR
b. AND
c. XOR
d. NOT
50. Which of the following is not an advantage of bit array?
a. Exploit bit-level parallelism
b. Maximal use of data cache
c. Can be stored and manipulated in the register set for long periods
d. Accessing Individual Elements is easy
51. Which of the following is not a disadvantage of bit array?
a. Without compression, they might become sparse
b. Accessing individual bits is expensive
c. Compressing bit array to byte/word array, the machine also has to support byte/word addressing
d. Storing and Manipulating in the register set for long periods
52. Which of the following is/are not applications of bit arrays?
a. Used by the Linux kernel
b. For the allocation of memory pages
c. Bloom filter
d. Implementation of Vectors and Matrices

53. Which class in Java can be used to represent a bit array?
a. BitSet
b. BitVector
c. BitArray
d. BitStream
54. Which bitwise operators will you use to invert all the bits in a bit array?
a. OR
b. NOT
c. XOR
d. NAND
55. Run-length encoding is used to compress data in bit arrays.
a. True
b. False
c. And

55. Operations on a data structure may be …..

a. creation

b. destruction

c. selection

d. all of the above

56. How the data item or items are logically related defines …..

a. storage structure

b. data structure

c. data relationship

d. data operation

57. Which of the following operations apply to primitive data structures?

a. create

b. destroy

c. update

d. all of the above

58. The use of pointers to refer to elements of a data structure in which components are logically adjacent is ….

a. pointers

b. linked allocation

c. Stack

d. Queue

59. Arrays are the best data structures

a. for relatively permanent collections of data

b. for the size of the structure and the data in the structure are constantly changing

c. for both of the above situation

d. for none of the above situation

60. Which of the following statements is false?

a. Arrays are dense lists and static data structures.

b. Data elements in the linked List need not be stored in adjacent space in memory

c. Pointers store the following data element of a list.

d. Linked List collects the nodes containing an information part and the next pointer.

61. Which of the following data structures is a non-linear type?

a. Strings

b. Lists

c. Stacks

d. Tree

62. Which of the following data structures is linear type?

a. Array

b. Tree

c. Graphs

d. Hierarchy

63. A particular data organization’s logical or mathematical model is called a ………

a. Data structure

b. Data arrangement

c. Data configuration

d. Data formation

64. The simplest type of data structure is ………………

a. Multidimensional array

b. Linear Array

c. Two-dimensional Array

d. Three-dimensional Array

65. Linear arrays are also called ……………….

a. Straight line array

b. One-dimensional Array

c. Vertical Array

d. Horizontal Array

66. Arrays are the best data structures …………

a. For relatively permanent collections of data.

b. For the size of the structure and the data in the structure are constantly changing

c. For both of the above situation

d. For none of the above

67. Which of the following data structures are indexed structures?

a. Linear arrays

b. Linked lists

c. Graphs

d. Trees

68. Each node in a linked list has two pairs of ………….. and ……………….

a. Link field and information field

b. Link field and avail field

c. Avail field and information field

d. Address field and link field

69. A …………………… does not keep track of the address of every element in the List.

a. Stack

b. String

c. Linear Array

d. Queue

70. When does the top value of the stack change?

a. Before Deletion

b. While checking Underflow

c. At the time of Deletion

d. After Deletion