Question: A 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?

Options

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.

Click to view Correct Answer

Previous || Next

Properties - General Questions more questions

Which of the following can be declared as a virtual....

Which of the following statements is correct?

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

A property can be declared inside a class, struct, Interface.

Which of the following statements is correct about properties used....

If a class Student has an indexer, then which of....

Which of the following statements are correct?

If Sample class has a Length property with get and....

Which of the following is the correct way to implement....

A property can be declared inside a namespace or a....

Attributes - General Questions more Online Exam Quiz

Inheritance - General Questions

Interfaces - General Questions

Namespaces - General Questions

Operators - General Questions

Polymorphism - General Questions

Structures - General Questions

Advanced SQL - General Questions

Data and Database Administration - General Questions

Database Design Using Normalization - General Questions

Database Processing for BIS - General Questions