COMPLETE EXAM QUESTIONS
ANSWER KEY & PYTHON
WORKED SOLUTIONS FALL 2026
CORNELL UNIVERSITY
UPDATED QUESTIONS AND ANSWERS
100% VERIFIED EXAM PREP
EXAM • STUDY GUIDE • SUMMARY • ASSIGNMENT
A clean, organized resource designed for easy revision and reference.
Cornell University • Introduction to Computing Using Python
Variables • Functions • Conditionals • Loops
Lists • Strings • Dictionaries • Classes & Recursion
TEAL • QUICK • CLEAR • PROFESSIONAL
• Instant Download
,MUST-KNOW TABLE — CS 1110 FINAL EXAM
Concept What It Does #1 Check #1 Trap
Variables Store values Assignment = == is comparison
Types int, float, str, bool type() 1 vs '1'
Operators +, -, *, /, //, % // = floor, % = mod / = float
If / Elif / Else Branching elif after if = vs ==
For Loop Iterate sequence for x in range(n) Off-by-one
While Loop Loop while True Need update Infinite loop
Function Reusable code def, return No return = None
Return vs Print Return gives value return stops print != return
Lists Ordered, mutable Index 0, slice Copy = alias
Strings Immutable text Index, slice, len String . append fails
Tuples Immutable, ordered Index, unpack Tuple . append fails
Dict Key -> value dict[key] KeyError if missing
Sets Unique, unordered add, in Index fails
Classes Blueprint, objects __init__, self Missing self
Recursion Self-call + base Base case No base = infinite
Scope Local vs global Local shadows Global needs global
Exceptions try/except Catch specific Bare except
FORMULAS + HIGH-ALERT
• range(n) = 0..n-1 • range(a,b) = a..b-1 • len(s) • s[0] first, s[-1] last, s[a:b] = a..b-1
• Mutable: list, dict, set - alias if = • Immutable: int, float, str, tuple - copy on assignment
SAMPLE Q1 — Try It (Answer Hidden)
Sample: print(7 // 2, 7 % 2) = ?
A. 3 1
B. 3.5 1
C. 3 0
D. 4 1
SAMPLE Q2 — Try It (Answer Hidden)
Sample: x = [1,2]; y = x; y.append(3); x = ?
A. [1,2,3]
B. [1,2]
C. [3]
D. None
,LABS + VALUES + MNEMONICS + PRIORITY FRAMEWORK
KEY VALUES
• range(5) = 0,1,2,3,4 • 'abc'[1] = 'b', 'abc'[-1] = 'c', 'abc'[0:2] = 'ab' • bool: True=1, False=0
• len([1,2,3])=3, sum([1,2,3])=6, max=3 • int('3')=3, str(3)='3', float('3.5')=3.5
MNEMONICS
• MUTABLE: List, Dict, Set - alias • IMMUTABLE: Int, Float, Str, Tuple • RETURN vs PRINT: Return gives, Print shows
PRIORITY FRAMEWORK — 10 RULES
1. Identify: Variables, Types, Control, Function, List/Dict, Class, Recursion?
2. Trace: Write table, step line by line. Off-by-one in range/slice.
3. Types: // = floor, % = mod, / = float. int vs str.
4. Functions: Return stops, no return = None. Arguments vs parameters.
5. Lists: Mutable, alias if =, copy with [:] or list(). Index 0.
6. Strings: Immutable, slice, methods return new string.
7. Dict: Key -> value, KeyError if missing, .get() safe.
8. Classes: __init__, self, attributes vs methods.
9. Recursion: Base case first, then recursive step.
10. Eliminate: = vs ==, print vs return, alias vs copy, mutable vs immutable.
SAMPLE Q3 — Try It (Answer Hidden)
Sample: def f(): return 5; print(f()) = ?
A. 5
B. None
C. 0
D. Error
SAMPLE Q4 — Try It (Answer Hidden)
Sample: 'abc'[0:2] = ?
A. 'ab'
B. 'abc'
C. 'bc'
D. 'a'
FULL QUESTIONS + ANSWERS + RATIONALES START ON PAGE 4
,Final Exam Key Name _______ Student ID _______
SECTION 1 - CS 1110 Final Exam (Questions 1 to 78)
1. What is output of print(7 // 2, 7 % 2)?
A. 3 1 - // floor, % remainder: 7//2=3, 7%2=1
B. 3.5 1
C. 3 0
D. 4 1
Answer: A [Concept: Python]
Rationale: Correct is A: // = floor division, % = remainder. Worked: 7//2=3,
7%2=1. Answer 3 1. Another option is wrong because / gives 3.5, // gives 3.
Another option is wrong because remainder is 1. Another option is wrong because
floor is 3.
Page 4 • CS 1110 Final Exam - Cornell