Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 13 pages
Exam (elaborations)

CIS2300: Final Study Guide | 2026 Update - Baruch College, CUNY

Document preview thumbnail
Preview 2 out of 13 pages

CIS2300: Final Study Guide | 2026 Update - Baruch College, CUNY

Content preview

CIS2300FinalReview

Tuples
Key Concepts:

• A tuple is an ordered, immutable data structure that holds multiple values of
different types.
• Parentheses ( ) are usually placed around tuples, but the commas are what make it a
tuple → not the parentheses.
t1 = 1, 2, 3
t2 = (1, 2, 3)
• Tuples use square brackets [ ] for indexing and slicing, just like lists
• Tuples are immutable → you cannot update, insert, remove items once created.

Questions:

1. Fix the error below:
fruits = ("apple", "banana", "cherry"
print(fruits)
2. Will this code print all elements of the tuple correctly? If not, fix the error:
cars = ("Ford", "Honda", "Tesla")
for i in range(0, len(cars)+1):
print(cars[i])
3. Given t1 = (1, 2, "apple", "banana”, 5), append "cherry" to the
tuple.
4. Given t2 = (1, 2, ["apple", "banana"], 5), is it possible to append
"cherry"to the inner list without transforming the tuple?
5. What does this code print?
t = (2, 4, 6)
for n in t:
n = (n * n)
print(t)

6. Write a program that loops through the tuple and counts how many numbers are
even. Then, print the total.
7. Using a loop and t = ("a", "b", "c", "d", "e"), print only elements at
even indices.
8. Given t = (1, 2, 3, 4, 5, 6), print the index and the value, but only when
the value is even.

, Dictionaries
Key Concepts:

• A dictionary stores data as key–value pairs.
• Dictionaries use curly braces { }.
student = {"name": "Alex", "age": 20, "major": "CS"}
• Each item has two parts:
o Key → the lookup term
▪ Keys must be unique and must be immutable.
o Value → the data stored under that key
▪ Values can be any type, including lists or other dictionaries.
• Dictionaries are mutable, so you can add, change, or remove items.
• Use square brackets with the key, not the index
o student["name"]
• If you try to access a key that does not exist → KeyError.
• To avoid errors, use .get():
o student.get("age") # returns None if key not found

• You update or add items using square brackets with the key
• If the key already exists, assigning a new value replaces the old one:
o student["Age"] = 21
• If the key does not exist, assigning a new value creates the entry:
o student["GPA"] = 3.7
• Can remove key-value pairs using del or .pop()
o del student["GPA"]
o student.pop("GPA")
• Common Dictionary Methods
Method Description
.keys() Returns all keys
.values() Returns all values
.items() Returns key, value pairs
.get(key) Safe lookup, returns None if key not found


Questions:

1. What does this code print?
d = {"a": 1, "b": 2}
d["c"] = d["a"] + d["b"]
print(d)
2. Would this cause an error? Why?
d = { [1,2,3] : "numbers", "x": 5 }

Document information

Uploaded on
July 24, 2026
Number of pages
13
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$18.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
PassPointExams
4.1
(50)
Sold
184
Followers
170
Items
2906
Last sold
1 week ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions