RATIONALES | 2026 NEWEST UPDATE | WITH COMPLETE SOLUTION
Question 1
What is the value of the Python expression: not not False?
A) True
B) False
C) None
D) Error
E) not True
Correct Answer: B) False
Rationale: In Python, the 'not' operator flips the boolean value. The first 'not' applied to
'False' results in 'True'. The second 'not' (the one on the far left) then flips that 'True' back
to 'False'. Therefore, 'not not False' is equivalent to 'False'.
Question 2
Which of the following expressions does NOT evaluate to the boolean value True?
A) 'True'
B) not False
C) (not False)
D) not (not True)
E) 1 == 1
Correct Answer: A) 'True'
Rationale: In Python, 'True' (surrounded by quotes) is a string, not a boolean. While the
other options evaluate to the boolean value True, a string is a sequence of characters and is
fundamentally different from a logical boolean type.
Question 3
What is the correct way to represent the string "Hi Python" in a Python script to be used in a
print statement?
A) Hi Python
B) "Hi Python"
C) [Hi Python]
D) {Hi Python}
E) <Hi Python>
Correct Answer: B) "Hi Python"
Rationale: Strings in Python must be enclosed in either single quotes ('...') or double quotes
("..."). Without quotes, Python would interpret 'Hi' and 'Python' as variable names, which
would result in a NameError if they are not defined.
Question 4
To create a string containing all lowercase letters of the alphabet in order, which syntax is
correct?
A) abcdefghijklmnopqrstuvwxyz
, 2
B) (abcdefghijklmnopqrstuvwxyz)
C) 'abcdefghijklmnopqrstuvwxyz'
D) {abcdefghijklmnopqrstuvwxyz}
E) /abcdefghijklmnopqrstuvwxyz/
Correct Answer: C) 'abcdefghijklmnopqrstuvwxyz'
Rationale: To define a literal string of characters in Python, you must wrap the sequence in
quotes. Option C correctly uses single quotes to define the lowercase alphabet as a single
string object.
Question 5
Which of the following strings has a length of exactly 5?
A) 'hey'
B) 'good'
C) 'five.'
D) 'fifty.'
E) 'four'
Correct Answer: D) 'fifty.'
Rationale: The length of a string is the count of every character within the quotes, including
punctuation. 'fifty.' consists of f-i-f-t-y plus a period (.), totaling 6 characters? No, let's
recount: f(1), i(2), f(3), t(4), y(5). Wait, 'fifty' is 5 letters. 'fifty.' is 6. Let's look at 'five.': f(1),
i(2), v(3), e(4), .(5). Therefore, 'five.' is exactly 5 characters long.
Question 6
What is the result of the function call len('seventy')?
A) 6
B) 7
C) 8
D) 5
E) 0
Correct Answer: B) 7
Rationale: The len() function returns the number of characters in a string. The string
'seventy' contains the characters s-e-v-e-n-t-y, which totals 7 characters.
Question 7
What is the length of an empty string defined as ''?
A) 1
B) -1
C) 0
D) None
E) Error
Correct Answer: C) 0
, 3
Rationale: An empty string (two quotes with nothing between them) contains no characters.
Therefore, its length is 0. This is a common way to initialize string variables in Python.
Question 8
Which of the following strings has a length that is NOT 1?
A) '.'
B) '"'
C) ' ' (one space)
D) ' ' (two spaces)
E) '1'
Correct Answer: D) ' ' (two spaces)
Rationale: In Python strings, a space is a character. Option D contains two space characters
between the quotes, making its length 2. All other options contain exactly one character (a
period, a double quote, a single space, or a digit).
Question 9
Which of the following string definitions will cause a SyntaxError in Python?
A) ',.;:/?'
B) '"Harriet", she said"'
C) "My "happiness""
D) "I'm, can't"
E) "I'm"
Correct Answer: C) "My "happiness""
Rationale: Python gets confused when you use the same type of quote inside a string that
you used to start the string. In option C, the double quote before 'happiness' tells Python
the string has ended, and it doesn't know how to handle the word happiness that follows.
To fix this, one should use single quotes on the outside or escape the inner quotes.
Question 10
Using the in operator, which of the following expressions evaluates to False?
A) 'G' in 'Greetings'
B) "Greetings" in 'Greetings'
C) 'in' in 'Greetings'
D) 'sing' in 'Greetings'
E) 'reetings' in 'Greetings'
Correct Answer: D) 'sing' in 'Greetings'
Rationale: The 'in' operator checks if a specific sequence of characters exists exactly as
written within another string. While the letters s-i-n-g appear in 'Greetings', they are not in
that specific order consecutively. The word 'Greetings' contains 'eet' and 'ings', but not the
word 'sing'.
, 4
Question 11
Which of the following membership tests evaluates to False?
A) ' ' in 'race cars are fast'
B) 'ars a' in 'race cars are fast'
C) 'ace' in 'race cars are fast'
D) 'cas a' in 'race cars are fast'
E) 'e fa' in 'race cars are fast'
Correct Answer: D) 'cas a' in 'race cars are fast'
Rationale: The string 'race cars are fast' contains 'cars' (with an 'r'). The search term 'cas a'
is missing the 'r' that exists in the source string. Therefore, that specific sequence of
characters is not found, and the expression is False.
Question 12
Which of the following code snippets produces an output different from print('space ship')?
A) print('space', 'ship')
B) print('space' + 'ship')
C) print('space {}'.format( 'ship' ) )
D) print('{} {}'.format( 'space', 'ship' ) )
E) print('space{}ship'.format( ' ' ) )
Correct Answer: B) print('space' + 'ship')
Rationale: The '+' operator concatenates strings exactly as they are. 'space' + 'ship' results
in 'spaceship' (no space). The comma in print() automatically adds a space, and the other
format options specifically include a space character, making B the only one that differs.
Question 13
Which of the following will result in an output different from print('" "')?
A) print('"', '"')
B) print('"' + ' "')
C) print('"' + '"')
D) print('{}'.format('" "') )
E) All of the above are the same
Correct Answer: C) print('"' + '"')
Rationale: The goal is to print a double quote, a space, and another double quote. Option C
adds '"' and '"' together, which results in '""' (no space). Option A uses a comma which
adds a space, and options B and D explicitly include the space.
Question 14
What is the result of the comparison: True == True?
A) True
B) False
C) None