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.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Academia199. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.49. You're not tied to anything after your purchase.