Python Test Questions and Answers
assignment statement - Answer-gives value to a variable
statement - Answer-instruction that the Python interpreter can execute
operators - Answer-special tokens that represent computations like addition, multiplication and division
evaluate - Answer-To s...
Python Test Questions and
Answers
assignment statement - Answer-gives value to a variable
statement - Answer-instruction that the Python interpreter can execute
operators - Answer-special tokens that represent computations like addition,
multiplication and division
evaluate - Answer-To simplify an expression by performing the operations in order to
yield a single value.
int - Answer-A Python data type that holds positive and negative whole numbers
float - Answer-A Python data type which stores floating-point numbers. Floating-point
numbers are stored internally in two parts: a base and an exponent. When printed in the
standard format, they look like decimal numbers
flow of execution - Answer-The order in which statements are executed during a
program run.
function - Answer-A named sequence of statements that performs some useful
operation. Functions may or may not take parameters and may or may not produce a
result
local variable - Answer-A variable defined inside a function. A local variable can only be
used inside its function. Parameters of a function are also a special kind of local
variable.
boolean function - Answer-A function that returns a Boolean value. The only possible
values of the bool type are False and True.
block - Answer-A group of consecutive statements with the same indentation.
boolean expression - Answer-An expression that is either true or false.
conditional statement - Answer-A statement that controls the flow of execution
depending on some condition. In Python the keywords if, elif, and else are used for
conditional statements.
, conditional statement - Answer-One program structure within another, such as a
conditional statement inside a branch of another conditional statement
dictionary - Answer-A collection of key/value pairs that maps from keys to values.
exception - Answer-Raised by the runtime system if something goes wrong while the
program is running.
file - Answer-A named entity, usually stored on a hard drive, floppy disk, or CD-ROM,
that contains a stream of characters.
format operator - Answer-The % operator takes a format string and a tuple of values
and generates a string by inserting the data values into the format string at the
appropriate locations.
sequence - Answer-A data type that is made up of elements organized linearly, with
each element accessed by an integer index.
str - Answer-converts to a string
argument - Answer-a value provided to a function when the function is called. This value
is assigned to the corresponding parameter in the function.
integer division - Answer-An operation that divides one integer by another and yields an
integer. Integer division yields only the whole number of times that the numerator is
divisible by the denominator and discards any remainder.
element - Answer-One of the values in a list (or other sequence). The bracket operator
selects elements of a list.
module - Answer-A file containing definitions and statements
intended to be imported by other programs.
What type of loop structure repeats the code a specific number of times - Answer-
Count-controlled loop
What type of loop structure repeats the code based on the value of the Boolean
expression - Answer-Condition-controlled loop
What is the format for the while clause in Python - Answer-while condition : statement
The variable used to keep the running total - Answer-Accumulator
_____ is the process of inspecting data that has been input to a program to make sure it
is valid before it is used in a computation. - Answer-Input validation
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Perfectscorer. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for R227,08. You're not tied to anything after your purchase.