Apr-06-2017, 01:26 PM
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.
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.