INTRODUCTION TO PYTHON EXAM LATEST EXAM
2025 | ALL QUESTIONS AND CORRECT ANSWERS
(VERIFIED ANSWERS) | LATEST EXAM | GRADED A+ |
JUST RELEASED
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.
The len function can be used to determine the which of the following about
a string?
A. The value of the last index in the string.
B. The number of non-space characters in the string.
C. The number of characters in the string.
D. The number of bits of memory that the string requires. ---------CORRECT
ANSWER-----------------C. The number of characters in the string.
,To traverse a string you could use which of the following Python
constructs?
A. A loop.
B. An assignment.
C. A Boolean expression.
D. A conditional. ---------CORRECT ANSWER-----------------A. A loop.
The relationship between the value returned by the len function when run
on a string and the last index of the string is which of the following?
A. The last index is the value returned by len minus 1.
B. It is dependent on the exact string and cannot be determined for the
general case.
C. The last index is the value returned by len plus 1.
D. The last index is the value returned by len. ---------CORRECT ANSWER-
----------------A. The last index is the value returned by len minus 1.
What is the length of an empty string?
A. -1
B. 0
C. It cannot be determined.
D. 1 ---------CORRECT ANSWER-----------------B. 0
The plus sign '+' operator performs what task when used on two lists?
A. index shifting
B. concatenation
C. summation
D. addition ---------CORRECT ANSWER-----------------B. concatenation
The "is" operator checks which of the following?
A. Whether two lists have the same number of elements.
B. Whether two variables refer to the same object.
C. Whether two variables have equivalent values.
, D. Whether two strings have the same value. ---------CORRECT ANSWER-
----------------B. Whether two variables refer to the same object.
In a list slice, if the second number is omitted, what will be the last index of
the sliced data?
A. One more than the first number used in the slice.
B. The second to last index of the list.
C. The last index of the list.
D. The first index of the list. ---------CORRECT ANSWER-----------------B.
The second to last index of the list.
Which of the following is NOT true of lists in Python?
A. They can contain lists.
B. They can contain mixed data types.
C. They must hold at least one element.
D. The data at any position in the list can be changed. ---------CORRECT
ANSWER-----------------C. They must hold at least one element.
Which of the following is NOT a list method?
A. append
B. sort
C. remove
D. len ---------CORRECT ANSWER-----------------D. len
What is true about using a "for" loop with a "range" to access list items that
is not true when a "for" loop is used to loop over the list items directly?
A. You can find the length of the list.
B. You can update the items in the list.
C. You can guarantee that the loop will run at least once.
D. You can print the items from the list. ---------CORRECT ANSWER---------
--------B. You can update the items in the list.
2025 | ALL QUESTIONS AND CORRECT ANSWERS
(VERIFIED ANSWERS) | LATEST EXAM | GRADED A+ |
JUST RELEASED
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.
The len function can be used to determine the which of the following about
a string?
A. The value of the last index in the string.
B. The number of non-space characters in the string.
C. The number of characters in the string.
D. The number of bits of memory that the string requires. ---------CORRECT
ANSWER-----------------C. The number of characters in the string.
,To traverse a string you could use which of the following Python
constructs?
A. A loop.
B. An assignment.
C. A Boolean expression.
D. A conditional. ---------CORRECT ANSWER-----------------A. A loop.
The relationship between the value returned by the len function when run
on a string and the last index of the string is which of the following?
A. The last index is the value returned by len minus 1.
B. It is dependent on the exact string and cannot be determined for the
general case.
C. The last index is the value returned by len plus 1.
D. The last index is the value returned by len. ---------CORRECT ANSWER-
----------------A. The last index is the value returned by len minus 1.
What is the length of an empty string?
A. -1
B. 0
C. It cannot be determined.
D. 1 ---------CORRECT ANSWER-----------------B. 0
The plus sign '+' operator performs what task when used on two lists?
A. index shifting
B. concatenation
C. summation
D. addition ---------CORRECT ANSWER-----------------B. concatenation
The "is" operator checks which of the following?
A. Whether two lists have the same number of elements.
B. Whether two variables refer to the same object.
C. Whether two variables have equivalent values.
, D. Whether two strings have the same value. ---------CORRECT ANSWER-
----------------B. Whether two variables refer to the same object.
In a list slice, if the second number is omitted, what will be the last index of
the sliced data?
A. One more than the first number used in the slice.
B. The second to last index of the list.
C. The last index of the list.
D. The first index of the list. ---------CORRECT ANSWER-----------------B.
The second to last index of the list.
Which of the following is NOT true of lists in Python?
A. They can contain lists.
B. They can contain mixed data types.
C. They must hold at least one element.
D. The data at any position in the list can be changed. ---------CORRECT
ANSWER-----------------C. They must hold at least one element.
Which of the following is NOT a list method?
A. append
B. sort
C. remove
D. len ---------CORRECT ANSWER-----------------D. len
What is true about using a "for" loop with a "range" to access list items that
is not true when a "for" loop is used to loop over the list items directly?
A. You can find the length of the list.
B. You can update the items in the list.
C. You can guarantee that the loop will run at least once.
D. You can print the items from the list. ---------CORRECT ANSWER---------
--------B. You can update the items in the list.