properties c programming questions

16.

Which of the folowing does an indexer allow to index in the same way as an array?

A class
A property
A struct
A function
An interface

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

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Workspace Report Discuss in Forum
17.

An Employee class has a property called age and emp is reference to a Employee object and we want the statement Console.WriteLine(emp.age) to fail. Which of the following options will ensure this functionality?
A.     Declare age property with only get accessor.
B.     Declare age property with only set accessor.
C.     Declare age property with both get and set accessors.
D.     Declare age property with get, set and normal accessors.
E.     None of the above
Answer & Explanation

Answer: Option B

Explanation:

No answer description available for this question.

Leave a Reply0