How do we gain access to private attributes outside of the class they are defined? Through public methods Through static methods Through private methods Through the class identifier 2. If you were designing a class called Point and the class had a static variable or function, which of the following would either define or use it correctly? self.x = x self.increaseNumPoints() def mystery(self, x, y): Point.numPoints += 1 3.To promote security and object ecapsulations, object attributes should be declared as: static protected private public 4. Two underscores ( __ ) will precede: public attributes private attributes public methods private methods Both public attributes and methods both private attributes and methods 5. Which of the following is required in a class to create unique instances of the class? static attributes object methods A constructor return methods 6. Which of the following keywords marks the beginning of the class definition? return @staticmethod def class 7. Which of the following programming ideas is similar to a distinctly identifiable item in the real world, in terms of computer science? A method A class An Object An attribute 8. Which of the following programming ideas represent the template, or blueprint for a distinctly identifiable item in the real world in terms of computer science? An object An attribute A class A method
1.How do we gain access to private attributes outside of the class they are defined?
Through public methods |
||
Through static methods |
||
Through private methods |
||
Through the class identifier |
2. If you were designing a class called Point and the class had a static variable or function, which of the following would either define or use it correctly?
self.x = x |
||
self.increaseNumPoints() |
||
def mystery(self, x, y): |
||
Point.numPoints += 1 |
static |
||
protected |
||
private |
||
public |
4. Two underscores ( __ ) will precede:
public attributes |
||
private attributes |
||
public methods |
||
private methods |
||
Both public attributes and methods |
||
both private attributes and methods |
5. Which of the following is required in a class to create unique instances of the class?
static attributes |
||
object methods |
||
A constructor |
||
return methods |
6. Which of the following keywords marks the beginning of the class definition?
return |
||
@staticmethod |
||
def |
||
class |
7. Which of the following
A method |
||
A class |
||
An Object |
||
An attribute |
8. Which of the following programming ideas represent the template, or blueprint for a distinctly identifiable item in the real world in terms of computer science?
An object |
||
An attribute |
||
A class |
||
A method |
Trending now
This is a popular solution!
Step by step
Solved in 3 steps