1. | 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? |
|||||||||
Answer: Option B Explanation: No answer description available for this question. Let us discuss.
|
2. | Which of the folowing does an indexer allow to index in the same way as an array? 1 A class 2 A property 3 A struct 4 A function 5 An interface
|
|||||||
Answer: Option A Explanation: No answer description available for this question. Let us discuss.
|
3. | Which of the following is the correct way to implement a read only property Length in a Sample class?
|
|||||||
|
4. | Which of the following statements is correct about properties used in C#.NET?
|
|||||||
Answer: Option C Explanation: No answer description available for this question. Let us discuss.
|
5. | Suppose a Student class has an indexed property. This property is used to set or retrieve values to/from an array of 5 integers called scores[]. We want the property to report "Invalid Index" message if the user attempts to exceed the bounds of the array. Which of the following is the correct way to implement this property?
|
|||||||
Answer: Option B Explanation: No answer description available for this question. Let us discuss.
|
6. | An Account class has a property called accountNo and acc is a reference to a bank object and we want the C#.NET code snippet given below to work. Which of the following options will ensure this functionality? acc.accountNo = 10; Console.WriteLine(acc.accountNo); |
|||||||||
Answer: Option A Explanation: No answer description available for this question. Let us discuss.
|
7. | If Sample class has a Length property with get accessor then which of the following statements will work correctly?
|
|||||||||
Answer: Option C Explanation: No answer description available for this question. Let us discuss.
|
8. | If Sample class has a Length property with set accessor then which of the following statements will work correctly?
|
|||||||||
Answer: Option E Explanation: No answer description available for this question. Let us discuss.
|