COSC STUDY GUIDE FOR (QUIZ 2) WITH QUESTIONS AND ANSWERS LATEST
UPDATE 2026
What is a function in Python? - (answer)A standalone block of code that does not belong to an object.
What is a method in Python? - (answer)A function that belongs to an object and is called using dot
notation.
What symbol connects an object to its method? - (answer)A dot (.)
Give an example of a standalone function. - (answer)print(), input(), len(), type()
Give an example of a method. - (answer)name.upper()
What does .upper() do? - (answer)Converts all characters in a string to uppercase.
What does .lower() do? - (answer)Converts all characters in a string to lowercase.
What does .title() do? - (answer)Capitalizes the first letter of every word.
What does .capitalize() do? - (answer)Capitalizes only the first letter of the string and makes the rest
lowercase.
What does .strip() do? - (answer)Removes whitespace from both beginning and end of a string.
What does .lstrip() do? - (answer)Removes whitespace from the left side only.
What does .rstrip() do? - (answer)Removes whitespace from the right side only.
What does .startswith("text") return? - (answer)True or False depending on whether the string starts
with the given text.
, COSC STUDY GUIDE FOR (QUIZ 2) WITH QUESTIONS AND ANSWERS LATEST
UPDATE 2026
What does .endswith("text") return? - (answer)True or False depending on whether the string ends with
the given text.
What does .find("x") return if found? - (answer)The index position of the first occurrence.
What does .find("x") return if NOT found? - (answer)-1
What does .count("x") return? - (answer)The number of times a substring appears.
What does .replace(old, new) do? - (answer)Replaces all occurrences of old with new in a string.
What does .split() do? - (answer)Breaks a string into a list (default separator is space).
What does "separator".join(list) do? - (answer)Combines list elements into a single string separated by
the given separator.
Are strings mutable or immutable? - (answer)Immutable (methods return new strings).
What does \n do? - (answer)Creates a new line.
What does \t do? - (answer)Creates a tab (indent).
What symbols indicate a list in Python? - (answer)Square brackets [ ].
What index number represents the first element in a list? - (answer)0.
UPDATE 2026
What is a function in Python? - (answer)A standalone block of code that does not belong to an object.
What is a method in Python? - (answer)A function that belongs to an object and is called using dot
notation.
What symbol connects an object to its method? - (answer)A dot (.)
Give an example of a standalone function. - (answer)print(), input(), len(), type()
Give an example of a method. - (answer)name.upper()
What does .upper() do? - (answer)Converts all characters in a string to uppercase.
What does .lower() do? - (answer)Converts all characters in a string to lowercase.
What does .title() do? - (answer)Capitalizes the first letter of every word.
What does .capitalize() do? - (answer)Capitalizes only the first letter of the string and makes the rest
lowercase.
What does .strip() do? - (answer)Removes whitespace from both beginning and end of a string.
What does .lstrip() do? - (answer)Removes whitespace from the left side only.
What does .rstrip() do? - (answer)Removes whitespace from the right side only.
What does .startswith("text") return? - (answer)True or False depending on whether the string starts
with the given text.
, COSC STUDY GUIDE FOR (QUIZ 2) WITH QUESTIONS AND ANSWERS LATEST
UPDATE 2026
What does .endswith("text") return? - (answer)True or False depending on whether the string ends with
the given text.
What does .find("x") return if found? - (answer)The index position of the first occurrence.
What does .find("x") return if NOT found? - (answer)-1
What does .count("x") return? - (answer)The number of times a substring appears.
What does .replace(old, new) do? - (answer)Replaces all occurrences of old with new in a string.
What does .split() do? - (answer)Breaks a string into a list (default separator is space).
What does "separator".join(list) do? - (answer)Combines list elements into a single string separated by
the given separator.
Are strings mutable or immutable? - (answer)Immutable (methods return new strings).
What does \n do? - (answer)Creates a new line.
What does \t do? - (answer)Creates a tab (indent).
What symbols indicate a list in Python? - (answer)Square brackets [ ].
What index number represents the first element in a list? - (answer)0.