Exam 10: Astronomy: Creating Classes, Writing Constructors, Accessors, Mutators and Special Methods
Exam 1: Introduction to Python: Introduction to Numeric Types, Turtle Graphics, Simple for Loops and Functions34 Questions
Exam 2: Pthon: Estimating PI: Math and Random Methods, Selection and Boolean Expressions, the Print Function33 Questions
Exam 3: Codes and Other Secrets: String Operators and Methods, the Len Built-In Function, Keyword Parameters, User Input33 Questions
Exam 4: Introducing the Python Collections: Lists, Dictionaries, Tuples, and Statistics33 Questions
Exam 5: Bigger Data: File Io: the While Loop, String Formatting, Reading Online Data in CSV and Json Formats33 Questions
Exam 6: Image Processing: Nested for Loops, Functions As Parameters, Namespaces, Lists of Lists33 Questions
Exam 7: Data Mining: Cluster Analysis: More on the While Loop; Parrallel Lists31 Questions
Exam 8: Cryptanalysis: Advanced Dictionaries and Lists, Regular Expressions32 Questions
Exam 9: Fractals: the Geometry of Nature: Recursion, Grammars and Production Rules33 Questions
Exam 10: Astronomy: Creating Classes, Writing Constructors, Accessors, Mutators and Special Methods33 Questions
Exam 11: Simulation:computer Simulation Using Objects34 Questions
Exam 12: Father Was a Rectangle: Inheritance and Object-Oriented Design32 Questions
Exam 13: Video Games: Multithreading, Event Handlers, Static Variables33 Questions
Select questions type
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?
Free
(Multiple Choice)
4.9/5
(43)
Correct Answer:
A
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?
Free
(Multiple Choice)
4.9/5
(34)
Correct Answer:
B
What is a constructor method?
Free
(Essay)
4.9/5
(29)
Correct Answer:
The first method that all classes should provide is the constructor, which can be defined as the way data objects are created. The constructor will then create instance variables to hold these values. Each instance variable holds a reference to an object. In Python, the constructor is always called __init__ . Methods in class definitions are written in the same way as other functions seen thus far. We provide the name of the method and then a collection of parameters that describe the initial state of the new object. These parameters will be filled in with values when the method is invoked.
What does it mean to say that "Python supports the object-oriented programming paradigm?"
(Essay)
4.9/5
(42)
To create an instance of a class, call the __init__ method directly.
(True/False)
5.0/5
(48)
Match each definition with its term.
-Describes what an object will "look" like, what an object knows about itself, and what an object can do.
(Multiple Choice)
4.7/5
(42)
Match each definition with its term.
-Sometimes referred to as a "getter" method.
(Multiple Choice)
4.9/5
(46)
Provide a high-level overview of the steps needed to create an animation of planets moving around the sun.
(Essay)
4.8/5
(36)
What are some of the primitive and collection classes built into the Python language?
(Essay)
4.8/5
(35)
In a Python class, ____ refers to the object for which the method was called.
(Multiple Choice)
4.7/5
(45)
Showing 1 - 20 of 33
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)