CSC-1110 Quiz 4

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

________ is the process of inspecting data that has been input into a program in order to ensure that the data is valid before it is used in a computation. A) Data validation B) Input validation C) Correcting data D) Correcting input

B) Input validation

In Python, the variable in the for clause is referred to as the ________ because it is the target of an assignment at the beginning of each loop iteration. A) loop variable B) target variable C) count variable D) for variable

B) target variable

When will the following loop terminate?while keep_on_going != 999: A) when keep_on_going refers to a value equal to 999 B) when keep_on_going refers to a value not equal to 999 C) when keep_on_going refers to a value greater than 999 D) when keep_on_going refers to a value less than 999

B) when keep_on_going refers to a value not equal to 999

What will be displayed after the following code is executed? for num in range(0, 20, 5): num += num print(num) A) 0 5 10 15 20 B) 5 10 15 C) 30 D) 25

C) 30

What will be displayed after the following code is executed? total = 0 for count in range(1,4): total += count print(total) A) 6 B) 5 C) 1 4 D) 1 ---3 ---6

D) 1 ---3 ---6

In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called A) sequence B) variable C) value D) list

D) List

Which of the following represents an example to calculate the sum of numbers (that is, an accumulator), given that the number is stored in the variable number and the total is stored in the variable total? A) total + number = total B) total = number C) number += number D) total += number

D) total += number

Both of the following for clauses would generate the same number of loop iterations. for num in range(4): for num in range(1, 5):

False

Functions can be called from statements in the body of a loop and loops can be called from within the body of a function.

False

In Python, an infinite loop usually occurs when the computer accesses an incorrect memory address.

False

The first line in a while loop is referred to as the condition clause.

False

A good way to repeatedly perform an operation is to write the statements for the task once and then place the statements in a loop that will repeat as many times as necessary.

True

In a nested loop, the inner loop goes through all of its iterations for each iteration of the outer loop.

True

Reducing duplication of code is one of the advantages of using a loop structure.

True

To get the total number of iterations in a nested loop, add the number of iterations in the inner loop to the number in the outer loop.

True


Kaugnay na mga set ng pag-aaral

Chapter 12: Marketing Channels: Delivering Customer Values

View Set

Chapter 3 Review - Gross Income: Inclusions and Exclusions

View Set

SOC101 Chapter 9 Constructing Gender and Sexuality

View Set

Ch. 1 of Effective Supervisory Practices (Roles of the supervisor)

View Set

AWS Certified Solutions Architect Practice Exams

View Set

Chapter 8: Thinking, Language, and Intelligence

View Set