Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Python Programming in Context
Quiz 10: Astronomy: Creating Classes, Writing Constructors, Accessors, Mutators and Special Methods
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 1
Multiple Choice
Every Python object is an instance of a(n) :
Question 2
Multiple Choice
The details about what an object can do are called:
Question 3
Multiple Choice
Which of the following is one of Python's collection classes?
Question 4
Multiple Choice
The ____ operator is used to invoke a method of an object.
Question 5
Multiple Choice
Case Study 1: >>> count = 1 >>> count = count + 1 >>> count 2 >>> count = count.__add__(1) >>> count 3 >>> >>> mylist.__getitem__(1) 66 -Refer to the session in the accompanying Case Study 1. What is the equivalent of the + operator?
Question 6
Multiple Choice
Case Study 1: >>> count = 1 >>> count = count + 1 >>> count 2 >>> count = count.__add__(1) >>> count 3 >>> >>> mylist.__getitem__(1) 66 -Refer to the session in the accompanying Case Study 1. What is the equivalent of the __getItem__ operator?
Question 7
Multiple Choice
What keyword defines a class in Python?
Question 8
Multiple Choice
In Python, the constructor is always named:
Question 9
Multiple Choice
In a Python class, ____ refers to the object for which the method was called.
Question 10
Multiple Choice
An accessor method is most likely to be used to implement:
Question 11
Multiple Choice
The print method invokes the ____ method of a class.
Question 12
Multiple Choice
____ objects store method names that refer to method definitions that are implemented by the class.
Question 13
Multiple Choice
____ methods change an object in some way.
Question 14
Multiple Choice
Preceding an instance variable name by two underscores____ the instance variable.
Question 15
Multiple Choice
Case Study 2: 1. def createSSandAnimate() : 2. ss = SolarSystem(2, 2) 3. 4. sun = Sun("SUN", 5000, 1000, 5800) 5. ss.addSun(sun) 6. 7. m = Planet("MERCURY", 19.5, 1000, .25, 0, 2, "blue") 8. ss.addPlanet(m) 9. 10. m = Planet("EARTH", 47.5, 5000, 0.3, 0, 2.0, "green") 11. ss.addPlanet(m) 12. 13. m = Planet("MARS", 50, 9000, 0.5, 0, 1.63, "red") 14. ss.addPlanet(m) 15. 16. m = Planet("JUPITER", 100, 49000, 0.7, 0, 1, "black") 17. ss.addPlanet(m) 18. 19. numTimePeriods = 2000 20. for aMove in range(numTimePeriods) : 21. ss.movePlanets() 22. 23. ss.freeze() 24. -Refer to the session in the accompanying Case Study 2. Which line(s) perform the actual work of the animation?
Question 16
True/False
Algorithms describe the solution to a problem in terms of the data needed to represent the problem instance and a set of steps necessary to produce the intended result.
Question 17
True/False
To create an instance of a class, call the __init__ method directly.
Question 18
True/False
Each object from a particular class has the same instance variables, but the values of those variables are different, therefore allowing the object to "behave" differently when asked to perform methods.