Explore topic-wise MCQs in Attributes .

This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your Attributes knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following are necessary for Run-time Polymorphism? 1.The overridden base method must be virtual, abstract or override. 2.Both the override method and the virtual method must have the same access level modifier. 3.An override dec

A. 1, 2, 5
B. 1, 3
C. 4 only
D. 2, 3, 4
Answer» E.
2.

Which of the following can be declared as a virtual in a class? 1.Methods 2.Properties 3.Events 4.Fields 5.Static fields

A. 3, 5
B. 1, 2, 3
C. 2, 3, 5
D. 2, 4
Answer» C. 2, 3, 5
3.

Which of the following operators cannot be overloaded? 1.true 2.false 3.new 4.~ 5.sizeof

A. 2, 4
B. 1, 3
C. All of the above
D. 3, 5
Answer» E.
4.

Which of the following are necessary for Run-time Polymorphism?

A. 1, 3
B. 1, 2, 5
C. 2, 3, 4
D. 4 only
Answer» C. 2, 3, 4
5.

Which of the following can be declared as a virtual in a class?

A. 1, 2, 3
B. 3, 5
C. 2, 4
D. 2, 3, 5
Answer» B. 3, 5
6.

Which of the following statement is correct about the C#.NET code snippet given below?

A. DerivedSample class hides the fun() method of base class.
B. The DerivedSample class version of fun() method gets called using Sample class reference which holds DerivedSample class object.
C. The code replaces the DerivedSample class version of fun() method with its Sample class version.
D. It is not possible to hide Sample class version of fun() method without use of new in DerivedSample class.
Answer» B. The DerivedSample class version of fun() method gets called using Sample class reference which holds DerivedSample class object.
7.

Which of the following is the correct way to overload + operator?

A. public sample operator + ( sample a, sample b )
B. public abstract operator + ( sample a, sample b)
C. public abstract sample operator + (sample a, sample b )
D. public static sample operator + ( sample a, sample b )
Answer» E.
8.

Which of the following unary operators can be overloaded?

A. 1, 2, 3
B. 3, 4, 5
C. 3 only
D. 5 only
Answer» B. 3, 4, 5