C# Programming - Properties
Exercise : Properties - General Questions
- Properties - General Questions
11.
If Sample class has a Length property with get accessor then which of the following statements will work correctly?
12.
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);
13.
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?
14.
Which of the following statements is correct about properties used in C#.NET?
15.
Which of the following is the correct way to implement a read only property Length in a Sample class?
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers