INTRODUCTION TO PYTHON EXAM LATEST EXAM
2025 | ALL QUESTIONS AND CORRECT ANSWERS
(VERIFIED ANSWERS) | LATEST EXAM | ALREADY
GRADED A+ | JUST RELEASED
Which of the following is NOT an example of a function?
A. print
B. int
C. math.sin
D. math.pi ---------CORRECT ANSWER-----------------D. math.pi
Which of the following is an example of a Boolean expression?
A. a = a + b
B. a = 10
C. a += b
D. a % b == 2 ---------CORRECT ANSWER-----------------D. a % b == 2
The keyword True in Python is an example of which of the following?
A. A logical operator.
B. A Boolean.
C. A conditional.
D. An expression. ---------CORRECT ANSWER-----------------B. A Boolean.
What type of data results from the last line of the following code:
a += 10
b += 20
a == b
A. A logical operator.
B. A Boolean.
C. An expression.
D. A conditional. ---------CORRECT ANSWER-----------------B. A Boolean.
,If a recursive function does not have a base case or cannot reach a base
case, what will happen?
A. The function will continue to call itself forever until the program crashes.
B. The function will cause a syntax error in the program and the program
will never run.
C. The function will continue to call itself until a conditional statement is
reached.
D. The function will return a Boolean value after it completes 1000
iterations of the function. ---------CORRECT ANSWER-----------------A. The
function will continue to call itself forever until the program crashes.
In Python the following keywords are examples of what?
and
or
not
A. Logical operators.
B. Boolean operators.
C. Expressions.
D. Conditional statements. ---------CORRECT ANSWER-----------------A.
Logical operators.
The Python keyword elif provides what to a program?
A. Forced program termination
B. Logical operators
C. Branching
D. Boolean values ---------CORRECT ANSWER-----------------C. Branching
Consider the following:
a is true
b is false
c is true
,then which of the following statements is correct?
A. a and b and c is true
B. not b or c is false
C. b and not a is true
D. a and b and c is false ---------CORRECT ANSWER-----------------D. a and
b and c is false
When an if/else block is fully contained within an if/elif/else statement, this
is referred to as ...
A. a chained conditional statement.
B. a compound logical operation.
C. a nested conditional statement.
D. an enhanced Boolean operation. ---------CORRECT ANSWER--------------
---C. a nested conditional statement.
When using the "upper" and "lower" methods of a string, which of the
following is true?
A. Parentheses are not required after the keywords "upper" and "lower".
B. An argument will be required.
C. The methods return a new string but do not change the string on which
they operate.
D. They will invert the cases of existing characters in the string. ---------
CORRECT ANSWER-----------------C. The methods return a new string but
do not change the string on which they operate.
Which is a valid way to traverse the characters in a string?
A. Using a "while" loop with a counter.
B. Using the "in" operator.
C. Using the "range" function.
D. Using string methods. ---------CORRECT ANSWER-----------------A. Using
a "while" loop with a counter.
, In the following string
"This is a test"
What is the character at index 5?
A. i
B. s
C. a space
D. a ---------CORRECT ANSWER-----------------A. i
Which of the following is NOT true of strings in Python?
A. The represent a sequence of characters.
B. The have an index value associated with each character.
C. The value of characters at specific indexes can be reassigned.
D. They can contain zero characters. ---------CORRECT ANSWER------------
-----C. The value of characters at specific indexes can be reassigned.
When comparing two strings using greater than or less than Boolean
expressions, which of the following is true?
A. Strings can only be compared when they are assigned to variables.
B. Lowercase characters are evaluated as coming before uppercase
characters.
C. Strings are evaluated based on their length so longer strings are greater
than smaller strings.
D. Uppercase characters are evaluated as coming before lowercase
characters. ---------CORRECT ANSWER-----------------D. Uppercase
characters are evaluated as coming before lowercase characters.
Which is a valid way to traverse the characters in a string?
A. Using a conditional expression and the "len" function.
B. Using a counter and a conditional expression.
C. Using a "for" loop.
D. Using the "find" method. ---------CORRECT ANSWER-----------------C.
Using a "for" loop.
2025 | ALL QUESTIONS AND CORRECT ANSWERS
(VERIFIED ANSWERS) | LATEST EXAM | ALREADY
GRADED A+ | JUST RELEASED
Which of the following is NOT an example of a function?
A. print
B. int
C. math.sin
D. math.pi ---------CORRECT ANSWER-----------------D. math.pi
Which of the following is an example of a Boolean expression?
A. a = a + b
B. a = 10
C. a += b
D. a % b == 2 ---------CORRECT ANSWER-----------------D. a % b == 2
The keyword True in Python is an example of which of the following?
A. A logical operator.
B. A Boolean.
C. A conditional.
D. An expression. ---------CORRECT ANSWER-----------------B. A Boolean.
What type of data results from the last line of the following code:
a += 10
b += 20
a == b
A. A logical operator.
B. A Boolean.
C. An expression.
D. A conditional. ---------CORRECT ANSWER-----------------B. A Boolean.
,If a recursive function does not have a base case or cannot reach a base
case, what will happen?
A. The function will continue to call itself forever until the program crashes.
B. The function will cause a syntax error in the program and the program
will never run.
C. The function will continue to call itself until a conditional statement is
reached.
D. The function will return a Boolean value after it completes 1000
iterations of the function. ---------CORRECT ANSWER-----------------A. The
function will continue to call itself forever until the program crashes.
In Python the following keywords are examples of what?
and
or
not
A. Logical operators.
B. Boolean operators.
C. Expressions.
D. Conditional statements. ---------CORRECT ANSWER-----------------A.
Logical operators.
The Python keyword elif provides what to a program?
A. Forced program termination
B. Logical operators
C. Branching
D. Boolean values ---------CORRECT ANSWER-----------------C. Branching
Consider the following:
a is true
b is false
c is true
,then which of the following statements is correct?
A. a and b and c is true
B. not b or c is false
C. b and not a is true
D. a and b and c is false ---------CORRECT ANSWER-----------------D. a and
b and c is false
When an if/else block is fully contained within an if/elif/else statement, this
is referred to as ...
A. a chained conditional statement.
B. a compound logical operation.
C. a nested conditional statement.
D. an enhanced Boolean operation. ---------CORRECT ANSWER--------------
---C. a nested conditional statement.
When using the "upper" and "lower" methods of a string, which of the
following is true?
A. Parentheses are not required after the keywords "upper" and "lower".
B. An argument will be required.
C. The methods return a new string but do not change the string on which
they operate.
D. They will invert the cases of existing characters in the string. ---------
CORRECT ANSWER-----------------C. The methods return a new string but
do not change the string on which they operate.
Which is a valid way to traverse the characters in a string?
A. Using a "while" loop with a counter.
B. Using the "in" operator.
C. Using the "range" function.
D. Using string methods. ---------CORRECT ANSWER-----------------A. Using
a "while" loop with a counter.
, In the following string
"This is a test"
What is the character at index 5?
A. i
B. s
C. a space
D. a ---------CORRECT ANSWER-----------------A. i
Which of the following is NOT true of strings in Python?
A. The represent a sequence of characters.
B. The have an index value associated with each character.
C. The value of characters at specific indexes can be reassigned.
D. They can contain zero characters. ---------CORRECT ANSWER------------
-----C. The value of characters at specific indexes can be reassigned.
When comparing two strings using greater than or less than Boolean
expressions, which of the following is true?
A. Strings can only be compared when they are assigned to variables.
B. Lowercase characters are evaluated as coming before uppercase
characters.
C. Strings are evaluated based on their length so longer strings are greater
than smaller strings.
D. Uppercase characters are evaluated as coming before lowercase
characters. ---------CORRECT ANSWER-----------------D. Uppercase
characters are evaluated as coming before lowercase characters.
Which is a valid way to traverse the characters in a string?
A. Using a conditional expression and the "len" function.
B. Using a counter and a conditional expression.
C. Using a "for" loop.
D. Using the "find" method. ---------CORRECT ANSWER-----------------C.
Using a "for" loop.