



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Object Oriented Programming NBCC questions with correct answers
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




In a three-layer application, the three layers are CORRECT ANSWER the presentation layer, the middle layer, and the database layer When you design and develop business classes for an application, your goal is to CORRECT ANSWER allow development to be spread among members of a development team separate the business rules from the presentation and database logic make the application easier to develop and maintain (all of the above) A class defines the properties and methods of CORRECT ANSWER an object The process of creating an object from a class is known as CORRECT ANSWER instantiation What feature are you taking advantage of when you call the ToDecimal method of the Convert class without knowing how it's coded? CORRECT ANSWER encapsulation The fields of a class CORRECT ANSWER are the variables that are defined at the class level
Two objects created from the same class can have different CORRECT ANSWER data A class file that you add to a project has the extension CORRECT ANSWER cs To return the value of an instance variable named v from a get accessor, you code CORRECT ANSWER return v; Which of the variables declared in the following class is an instance variable? public class Customer { public string firstName; private static int count; public string GetDisplayText() { string displayText = firstName + count; return displayText; } } CORRECT ANSWER firstName A read-only property consists of just CORRECT ANSWER a get accessor To begin the declaration for a property, you code the public keyword followed by CORRECT ANSWER the data type and the name of the property
To generate the starting code for a new member of a class, you can use CORRECT ANSWER the Class Details window To browse the classes in a solution, you can use CORRECT ANSWER The Solution Explorer You can use the Peek Definition window to CORRECT ANSWER display the definition of a class member from within a class that refers to it To display the location of each reference to a class or member when it's displayed in the Code Editor, you can use CORRECT ANSWER The CodeLens Feature Which of the following is not true about a structure? CORRECT ANSWER A structure lets you instantiate a reference type just like a class. An indexer CORRECT ANSWER is a special type of property uses the this keyword in its declaration lets the user of a class access an item by using an index (all of the above) When coding a business class, why would you want to throw an argument exception from a property or method? CORRECT ANSWER So the business class is completely self-contained and doesn't depend on classes that may be coded by other programmers to validate data
The declaration for an event specifies CORRECT ANSWER a delegate that will handle the event and the event's name To raise an event, you code CORRECT ANSWER the name of the event along with its arguments Operator overloading is typically used to CORRECT ANSWER define or redefine the function of an existing operator for a user-defined data type To overload the == operator, you must override Question options: CORRECT ANSWER the Equals and GetHashCode methods inherited from the Object class Code example 13- customer.NameChanged += new EventHandler(Customer_NameChanged); (Refer to code example 13-2.) What is the name of the event? CORRECT ANSWER NameChanged Code example 13- customer.NameChanged += new EventHandler(Customer_NameChanged);