PCEP Numeric Types and Arithmetic Flashcards
6 cards from real PCEP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 PCEP Numeric Types and Arithmetic flashcards as text
What is the result of `7 // 2` in Python?
Answer: 3
`//` is floor division, which divides and rounds down to the nearest integer, giving 3.
Which Python function converts a string to an integer?
Answer: int()
`int()` converts a numeric string or float to an integer, truncating any decimal part.
What is the output of `type(3.0)`?
Answer:
`3.0` is a floating-point literal, so `type()` returns ``.
What does the `%` operator do in Python arithmetic?
Answer: Returns the remainder of division
The `%` modulo operator returns the remainder after dividing the left operand by the right.
What is the result of `2 ** 3` in Python?
Answer: 8
`**` is the exponentiation operator; `2 ** 3` means 2 raised to the power of 3, which is 8.
What is the value of `round(3.567, 2)`?
Answer: 3.57
`round(3.567, 2)` rounds to 2 decimal places; since the third decimal is 7 ≥ 5, it rounds up to 3.57.