ISA 221 Final Exam
This is the first index in a string.
a. - 1
b. 1
c. 0
d. The size of the string minus one - correct answer 0
This is the last index in a string.
a. 1
b. 99
c. 0
d. The size of the string minus one - correct answer The size of the string minus one
This will happen if you try to use an index that is out of range for a string.
a. A ValueError exception will occur.
b. An IndexError exception will occur.
c. The string will be erased and the program will continue to run.
d. Nothing-the invalid index will be ignored. - correct answer An IndexError exception
will occur.
This function returns the length of a string.
a. length
b. size
c. len
d. lengthof - correct answer len
This string method returns a copy of the string with all leading whitespace characters
removed.
a. lstrip
b. rstrip
c. remove
d. strip_leading - correct answer lstrip
This string method returns the lowest index in the string where a specified substring is
found.
a. first index of
b. locate
c. find
d. index of - correct answer find
This operator determines whether one string is contained inside another string.
a. contains
b. is in
c. ==
,d. in - correct answer in
This string method returns true if a string contains only alphabetic characters and is at
least one character in length.
a. the isalpha method
b. the alpha method
c. the alphabetic method
d. the isletters method - correct answer the isalpha method
This string method returns true if a string contains only numeric digits and is at least one
character in length.
a. the digit method
b. the isdigit method
c. the numeric method
d. the isnumber method - correct answer the isdigit method
This string method returns a copy of the string with all leading and trailing whitespace
characters removed.
a. clean
b. strip
c. remove_whitespace
d. rstrip - correct answer strip
Once a string is created, it cannot be changed.
T or F - correct answer True
You can use the for loop to iterate over the individual characters in a string.
T or F - correct answer True
The isupper method converts a string to all uppercase characters.
T or F - correct answer False
The repetition operator ( *) works with strings as well as with lists.
T or F - correct answer True
When you call a string's split method, the method divides the string into two substrings.
T or F - correct answer False
function - correct answer A group of statements that exist within a program for the
purpose of performing a specific task is a(n) _________.
, code reuse - correct answer A design technique that programmers use to reduce the
duplication of code within a program and is a benefit of using functions as _________.
header - correct answer The first line of a module definition is known as the
_________.
call - correct answer You _________ the module to execute it.
Top Down Design - correct answer A design technique that programmers use to break
down an algorithm into modules is know as _________.
hierarchy chart - correct answer A _________ is a diagram that gives a visual
representation of the relationships between modules in a program.
local variable - correct answer A _________ is a variable that is declared inside a
module.
scope - correct answer A(n) _________ is the part of a program in which a variable
may be accessed.
argument - correct answer A(n) _________ is a piece of data that is sent into a
function.
parameter - correct answer A(n) _________ is a special variable that receives a piece
of data when a module is called.
global variable - correct answer A variable that is visible to every module in the
program is a _________.
global - correct answer When possible, you should avoid using _________ variables
in a program.
library function - correct answer This is a prewritten function that is built into a
programming language
randint - correct answer This standard library function returns a random integer within
a special range of values.
random - correct answer This standard library function returns a random floating-point
number in the range of 0.0 up to 1.0 (but not including 1.0).
uniform - correct answer This standard library function returns a random floating-point
number within a specified range of values.
return - correct answer This statement causes a function to end and sends a value
back to the part of the program that called the function.
Les avantages d'acheter des résumés chez Stuvia:
Qualité garantie par les avis des clients
Les clients de Stuvia ont évalués plus de 700 000 résumés. C'est comme ça que vous savez que vous achetez les meilleurs documents.
L’achat facile et rapide
Vous pouvez payer rapidement avec iDeal, carte de crédit ou Stuvia-crédit pour les résumés. Il n'y a pas d'adhésion nécessaire.
Focus sur l’essentiel
Vos camarades écrivent eux-mêmes les notes d’étude, c’est pourquoi les documents sont toujours fiables et à jour. Cela garantit que vous arrivez rapidement au coeur du matériel.
Foire aux questions
Qu'est-ce que j'obtiens en achetant ce document ?
Vous obtenez un PDF, disponible immédiatement après votre achat. Le document acheté est accessible à tout moment, n'importe où et indéfiniment via votre profil.
Garantie de remboursement : comment ça marche ?
Notre garantie de satisfaction garantit que vous trouverez toujours un document d'étude qui vous convient. Vous remplissez un formulaire et notre équipe du service client s'occupe du reste.
Auprès de qui est-ce que j'achète ce résumé ?
Stuvia est une place de marché. Alors, vous n'achetez donc pas ce document chez nous, mais auprès du vendeur Carzola98. Stuvia facilite les paiements au vendeur.
Est-ce que j'aurai un abonnement?
Non, vous n'achetez ce résumé que pour 15,11 €. Vous n'êtes lié à rien après votre achat.