IDSC 3102 Midterm

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Statements of which of the following kind should be placed in the Declarations section of a class code block? (A) Public Event UserDefinedEvent(par1 As dataType1, par2 As dataType2, ...) (B) RaiseEvent UserDefinedEvent(arg1, arg2, ...) (C) Dim WithEvents object1 As ClassName (D) Private Sub object1_UserDefinedEvent(par1, par2, ...) _ Handles object1.UserDefinedEvent

A

What is the purpose of the Get property procedure? (A) retrieve the value of a property (B) assign values (C) access private methods (D) verify the data

A

Which of the following best defines the term inheritance? (A) the process by which the properties, methods, and events of one class are passed onto another class (B) the collection of a parent class along with its descendants (C) when a member variable of class A makes use of an object of type class B (D) when one class manipulates or changes objects of another class

A

Which one of the following statements does NOT accurately describe object-oriented programs? (A) they are populated with objects that don't have properties (B) they are populated with objects that hold data (C) they are populated with objects that respond to methods (D) they are populated with objects that raise events

A

Which statement form below assigns a value to a property? (A) objectName.propertyName = value (B) varName = objectName.propertyName (C) objectName.methodName(arg1, ...) (D) RaiseEvent eventName

A

2. What are variables declared inside a class but not inside a method called? (A) global variables (B) member variables (C) local variables (D) class-level variables

B

Control objects and code objects share many things in common. Which of the following statements applies only to control objects (in other words, which of the following statements does not apply to code objects)? (A) these objects have properties (B) these objects are predefined and have physical manifestations (C) these objects respond to methods (D) these objects are an encapsulation of data and procedures that act on the data

B

In the following code block, which of the following represents the line of code that assigns the value of the Name property? Class Student Private m_name As String Public Property Name() As String Get Return m_name End Get Set(Value As String) m_name = Value End Set End Property End Class (A) End Class (B) m_name = Value (C) Return m_name (D) Private m_name As String

B

Statements of which of the following kind should be placed at locations in the class block code at which the event should be raised? (A) Public Event UserDefinedEvent(par1 As dataType1, par2 As dataType2, ...) (B) RaiseEvent UserDefinedEvent(arg1, arg2, ...) (C) Dim WithEvents object1 As ClassName (D) Private Sub object1_UserDefinedEvent(par1, par2, ...) _ Handles object1.UserDefinedEvent

B

Which of the following best defines the term hierarchy? (A) the process by which the properties, methods, and events of one class are passed onto another class (B) the collection of a parent class along with its descendants (C) when a member variable of class A makes use of an object of type class B (D) when one class manipulates or changes objects of another class

B

Which of the following is a benefit of inheritance? (A) Inheritance leads to the duplication of code in multiple classes. (B) Inheritance allows two or more classes to share some common features yet differentiate themselves on others. (C) Inheritance allows variables to be collected in arrays. (D) Inheritance allows Visual Basic programs to directly connect to databases.

B

Which of the following is an example of an array declaration whose data type is a user-defined object? (A) Dim students(50) As String (B) Dim students(50) As Student (C) Dim students(50) As Integer (D) Dim students(50) As TextBox

B

Which of the following statements best applies to the term user-defined events? (A) User-defined events represent specific instances of a user-defined type. (B) User-defined events are used to communicate changes of properties, errors, and the progress of lengthy operations. (C) User-defined events are predefined objects with physical manifestations. (D) User-defined events are populated with objects that hold data, have properties, respond to methods, and raise events.

B

Which of the following terms does not describe a relationship between classes? (A) use (B) subclass (C) inheritance (D) containment

B

Which statement form below assigns the value of a property to a variable? (A) objectName.propertyName = value (B) varName = objectName.propertyName (C) objectName.methodName(arg1, ...) (D) RaiseEvent eventName

B

Statements of which of the following kind should be placed in the form's code to declare an instance of a class that contains an event? (A) Public Event UserDefinedEvent(par1 As dataType1, par2 As dataType2, ...) (B) RaiseEvent UserDefinedEvent(arg1, arg2, ...) (C) Dim WithEvents object1 As ClassName (D) Private Sub object1_UserDefinedEvent(par1, par2, ...) _ Handles object1.UserDefinedEvent

C

The _________________ feature of Visual Basic allows certain types of property blocks to the written with neither a Get or a Set block? (A) default properties (B) self-implemented properties (C) auto-implemented properties (D) self-explanatory properties

C

What keyword allows a child class to access its parent class's implementation of a method that the child class is overriding? (A) Base (B) Parent (C) MyBase (D) DoNotOverride

C

Which of the following is an accurate definition of the term object-oriented program? (A) An object-oriented program is a specific instance of a user-defined type. (B) An object-oriented program is an encapsulation of data and procedures that has properties and responds to methods. (C) An object-oriented program is populated with objects that hold data, have properties, respond to methods, and raise events. (D) An object-oriented program is a template from which objects are created.

C

Which of the following statements applies to code objects? (A) they are created from the Toolbox (B) they are predefined and have physical manifestations (C) they require the writing of a class block of code (D) they include objects of the type TextBox and ListBox

C

Which procedure will set default values for member variables when an object is instantiated? (A) Form1_Load (B) Get property procedure (C) New (D) Set property procedure

C

Which statement form below carries out a method? (A) objectName.propertyName = value (B) varName = objectName.propertyName (C) objectName.methodName(arg1, ...) (D) RaiseEvent eventName

C

In the following code, which of the following represents the line of code that guarantees that the variable m_name cannot be directly accessed from outside a Student object? Class Student Private m_name As String Public Property Name() As String Get Return m_name End Get Set(Value As String) m_name = Value End Set End Property End Class (A) End Class (B) m_name = Value (C) Return m_name (D) Private m_name As String

D

Which line of code will declare and create an instance of a new object variable called instructor using a class called Faculty? (A) Dim Faculty As instructor (B) Dim instructor As Faculty (C) Dim Faculty As New instructor (D) Dim instructor As New Faculty

D

Which of the following is an accurate definition of the term class? (A) A class is a specific instance of a user-defined type. (B) A class is an encapsulation of data and procedures that has properties and responds to methods. (C) A class is populated with objects that hold data, have properties, respond to methods, and raise events. (D) A class is a template from which objects are created.

D

Which of the following is an example of a control object? (A) string variable (B) array (C) primary key (D) list box

D

Which one of the following statements does NOT apply to object-oriented programming? (A) Object-oriented programming helps to prevent the complete rewriting of a program every time a minor change needs to be made. (B) Object-oriented programming makes use of the principle of "data hiding." (C) Object-oriented programming makes use of the encapsulation within an object of data and procedures that act on the data. (D) Object-oriented programming depends on the programmer having access to and understanding all of the code that contains the data and procedures that are encapsulated within an object.

D

A good rule of thumb for object-oriented programming is that classes are the verbs in your analysis of the problem. (T/F)

F

An auto-implemented property can be specified as ReadOnly. (T/F)

F

An object can be created in the Declaration section of a form's Code editor with a pair of statements of the form. (T/F) Dim objectname As className objectName = New className

F

An object is a template from which classes are created. (T/F) F

F

Each class has a special method called a constructor that is sometimes invoked when an object is instantiated. (T/F)

F

In inheritance, the keyword Overrides is used to designate the parent's methods that are overridden by its children. (T/F)

F

In the following statement, the word m_name demonstrates the proper name for a member or instance variable. If these variables are declared without the prefix "m_", an exception will be thrown. (T/F) Private m_name As String

F

Inheritance does not enhance code reusability. (T/F)

F

Inheritance is the process by which the parent or base class inherits the properties, methods, and events of the child or derived class. (T/F)

F

Property blocks of code, that are used to access (indirectly) member or instance variables, must always contain both Get and Set property procedures. (T/F)

F

The constructor method requires at least one argument, and the code inside the procedure block performs any tasks needed for initializing an object. (T/F)

F

The feature that two classes can have methods with different names but that have the same purpose (and essentially the same implementation), is known as polymorphism. (T/F)

F

The lines of code used to create an instance of a class cannot be used inside of a procedure. (T/F)

F

The principle of "data hiding" is the exact opposite of the concepts that serve as the basis for object-oriented programming. (T/F)

F

The statement for raising a user-defined event is located in the form's code and the event is dealt with in the class block of code. (T/F)

F

15. Member variables in a class are normally specified as Private. (T/F)

T

A class specifies the properties and methods that will be common to all objects that are instances of that class. (T/F)

T

A line of code of the form Dim objectName As New className is used to instantiate an object variable or instance of an object. (T/F)

T

A line of code that contains arguments and instantiates an object passes the value of these arguments to the object's New procedure. (T/F)

T

A member variable in a class specified as Public can be accessed by code outside of the class. (T/F)

T

An object is an encapsulation of data and procedures that act on that data. (T/F)

T

Code objects are specific instances of a user-defined type, called a class. (T/F)

T

Each list box is said to be an instance of the class ListBox. (T/F)

T

Get property procedures are used to retrieve values of member variables. (T/F)

T

If member variables are declared as Private, they cannot be accessed directly from outside an object. (T/F)

T

In inheritance, the keyword Overridable is used to designate the parent's methods that may be overridden by its children. (T/F)

T

In the following statement, the word Private is used to guarantee that the variable cannot be accessed directly from outside the object. (T/F) Private m_name As String

T

It can be said that class Student contains class College when a member variable of class Student makes use of an object of type class College. (T/F)

T

Member or instance variables should not be accessed directly; instead, these variables are accessed indirectly through the use of a property block of code. (T/F)

T

Methods are constructed with a Function procedure when the method returns a value, and with a Sub procedure otherwise. (T/F)

T

Methods can be either Sub or Function procedures. (T/F)

T

Set property procedures are used to assign values to member variables. (T/F)

T

The ISA test is one guideline used in determining when and how to establish a hierarchy. It posits that if one class is a more specific case of another class, then it should be derived from that other class. (T/F)

T

The New event procedure is automatically invoked when an object is instantiated. (T/F)

T

The class interface is a set of properties, methods, and events that define how the class should behave. (T/F)

T

The constructor method takes zero or more arguments, and the code inside the procedure block performs any tasks needed for initializing an object. (T/F)

T

The constructor method that is possessed by each class is used to set default values for member variables and to create other objects associated with this object. (T/F)

T

The header for an event procedure for an instance of a class will be of the following type: (T/F) Private Sub object1_UserDefinedEvent(par1 As DataType1,_ par2 As DataType2, ...) Handles object1.UserDefinedEvent

T

The keyword MustInherit is used to declare an abstract base class. (T/F)

T

The keyword WithEvents is inserted into the standard declaration statement for instantiation of a class to allow the instance to respond to an event. (T/F)

T

The programmer needs to be able to identify useful hierarchies of classes and derived classes in working with object-oriented programming. (T/F)

T

The statement for raising a user-defined event is located in the class block of code and the event is dealt with in the form's code. (T/F)

T

Two instances of the same class may exist in a single program. (T/F) T

T


Set pelajaran terkait

Unit 1 - Psychology's History and Approaches

View Set

Living Environment State Lab Questions

View Set

metric prefixes (smallest to largest)

View Set

Policy Provisions and Contract Law

View Set

French Phonetic Transcription Practice

View Set