100% Latest & Updated Python Institute PCEP-30-02 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!
Question 60
During a review of bitwise masking and shifts, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A:
print(5 | 2)
Program B:
print(3<<2)
Program C:
print(12>>2 ^ 1)
- Program A prints '7'.
- Program B prints '12'.
- Program A prints '5'.
- Program B prints '16'.
- Program C prints '2'.
- Program C prints '4'.
Explanation
Correct Answers
A:Running Program A prints '7'. Bitwise operations work on integer bits: & keeps common set bits, | combines them, and shifts move bit positions.
B:Running Program B prints '12'. Bitwise operations work on integer bits: & keeps common set bits, | combines them, and shifts move bit positions.
E:Running Program C prints '2'. Bitwise operations work on integer bits: & keeps common set bits, | combines them, and shifts move bit positions.
Incorrect Answers
C:Program A does not produce '5'; its verified result is: Prints '7'. Bitwise operations work on integer bits: & keeps common set bits, | combines them, and shifts move bit positions.
D:Program B does not produce '16'; its verified result is: Prints '12'. Bitwise operations work on integer bits: & keeps common set bits, | combines them, and shifts move bit positions.
F:Program C does not produce '4'; its verified result is: Prints '2'. Bitwise operations work on integer bits: & keeps common set bits, | combines them, and shifts move bit positions.
Question 61
A learner is checking short-circuit Boolean expressions. What is the exact printed result or uncaught exception?print(0 or 7)
- Prints '7'
- Prints '6'
- Prints '9'
- Prints '8'
Explanation
Correct Answer
A:The snippet prints '7'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
Incorrect Answers
B:This predicts that the snippet prints '6', but executing the displayed Python 3 code prints '7'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
C:This predicts that the snippet prints '9', but executing the displayed Python 3 code prints '7'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
D:This predicts that the snippet prints '8', but executing the displayed Python 3 code prints '7'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
Question 62
A developer tests short-circuit Boolean expressions. The following code prints '9'. Which explanation best accounts for that observed behavior?print(4 and 9)
- The and and or operators short-circuit and return operands, not necessarily Boolean objects.
- Escape sequences such as \n and \t represent control characters inside strings rather than literal backslash-letter pairs.
- For integers, a == (a // b) * b + (a % b); the modulo result has the divisor sign when nonzero.
- Bitwise operations work on integer bits: & keeps common set bits, | combines them, and shifts move bit positions.
Explanation
Correct Answer
A:This is the operative language rule for the code. It directly explains why the example prints '9'; the displayed behavior was independently reproduced by a Python 3 execution check.
Incorrect Answers
B:The escaped newline and tab characters topic does not explain why the code prints '9'. The relevant Python rule is: The and and or operators short-circuit and return operands, not necessarily Boolean objects.
C:The modulo with a negative divisor topic does not explain why the code prints '9'. The relevant Python rule is: The and and or operators short-circuit and return operands, not necessarily Boolean objects.
D:The bitwise masking and shifts topic does not explain why the code prints '9'. The relevant Python rule is: The and and or operators short-circuit and return operands, not necessarily Boolean objects.
Question 63
A learner is checking short-circuit Boolean expressions. After this modification, what does Python 3 actually do?print("" or "backup")
- Prints 'backup?'
- Prints 'backu'
- Prints 'pukcab'
- Prints 'backup'
Explanation
Correct Answer
D:The snippet prints 'backup'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
Incorrect Answers
A:This predicts that the snippet prints 'backup?', but executing the displayed Python 3 code prints 'backup'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
B:This predicts that the snippet prints 'backu', but executing the displayed Python 3 code prints 'backup'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
C:This predicts that the snippet prints 'pukcab', but executing the displayed Python 3 code prints 'backup'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
Question 64
During a review of short-circuit Boolean expressions, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A:
print(4 and 9)
Program B:
print("" or "backup")
Program C:
print(0 and 1//0)
- Program B prints 'backup'.
- Program B prints '(1, 2)'.
- Program C prints '0'.
- Program C prints '7'.
- Program A prints '9'.
- Program A prints '5'.
Explanation
Correct Answers
A:Running Program B prints 'backup'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
C:Running Program C prints '0'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
E:Running Program A prints '9'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
Incorrect Answers
B:Program B does not produce '(1, 2)'; its verified result is: Prints 'backup'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
D:Program C does not produce '7'; its verified result is: Prints '0'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
F:Program A does not produce '5'; its verified result is: Prints '9'. The and and or operators short-circuit and return operands, not necessarily Boolean objects.
Question 65
A learner is checking print separators and line endings. What is the exact printed result or uncaught exception?print("red","blue",sep="/")
- Prints 'red/blue?'
- Prints 'red/blue'
- Prints 'eulb/der'
- Prints 'red/blu'
Explanation
Correct Answer
B:The snippet prints 'red/blue'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
Incorrect Answers
A:This predicts that the snippet prints 'red/blue?', but executing the displayed Python 3 code prints 'red/blue'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
C:This predicts that the snippet prints 'eulb/der', but executing the displayed Python 3 code prints 'red/blue'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
D:This predicts that the snippet prints 'red/blu', but executing the displayed Python 3 code prints 'red/blue'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
Question 66
A developer tests print separators and line endings. The following code prints 'a-b'. Which explanation best accounts for that observed behavior?print("A",end="-")
print("B")
- A # outside a string begins a comment and does not change the preceding executable expression.
- The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
- The / operator returns a float whereas // floors the quotient toward negative infinity.
- Escape sequences such as \n and \t represent control characters inside strings rather than literal backslash-letter pairs.
Explanation
Correct Answer
B:This is the operative language rule for the code. It directly explains why the example prints 'a-b'; the displayed behavior was independently reproduced by a Python 3 execution check.
Incorrect Answers
A:The comments and executable code topic does not explain why the code prints 'a-b'. The relevant Python rule is: The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
C:The true division versus floor division topic does not explain why the code prints 'a-b'. The relevant Python rule is: The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
D:The escaped newline and tab characters topic does not explain why the code prints 'a-b'. The relevant Python rule is: The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
Question 67
A learner is checking print separators and line endings. After this modification, what does Python 3 actually do?print(1,2,3,sep="|")
- Prints '1|2|3?'
- Prints '3|2|1'
- Prints '1|2|'
- Prints '1|2|3'
Explanation
Correct Answer
D:The snippet prints '1|2|3'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
Incorrect Answers
A:This predicts that the snippet prints '1|2|3?', but executing the displayed Python 3 code prints '1|2|3'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
B:This predicts that the snippet prints '3|2|1', but executing the displayed Python 3 code prints '1|2|3'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
C:This predicts that the snippet prints '1|2|', but executing the displayed Python 3 code prints '1|2|3'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
Question 68
During a review of print separators and line endings, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A:
print("A",end="-")
print("B")
Program B:
print(1,2,3,sep="|")
Program C:
print("go",end="")
print("al")
- Program A prints 'a-b'.
- Program C prints '3\n4'.
- Program B prints 'false'.
- Program C prints 'goal'.
- Program B prints '1|2|3'.
- Program A prints 'str'.
Explanation
Correct Answers
A:Running Program A prints 'a-b'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
D:Running Program C prints 'goal'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
E:Running Program B prints '1|2|3'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
Incorrect Answers
B:Program C does not produce '3\n4'; its verified result is: Prints 'goal'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
C:Program B does not produce 'false'; its verified result is: Prints '1|2|3'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
F:Program A does not produce 'str'; its verified result is: Prints 'A-B'. The sep parameter joins print arguments, and end replaces the trailing newline emitted by print.
Question 69
A learner is checking input strings and explicit conversion. What is the exact printed result or uncaught exception?v=input()
print(v+"3")
- Prints '124'
- Prints '125'
- Prints '123'
- Prints '122'
Explanation
Correct Answer
C:The snippet prints '123'. input returns a string; numeric calculations require explicit int or float conversion when text is provided.
Incorrect Answers
A:This predicts that the snippet prints '124', but executing the displayed Python 3 code prints '123'. input returns a string; numeric calculations require explicit int or float conversion when text is provided.
B:This predicts that the snippet prints '125', but executing the displayed Python 3 code prints '123'. input returns a string; numeric calculations require explicit int or float conversion when text is provided.
D:This predicts that the snippet prints '122', but executing the displayed Python 3 code prints '123'. input returns a string; numeric calculations require explicit int or float conversion when text is provided.
Question 70
A developer tests input strings and explicit conversion. The following code prints '15'. Which explanation best accounts for that observed behavior?v=input()
print(int(v)+3)
- Escape sequences such as \n and \t represent control characters inside strings rather than literal backslash-letter pairs.
- Python statements execute in source order; earlier assignments and prints take effect before later ones.
- A # outside a string begins a comment and does not change the preceding executable expression.
- input returns a string; numeric calculations require explicit int or float conversion when text is provided.
Explanation
Correct Answer
D:This is the operative language rule for the code. It directly explains why the example prints '15'; the displayed behavior was independently reproduced by a Python 3 execution check.
Incorrect Answers
A:The escaped newline and tab characters topic does not explain why the code prints '15'. The relevant Python rule is: input returns a string; numeric calculations require explicit int or float conversion when text is provided.
B:The sequential interpreter execution topic does not explain why the code prints '15'. The relevant Python rule is: input returns a string; numeric calculations require explicit int or float conversion when text is provided.
C:The comments and executable code topic does not explain why the code prints '15'. The relevant Python rule is: input returns a string; numeric calculations require explicit int or float conversion when text is provided.
PCEP - Certified Entry-Level Python Programmer (PCEP-30-02) Practice Tests