Docsity

IT24111 & Problem Solving Techniques: Comprehensive Advanced Exam on Algorithmic Paradigm, Exams of Nursing

Toggle sidebar
bg1
IT24111 & Problem Solving Techniques: Comprehensive Advanced
Exam on Algorithmic Paradigms, Computational Complexity,
Heuristic Search, Debugging, and Constraint Processing (
Week 23)
Questions 1–150 (Multiple Choice)
1. Which of the following best defines a greedy algorithm?
A) Explores all possible solutions systematically
B) Makes the locally optimal choice at each stage with the hope
offinding global optimum
C) Solves subproblems independently and combines them
D) Stores results of subproblems to avoid recomputation
Correct Answer: B
Rationale: Greedy algorithms choose the best immediate option,
not necessarily optimal globally.
2. In computational thinking, abstraction allows a programmer to:
A) Break a problem into smaller pieces
B) Ignore irrelevant details to focus on essential concepts
C) Recognize patterns across different problems
D) Design step‑by‑step instructions
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41

Partial preview of the text

Download IT24111 & Problem Solving Techniques: Comprehensive Advanced Exam on Algorithmic Paradigm and more Exams Nursing in PDF only on Docsity!

IT24111 & Problem Solving Techniques: Comprehensive Advanced Exam on Algorithmic Paradigms, Computational Complexity, Heuristic Search, Debugging, and Constraint Processing ( Week 23)

Questions 1–150 (Multiple Choice)

1. Which of the following best defines a greedy algorithm? A) Explores all possible solutions systematically B) Makes the locally optimal choice at each stage with the hope offinding global optimum C) Solves subproblems independently and combines them D) Stores results of subproblems to avoid recomputation Correct Answer: B Rationale: Greedy algorithms choose the best immediate option, not necessarily optimal globally. 2. In computational thinking, abstraction allows a programmer to: A) Break a problem into smaller pieces B) Ignore irrelevant details to focus on essential concepts C) Recognize patterns across different problems D) Design step‑by‑step instructions

Correct Answer: B Rationale: Abstraction hides complexity and highlights only relevant information.

3. Which search algorithm is optimal for a weighted graph with non‑negative edges? A) Depth‑first search B) Breadth‑first search C) Uniform cost search (Dijkstra) D) Greedy best‑first search Correct Answer: C Rationale: Uniform cost search expands node with lowest path cost; optimal for non‑negative weights. 4. The master theorem is used to solve recurrences of the form: A) T(n) = aT(n/b) + f(n) B) T(n) = T(n-1) + T(n-2) C) T(n) = nT(n/2) D) T(n) = √n T(√n) + n Correct Answer: A Rationale: Master theorem applies to divide‑and‑conquer recurrences.

C) Euclidean distance without considering obstacles D) Both B and C are admissible Correct Answer: D (both B and C are admissible) Rationale: Misplaced tiles ≤ true cost; Euclidean distance ≤ true cost (ignores obstacles).

8. A backtracking algorithm for N‑Queens prunes branches when: A) A queen is under attack B) A queen is placed safely C) All queens are placed D) No more rows exist Correct Answer: A Rationale: Pruning occurs when a partial assignment violates constraints. 9. The time complexity of the Bellman‑Ford algorithm on a graph with V vertices and E edges is: A) O(V + E) B) O(VE) C) O(V²) D) O(E log V)

Correct Answer: B Rationale: Bellman‑Ford relaxes all edges V‑1 times.

10. Which debugging technique is most effective for intermittent bugs in multi‑threaded code? A) Printf debugging B) Thread sanitizer (TSan) C) Single‑stepping with a debugger D) Code inspection without execution Correct Answer: B Rationale: Thread sanitizer detects data races and locking issues dynamically. 11. In constraint satisfaction problems (CSPs) , arc consistency (AC‑3) ensures: A) Every variable has at least one value B) For every binary constraint, each domain value has support inthe other domain C) All constraints are satisfied simultaneously D) The solution is unique Correct Answer: B Rationale: Arc consistency prunes unsupported values.

A) Prim’s algorithm B) Merge sort C) Dijkstra’s algorithm D) Floyd‑Warshall Correct Answer: B Rationale: Merge sort recursively splits, sorts halves, and merges.

15. What is the main advantage of iterative deepening depth‑first search (IDDFS) over BFS? A) Lower time complexity B) Lower memory usage (O(d) vs O(b^d)) C) Guarantees optimality for weighted graphs D) Works with infinite branching factor Correct Answer: B Rationale: IDDFS uses depth‑limited DFS repeatedly, memory O(d). 16. In genetic algorithms , the crossover operation: A) Randomly changes a single gene B) Combines genetic material from two parents C) Selects the fittest individuals D) Eliminates low‑fitness solutions Correct Answer: B

Rationale: Crossover produces offspring by exchanging genetic material.

17. Which of the following problems is not solvable in polynomial time? A) Finding a minimum spanning tree B) Determining if a graph has a Hamiltonian cycle C) Sorting a list of integers D) Finding the shortest path in a DAG Correct Answer: B Rationale: Hamiltonian cycle is NP‑complete; no polynomial algorithm known. 18. The P vs. NP question asks: A) Whether P = NP B) Whether NP = EXP C) Whether P NP D) Whether NP P Correct Answer: A Rationale: It asks if every problem verifiable in polynomial time is solvable in polynomial time.

Subset sum is a classic NP‑complete problem.

21. Which of the following is not a phase in Polya’s problem‑solving model? A) Understanding the problem B) Devising a plan C) Implementing the plan in code D) Looking back (review and extend) Correct Answer: C Rationale: Polya’s model predates coding; “carrying out the plan” is general, not coding‑specific. 22. The worst‑case time complexity of quicksort with median‑of‑three pivot selection is: A) O(n log n) guaranteed B) O(n²) still possible (e.g., all equal elements) C) O(n) D) O(log n) Correct Answer: B Rationale: Median‑of‑three reduces probability but worst case O(n²) remains.

Correct Answer: B Rationale:

23. In backtracking , the minimum remaining values (MRV) heuristic selects: A) The variable with the largest domain B) The variable with the fewest legal values C) The variable with the highest degree D) A random variable Correct Answer: B Rationale: MRV (fail‑first) chooses the most constrained variable. 24. The time complexity of Floyd‑Warshall’s all‑pairs shortest path algorithm is: A) O(V³) B) O(V²) C) O(VE) D) O(E log V) Correct Answer: A Rationale: Three nested loops over all vertices. 25. Which of the following is an in‑place sorting algorithm? A) Merge sort (standard) B) Heapsort

Correct Answer: B Rationale: Correct Answer: A Rationale: Formula 2ⁿ − 1 → 2⁵ − 1 = 31.

28. Which of the following is a metaheuristic optimization algorithm? A) Dijkstra’s algorithm B) Simulated annealing C) Merge sort D) Binary search Correct Answer: B Rationale: Simulated annealing is a metaheuristic; others are exact or deterministic. 29. The Rabin‑Karp string matching algorithm uses: A) A failure function (LPS) B) Rolling hash to compare substrings C) Two pointers moving toward each other D) Suffix arrays Correct Answer: B Rationale: Rabin‑Karp uses a hash function to compare patterns in O(1) average.

30. In dynamic programming , the principle of optimality states: A) Greedy choice leads to optimal solution B) An optimal solution contains optimal solutions to subproblems C) Subproblems must be independent D) Memoization is mandatory Optimal substructure is required for DP. 31. Which of the following is admissible for A* in grid pathfinding with 4‑directional movement? A) Manhattan distance B) Euclidean distance C) Chebyshev distance D) All of the above are admissible Correct Answer: D Rationale: All three never overestimate the true path length (with appropriate movement rules). 32. The time complexity of the KMP (Knuth‑Morris‑Pratt) string matching algorithm (text length n, pattern length m) is: A) O(n + m) B) O(nm) C) O(m log n)

35. The minimum spanning tree of a graph can be found by: A) Dijkstra’s algorithm B) Prim’s algorithm C) Bellman‑Ford algorithm D) Floyd‑Warshall algorithm Correct Answer: B Rationale: Prim’s algorithm builds MST by adding the cheapest

edge from the tree.

36. The worst‑case time complexity of binary search in a sorted array of size n is: A) O(n) B) O(log n) C) O(n log n) D) O(1) Correct Answer: B Rationale: Each comparison halves the search space. 37. In backtracking , the least constraining value (LCV) heuristic chooses: A) The value that rules out the fewest choices for neighbors B) The value with the smallest domain C) A random value D) The value that appears most frequently Correct Answer: A Rationale: LCV leaves maximum flexibility for future assignments.

D) Selection sort Correct Answer: C Rationale: Insertion sort preserves relative order of equal keys.

41. In genetic algorithms , elitism ensures: A) The worst individual is removed B) The best individual(s) survive to next generation unchanged C) Mutation rate increases D) Crossover is avoided Correct Answer: B Rationale: Elitism prevents loss of the best solution. 42. The time complexity of the Edmonds‑Karp (BFS‑based Ford‑Fulkerson) algorithm is: A) O(VE²) B) O(V²E) C) O(E log V) D) O(V + E) Correct Answer: A Rationale: Edmonds‑Karp runs in O(VE²) because each BFS is O(E) and up to O(VE) augmentations.

43. In problem decomposition , high coupling between subproblems indicates: A) Subproblems are independent and easy to solve B) Subproblems are strongly interdependent, making separatesolving difficult C) The problem is trivial D) The solution is optimal Correct Answer: B Rationale: High coupling means changes in one subproblem affect others. 44. The edit distance (Levenshtein) between “kitten” and “sitting” is: A) 2 B) 3 C) 4 D) 5 Correct Answer: B Rationale: kitten → sitten (substitute k→s), sittin (substitute e→i), sitting (insert g) = 3. 45. Which of the following is not a requirement for a consistent heuristic?