Exam 5: Algorithms

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

Vocabulary (Matching)Questions The following is a list of terms from the chapter along with descriptive phrases that can be used to produce questions (depending on the topics covered in your course)in which the students are ask to match phrases and terms.An example would be a question of the form,"In the blank next to each phrase,write the term from the following list that is best described by the phrase." Term Descriptive Phrase algorithm The fundamental concept in computer science pseudocode An informal notation for representing algorithms assignment statement A means of saving the result of a computation for future use if-else statement A means of producing different actions depending on a condition stepwise refinement A divide and conquer approach to problem solving loop invariant A statement that is true each time a specific point in a repetitive process is reached function A program segment isolated as a unit recursion The technique of applying a program segment within itself pretest loop Looks before it leaps proof of correctness A formal means of verifying software sequential search Less efficient than the binary method primitive A basic building block

(Short Answer)
4.8/5
(93)

Circle the portion of the program below in which control of the loop is initialized.Draw a rectangle around the portion in which the test for termination is performed.Underline the portion in which the state of the loop is moved toward the termination condition. X = 3 while (X < 9): X = X + 1

(Short Answer)
4.8/5
(99)

If numeric values are represented in two's complement notation,does the following program represent an infinite process? Explain your answer. X = 2 while (X > 0): X = X + 1

(Essay)
4.8/5
(76)

Which of the sequential or binary search algorithms would find the name Roger in the list John,Kelly,Lewis,Maurice,Nathan,Oliver,Pat,Quincy,Roger,Stan,Tom more quickly? _______________

(Short Answer)
5.0/5
(75)

Use a repeat loop rather than a while loop to accomplish the same results as the following program segment.Assume that X will have only integer values.(You may also use an if statement if you like.) while (<5): print () =+1

(Essay)
4.8/5
(73)

Which of the following lists would not be obtained at some point when applying the insertion sort algorithm to the list below? Sylvia Nancy Lois Alice

(Multiple Choice)
5.0/5
(67)

Under the assumption that N takes on only integer values,which of the following is the termination condition in the following recursive function? def xxx(N): If (N < 5): Xxx(N + 1) Else: Print(N)

(Multiple Choice)
4.9/5
(76)

Rewrite the following routine using a pretest while statement. repeat: print () =+1 until (>5)

(Essay)
4.8/5
(91)

Identify a flaw in the control of the following loop. =3 while (=8): =+2

(Essay)
4.9/5
(75)

Fill in the blank in the function below so that the function prints the integers from 0 up to the integer value it was given for N.That is,if the function is executed with the value of N being 3,it should print 0,1,2,3. def xxx(N): if (_________): xxx(N - 1) print(N)

(Short Answer)
4.9/5
(66)

Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure? X = 3 Repeat: X = X + 2 Until (X > 5)

(Multiple Choice)
4.9/5
(83)

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 binary search algorithm?

(Multiple Choice)
4.9/5
(79)

Use a while loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive function. def xxx(N): print (N) if (N<5): xxx(N+1)

(Essay)
4.8/5
(66)

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

(Multiple Choice)
4.9/5
(80)

Which of the following is an activity?

(Multiple Choice)
4.8/5
(79)

Which of the following set of instructions defines an algorithm in the formal,strict sense?

(Multiple Choice)
4.8/5
(81)

Do the following instructions define an algorithm? Explain your answer. Write down all the positive odd integers. Select the integer in the middle of the list. Print the even integer that is one less than the selected odd integer.

(Essay)
4.8/5
(80)

Which of the sequential or binary search algorithms would find the name Kelly in the list John,Kelly,Lewis,Maurice,Nathan,Oliver,Pat,Quincy,Roger,Stan,Tom more quickly? _______________

(Short Answer)
4.7/5
(84)

What sequence of values will be printed when the following instructions are executed? X = 5 if (X < 7): print(6) Y = 6 else: print(4) Y = 4 if (Y < 5): print(3) else: print(2) _______________________

(Short Answer)
4.9/5
(67)

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
(82)
Showing 21 - 40 of 53
close modal

Filters

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