State Compliance Practice Exam
b b b b b
Questions And Correct Answers (Verified b b b b b
Answers) Plus Rationales 2026|2027 Q& b b b b
A | Instant Download Pdf
b b b b
1. Which of the following is the correct way to define a function in
b b b b b b b b b b b b b b
Python?
A. function myFunction(): b
B. def myFunction():b
C. define myFunction(): b
D. func myFunction(): b
B is correct because "def" is the keyword used to define a function in Python
b b b b b b b b b b b b b b
.
2. What will the following code output: print(type([]))?
b b b b b b
A. <class 'tuple'> b
B. <class 'dict'> b
C. <class 'list'> b
D. <class 'set'> b
,C is correct because square brackets denote a list in Python.
b b b b b b b b b b
3. What is the result of bool("") in Python?
b b b b b b b
A. True
B. False
C. None
D. "False"
B is correct because an empty string evaluates to False in a boolean context.
b b b b b b b b b b b b b
4. Which HTTP status code should a Python API return when access is f
b b b b b b b b b b b b
orbidden due to lack of permissions?
b b b b b
A. 200
B. 301
C. 403
D. 500
C is correct because 403 is the standard status code for "Forbidden" access.
b b b b b b b b b b b b
5. In Python, which built-
b b b
in function can be used to get the ASCII value of a character?
b b b b b b b b b b b b
A. ascii()
B. ord()
C. chr()
D. int()
B is correct because ord() returns the ASCII or Unicode code of a character.
b b b b b b b b b b b b b
, 6. What Python data structure is best suited to store unique, unordered
b b b b b b b b b b b
elements?
A. list
B. tuple
C. dict
D. set
D is correct because sets store unique items and do not guarantee order.
b b b b b b b b b b b b
7. Which Python statement is used to handle exceptions?
b b b b b b b
A. catch
B. try
C. check
D. except
B is correct because Python uses try-except blocks for exception handling.
b b b b b b b b b b
8. What does the expression 3 == '3' evaluate to in Python?
b b b b b b b b b b
A. True
B. False
C. Error
D. None
B is correct because Python is strictly typed and does not coerce different ty
b b b b b b b b b b b b b
pes in equality checks.
b b b
, 9. Which of the following file types must be used when submitting code f
b b b b b b b b b b b b
or a Texas state agency compliance audit?
b b b b b b
A. .docx
B. .exe
C. .js
D. .py
D is correct because Python source code files must have a .py extension.
b b b b b b b b b b b b
10. What is the output of print("Hello" + str(5))?
b b b b b b b
A. Hello5
B. Hello5
C. Error
D. Hello 5 b
B is correct because str(5) converts the integer to a string for concatenation.
b b b b b b b b b b b b
11. In Python, what does the with statement manage?
b b b b b b b
A. Memory leaks b
B. HTTP sessions
b
C. Context managers b
D. Thread safety b
C is correct because the with statement is used with context managers to m
b b b b b b b b b b b b b
anage resources.
b