COMPREHENSIVE EXAMINATION TEST 2026
COMPLETE QUESTIONS AND CORRECT
ANSWERS
◉ Outside a function. Answer: Global code that exists outside of a
function and runs directly, with no need to be specifically called by a
function.
◉ Local vs. Global Variables. Answer: Local variables take precedence
over global variables inside functions.
Global variables can be used by any functions in your code.
Local variables can only be used in the function they were created from.
◉ global [variable] keyword. Answer: This keyword is used to call a
global variable inside of a function.
Ex:
ip1 = "10.1.1.1"
def sample()
,global ip1
print(ip1)
sample()
Output: "10.1.1.1"
◉ What is the primary characteristic of Python variables?. Answer:
Variables are created as soon as a value is assigned to them.
◉ Unpacking variables. Answer: Extracting elements from iterable
objects and assigning them to individual variables.
◉ How can multiple Python variables of different types be output using
the print() function?. Answer: Using commas
◉ Python membership operator. Answer: in
(ex: result = user_input in usernames. If the input contains a match in a
list of usernames, it prints "True").
◉ Python operator precedence. Answer: Parenthesis - () - Highest
precedence.
Exponentiation - ** - Next highest precedence.
Multiplication, division, floor division, modulus - * / // % - Same
precedence, read from left to right.
, Addition and subtraction - + - - Same precedence, read from left to right.
Bitwise shift - << >> - Lower than arithmetic operations.
Bitwise AND - & - Lower than bit shifts.
Bitwise XOR - ^ - Lower than AND.
Bitwise OR - | - Lowest precedence.
◉ Parenthesis precedence. Answer: Has the highest precedence.
◉ Exponentiation precedence. Answer: Has the next highest precedence
below parenthesis.
◉ Multiplication, division, floor division, modulus precedence. Answer:
Has same precedence and is evaluated left to right. This precedence is
lower than exponentiation.
◉ Addition and subtraction. Answer: Has the same precedence and is
evaluated left to right. This precedence is lower than multiplication,
division, floor division, and modulus precedence.
◉ Bitwise shift precedence. Answer: Has a lower precedence than
arithmetic operations.
◉ Bitwise AND precedence. Answer: Has a lower precedence than a
bitwise shift.