Filters
Question type

Study Flashcards

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)


A) X < 5
B) X > 4
C) X > 5

D) A) and C)
E) All of the above

Correct Answer

verifed

verified

Which of the following is an activity?


A) Algorithm
B) Program
C) Process

D) None of the above
E) All of the above

Correct Answer

verifed

verified

Which of the following does not print the same sequence of numbers as the others?


A) X \leftarrow 5
B) X \leftarrow 4
C) X \leftarrow 5
 Which of the following does not print the same sequence of numbers as the others? A)  X  \leftarrow  5 B)  X  \leftarrow  4 C)  X  \leftarrow  5

D) All of the above
E) A) and B)

Correct Answer

verifed

verified

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


A) Which of the following set of instructions defines an algorithm in the formal, strict sense?  A)    B)    C)
B) Which of the following set of instructions defines an algorithm in the formal, strict sense?  A)    B)    C)
C) Which of the following set of instructions defines an algorithm in the formal, strict sense?  A)    B)    C)

D) A) and B)
E) None of the above

Correct Answer

verifed

verified

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?


A) Lewis
B) Pat
C) Tom

D) All of the above
E) A) and C)

Correct Answer

verifed

verified

Which of the following is not a way of representing algorithms?


A) Stepwise refinement
B) Pseudocode
C) Flowchart
D) Programming language

E) None of the above
F) A) and D)

Correct Answer

verifed

verified

In general, an algorithm in which of the following categories is considered more efficient?


A) Θ \varTheta (lg n)
B) Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( n2 )

E) A) and C)
F) B) and D)

Correct Answer

verifed

verified

Use a while loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive procedure. Use a while loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive procedure.

Correct Answer

verifed

verified

Rewrite the following routine using a pretest while statement. Rewrite the following routine using a pretest while statement.

Correct Answer

verifed

verified

One possib...

View Answer

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


A) Θ \varTheta (lg n)
B) Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( n2 )

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

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


A) Θ \varTheta (lg n)
B) F Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( n2 )

E) C) and D)
F) B) and D)

Correct Answer

verifed

verified

Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure?  Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure?   A)  X > 5 B)  X < 8 C)  X  \ge  5 D)  X  \le  6


A) X > 5
B) X < 8
C) X \ge 5
D) X \le 6

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

The pseudocode used in this chapter included both an if-then statement and an if-then-else statement. Show how the statement The pseudocode used in this chapter included both an if-then statement and an if-then-else statement. Show how the statement   can be simulated with a program segment using only if-then statements. can be simulated with a program segment using only if-then statements.

Correct Answer

verifed

verified

First pick a variable that does not alre...

View Answer

Showing 21 - 33 of 33

Related Exams

Show Answer