Q#1: What is the key difference between recursion and a loop structure in implementing repetitive activities?
(A) Recursion repeats a set of instructions in a circular manner.
(B) A loop involves repeating a subtask of itself.
(C) Recursion always results in faster execution.
(D) A loop involves calling multiple functions.
Answer: (B) A loop involves repeating a subtask of itself
Q#2: In the context of searching a dictionary, what approach does the text suggest for narrowing down the search quickly?
(A) Start at the beginning of the dictionary
(B) Open to a random page
(C) Begin with the middle entry
(D) Randomly pick entries
Answer: (C) Begin with the middle entry
Q#3: How does the binary search algorithm restrict the search process after each step?
(A) It always searches the entire list
(B) It restricts the search to the first half of the list
(C) It restricts the search to the second half of the list
(D) It narrows the search to a random portion of the list
Answer: (B) It restricts the search to the first half of the list
Q#4: What type of control is used to ensure that a recursive algorithm terminates properly?
(A) Loop control
(B) Initialization control
(C) Modification control
(D) Termination control
Answer: (D) Termination control
Q#5: What is the primary purpose of the initialization phase in repetitive control?
(A) To test for termination
(B) To create new activations
(C) To narrow down the search
(D) To establish a starting condition
Answer: (D) To establish a starting condition
Q#6: In the binary search algorithm, what is considered the termination condition?
(A) Finding the target value
(B) Reaching the end of the list
(C) Creating new activations
(D) Establishing a starting condition
Answer: (A) Finding the target value
Q#7: Which algorithm, the sequential search or the binary search, would be more efficient for searching a list of 30,000 entries?
(A) Sequential search
(B) Binary search
(C) Both are equally efficient
(D) Neither is efficient
Answer: (B) Binary search
Q#8: How does the binary search algorithm restrict the number of entries to consider after each step?
(A) It halves the number of entries
(B) It reduces the entries by one
(C) It always searches the entire list
(D) It depends on the target value
Answer: (A) It halves the number of entries
Q#9: What is the primary focus of algorithm analysis in computer science?
(A) Evaluating the efficiency of hardware
(B) Evaluating the correctness of software
(C) Evaluating the relative merits of alternative algorithms
(D) Evaluating the number of computer scientists
Answer: (C) Evaluating the relative merits of alternative algorithms
Q#10: What does “log2 n” represent in the context of algorithm analysis?
(A) The base two logarithm of n
(B) The number of iterations in a loop
(C) The number of recursive calls
(D) The total time required for execution
Answer: (A) The base two logarithm of n
Q#11: What is the significance of “algorithm analysis” in computer science?
(A) Evaluating the correctness of algorithms
(B) Comparing hardware specifications
(C) Evaluating the efficiency of algorithms
(D) Analyzing computer program syntax
Answer: (C) Evaluating the efficiency of algorithms
Q#12: Which phase of problem-solving involves evaluating the solution for accuracy and potential use in solving other problems?
(A) The first phase
(B) The second phase
(C) The third phase
(D) The fourth phase
Answer: (D) The fourth phase
Q#13: In the problem of cutting a chain of links, how many cuts are initially required to solve it optimally?
(A) Three cuts
(B) Two cuts
(C) One cut
(D) Four cuts
Answer: (C) One cut
Q#14: What distinguishes a program that is believed to be correct from one that is truly correct?
(A) Belief in its correctness
(B) Testing with known inputs
(C) Verification through efficient techniques
(D) The number of lines of code
Answer: (C) Verification through efficient techniques
Q#15: What is the importance of software verification in the context of programming?
(A) It ensures that software is believed to be correct
(B) It guarantees that software is always correct
(C) It identifies unforeseen issues in the software
(D) It speeds up the execution of software
Answer: (C) It identifies unforeseen issues in the software
Q#16: What is the main focus of research in computer science concerning software verification?
(A) Identifying the most complex algorithms
(B) Creating new programming languages
(C) Developing software without bugs
(D) Efficient verification techniques
Answer: (D) Efficient verification techniques
Q#17: What is the potential downside of software that is “known” to be correct but fails in practice?
(A) It can lead to increased efficiency
(B) It can result in unexpected errors
(C) It can improve software performance
(D) It can be more complex
Answer: (B) It can result in unexpected errors
Q#18: In the context of algorithm analysis, what does the “worst-case scenario” refer to?
(A) The best possible outcome
(B) The average performance
(C) The most efficient solution
(D) The most challenging situation
Answer: (D) The most challenging situation
Q#19: How does the binary search algorithm restrict the search space after each step?
(A) It searches the entire list
(B) It always divides the list into equal halves
(C) It narrows down the search space to a fraction of the original list
(D) It randomly selects a portion of the list
Answer: (C) It narrows down the search space to a fraction of the original list
Q#20: What is the primary goal of algorithm analysis concerning algorithms for searching lists?
(A) To analyze specific lists of fixed lengths
(B) To determine the fastest algorithm
(C) To identify a formula indicating algorithm performance for arbitrary list lengths
(D) To evaluate the performance of different hardware configurations
Answer: (C) To identify a formula indicating algorithm performance for arbitrary list lengths