Python - Foundation programming

Ace your homework & exams now with Quizwiz!

What is the largest value that can be stored in one byte?

255

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

68

What type of loop structure repeats the code a specific number of times? A. Condition-controlled loop B. Boolean-controlled loop C. Response-controlled loop D. Number-controlled loop E. Count-controlled loop

E

Python allows you to compare strings, but it is not case sensitive.

F

Python formats all floating-point numbers to two decimal places when outputting using the print statement. T/F

F

The \t escape character advances the output to the next vertical tab.

F

Main memory is commonly known as ___.

RAM

What type of volatile memory is usually used only for temporary storage while running a program?

RAM

___ ___is a type of memory that can hold data for long periods of time, even when there is no power to the computer.

Secondary storage

A parameter is the variable which is part of the method's signature (method declaration). T/F

T

A value-returning function is like a simple function except that when it finishes it returns a value back to the called part of the program.T/F

T

An argument is an expression used when calling the method.T/F

T

Different functions can have local variables with the same names.

T

In Python, print statements written on separate lines do not necessarily output on separate lines.T/F

T

Nested decision structures are one way to test more than one condition.

T

One of the reasons not to use global variables is that it makes a program hard to understand.T/F

T

Python function names follow the same rules for naming variables. T/F

T

RAM is a volatile memory used for temporary storage while a program is running.T/F

T

The CPU understands instructions written in a binary machine language. T/F

T

It is recommended that programmers should avoid using ______ variables in a program when possible.

global

The statement is used to create a decision structure.

if

The Python _____ is a program that can read Python programming statements and execute them.

interpreter

A ___________ variable is created inside a function. A. global B. constant C. defined D. local E. None of the above

local

A disk drive stores data by encoding it onto a circular disk_______.

magnetically

A _____ operator determines whether a specific relationship exists between two values.

relational

A variable's __________ is the part of a program in which the variable may/may not be accessed.

scope

A _____ is a special value that marks the end of a sequence of items.

sentinel

A _____ is a name that represents a value stored in the computer's memory.

variable

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

**

In Python the _________ symbol is used as the equality operator. A. <= B. = C. != D. >= E. ==

==

The ____________ built-in function is used to read a number that has been typed on the keyboard. A. input() B. read() C. get() D. keyboard() E. None of the above

A

The first line in the function definition is known as the function __________. A. header B. block C. return D. parameter E. none of these

A

What is the following statement performing? num1, num2 = get_num() A. The function get_num() is expected to return two values - one for each of num1 and num2 B. The function get_num() is expected to return a single value, but to assign it to both num1 and num2 C. Statement will cause a syntax error D. Statement will cause a run-time error E. None of the above

A

When the function is called by its name then it is ___________. A. executed B. located C. defined D. exported

A

Which of the following is the correct if clause to use to determine whether choice is other than 10? A. if choice != 10: B. if choice != 10 C. if choice <> 10: D. if choice <> 10 E. None of the above

A

A Boolean variable can reference one of two values: _______________. A. Yes or No B. True or False C. T or F D. Y or N E. None of the above

B

A __________ structure is a logical design that controls the order in which a set of statements execute. A. function B. control C. sequence D. iteration E. None of the above

B

A set of statements that belong together as a group and contribute to the function definition is known as a ________________ A. Header B. Block C. Return D. parameter E. None of these

B

In a value-returning function, the value of the expression that follows the key word _________ will be sent back to the part of the program that called the function. A. Back B. Return C. Sent D. Def E. Result

B

What is the result of the following Boolean expression, if x is 5, y is 3, and z is 8? x < y and z > x A. true B. false C. 8 D. 5 E. None of the above

B

What type of error produces incorrect results but does not prevent the program from running? A. syntax B. logic C. grammatical D. human

B

When using the _______ operator, both subexpressions must be true for the compound expression to be true. A. or B. and C. not D. Any of the above E. None of the above

B

Which of these is not a major component of a typical computer system? A. Secondary storage devices B. Operating System C. Central processing unit D. Input and Output devices E. Main memory

B

A(n) _____________ is any piece of data that is passed into a function when the function is called. A. local B. global C. argument D. parameter E. scope

C

A value-returning function is: A. A group of statements that perform a specific task B. Called when you want to execute the function C. A function that will return a value back to the part of the program that called it D. All of the above

D

In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called a ___________. A. Sequence B. Variables C. Values D. List E. None of the above

D

Which computer language uses short words known as mnemonics for writing programs?

assembly

The term ________ stands for a binary digit.

bit

A _______expression in an if statement determines the actions to be performed.

boolean

A _______ expression is made up of two or more Boolean expressions.

compound

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

definition

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

escape

It is only necessary for one of the subexpressions to be true when using the operator_____.

or

A ______ is a set of instructions that a computer follows to perform a task.

program


Related study sets

Pharmacology Cardiovascular and Renal Medications

View Set

Unit 7 APUSH Terms with Significance

View Set

Florida statutes, rules, and regulations common to all lines

View Set

4. Ch3: Transport Layer - Exam 2, 5 - copy. Ch3: Transport Layer Cont., 6-copy. Ch4. Network Layer

View Set

Neat pathognomonics and cool stuff

View Set