This COSC Exam 2 Study Guide 2026/2027 contains 50+ exam questions and answers across 7 pages, providing a focused review of essential Python programming concepts. The material begins with the distinction between functions and methods, dot notation, and common standalone functions such as print(), input(), len(), and type(). It then provides extensive practice with Python string methods, including .upper(), .lower(), .title(), .capitalize(), .strip(), .lstrip(), .rstrip(), .startswith(), .endswith(), .find(), .count(), .replace(), .split(), and .join().
The strings section also reinforces important concepts such as string immutability, substring searching, index positions, replacement operations, whitespace removal, and escape sequences including n for a new line and t for a tab. These questions help students distinguish closely related string methods and understand what each method returns or changes.
A substantial section focuses on Python lists and list manipulation. Students review square-bracket list syntax, zero-based and negative indexing, modifying list elements, .append(), .insert(), del, .pop(), and .remove(). Sorting receives particularly detailed coverage through .sort(), sorted(), reverse sorting, .reverse(), sorting with key=len, case-insensitive sorting using , lambda-based sorting by the last character, and ASCII ordering of numbers, uppercase letters and lowercase letters.
The final portion covers Python iteration, loops and ranges. Questions explain the purpose and syntax of for and while loops, how range() determines starting, stopping and step values, and how to count backward using a negative step. The guide concludes with the accumulator pattern, initialization of running totals, len(), and common programming mistakes involving missing colons, incorrect indentation and unnecessary indentation.
Overall, this resource provides a concise but targeted review for COSC Exam 2, particularly for an assessment emphasizing Python strings, lists, methods, iteration and fundamental programming syntax. The question-and-answer structure makes it suitable for self-testing, rapid revision and reinforcing the expected behavior of commonly used Python operations.
Relevant Students: COSC students preparing for Exam 2, introductory Python programming students, first-year computer science students, programming fundamentals students, students learning Python strings and lists, and learners preparing for assessments covering functions, methods, sorting, loops, ranges, accumulators and common Python syntax errors.
Keywords: COSC Exam 2 Study Guide , COSC Exam 2 questions and answers, COSC Exam 2 review, 50 Python questions and answers, Python Exam 2, Python study guide, Python programming exam, introductory Python questions, Python functions, Python methods, Python dot notation, Python string methods, upper lower strip Python, startswith endswith, Python find method, Python replace method, Python split and join, string immutability, Python lists, list indexing, append insert pop remove, Python list sorting, sort vs sorted Python, reverse sorting Python, lambda sorting, ASCII sorting, Python for loop, Python while loop, Python range function, range start stop step, Python accumulator, Python len function, Python syntax error, Python indentation error, programming fundamentals exam
Vista previa del contenido
COSC Study Guide Exam 2
2026/2027 Exam Questions and
Answers | A+ Score Assured
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.