Set 6

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

D. While loop

A program should continue accepting input numbers, adding each to a sum, until a 0 is input. Which control structure should be used? A. If statement B. For loop C. Multiple if statements D. While loop

D. 'Hello' will print indefinitely.

A programmer has developed the following code: count = 0 while count is less than 5: print 'Hello' What is the result of implementing this code? A. 'Hello' will print four times. B. 'Hello' will print five times. C. The program will throw an error. D. 'Hello' will print indefinitely.

D. Testing

After a programmer is done writing a program, another person runs the program hundreds of times, each time with different input, checking that each run yields correct output. Which phase of a waterfall approach is the person carrying out? A. Analysis B. Design C. Implementation D. Testing

D. Input 99, 0, 5. Ensure output is "Not OK."

An algorithm should output "OK" if a list's numbers are all non-zero, else the output is "Not OK." Which test is a valid test of the algorithm? A. Input 0, 0, 0. Ensure output is "OK." B. Input 5, 4, 0. Ensure output is "OK." C. Input -3, -2, 5. Ensure output is "Not OK." D. Input 99, 0, 5. Ensure output is "Not OK."

D. Testing

Which phase of an agile approach would define a hypothesis to find a problem in a program? A. Analysis B. Design C. Implementation D. Testing

B. Insert key, turn key, open door.

Which text represents an algorithm? A. Cats and dogs have tails. B. Insert key, turn key, open door. C. The forecast for tomorrow is rain. D. A box has balls, bats, and hats.

A. Shake bulb; if it rattles, replace it.

Which text represents an algorithm? A. Shake bulb; if it rattles, replace it. B. Water is wet; fire is not wet. C. Staring at the sun hurts the eyes. D. The max speed is 60 mph.

C. Do-while loop

Joe is building an online game. He wants to provide a riddle and have the player guess the answer. The game needs to prompt the user to enter the answer, check to see if it the input provided does not match the correct answer, and continue prompting the user until the answer entered matches the correct answer. Which control structure supports Joe's needs? A. For loop B. While loop C. Do-while loop D. If-else branch

B. i < 20

What is the loop expression in the following pseudocode? i = 0 while i < 20 Put i to output i = i + 1 A. i B. i < 20 C. i = 0 D. i = i + 1

A. y = 0

What is the loop variable initialization in the following pseudocode? y = 0 s = 100.0 while y < 10 s = s + (s * 5.0) y = y + 1 A. y = 0 B. y = y + 1 C. s = 100.0 D. s = s + ( s * 5.0)

B. Before writing a program to solve the problem

When should a programmer develop an algorithm to solve a problem? A. Before knowing the problem B. Before writing a program to solve the problem C. While writing a program to solve the problem D. After writing a program to solve the problem

A. System's classes, attributes, and methods and their features, constraints, and relationships

Which elements are characteristic of a class diagram? A. System's classes, attributes, and methods and their features, constraints, and relationships B. Flow of logic and process interaction within a system C. Physical resources or logical architecture of a system D. Internal structure of a class and collaboration between classes or instances

A. Analysis

Which phase of a waterfall approach defines a program's goals? A. Analysis B. Design C. Implementation D. Testing

D. Testing

Which phase of a waterfall approach would create a sequence diagram that specifies the required order of events between completed program components? A. Analysis B. Design C. Implementation D. Testing

B. Design

Which phase of an agile approach would create a list of components needed to build an online auction site? A. Analysis B. Design C. Implementation D. Testing

C. Implementation

Which phase of an agile approach would create an executable program? A. Analysis B. Design C. Implementation D. Testing

C. At least one integer is negative.

What does an output of 1 indicate for the following algorithm running on a five-element list of integers? i = 0 x = 0 while i < 5 if list[i] < 0 x = 1 i = i + 1 Put x to output A. All integers are positive. B. All integers are negative. C. At least one integer is negative. D. At least one integer is positive.

D. Outputs Goodbye when user types -1

What does the following algorithm accomplish? x = Get next input if x == -1 Put "Goodbye" to output A. Outputs -1 when user types any input B. Outputs "x" when user types -1 C. Outputs -1 when x is positive D. Outputs Goodbye when user types -1

A. Whether x and y are the same

What does the following algorithm determine? if x == y z = 1 else z = 0 A. Whether x and y are the same B. Whether x and y are negative C. Whether x is 1 D. Whether x is 0

D. 3 2 1

What is put to output by the following pseudocode? x = 3 do Put x to output Put " " to output x = x - 1 while x > 0 A. 3 2 1 0 B. 3 2 1 0 -1 C. 2 1 0 D. 3 2 1


Kaugnay na mga set ng pag-aaral

The Integumentary System Structure & Function

View Set

Congenital Heart Defect Practice Questions (Test #4, Fall 2020)

View Set

Chapter 32 Environmental Emergencies

View Set

Psychology of Women (PSYC 300) Exam 2

View Set