A static method can directly refer only to static variables of the class.. Allows access to the members only within the class D.. Which of these statements about method overloading and t
Trang 1ACCP I10 SEMESTER 2 PCS – PROGRAMMING IN C#
MODULAR QUIZ
FOR Session 03
1 Which of these statements about object-oriented programming and objects are true and which statements are false?
A Object-oriented programming focuses on the data-based approach
B An object stores its state in variables and implements its behavior through methods
C Classes contain objects that may or may not have a unique identity
D Declaration of classes involves the use of the class keyword
E Creating objects involves the use of the new keyword
2 Can you match the object-oriented programming (OOP) terms against their
corresponding descriptions?
A Represents the behavior of an object
B Represents an instance of a class
C Represents the state of an object
D Defines the state and behavior for all objects belonging to a particular entity
E Describes an entity
Description
Method
Object
Field
Class
3 Which of these statements about methods are true and which statements are false?
A A static method can directly refer only to static variables of the class
B A method definition includes the return type as null if the method does not return any value
C A method name begins with the & symbol or an underscore
D A static method uses the static keyword in its declaration
E A method declaration can specify multiple parameters to be used in the method
4 Can you match the keywords used for access modifiers against their corresponding descriptions?
A Allows access to the member by all classes
B Allows access to the members only in the same assembly
C Allows access to the members only within the class
D Provides the most permissive access level
Trang 2E Allows access to the base class members in the derived classes
Access modifier
public
internal
private
protected
5 Which of these statements about method overloading and the this keyword are true and which statements are false?
A The return types of the overloaded methods should be the same
B Overloaded methods should contain parameters of the same type
C The ref and out keywords should not be part of the signature of overloaded methods
D Overloaded methods should have the same method name but with different casing
E The this keyword is used to pass the current object as a parameter to a method
6 Can you match the terms about constructors and destructors against their corresponding description?
A Initializes static data members within a class 1 Default constructor
B Initializes variables and is automatically invoked when an object
of a class is created. 2 Garbage collector
C Manages memory for objects 3 Static constructor
D Initializes variables of a class to zero 4 Destructor
E Implements statements that are to be executed during the
garbage collection process. 5 Constructor
7 Which of these statements about constructors and destructors in C# are true and which statements are false?
A A constructor can have return types like int and void
B A class can have more than one constructor
C A static constructor can contain the public access modifier
D A destructor can contain the private access modifier
E A static constructor can refer to static variables only
8 Can you match the terms, keywords and modifiers related to inheritance against their corresponding descriptions?
A Is used to invoke methods 1 new operator
B Is used to create new objects 2 new modifier
C Is used to access base class members only
by the derived class. 3 dot operator
D Is used to execute the inherited methods
of the derived class. 4 base keyword
E Is used to access the constructor of the
base class. 5 protected keyword
Trang 39 Which of these statements about method overriding are true and which statements are false?
A A method is overridden with the same name and signature as declared in the base class
B A method that is overriding the method defined in the base class is preceded by the virtual keyword
C A base class method is preceded with the override keyword in order to override it in the derived class
D A method is known as overridden derived method when it is overridden in the derived class
E A method is overridden by invoking it in the derived class
10 Which of these statements about sealed classes are true and which statements are false?
A The seal keyword is used to declare a class as sealed
B A sealed class is used to ensure security by preventing any modification to its existing methods
C A sealed class is also referred to as final class in C#
D A sealed class is a class whose data members cannot be modified
E A sealed class is used to support the functioning of the virtual keyword
11 Which of these statements about polymorphism are true and which statements are false?
A Polymorphism supports the existence of a single class in multiple forms
B Polymorphism implements multiple methods with different names but with the same signature
C Compile-time polymorphism allows the compiler to identify the methods to be executed
D Run-time polymorphism allows you to execute overridden methods
E Run-time polymorphism supports methods with different signatures
Trang 42 A method, B object, C field,
D class, E class
4 A public, B internal, C private,
D public, E protected
6 A 3, B 5, C 2, D 1, E 4
8 A 3, B 1, C 5, D 2, E 4