Chapter 11 Concepts/Quiz

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

21. Which of the following does not instantiate an Animal object and assigns it to the dog variable? A) Dim dog As Animal B) Dim dog As New Animal C) Dim dog As Animal dog = New Animal

A) Dim dog As Animal

12. The Return statement is entered in the __________ statement in a Property procedure. A) Get B) Set C) Assign D) Validate

A) Get

27. The Return statement is entered in the __________ statement in a Property procedure. A) Get B) Set C) Assign D) Validate

A) Get

19. Which of the following clauses allows a derived class named Dog to have the same attributes and behaviors as its base class, which is named Animal? A) Inherits Animal B) Inherits Dog C) Overloads Dog D) Overrides Animal

A) Inherits Animal

29. Which of the following clauses allows a derived class named Dog to have the same attributes and behaviors as its base class, which is named Animal? A) Inherits Animal B) Inherits Dog C) Overloads Dog D) Overrides Animal

A) Inherits Animal

22. The Salaried class is derived from a base class named Employee. Which of the following statements can be used by the Salaried class to invoke the Employee class's default constructor? A) MyBase.New() B) MyEmployee.New() C) Call Employee.New D) none of them

A) MyBase.New()

24. A class contains an auto-implemented property named Address. Which of the following is the correct way for the default constructor to assign the string "Test" to the variable associated with the property? A) _Address = "Test" B) _Address.strAddress = "Test" C) Address = "Test" D) None of them

<>C

5. Which of the following statements is false? A) A class can contain only one constructor. B) An example of a behavior is the SetTime method in a Time class. C) An object created from a class is referred to as an instance of the class. D) An instance of a class is considered an object.

A) A class can contain only one constructor.

10. Which of the following does not instantiate an Animal object and assigns it to the dog variable? A) Dim dog As Animal B) Dim dog As New Animal C) Dim dog As Animal dog = New Animal

A) Dim dog As Animal

35. The Salaried class is derived from a base class named Employee. Which of the following statements can be used by the Salaried class to invoke the Employee class's default constructor? A) MyBase.New() B) MyEmployee.New() C) Call Employee.New D) none of them

A) MyBase.New()

1. The Option statements have the same meaning in a class file as they have in a form file. A) True B) False

A) True

10. A Private variable in a class can be accessed directly by a Public method in the same class. A) True B) False

A) True

16. One of the disadvantage of using Public variables in a class is that a class cannot control the values assigned to its Public variables. A) True B) False

A) True

6. A Private variable in a class can be accessed directly by a Public method in the same class. A) True B) False

A) True

16. A class contains an auto-implemented property named Location.Which of the following is the correct way for the default constructor to assign the string "Unknown" to the variable associated with the property? A) _Location = "Unknown" B) _Location.strLocation = "Unknown" C) Location = "Unknown" D) None of them

A) _Location = "Unknown"

18. The Salesperson class contains a ReadOnly property named Bonus. The property is associated with the Private _dblBonus variable. A button's Click event procedure instantiates a Salesperson object and assigns it to the ourSalesperson variable. Which of the following isvalid in the Click event procedure? A) lblBonus.Text = ourSalesperson.Bonus.ToString("C2") B) ourSalesperson.Bonus = dblSales * .1 C) ourSalesperson._dblBonus = 500 D) none of them

A) lblBonus.Text = ourSalesperson.Bonus.ToString("C2")

36. A method name combined with its optional parameterList is called the method's ____. A) signature B) event C) attribute D) behavior

A) signature

13. A class contains a Private variable named _strCapital. The variableis associated with a Public property named Capital. Which of the following is the best way for a parameterized constructor to assign the value stored in its strCapName parameter to the variable? A) _strCapital = strCapName B) Capital = strCapName C) _strCapital.Capital = strCapName D) None of them

B) Capital = strCapName

33. A class contains a Private variable named _strCapital. The variableis associated with a Public property named Capital. Which of the following is the best way for a parameterized constructor to assign the value stored in its strCapName parameter to the variable? A) _strCapital = strCapName B) Capital = strCapName C) _strCapital.Capital = strCapName D) None of them

B) Capital = strCapName

13. Constructors never return a value, so they are always Function procedures. A) True B) False

B) False

15. A ReadOnly property can be an auto-implemented property. A) True B) False

B) False

17. A ReadOnly property can be an auto-implemented property. A) True B) False

B) False

23. When a variable in a class is declared using the Public keyword, it can be used only within the class. A) True B) False

B) False

25. A class can have multiple default constructors. A) True B) False

B) False

30. A Sub procedure returns a value using the return keyword after performing its assigned task, whereas a Function procedure does not return a value. A) True B) False

B) False

31. When an application instantiates an object, only the Private members of the object's class are visible to the application; the application cannot access the Public members of the class. A) True B) False

B) False

6. Which of the following statements is false? A) A class can contain more than one constructor. B) None of them. C) An object created from a class is referred to as an instance of the class. D) An instance of a class is considered an object.

B) None of them.

8. A(n) ____ is a class method whose sole purpose is to initialize the class's Private variables. A) signature B) constructor C) Get block D) event

B) constructor

28. A constructor that has no parameters is called the ____. A) Property procedure B) default constructor C) parameterized constructor D) Set block

B) default constructor

7. The Product class contains a Private variable named _intPrice. The variable is associated with the Public Price property. An application instantiates a Product object and assigns it to a variable named item. The Product class above contains a Public method named GetNewPrice. The method is a Function procedure. Which of the following can be used by the application above to invoke the GetNewPrice method? A) intNewPrice = Call GetNewPrice B) intNewPrice = Price.GetNewPrice C) intNewPrice = item.GetNewPrice D) intNewPrice = item.GetNewPrice(item._intPrice)

B) intNewPrice = Price.GetNewPrice

14. Two or more methods that have the same name but different parameterLists are referred to as ________ methods. A) loaded B) overloaded C) parallel D) signature

B) overloaded

32. An application can access the Private variables in a class ___________. A) directly B) using properties created by Public Property procedures C) through Private procedures contained in the class D) none of them

B) using properties created by Public Property procedures

7. An application can access the Private variables in a class ___________. A) directly B) using properties created by Public Property procedures C) through Private procedures contained in the class D) none of them

B) using properties created by Public Property procedures

1. The name of a class file ends with ______. A) .cla B) .cls C) .vb D) none of them

C) .vb

12. The name of a class file ends with ______. A) .cla B) .cls C) .vb D) none of them

C) .vb

19. The Inherits clause is the keyword ____ followed by the name of the class whose attributes and behaviors you want the derived class to inherit. A) It Inherits B) InheritsFrom C) Inherits D) Inherits_From

C) Inherits

34. To expose a variable or method contained in a class, you declare the variable or method using the keyword ___________. A) Exposed B) Private C) Public D) Viewable

C) Public

8. To expose a variable or method contained in a class, you declare the variable or method using the keyword ___________. A) Exposed B) Private C) Public D) Viewable

C) Public

20. A base class contains a method named GetBonus. Which of the following procedure headers can be used in the base class to indicate that a derived class can provide its own code for the method? A) Public Inherits Sub GetBonus() B) Public Overloads Sub GetBonus() C) Public Overridable Sub GetBonus() D) Public Overrides Sub GetBonus()

C) Public Overridable Sub GetBonus()

22. A base class contains a method named GetBonus. Which of the following procedure headers can be used in the base class to indicatethat a derived class can provide its own code for the method? A) Public Inherits Sub GetBonus() B) Public Overloads Sub GetBonus() C) Public Overridable Sub GetBonus() D) Public Overrides Sub GetBonus()

C) Public Overridable Sub GetBonus()

11. If you need to validate a value before assigning it to a Private variable, you enter the validation code in the _______ block in a Property procedure. A) Assign B) Get C) Set D) Validate

C) Set

14. If you need to validate a value before assigning it to a Private variable, you enter the validation code in the _______ block in a Property procedure. A) Assign B) Get C) Set D) Validate

C) Set

2. A constructor is ___________ . A) a Function procedure B) a Property procedure C) a Sub procedure D) either a Function procedure or a Sub procedure

C) a Sub procedure

26. A constructor is ___________ . A) a Function procedure B) a Property procedure C) a Sub procedure D) either a Function procedure or a Sub procedure

C) a Sub procedure

4. The Product class contains a Private variable named _intPrice. The variable is associated with the Public Price property. An application instantiates a Product object and assigns it to a variable named item. The Product class above contains a Public method named GetNewPrice. The method is a Function procedure. Which of the following can be used by the application above to invoke the GetNewPrice method? A) intNewPrice = Call GetNewPrice B) intNewPrice = Price.GetNewPrice C) intNewPrice = item.GetNewPrice D) intNewPrice = item.GetNewPrice(item._intPrice)

C) intNewPrice = item.GetNewPrice

4. When two or more methods have the same name but different parameters, the methods are referred to as ____. A) default methods B) parameterized methods C) overloaded methods D) Property procedures

C) overloaded methods

15. The method name combined with the method's optional parameterList is called the method's _____________. A) autograph B) inscription C) signature D) statement

C) signature

2. In a Property procedure, the code contained in the ____ block allows an application to retrieve the contents of the Private variable associated with the property. A) Set B) Assign C) New D) Get

D) Get

11. Which of the following is the name of the Animal class's default constructor? A) Animal B) AnimalConstructor C) Default D) New E) None of them

D) New

18. A base class contains a method named GetBonus. Which of the following procedure headers can be used in the derived class to indicate that it is providing its own code for the method? A) Public Inherits Sub GetBonus() B) Public Overloads Sub GetBonus() C) Public Overridable Sub GetBonus() D) Public Overrides Sub GetBonus()

D) Public Overrides Sub GetBonus()

21. A base class contains a method named GetBonus. Which of the following procedure headers can be used in the derived class to indicate that it is providing its own code for the method? A) Public Inherits Sub GetBonus() B) Public Overloads Sub GetBonus() C) Public Overridable Sub GetBonus() D) Public Overrides Sub GetBonus()

D) Public Overrides Sub GetBonus()

9. The instructions of a ____ are automatically processed each time an object is instantiated from the class. A) structure B) designer C) loader D) constructor

D) constructor

5. You can create one class from another class. In OOP, this is referred to as ____. A) encapsulation B) overloading C) overriding D) inheritance

D) inheritance

17. The Product class contains a Private variable named _intPrice. The variable is associated with the Public Price property. An application instantiates a Product object and assigns it to a variable named item. Which of the following can be used by the application to assign thenumber 45 to the _intPrice variable? A) _intPrice = 45 B) Price = 45 C) item._intPrice = 45 D) item.Price = 45

D) item.Price = 45

3. The Product class contains a Private variable named _intPrice. The variable is associated with the Public Price property. An application instantiates a Product object and assigns it to a variable named item. Which of the following can be used by the application to assign the number 45 to the _intPrice variable? A) _intPrice = 45 B) Price = 45 C) item._intPrice = 45 D) item.Price = 45

D) item.Price = 45

9. Which of the following is the name of the Animal class's default constructor? A) Animal B) AnimalConstructor C) Default D) none of them

D) none of them

3. Constructors that contain parameters are called ____. A) attributes B) default constructors C) Set blocks D) parameterized constructors

D) parameterized constructors

20. In a Property procedure, the dataType must match the data type of ____ associated with the Property procedure. A) all constructors B) all variables C) the Public variable D) the Private variable

D) the Private variable


Kaugnay na mga set ng pag-aaral

NFS 2112 Exam 3 WIC SNAP HS NSLP

View Set

Chapter 3 - General Biology Majors

View Set

Intro to Programming Definitions

View Set

National Real Estate Exam Questions

View Set

Marketing Principles: Chapter 11

View Set

Monopolistic Competition and Oligopoly

View Set