CIS 202

¡Supera tus tareas y exámenes ahora con Quizwiz!

What are the values that the variable num contains through the iterations of the following for loop?for num in range(4):

0,1,2,3

What is the output of the following code?val = 123456.789print(f'{val:,.2f}')

123,456.79

What is the output of the following code?val = 123.456789print(f'{val:.3f}')

123.457

What are the values that the variable num contains through the iterations of the following for loop?for num in range(2, 9, 2):

2,4,6,8

In Python the __________ symbol is used as the equality operator.

==

What is the output of the following statement?print('I\'m ready to begin')

I'm ready to begin

__________ 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.

Input validation

What does the following program do?student = 1while student <= 3: total = 0for score in range(1, 4): score = int(input("Enter test score: ")) total += scoreaverage = total/3print("Student ", student, "average: ", average)student += 1

It accepts 3 test scores for each of 3 students and outputs the average for each student.

What is the output of the following statement?print('One' 'Two' 'Three')

OneTwoThree

The line continuation character is a

\

A variable used to keep a running total is called a(n)

accumulator

In a print statement, you can set the __________ argument to a space or empty string to stop the output from advancing to a new line.

end

A(n) __________ is a diagram that graphically depicts the steps that take place in a program?

flowchart

Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive?

if y >= 10 and y <= 50:

The __________ built-in function is used to read a number that has been typed on the keyboard.

input()

The __________ function reads a piece of data that has been entered at the keyboard and returns that piece of data, as a string, back to the program.

input()

When using the __________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.

or

Which of the following will display 20%?

print(f'{0.2:.0%}')

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.

target variable

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?

total += number

When will the following loop terminate?while keep_going != 999:

when keep_going refers to a value equal to 999

What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8?x < y and z > x

False

What is the result of the following Boolean expression, given that x = 5, y = 3, and z= 8?not (x < y or z > x) and y < z

False

What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8?x < y or z > x

True

A Boolean variable can reference one of two values which are

True or False

What symbol is used to mark the beginning and end of a string?

a quote mark (")

When using the __________ logical operator, both subexpressions must be true for the compound expression to be true.

and

Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions.

compound

What type of loop structure repeats the code based on the value of Boolean expression?

condition-controlled loop

A(n) __________ structure is a logical design that controls the order in which a set of statements execute.

control

What type of loop structure repeats the code a specific number of times?

count-controlled loop

Write nested decision structures that perform the following: If amount1 is greater than 10 and amount2 is less than 100, display the lesser of amount1 and amount2.

if amount1 > 10 and amount2 < 100:if amount1 < amount2:print (amount1)elif amount2 < amount1:print (amount2)else:print('Both values are the same.')

Which of the following is the correct if clause to determine whether choice is anything other than 10?

if choice != 10

Write an if-else statement that determines whether the points variable is outside the range of 1 to 10. If the variable's value is outside this range it should display "Invalid points." Otherwise, it should display "Valid points."

if points < 1 or points > 10:print ('Invalid points')else:print ('Valid points')

Which logical operators perform short-circuit evaluation?

or, and

The first operation is called the __________ and its purpose is to get the first input value that will be tested by the validation loop.

priming read

What is the informal language, used by programmers use to create models of programs, that has no syntax rules and is not meant to be compiled or executed?

pseudocode

A(n) __________ structure is a structure that causes a statement or a set of statements to execute repeatedly.

repetition

What does the following expression mean?x <= y

x is less than or equal to y

n Python the __________ symbol is used as the not-equal-to operator.

!=

Which mathematical operator is used to raise 5 to the second power in Python?

**

What is the output of the following statement, given that value1 = 2.0 and value2 = 12?print(value1 * value2)

24.0

What will be displayed after the following code is executed?for num in range(0, 20, 5):num += numprint(num)

30

What will be displayed after the following code is executed?total = 0for count in range(4,6):total += countprint(total)

4 9

What will be displayed after the following code is executed?total = 0for count in range(1,4):total += countprint(total)

6

After the execution of the following statement, the variable price will reference the value __________.price = int(68.549)

68

Which of the following is not an augmented assignment operator?

<=

What is the output of the following statement?print('The path is D:\\sample\\test.')

The path is D:\sample\test.

What will be displayed after the following code is executed?count = 4while count < 12:print("counting")count = count + 2

counting counting counting counting

After the execution of the following statement, the variable sold will reference the numeric literal value as (n) __________ data type. sold = 256.752

float

In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called

list


Conjuntos de estudio relacionados

PSCS 3111 - Midterm Exam (Chapters 1-6)

View Set

Reproductive System Chapter 28 Mastering 28.2

View Set

Substance Abuse & Counseling, Exam 2

View Set

Course Point - Ch. 15 Evaluation

View Set