Python Forum
Just some second choice answers help please - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Just some second choice answers help please (/thread-2748.html)



Just some second choice answers help please - ajaY - Apr-06-2017

Forget my uni assignment was in for today :/


1.      What could we do to better encapsulate our classes?
A.     Use Getters and Setters.
B.     Use fewer methods.
C.     Allow free access to the instance variables.
D.     Give descriptive variable names.
 
Answer:
 
2.      Which of the following statement is correct?
A.     Class is an instance of object.
B.     Object is an instance of a class.
C.     Class is an instance of data type.
D.     Object is a description of a class.      
 
3.      What method is called when instantiating an object?
A.     The Destructor.
B.     The Constructor.
C.     The Getter.
D.     The Setter.
 
4.      Which of the following concepts means wrapping up of data and functions together?
A.     Abstraction
B.     Encapsulation
C.     Inheritance
D.     Polymorphism
 
 
 
5.      What does the double underscore denote in at the beginning of a method?
A.     The method is Private
B.     The method is Public
C.     The method is a Friend
D.     The method is Protected


6.      In UML what is character used to denote a public variable?
A.     
B.     +
C.     /
D.     P
 
7.      What goes at the top of a UML class diagram?
A.     The constructor
B.     The methods
C.     The variables
D.     The name of the class
 
8.      What do we call it when we create a new class that is based on an existing class?
A.     Polymorphism.
B.     Inheritance.
C.     Overloading.
D.     Overriding.


RE: Just some second choice answers help please - buran - Apr-06-2017

(Apr-06-2017, 01:26 PM)ajaY Wrote: Forget my uni assignment was in for today :/

Sorry to hear that...
Still you have time to research the correct answers yourself.


RE: Just some second choice answers help please - ajaY - Apr-06-2017

bump pls


RE: Just some second choice answers help please - snippsat - Apr-06-2017

There are people coming from Java/C++ that that has made these questions Snooty


RE: Just some second choice answers help please - micseydel - Apr-07-2017

(Apr-06-2017, 01:40 PM)ajaY Wrote: bump pls
We're not going to answer your questions. If you make an attempt and explain your reasoning, someone might come along and help. But you're very unlikely to get satisfactory answers if you haven't made a clean effort.


RE: Just some second choice answers help please - nilamo - Apr-07-2017

1) None of the answers are appropriate.  All of those answers assume private/protected/public accessors, which don't exist in python.
2-the rest) These are simple definitions, which can easily be looked up.


RE: Just some second choice answers help please - micseydel - Apr-07-2017

(Apr-07-2017, 05:34 PM)nilamo Wrote: 1) None of the answers are appropriate.
Well, one of them makes more sense than the others, especially if you forgive the poorly-worded question (it's not the classes you want to encapsulate, the classes are the tool for doing the encapsulation).

(Apr-07-2017, 05:34 PM)nilamo Wrote: All of those answers assume private/protected/public accessors, which don't exist in python.
Sure, but you could (try) to use it as a comparison of Python vs. C++. Though there's more nuance to it than the multi-choice suggests.

(Apr-07-2017, 05:34 PM)nilamo Wrote: 2-the rest) These are simple definitions, which can easily be looked up.
(EDIT: This is the first time I've been bit by unicode stuff on this site; I tried to do a thumbs up.)