Docsity

Python Exam 1: Multiple Choice Questions and Answers, Exams of Advanced Education

Toggle sidebar
bg1
Python Exam 1 Multiple Choice
Questions and Answers
The python standard library's ___________ module contains numerous
functions that can be used in mathematical calculations - ANSWERS-math
** - ANSWERS-exponent
What type of loop structure repeats the code a specific number of times -
ANSWERS-count controlled loop
what type of loop structure repeats the code based on the value of boolean
expression - ANSWERS-condition controlled loop
Augmented Assignment Operators - ANSWERS-+=, -=, *=, /=, %=
a variable used to keep a running total is called an - ANSWERS-accumulator
___________ 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 - ANSWERS-input validation
an _____________ structure is a structure that causes a statement or a set of -
ANSWERS-repitition
the first operation is called the ___________ and its purpose is to get the first
input value that will be tested by the validation loop - ANSWERS-priming read
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Python Exam 1: Multiple Choice Questions and Answers and more Exams Advanced Education in PDF only on Docsity!

Python Exam 1 Multiple Choice

Questions and Answers

The python standard library's ___________ module contains numerous functions that can be used in mathematical calculations - ANSWERS-math ** - ANSWERS-exponent What type of loop structure repeats the code a specific number of times - ANSWERS-count controlled loop what type of loop structure repeats the code based on the value of boolean expression - ANSWERS-condition controlled loop Augmented Assignment Operators - ANSWERS-+=, -=, *=, /=, %= a variable used to keep a running total is called an - ANSWERS-accumulator ___________ 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 - ANSWERS-input validation an _____________ structure is a structure that causes a statement or a set of - ANSWERS-repitition the first operation is called the ___________ and its purpose is to get the first input value that will be tested by the validation loop - ANSWERS-priming read

in python, a comma separated sequence of data items that are enclosed in a set of brackets is called a - ANSWERS-list 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 - ANSWERS-target variable 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? a. flowchart b. algorithm c. source code d. pseudocode - ANSWERS-d. pseudocode A(n) ________ is a diagram that graphically depicts the steps that take place in a program. a. flowchart b. algorithm c. source code d. pseudocode - ANSWERS-a. flowchart 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. a. input() b. output()

a. int b. float c. str d. currency - ANSWERS-b. float After the execution of the following statement, the variable price will reference the value price = int(68.549) a. 68 b. 69 c. 68. d. 68.6 - ANSWERS-a. 68 What is the output of the following statement? print('I'm ready to begin') a. Im ready to begin b. I'm ready to begin c. I'm ready to begin d. 'I'm ready to begin' - ANSWERS-c. I'm ready to begin What is the output of the following statement, given that value1 = 2.0 and value2 = 12? print(value1 * value2)

a. 24 b. value1 * value c. 24. d. 2.0 * 12 - ANSWERS-c. 24. What is the output of the following statement? print('The path is D:\sample\test.') a. 'The path is D:\sample\test.' b. The path is D:\sample\test. c. The path is D\sample\test. d. The path is D:\sample\test. - ANSWERS-d. The path is D:\sample\test. What is the output of the following statement? print('One' 'Two' 'Three') a. One Two Three b. One Two Three c. OneTwoThree d. Nothing; this statement contains an error. - ANSWERS-c. OneTwoThree

a. print(f'{20:.0%}') b. print(f'{0.2:.0%}') c. print(f'{0.2 * 100:.0%}') d. print(f'{0.2:%}') - ANSWERS-b. print(f'{0.2:.0%}') What symbol is used to mark the beginning and end of a string? a. a slash (/) b. an asterisk (*) c. a quote mark (") d. a comma (,) - ANSWERS-c. a quote mark (") A(n) ________ structure is a logical design that controls the order in which a set of statements execute. a. function b. control c. sequence d. iteration - ANSWERS-b. control The decision structure that has two possible paths of execution is known as a. single alternative b. double alternative c. dual alternative d. two alternative - ANSWERS-c. dual alternative

Multiple Boolean expressions can be combined by using a logical operator to create ________ expressions. a. sequential b. logical c. compound d. mathematical - ANSWERS-c. compound When using the ________ logical operator, one or both of the subexpressions must be true for the compound expression to be true. a. or b. and c. not d. maybe - ANSWERS-a. or Which logical operators perform short circuit evaluation? a. or, not b. not, and c. or, and d. and, or, not - ANSWERS-c. or, and Which of the following is the correct if clause to determine whether y is int he range 10 through 50, inclusive? - ANSWERS-if y>=10 and y<= a Boolean variable can reference one of two values which are - ANSWERS- True or False What is the result of the following boolean expression, given that x = 5, y=3, and z=

What is a group of statements that exists within a program for the purpose of performing a specific task - ANSWERS-a function the first line in a function definition is known as the function - ANSWERS- header What design technique can be used to break down an algorithm into functions - ANSWERS-top down a set of statements that belong together as a group and contribute to the function definition is known as a - ANSWERS-block the __________ keyword is ignored by Python interpreter and can be used as a placeholder for code that will be written later - ANSWERS-pass what variable is created inside of a function - ANSWERS-local What is any piece of data that is passed into a function when the function is called - ANSWERS-argument a ______________ is a variable that receives and argument that is passed into - ANSWERS-parameter a __________ variable is accessible to all the functions in a program file - ANSWERS-global it is reccommended that programmers refrain using ____________ variables in a program whenever possible - ANSWERS-global

the python library functions that are built into the python _________________ can be used by simply calling the required function - ANSWERS-interpreter what type of function can be used to determine whether a number is even or odd - ANSWERS-boolean which of the following will assign a random integer in the range of 1 through 50 to the variable number - ANSWERS-number = random.randint(1, 50)