INSY 3300 TEST 1

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

A(n) ________ expression has a value of either True or False.

Boolean

A ____ controlled loop uses a true/false condition to control the number of times that it repeats.

Condition

A _____ controlled loop repeats a specific number of times.

Count

A _____ structure can execute a set of statements only under certain circumstances.

Decision

/

Divides one number by another and gives the result as a floating-point number

//

Divides one number by another and gives the result as a whole number (int)

Each repetition of a loop is known as a(n) ______________.

Iteration

A is a Boolean variable that signals when some condition exists in the program.

flag

GIGO stands for ______________________.

garbage in, garbage out

You use a(n) ____ statement to write a single alternative decision structure.

if

'.2f'

-The .2 specifies the precision. It indicates that we want to round the number to two decimal places. -The f specifies that the data type of the number we are formatting is a floating-point number."

Explain what is meant by the term conditionally executed

A conditionally executed statement is performed only when a certain condition is true.

What is a flag and how does it work?

A flag is a variable that singnal when some condition exists in the program. When the flag variable is set to False, it indicates the condition does not exist. When tha flag variable is set to True, it means the condition does exist.

end=' '

A keyword parameter for the print() function that causes the function to NOT add a newline at the end of the string.

Void Function

A void function is a group of statements that exist within a program for the purpose of performing a specific task.

A program can be made of only one type of control structure. You cannot combine structures.

False

A single alternative decision structure tests a condition and then takes one path if the condition is true, or another path if the condition is false.

False

True or False: A condition-controlled loop always repeats a specific number of times.

False

True or False: It is not necessary to initialize accumulator variables.

False

True or False: To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.

False

True or False: To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops. false True or False: The process of input validation works as follows: when the user of a program enters invalid data, the program should ask the user "Are you sure you meant to enter that?" If the user answers "yes," the program should accept the data.

False

You can write any program using only sequence structures.

False

What type of value does the "random" function return?

Floating point in the range of 0.0 up to 1.0 (but not including 1.0)

What type of value does the "uniform" function return?

Floating point. It also allows you to specify the range of values returned.

Explain when you would use a case structure (a type of multiple alternative decision structure)

If you need to test the value of a variable and use that value to determine which statement or set of statements to execute

A(n) ______________________ loop has no way of ending and repeats until the program is interrupted.

Infinite

What type of value do the functions "randint" and "randrange" return?

Integer

When determing whether a number is inside a range, which logical operator is it best to use?

The AND operator

Briefly describe how the AND operator works.

The AND operator connects two Boolean expressions into one compound expression. Both subexpressions must be true for the compound expression to be true.

Briefly describe how the OR operator works.

The OR operator connects two Boolean expressions into one compound expression. One or both subexpressions must be true for the compound expression to be true. It is only necessary for one of the expressions to be true, and it does not matter which.

A compound Boolean expression created with the and operator is true only when both subexpressions are true.

True

A decision structure can be nested inside another decision structure.

True

True or False: In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop.

True

True or False: The following statement subtracts 1 from x : x = x - 1

True

True or False: The while loop is a pretest loop.

True

Explain when to use a dual alternative decision structure

You need to test a condition and then execute one set of statements if the condition is true. If the condition is false, you need to execute a different set of statements.

A(n) ________________ variable keeps a running total.

accumulator

A compound Boolean expression created with this operator is true only if both of its subexpressions are true.

and

The -= operator is an example of a(n) ______ operator.

augmented assignment

A(n) ___________________ tests a condition and then takes one path if the condition is true, or another path if the condition is false.

dual alternative decision structure

Validation loops are also known as ___________________.

error traps

You use a(n) _________ statement to write a dual alternative decision structure.

if-else

The integrity of a program's output is only as good as the integrity of the program's _____________________.

input

and, or, and not are __________ operators.

logical

This operator takes a Boolean expression as its operand and reverses its logical value.

not

A compound Boolean expression created with this operator is true if either of its subexpressions is true.

or

The while loop is a ________________ type of loop.

pretest

The input operation that appears just before a validation loop is known as the ________________________.

priming read

Which of the following will display 20%?

print(format(0.2, '.0%')) <enter>

The symbols >, <, and == are all ___________ operators.

relational

A(n) ________________ is a special value that signals when there are no more items from a list of items to be processed. This value cannot be mistaken as an item from the list.

sentinel

A ________________structure provides one alternative path of execution.

single alternative

IPO

stands for input, processing, and output, and an IPO chart describes the input, processing, and output of a function.

script mode

the interpreter reads the contents of a file that contains Python statements. Such a file is known as a Python program or a Python script.

interactive mode

the interpreter waits for you to type Python statements on the keyboard. Once you type a statement, the interpreter executes it and then waits for you to type another statement. When the Python interpreter is running in interactive mode, it is commonly called the Python shell.


संबंधित स्टडी सेट्स

Postpartum at Risk, Postpartum, 312 Exam 4

View Set

VARCAROLIS Chapter 21: Child, Older Adult, and Intimate Partner Violence

View Set

Topics 7,8 Practice for Final Exam

View Set

CNA practice quiz ( some answers could be a a bit off)

View Set