Professional Documents
Culture Documents
Test 2 Multiple Choice Questions: Level 1 Asia Pacific University of Technology and Innovation 2017/ 01
Test 2 Multiple Choice Questions: Level 1 Asia Pacific University of Technology and Innovation 2017/ 01
TEST 2
MULTIPLE CHOICE QUESTIONS
This section carries TWENTY FIVE (25) marks.
Each question carries ONE (1) mark. Answer ALL questions.
1. Which access modifier restricts the method access to the containing class and any derived
classes?
a) private
b) public
c) protected
d) static
3. Select the C# keyword that is required in the class definitions to allow the code to compile
successfully?
a) static
b) default
c) protected
d) partial
a) Inheritence models the IS-A relationship, in which the objects of the subclass are also objects
of the superclass.
b) The number of methods in a superclass is always higher than in each of its subclasses
c) Two subclasses of the same superclass always have the same number of methods
d) None of the above
6. You have created an abstract class and you want to force sub classes to implement a method.
How do you enforce this in C#?
The method ShowTax has been called using the following statement:
showTax (100.0m, 0.08m);
this.b = b;
}
}
a) MyClass(a)
b) base(a)
c) YourClass(a)
d) super(a)
10. Suppose that you want to develop a loyalty card scheme for an application related to a coffee
company. You might start by creating an interface for loyalty card holder that defines:
a) Two methods with the same name that are implemented in the same class, and that have the
same number and type of parameters
b) Two methods with the same name that are implemented in different classes, and that have the
same number and type of parameters
c) Two methods with the same name that are implemented in the same class, and that have the
same number of parameters but of different types
d) Two methods with the same name that are implemented in different classes, and that have the
same number of parameters but of different types
13. A(n) _______________ is a method that is automatically executed when an object is created.
a. opener
b. loader
c. constructor
d. assembler
class Rectangle
{
public Rectangle() {…}
public Rectangle(int length, int width)
{…}
}
{ …. }
….
}
a) base class parameterized constructor can be derived by base keyword in derived class
b) base class parameterized constructor is not inheritable
c) derived class cannot have parameterized constructor
d) None of the above
15. We note that the Employee class is being used as the base class for
Manager and Programmer. We can continue to extend the Employee class by creating as many
sub classes as required for different employees in our application. However, when looking at our
class hierarchy, it does not make sense to be able to create an object of which type directly?
a) Employee
b) Manager
c) Programmer
d) All of the above
16. Which of the following statements is Wrong about a List named myList?
18. Which of the following is not the property of Object Oriented Programming?
a) Inheritance
b) Classes and Objects
c) Function and Procedure
d) Polymorphism
19. The _________________ declares that a derived class is allowed to override a method.
a) void keyword
b) protected keyword
c) base keyword
d) virtual keyword
20. A class that is not intended to be instantiated, but used only as a base class, is called
a(n)________________.
a) dummy class
b) subclass
c) virtual class
d) abstract class
class University
{
int u;
public University ()
{
u = 7;
}
}
a) derived class
b) base class
c) dependent class
d) child class
24. Which of the following is not suitable for operations related to images?
a) List
b) Picture Box
c) Image List
d) Image Property
25. If you write a class with no constructor whatsoever, the compiler will provide
a(n)__________________ .
a) default constructor
b) constructor list
c) parameterized method
d) error message.