CS 1110 - Introduction to Programming
Review for Third Test
The following questions are provided to help you study for
the third test. Do not expect to see these exact questions on the test.
- How are lists and strings alike? How are they different?
- For the loop that you wrote in problem 30, can you
substitute the name of a string for the name of the list?
- What are two concatenation operators you can use with
- Explain string slice notation using this example:
- Write a few lines of code that will tell us what kind of
characters are in a string, and what cases exist in it?
- If strings are immutable, how does the string method
- What does the string method called split() do? How is that
- Is this a list or a tuple? ['a', 'b', 'c']
- Okay, it was a list. What would it look like if it were a tuple?
- Since we can make both, what are the restrictions on tuples that do not apply to lists?
- How can you easily convert from a tuple to a list, or from a list to a tuple?
- What is the notation used when creating a dictionary? How is a dictionary different from a list?
- What would happen if you entered this code
phonebook['Steve'] = '555-7738'
a. if the dictionary did not exist?
b. if the index indicated did not exist?
c. if the index indicated does exist?
- How can we verify that an index exists in a dictionary?
- What is the command to remove an element from a dictionary? What is an element, anyway?
- What are two quick ways to remove all elements from a dictionary?
- What is true about a set that makes it a little like a dictionary?
- What is the result of the Union of two sets?
- When we ask for the difference between two sets, why does it matter which one we name first?
- What is the intersection of two sets?
- What module should be imported for a python program to be able to use its dump() and load() functions? What are they for?
- What is a class, with respect to writing python programs?
- Classes allow us to use encapsulation. Why is this helpful?
- What methods should we expect to find in a class that has two attributes?
- What method should we find in every properly constructed class?
- What is the difference between a class and an instande of it?
- In a UML diagram of a class, what do we expect to seen in the three separate parts of it?