Explore topic-wise MCQs in Attributes .

This section includes 5 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 is the correct way to define the constructor(s) of the Sample class if we are to create objects as per the C#.NET code snippet given below?

A. public Sample() { i = 0 ; j = 0.0 f; } public Sample ( int ii, Single jj) { i = ii; j = jj; }
B. public Sample (Optional int ii = 0 , Optional Single jj = 0.0 f) { i = ii; j = jj; }
C. public Sample ( int ii, Single jj) { i = ii; j = jj; }
D. Sample s;
Answer» B. public Sample (Optional int ii = 0 , Optional Single jj = 0.0 f) { i = ii; j = jj; }
2.

Which of the following statements are correct about constructors in C#.NET?

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

In which of the following should the methods of a class differ if they are to be treated as overloaded methods?

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

Which of the following statements are correct about static functions?

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

Which of the following ways to create an object of the Sample class given below will work correctly?

A. Sample s1 = new Sample();
B. Sample s1 = new Sample(10);
C. Sample s2 = new Sample(10, 1.2f);
D. Sample s3 = new Sample(10, 1.2f, 2.4);
Answer» E.