Programming Final

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

In Python the ________ symbol is used as the not-equal-to operator.

!=

When applying the .3f formatting specifier to the number 76.15854, the result is ________.

(76.159)

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

**

In Python, a module's file name should end in ________.

.py

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 will be displayed after the following code is executed? def pass_it(x, y):z = x*yresult = get_result(z) return(result) def get_result(number): z = number + 2 return(z)num1 = 3 num2 = 4answer = pass_it(num1, num2) print(answer)

14

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

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

24

What will display after the following code is executed? def main(): print("The answer is", magic(5)) def magic(num):answer = num + 2 * 10return answermain()

25

What will display after the following code is executed? def main():print("The answer is", magic(5)) def magic(num):answer = num + 2 * 10return answermain()

25

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

6

What will be the output after the following code is executed? def pass_it(x, y): z = y**xreturn(z)num1 = 3 num2 = 4answer = pass_it(num1, num2) print(answer)

64

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

68

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

==

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

And

Which of the following will display 20%?

B) print(format(0.2, '.0%'))

What type of function can be used to determine whether a number is even or odd?

Boolean

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

C) counting counting counting counting

A(n) ________ expression is made up of two or more Boolean expressions.

Compound

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

Compound

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

Control

The decision structure that has two possible paths of execution is known as

Dual Alternative

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

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

The ________ specifier is a special set of characters that specify how a value should be formatted. Answer:

Formatting

The acronym ________ refers to the fact that the computer cannot tell the difference between good data and bad data.

GIGO

It is recommended that programmers avoid using ________ variables in a program whenever possible.

Global

The first line in a function definition is known as the function

Header

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

I'm ready to begin

A ________ is a name that represents a value the cannot be changed during a program's execution.

Named Constant

In the expression 12.45 + 3.6, the values to the right and left of the + symbol are the ________.

Opperands

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

Repetition

A(n) ________ is a single task that the program must perform in order to satisfy the customer.

Software Requirement

What does the following statement mean? num1, num2 = get_num()

The function get_num() is expected to return a value for num1 and for num2.

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

The path is D:\sample\test.

A Boolean variable can reference one of two values which are

True Or False

A(n) ________ is a name that represents a value stored in the computer's memory

Variable

The line continuation character is a

\

A value-returning function is

a function that will return a value back to the part of the program that called it

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

a quote mark(")

When the + operator is used with two strings, it performs string ________.

concatenation

A(n) ________-controlled loop causes a statement or set of statements to repeat as long as the condition is true.

condition

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

condition-controlled loop

In a decision structure, the action is ________ executed because it is performed only when a specific condition is true.

conditionally

Python uses ________ to categorize values in memory.

data types

The function header begins with the keyword ________ and is followed by the name of the function.

def

The code for a function is known as a function ________.

defenition

In flowcharting, the ________ symbol is used to represent a Boolean expression.

diamond

To refer to a function in a module, Python uses ________ notation.

dot

When a function is called by its name during the execution of a program, then it is

executed

Boolean variables are commonly used as ________ to indicate whether a specific condition exists.

flags

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

float

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

flowchart

In Python, you would use the ________ statement to write a count-controlled loop.

for

A(n) ________ chart is a visual representation of the relationships between functions.

hierarchy

The ________ statement is used to create a decision structure.

if

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

if choice != 10:

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:

Python provides a special version of a decision structure known as the ________ statement, which makes the logic of the nested decision structure simpler to write.

if-elif-else

A(n) ________ statement will execute one block of statements if its condition is true or another block if its condition is false.

if-else

A(n) ________ loop usually occurs when the programmer does not include code inside the loop that makes the test condition false.

infinite

A(n) ________ validation loop is sometimes called an error trap or an error handler.

input

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()

The Python library functions that are built into the Python ________ can be used by simply calling the required function.

interpreter

The main function contains a program's ________ logic which is the overall logic of the program.

mainline

The Python standard library's ________ module contains numerous functions that can be used in mathematical calculations.

math

The approach known as ________ makes a program easier to understand, test, and maintain.

modularization

Functions that are in the standard library are stored in files that are known as ________.

modules

The % symbol is the remainder operator, also known as the ________ operator.

modulus,mod

Which of the following will assign a random integer in the range of 1 through 50 to the variable number?

number = random.randint(1, 50)

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

or

Which logical operators perform short-circuit evaluation?

or, and

A(n) ________ is a variable that receives an argument that is passed into a function.

parameter

Arguments are passed by ________ to the corresponding parameter variables in a function.

position

The while loop is known as a(n) ________ loop because it tests the condition before performing an iteration.

pretest

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

The ________ function is a built-in function that generates a list of integer values.

range

In a flowchart, a function call is depicted by a(n) ________.

rectangle

A(n) ________ operator determines whether a specific relationship exists between two values.

relational

(n) ________ structure causes a set of statements to execute repeatedly.

repetition

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

repetition

A value-returning function has a(n) ________ statement that sends a value back to the part of the program that called it.

return

In a value-returning function, the value of the expression that follows the keyword ________ will be sent back to the part of the program that called the function.

return

A(n) ________ total is a sum of numbers that accumulates with each iteration of the loop.

running

A variable is available only to statements in the variable's ________.

scope

The ________ of a local variable is the function in which that variable is created.

scope

A(n) ________ is a special value that marks the end of a sequence of items.

sentinel

A(n) ________ character is a special character that is preceded with a backslash (\), appearing inside a string literal.

spacing

Python comes with ________ functions that have already been prewritten for the programmer.

standard

The top-down design breaks down the overall task of a program into a series of ________.

subtasks

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

The ________ design technique can be used to break down an algorithm into functions

top-down

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

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

true

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

when keep_on_going refers to a value equal to 999

What does the following expression mean? x <= y

x is less than or equal to y


Kaugnay na mga set ng pag-aaral

Financial Statement Analysis and Evaluation (1st part)

View Set

GOTD - Titanic, Mount Everest, Pompeji, World trade center

View Set

Chapter 5: Carbohydrates: Sugars, Starches, and Fiber

View Set