Properties

Q1:

Student class has a property called rollNo and stu is a reference to a Student object and we want the statement stu.RollNo = 28 to fail. Which of the following options will ensure this functionality?

A Declare rollNo property with both get and set accessors.

B Declare rollNo property with only set accessor.

C Declare rollNo property with get, set and normal accessors.

D Declare rollNo property with only get accessor.

E None of the above

ANS:D - Declare rollNo property with only get accessor.

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.