An application presents the user with a graphical interface. The interface includes buttons that the user clicks to perform tasks. Each time the user clicks a button, a method is called that corresponds to that button.
Which term is used to describe this programming model?
Functional
Service oriented
Structured
Event driven
Correct answer: D
Question 2
The purpose of a constructor in a class is to:
Initialize an object of that class.
Release the resources that the class holds.
Create a value type.
Inherit from the base class.
Correct answer: A
Explanation:
Each value type has an implicit default constructor that initializes the default value of that type.
Each value type has an implicit default constructor that initializes the default value of that type.
Question 3
A class named Manager is derived from a parent class named Employee. The Manager class includes characteristics that are unique to managers.
Which term is used to describe this object-oriented concept?
Encapsulation
Data modeling
Inheritance
Data hiding
Correct answer: C
Explanation:
Classes (but not structs) support the concept of inheritance. A class that derives from another class (the base class) automatically contains all the public, protected, and internal members of the base class except its constructors and destructors. Incorrect:not A: Encapsulation is sometimes referred to as the first pillar or principle of object-oriented programming. According to the principle of encapsulation, a class or struct can specify how accessible each of its members is to code outside of the class or struct. Methods and variables that are not intended to be used from outside of the class or assembly can be hidden to limit the potential for coding errors or malicious exploits.
Classes (but not structs) support the concept of inheritance. A class that derives from another class (the base class) automatically contains all the public, protected, and internal members of the base class except its constructors and destructors.
Incorrect:
not A: Encapsulation is sometimes referred to as the first pillar or principle of object-oriented programming. According to the principle of encapsulation, a class or struct can specify how accessible each of its members is to code outside of the class or struct. Methods and variables that are not intended to be used from outside of the class or assembly can be hidden to limit the potential for coding errors or malicious exploits.