Introduction to Programming Final Exam Review (Python) Questions With Verified Answers
A ________ does not prevent the program from running, but causes it to produce incorrect result - Answer Syntax Error A ______ is sequence of characters - Answer String A ____ is a name that references a value in the computer's memory - Answer Variable A _____ in python must be enclosed in either single or double-quotes - Answer String Literal Short notes placed in different parts of a program explaining how these parts of the program work are called - Answer Comments A(n) ______ makes a variable reference a value in the computer's memory - Answer Assignment Statement The ___ symbol marks the beginning of a comment in python - Answer # Values on the right and left of an operator symbol (+) are called: - Answer Operands ______ can be used to read input that has been typed on the keyboard - Answer input() having float(aroundSomething) - Answer converts to a float A magic number is an: - Answer unexplained value that appears in a program's code A _____ is a name that represents a value that does not change during the program's execution - Answer Named Constant First characters of a variable names: - Answer cannot be a number If a variable has not been assigned a value - Answer 0 will not display since the variable was not assigned 0 to begin with A _____ can execute a set of statements only certain circumstances - Answer Decision Structure A ____ provides one alternative path of executions - Answer Single Alternative Decision Boolean has a value of either - Answer True or False A compound boolean expression created with the "or" operator is true if: - Answer Either of its sub-expressions are true A ____ can be nested inside another decision structure - Answer Decision structure A compound boolean expression created with the "and" operator is true only when: - Answer Both sub-expression sare true The while loop is a ___ type of loop - Answer Pretest An ____ loop has no way of ending and repeats until the program is interrupted - Answer Infinite Loop The -= operator is an example of a(n) _______ - Answer augmented assignment operator 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 - Answer sentinel It is _____ that a condition-controlled loop always repeats a specific number of times - Answer false x= x-1 does? - Answer subtracts 1 from x It is necessary to initialize ______ - Answer accumulator variables In a ________, the inner loop goes through all of its iterations for every single iteration of the outer loop - Answer nested loop To calculate the total number of iterations of a nested loop, you ____ the number of iterations of all the loops - Answer multiply Design technique that helps to reduce the duplication of code within a program and is a benefit of using functions is _____ - Answer code reuse The first line of a function definition is known as the _____ - Answer header You ____ a function to execute it - Answer call A ______ is a variable that is created inside a function - Answer local variable A(n) ____ is the part of a program in which a variable may be accessed - Answer Scope A(n) _______ is a piece of data that is sent into a function - Answer argument A(n) ______ is a special variable that receives a piece of data when a function is called - Answer parameter A variable that is visible to every function in a program file is a ________ - Answer global variable Library Function - Answer Prewritten function that is built into a programming language Standard library function returns random integer within a specific range of values - Answer randint ____ causes a function to end and sends a value back to the part of the program that called the function - Answer return A function can return more than one ___ - Answer value An ______ is a file that data is written too - Answer input file A file that data is read from is known as an ______ - Answer ouput file Before a file can be used by a program, it must be _____ - Answer opened When a program is using a file, is should do this - Answer close the file The contents of this type of file can be viewed in an editor such as notepad: - Answer text file When an exception is generated, it is said to be ____ - Answer raised This is a section of code that gracefully responds to exceptions - Answer exception handler You write this statement to respond to exceptions: - Answer try/except If you open a file using 'w' mode; the contents of the existing file will be ____ - Answer erased If you do not handle an exception is it ____ by the python interpreter, and the program ____ continue to execute - Answer not ignored, won't The else suite in a try/except statement ___ execute if a statement in the try suite raises an exception - Answer won't Finally suite in a try/except statement won't execute if a statement in the _______ raises an exception - Answer try suite An ____ refers to an individual item in a list - Answer elements An _____ identifies an item in a list - Answer index ____ is the first index in a list - Answer 0 The size of the list minus one is the ___ - Answer last index An ____ exception occurs if you try to use an index that is out of range of a list - Answer IndexError
Written for
- Institution
- Python Programming
- Course
- Python Programming
Document information
- Uploaded on
- February 7, 2024
- Number of pages
- 17
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
introduction to programming stuvia
-
introduction to programming final exam review pyt
-
a does not prevent the program from runni
-
a is sequence of characters string