Data Structures and Algorithms MCQs Ι MCQ on Dynamic Programming Ι Data Structures and Algorithms Multiple Choice Questions and Answers.

## Dynamic Programming and Data Structures and Algorithms MCQs

1. Which concept simplifies the task of writing the large programs?

A) Divide and conquer

B) Modularity

C) Time Complexity

D) Partitioning

Ans: A

2. What is present at the level 1 of hierarchical structure?

A) Result

B) Issues at sub-modules

C) Brief general description of the problem

D) Detailed description of the problem

Ans: C

3. Stack is also known as ___.

A) LIFO

B) FIFO

C) LILO

D) FILO

Ans: A

4. Name the searching technique where each record is searched one at a time.

A) Binary search

B) Linear search

C) Non-linear search

D) Quadratic search

Ans: B

5. Which technique periodically collects all the deleted space onto the free storage list?

A) Traversing

B) Insertion

C) Deletion

D) Garbage collection

Ans: D

6. At the time of insertion of an item to the list, the ___ condition is first checked.

A) OVER FLOW

B) UNDER FLOW

C) FIRST FLOW

D) LAST FLOW

Ans: A

7. ___ facilitates traversal in both the forward and backward direction of a linked list.

A) Directed linked list

B) Bi-directed linked list

C) Doubly linked list

D) Circular linked list

Ans: C

8. Name the arrangement in which the null pointer in the last node is replaced with the address of the first node.

A) Doubly linked list

B) Circular linked list

C) One-way list

D) Two-way list

Ans: B

9. A major drawback with the stack is that the ___ and dynamically you cannot change the size of the stack.

A) Only accepts integer

B) Checks the value

C) Size is variable

D) Size is fixed

Ans: D

10. AB+ and XY+Z* are examples of ___ notation.

A) Postfix

B) Prefix

C) Infix

D) Polish

Ans: A

11. In a queue, deletions can take place only at one end called ___.

A) Rear

B) Front

C) Enter

D) Exit

Ans: B

12. Which method adds a new item to the queue?

A) Addition

B) Insertion

C) Enqueue

D) Dequeue

Ans: C

13. A tree with no nodes is called ___.

A) Null

B) Void

C) Free

D) Open

Ans: A

14. The ___of a tree is defined to be the maximum level of any node in the tree.

A) Leaf

B) Degree

C) Value

D) Height

Ans: D

15. In ___traversal, traversal starts with the leftmost subtree, then proceeds with the right subtree and then visits the parent node.

A) Inorder

B) Preorder

C) Postorder

D) Reverse

Ans: C

16. Visiting every node on a level before going to a lower level is called ___.

A) Depth-first traversal

B) Breadth-first traversal

C) Length first traversal

D) Node first traversal

Ans: B

17. Directed link between two nodes is known as ___.

A) Arc

B) Edge

C) Path

D) Line

Ans: A

18. A null graph contains only isolated ___.

A) Arcs

B) Edges

C) Paths

D) Vertices

Ans: D

19. In an undirected graph, the ___ of a vertex v is the number of edges connected to v.

A) Value

B) Weight

C) Depth

D) Degree

Ans: D

20. What is the full form of MST?

A) Minimum Searching Tree

B) Maximum Searching Tree

C) Minimum Spanning Tree

D) Maximum Spanning Tree

Ans: C

21. A directed graph is also referred to as a/an ___ graph.

A) Forward

B) Oriented

C) Biased

D) Unbiased

Ans: B

22. Two directed edges are said to be ___ edges if they are mapped onto the same ordered pair of vertices.

A) Parallel

B) Pendent

C) Isolated

D) Serial

Ans: A

23. A walk that is not a directed walk is called as ___.

A) Semi-edge

B) Semi-circuit

C) Semi-walk

D) Semi-path

Ans: C

24. A connected digraph containing no circuit is called a ___.

A) Path

B) Loop

C) Graph

D) Tree

Ans: D

25. Give the full form for PERT.

A) Program Evaluation and Resetting Technique

B) Program Evaluation and Review Technique

C) Path Examination and Review Technique

D) Path Evaluation and Review Technique

Ans: B

26. Dijkstra’s algorithm is used to find the ___ path between the two vertices.

A) Directed

B) Weighted

C) Longest

D) Shortest

Ans: D

27. A/an ___ algorithm is used to solve an optimization problem.

A) Complete

B) Approximation

C) Optimization

D) Decision

Ans: C

28. ___ is the class of all decision problems that are polynomially bounded.

A) P

B) NP

C) NP-complete

D) NP-hard

Ans: A

29. ___ is the process of arranging a collection of items in some specified order.

A) Directing

B) Traversing

C) Searching

D) Sorting

Ans: D

30. ___ compares the first two elements and arranges them accordingly.

A) Merge Sort

B) Bubble Sort

C) Binary Sort

D) Quick Sort

Ans: B

31. ___ is used for sequencing small lists.

A) Selection sort

B) Bubble sort

C) Merge sort

D) Heap sort

Ans: A

32. ___ is preferred for very large arrays in an unsorted state.

A) Binary sort

B) Quicksort

C) Heap sort

D) Selection sort

Ans: C

33. The word ___ is derived from the name of the Persian mathematician Mohammed al –Khwarizmi.

A) Program

B) Procedure

C) Theorem

D) Algorithm

Ans: D

34. A problem having at least one algorithmic solution is called ___ problem.

A) Designable

B) Computable

C) Solvable

D) Answerable

Ans: B

35. Algorithms that are designed to be executed on Von-Neumann architecture machines are called ___ algorithms.

A) Sequential

B) Computable

C) Solvable

D) Linear

Ans: A

36. The ___ method of notation is one of the frequently used methods for expressing algorithms.

A) Dynamic programming

B) Divide and Conquer

C) Pseudo-code

D) Procedural

Ans: C

37. Given *b = 42* and *n = 11*. Find *b* mod *n*.

A) 2

B) 42

C) 11

D) 0

Ans: A

38. Exp (*1.5, – 3*) = ?

A) 0

B) 1.5

C) -3

D) 1/3.375

Ans: D

39. Which strategy permits to divide a problem in subproblems, solves them individually, and combines them for a solution to the problem?

A) Mathematical strategy

B) Divide and Conquer

C) Dynamic programming

D) Greedy method

Ans: B

40. In the binary decision tree, the average number of element comparisons for a successful search is ___.

A)* l*

B) *l/n*

C) *l/n + 1*

D) *l/n – 1*

Ans: C

41. MaxMin is a ___ algorithm.

A) Recursive

B) Calculative

C) Speedy

D) Procedural

Ans: A

42. ___ suggests that one can devise an algorithm that works in stages, considering one input at a time.

A) Linked list

B) Divide and conquer

C) Dynamic programming

D) Greedy method

Ans: D

43. In ___ problem, the profits and weights are positive numbers.

A) MaxMin

B) Knapsack

C) Greedy

D) Dynamic

Ans: B

44. In job sequencing with deadlines, an optimal solution is a feasible solution with ___ value.

A) Positive

B) Negative

C) Maximum

D) Minimum

Ans: C

45. ___ states that whatever the initial state is, remaining decisions must be optimal with regard to the state following from the first decision.

A) Principle of optimality

B) Ordering paradigm

C) Subset paradigm

D) Feasible solution

Ans: A

46. Which type of complexity is often seen in dynamic programming algorithms?

A) Time complexity

B) Synthetic complexity

C) Numerical complexity

D) Polynomial complexity

Ans: D

47. The multistage graph problem is to find the/a ___ path.

A) Maximum-cost

B) Minimum-cost

C) Shortest

D) Longest

Ans: B

48. There are ___ possible ways to place 8 pieces for an 8×8 chessboard.

A) 4.4 billion

B) 4 billion

C) 40,000

D) 64

Ans: A

49. ___ algorithms determine problem solutions by systematically searching the solution space for the given problem instance.

A) Divide and Conquer

B) MaxMin

C) Backtracking

D) Dynamic

Ans: C

50. A good bounding function for the knapsack problem is obtained by using a/an ___ bound on the value of the best feasible solution.

A) Fixed

B) Variable

C) Lower

D) Upper

Ans: D

51. The representation of data structures in ___ is called a ___.

A) Memory, storage structure

B) Hard disk, presentation

C) Cache, mapping

D) CPU, saving

Ans: A

52. ___ and ___ are examples of linear and non-linear data structures, respectively.

A) Stack, queue

B) Array, graphs

C) Trees, files

D) Graphs, linked list

Ans: B

53. Name the two parts in which a node is divided.

A) Next field, raw field

B) Next field, data field

C) Link field, raw field

D) Data field, link field

Ans: D

54. The average-case complexity is ___ and ___ when the list is sorted and unsorted, respectively.

A) *n/2, n*

B) *n, n/2*

C) *n/2, n/2*

D) *n, n*

Ans: C

55. The two basic operations in the stack are ___ and ___.

A) Push, pop

B) In, out

C) Insert, delete

D) Throw, catch

Ans: A

56. The arithmetic expression where the operators are placed ___ the operands is called ___ notation.

A) Next to, numeric

B) In between, infix

C) Before, polish

D) After, polish

57. A tree is a structure consisting of one node called the ___ and one or more ___.

A) Data, nodes

B) Open, links

C) Start, nodes

D) Root, subtrees

Ans: D

58. Stack cannot be used to

A) Evaluate an arithmetic expression in postfix form

B) Implement recursion

C) Convert infix form to postfix of an expression

D) Allocate resources by the operating system

Ans: D

59. A ___ is a graph that has more than one ___ between the same two vertices.

A) Sparse graph, edge

B) Multigraph, edge

C) Weighted graph, path

D) Strongly connected graph, arc

Ans: B

60. In the incidence matrix, the rows represent the ___ and columns represent the ___.

A) Vertices, edges

B) Arcs, edges

C) Edges, paths

D) Edges, weight

Ans: A

61. A digraph that does not have ___nor ___ are called simple digraphs.

A) Pair of vertices, self-loop

B) An edge, vertices

C) Directed edge, pair of vertices

D) Self-loop, parallel edges

Ans: D

62. A directed walk that starts and ends at the ___is called a ___.

A) Euler line, closed directed walk

B) Circuit, opened directed walk

C) The Same vertex, closed directed walk

D) Different vertex, closed directed walk

Ans: C

63. Name the two greedy algorithms that run in polynomial time.

A) Matrix multiplication, Strassen algorithm

B) Prim’s algorithm, Kruskal’s algorithm

C) Euler’s algorithm, Kruskal’s algorithm

D) Prim’s algorithm, Strassen algorithm

Ans: B

64. If any NP-complete problem is in ___, then ___.

A) NP, NP = NP hard

B) NP hard, NP hard = P

C) P, NP = P

D) NP, NP = P

Ans: C

65. The collection of ___ is called ___.

A) Records, table

B) Data, table

C) Elements, records

D) Data, elements

Ans: A

66. To apply ___ search on a particular array, it must be ___.

A) Binary, pivoted

B) Merge, pivoted

C) Linear, sorted

D) Binary, sorted

Ans: D

67.___is a ___ which states that the sequence of execution of instructions is to be the same as the sequence in which instruction are written in the program text.

A) Selection, rule

B) Direct sequencing, control mechanism

C) Procedure, process

D) Repetition, process

Ans: B

68. A/an ___, which can call itself, is said to be ___.

A) Procedure, recursive

B) Process, recursive

C) Algorithm, iterative

D) Function, loop

Ans: A

69. The two computer resources taken into consideration for efficiency measures are ___ and ___ requirements.

A) Speed, accuracy

B) Memory, speed

C) Time, space

D) Finiteness, space

Ans: C

70. In the MaxMin method, the problem is to find the ___ and ___ items in a set of n elements.

A) Upper, lower

B) Maximum, minimum

C) Positive, negative

D) Real, complex

Ans: B

71. In ___, arrays are divided into two subarrays so that the ___ subarrays do not need to be merged later.

A) Linear search, unsorted

B) Binary search, unsorted

C) Merge sort, sorted

D) Quicksort, sorted

Ans: D

72. Implementation of the list in a dynamic fashion is

A)To call upon the system to allocate and free storage may not be time-consuming

B) A set of nodes is not reserved in advance for use.

C) The address computation is complex.

D) None of the above.

Ans: B

73. Stack is

A) Static data structure

B) Dynamic data structure

C) Inbuilt data structure

D) None of these

Ans: B

Memory allocation at the runtime is known as

A) Static memory allocation

B) Dynamic memory allocation

C) Paging

D) None of the above

Ans: B

Memory allocation at the compile time is known as

A) Static memory allocation

B) Dynamic memory allocation

C) Paging

D) None of the above

Ans: A

**You may also like to read MCQ on Data Structure and Algorithm with Answers: Set-1**

#### Conclusion

Thanks for your support and love for our blogs, if you like the post on Data Structures and Algorithms MCQs Ι MCQ on Dynamic Programming please share on social media.