Exam 5: Algorithms

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

The binary search algorithm is an example of an algorithm in which of the following classes?

(Multiple Choice)
4.8/5
(90)

What sequence of numbers would be printed if the function named xxx as described below were executed with the value of N being 2? def xxx (N): print(N) if (N < 3): yyy(4) print(N) def yyy(N): print(N) xxx(5) print(N) _____________________

(Short Answer)
4.9/5
(77)

Suppose the binary search algorithm was being used to search for the entry Tom in the list Nathan,Oliver,Pat,Quincy,Rodger,Stan,Tom A.What would be the first entry in the list to be considered? _____________ B.What would be the second entry in the list to be considered? _____________

(Short Answer)
4.9/5
(80)

List three of the primitives in the pseudocode developed in this chapter. ____________________ ____________________ ____________________

(Short Answer)
4.8/5
(61)

When searching within the list Lewis,Maurice,Nathan,Oliver,Pat,Quincy,Roger,Stan,Tom Which of the following entries will be found most quickly using the sequential search algorithm?

(Multiple Choice)
4.7/5
(76)

Under the assumption that X takes on only integer values,which of the following is the termination condition for the following loop? Repeat: . . . Until (X < 5)

(Multiple Choice)
4.7/5
(76)

The insertion sort algorithm is an example of an algorithm in which of the following classes?

(Multiple Choice)
4.8/5
(74)

Suppose the statement "X is an integer and X < 5" is a loop invariant at the point at which the test for termination is performed in the loop outlined below.What can be concluded about the value of X immediately after the loop is terminated? repeat: . . . until (>3)

(Short Answer)
4.8/5
(81)

Answer the following questions in terms of the function xxx below. def xxx(N): if (N < 7): print(N) else: N = n + 3 print(N) A.What value would be printed if the following function were executed with the value of N being 4? ____________ B.What value would be printed if the following function were executed with the value of N being 9? ____________

(Short Answer)
4.7/5
(82)

When searching for the entry X within the list R,S,T,U,V,W,Z how many entries will be considered before discovering that the entry is not present? (Note that the list is in alphabetical order.) ____________

(Short Answer)
4.8/5
(72)

Which of the following is the base case in the recursive function below? def xxx(N): If (N == 0): Print(N) Else: Xxx(N - 1)

(Multiple Choice)
4.8/5
(69)

What sequence of numbers would be printed if the following function were executed with the value of N being 0? def xxx(N): print(N) if (N < 2): xxx(N + 1) else: print(N) print(N) __________________

(Short Answer)
4.8/5
(78)

At most,how many entries in a list of 5000 names will be interrogated when using the sequential search algorithm? ___________

(Short Answer)
4.7/5
(72)
Showing 41 - 53 of 53
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)