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.
, Page | 2
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.
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