# Algorithm | DSA | The lru Algorithm MCQs

Algorithm MCQ Questions – DSA MCQ – The lru Algorithm MCQ – Data Structures and Algorithms MCQ Questions and Answers for IT exams.

## Algorithm | DSA | The lru Algorithm MCQs

1. Comments help the human reader of the algorithm to better understand the ___.
Ans. Algorithm

2. The symbol ___ is used for assignment.
Ans. ←

3. “A new variable is used to store the remainder which is obtained by dividing m by n, with 0 < r < m”. This is denoted by ___.
Ans. r ←m mod n

4. Four-Colour Problem requires us to find out whether a political map of the world, can be drawn using only ___.
Ans. Four colours

5. An algorithm has one or more ___
Ans. Outputs

6. The variable x is called ___ of the for-loop
Ans. Index variable

7. ___ is a self-contained algorithm which is written for the purpose of connecting into another algorithm.
Ans. Procedure

8. A procedure, which can call itself, is said to be ___
Ans. Recursive procedure/algorithm

9. In order to find the shortest paths, one should find the cost of covering each of the ___ different paths covering the n given cities
Ans. n!

10. A ___ notation is a sort of dialect obtained by mixing some programming language constructs with natural language descriptions of algorithms
Ans. Pseudocode

11. A function f: R → R is said to be monotonically increasing if for x, y ∈ R and x ≤ y we have ___.
Ans. f(x) ≤ f(y)

12. ___ maps each real number x to the integer, which is the least of all integers greater than or equal to x.
Ans. Ceiling function

13. ___ is a function of two variables x and n where x is any non – negative real number and n is an integer.
Ans. Exponentiation function

14. Which of the following data structure is a non-linear type?
a. Strings
b. Lists
c. Stacks
d. None of the above
Ans: d. None of the above

15. The concept of ___ is needed in average – case analysis of algorithms
Ans. Mathematical Expectation

16. Starting from the basic instructions and operations and using structuring rules, we can calculate the ___ of a problem.
Ans. time complexity

17. The ___ provides asymptotic upper bound for a given function.
Ans. Notation O

18. To represent the hierarchical relationship between elements, which data structure is suitable?
a. Deque
b. Priority
c. Tree
d. All of the above
Ans: c. Tree

19. Identify the data structure which allows deletions at both ends of the list but insertion at only one end.
a. Input-restricted deque
b. Output-restricted deque
c. Priority queues
d. None of the above
Ans: a. Input-restricted deque

20. ___ uses a left-justified binary tree to sort the elements.
Ans. heap sort

21. Which of the following data structure is a linear type?
a. Strings
b. Lists
c. Queues
d. All of the above
Ans: d. All of the above

22. Which data structure allows deleting data elements from the front and inserting them at the rear?
a. Stacks
b. Queues
c. Deques
d. Binary search tree
Ans: b. Queues

23. A good way of keeping track of ___ is to build a tree by adding a node each time a new call is made.
Ans. Recursive calls

24. When converting binary tree into extended binary tree, all the original nodes in binary tree are
a. internal nodes on extended tree
b. external nodes on extended tree
c. vanished on extended tree
d. None of the above
Ans: a. internal nodes on extended tree

25. A binary tree whose every node has either zero or two children is called
a. Complete binary tree
b. Binary search tree
c. Extended binary tree
d. None of the above
Ans: c. Extended binary tree

26. ___ searching technique can be applied if the given set is unordered.
Ans. linear search

27. Pick the correct option:
Which algorithm uses the MID value to search:
a) Binary
b) Linear
c) Heap
d) Merge
Ans. a) Binary

28. Which of the following sorting algorithm is of divide-and-conquer type?
a. Bubble sort
b. Insertion sort
c. Quicksort
d. All of above
Ans: c. Quicksort

29. The post-order traversal of a binary tree is DEBFCA. Find out the pre-order traversal
a. ABFCDE
c. ABDECF
d. ABDCEF
Ans: c. ABDECF

30. ___ is a Boolean-valued function that determines whether x can be included in the solution vector.
Ans. Feasible

31. Dynamic programming algorithms often have a ___
Ans. Polynomial complexity

32. A multistage graph G = (V, E) is a directed graph in which the vertices are ___ into K ≥ 2 disjoint sets Vi, 1 ≤ i ≤ k.
Ans. partitioned

33. The time needed by All paths is easy to determine, because the looping is ___ of the data in the matrix.
Ans. independent

34. A ___ of G is a directed simple cycle that includes every vertex in V.
Ans. tour

35. If ___, then Greedy knapsack algorithm generates an optimal solution to the given instance of the knapsack problem.
Ans. p1/w1 ≥ p2/w2 ≥…..≥ pn/wn

36. Each node in a tree has three fields ___, ___ and ___
Ans. lchild, rchild and weight.

37. The shortest path between v0 and some other node v is an ___ among a subset of the edges.
Ans. ordering

38. The time taken by the algorithm on graph with n vertices is ___.
Ans. O(n2)

39. A greedy approach to building the required permutation would choose the next program on the basis of some ___.
Ans. Optimization measure

40. The ordering defined by ij=j, 1 ≤ j ≤ n, ___ the d value.
Ans. Minimizes

41. The profits and weights are ___ numbers.
Ans. Positive

42. The in-order traversal of tree will yield a sorted listing of elements of the tree in.
a. Binary trees
b. Binary search trees
c. Heaps
d. None of the above
Ans: b. Binary search trees

43. An algorithm that calls itself directly or indirectly is known as.
a. Sub algorithm
b. Recursion
c. Polish notation
d. Traversal algorithm
Ans: b. Recursion

44. A connected graph T without any cycles is called.
a. a tree graph
b. free tree
c. a tree
d. All of the above
Ans: d. All of the above

45. Given positive numbers wi, 1 ≤ i ≤ n, and m, the problem calls for finding all –––– of the wi whose sums are m.
Ans. Subsets

46. In a graph if e=[u, v], Then u and v are called
a. endpoints of e
c. neighbours
d. all of above
Ans: d. all of above

47. ___ are rules that restrict each xi, to take a value only from a given set.
Ans. Explicit constraints

48. In a graph if e=(u, v) means
a. u is adjacent to v but v is not adjacent to u
b. e begins at u and ends at v
c. u is processor and v is successor
d. both b and c
Ans: d. both b and c

49. If every node u in G is adjacent to every other node v in G, A graph is said to be
a. isolated
b. complete
c. finite
d. strongly connected
Ans: b. complete

50. The memory address of the first element of an array is called