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 output of `abs(-15)`?
Answer: 15
`abs()` returns the absolute value of a number, which is always non-negative.
Which of the following is a valid Python complex number literal?
Answer: 3+4j
Python uses `j` (not `i`) as the imaginary unit; `3+4j` is a valid complex literal.
What does `int(3.9)` return?
Answer: 3
`int()` truncates toward zero, discarding the fractional part, so `int(3.9)` gives 3.
What is the result of `10 % 3`?
Answer: 1
10 divided by 3 is 3 remainder 1, so the modulo operation returns 1.
What is the output of `float('3.14')`?
Answer: 3.14
`float()` converts a string representation of a decimal number to a float value.
Which operator performs integer (floor) division in Python?
Answer: //
`//` is the floor division operator; it divides and floors the result to the nearest integer.