Exam 98-381: Introduction to Programming Using Python Practice Test
Exam 98-381: Introduction to Programming Using Python concerns foundational Python programming: reading expressions, assigning values, and controlling program flow. The available practice bank samples topics such as strings, numbers, lists, loops, conditional expressions, and exception handling, giving learners a way to work through short code examples and predict their behavior.
Exam overview
About the Exam 98-381: Introduction to Programming Using Python Exam
Python fluency at this level involves tracing how values change as statements execute and selecting syntax that expresses a task correctly. Practice with arithmetic operators such as integer division and exponentiation, comparisons, Boolean conditions, and conditional expressions. String skills include case-sensitive equality checks and extracting characters with slices. List work may involve iteration and creating a reversed copy without changing the original sequence. Loop questions ask you to identify how a `for` statement processes each item, while code-tracing tasks test accumulator patterns such as adding values to a running total. Exception-handling examples show how a `try` block and a specific `except` clause respond to errors such as division by zero. These skills support writing small scripts, checking edge cases, and explaining the output of concise Python code.
Sample Practice Questions
Review a selection from this exam's published US Practice Tests practice bank.
What is the value of `"pear" == "Pear"`?
Show answer
Correct answer: BString equality compares characters including their case. The lowercase `p` and uppercase `P` differ, so the strings are not equal.
What value is assigned to `status` by `status = "ready" if connected else "offline"` when `connected` is `False`?
Show answer
Correct answer: BIn a conditional expression, the value after `else` is selected when the condition is false. Therefore `status` becomes `"offline"`.
Which expression evaluates to `True` if `score` is at least 60 and no greater than 100?
Show answer
Correct answer: APython supports chained comparisons, so `60 <= score <= 100` means both `score >= 60` and `score <= 100` must be true.
What is the value of `7 // 2` in Python?
Show answer
Correct answer: AThe `//` operator performs floor division. Dividing 7 by 2 gives 3.5, and flooring that result gives 3.
What does this code print? `try: value = 10 / 0 except ZeroDivisionError: print("cannot divide")`
Show answer
Correct answer: CDividing by zero with `/` raises `ZeroDivisionError`. The matching `except` clause handles it and prints `cannot divide`.
What is the value of `result` after this code runs? `result = 2 ** 3`
Show answer
Correct answer: BIn Python, `**` is the exponentiation operator. `2 ** 3` means 2 raised to the third power, which is 8.
What is the value of `"python"[1:4]`?
Show answer
Correct answer: BA slice includes the character at its start index and stops before its end index. Indices 1, 2, and 3 contain `y`, `t`, and `h`.
How to use this practice test
The free practice bank contains 50 questions; each session presents up to 20 randomly selected questions. Use a session to trace code, evaluate expressions, and check your understanding of Python behavior. Results appear after the session, helping you identify which question types to revisit.
Preparation tips
- Trace each expression by hand, especially integer division, exponentiation, comparisons, and Boolean conditions.
- Test string indexing and slicing on short examples; note that indexes start at zero and string comparisons are case-sensitive.
- For list and loop questions, track each iteration and distinguish creating a reversed copy from modifying the original list.
- Predict the output of accumulator code by recording the running total after each loop iteration.
- Practice matching specific exceptions, such as `ZeroDivisionError`, with the corresponding `except` block and printed response.