Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Properties Questions
C#.NET — Implement a read-only property Length correctly in a class.
C#.NET properties — Which option correctly implements a write-only property named Length in the Sample class?
C#.NET indexers — A Student class exposes an indexed property over an int[5]. Which usages are correct?
C#.NET properties — Sample has a Length property with only a set accessor (write-only). Which statements compile and run?
C#.NET indexers — Student must support two-dimensional indexing as in: Student s = new Student(); s[1, 2] = 35; Which declaration enables this write-only indexer?
C#.NET properties — To allow both assigning and printing acc.accountNo, how should Account.accountNo be declared?
C#.NET indexers — What kinds of types can declare an indexer and thus be indexed like an array?
C#.NET properties — We want the statement stu.RollNo = 28 to fail for a Student object. How should the rollNo property be declared?
C#.NET indexers — Which statements are correct about indexer definitions and interface indexers?
C#.NET properties — Which statement correctly describes properties?
C#.NET properties — Sample has a Length property with only a get accessor (read-only). Which statements are valid?
C#.NET — Properties and accessibility: make Console.WriteLine(emp.age) fail by design. Scenario: An Employee class exposes a property named age. There is a reference emp to an Employee object. You want the statement below to fail at compile time (i.e., disallow reading age): Console.WriteLine(emp.age) Which option enforces this? Choose the best design choice.
C#.NET — Using an instance property with get and set: which statements compile and run? Assume class Sample defines a non-static property Length with both get and set accessors. Which of the following statements are valid?
C#.NET — True or False: A property can be declared inside a class, a struct, or an interface.
C#.NET — Which statement about properties is correct?
C#.NET — True or False: A property can be declared inside a namespace or inside a procedure (method).
C#.NET — Implementing a bounds-checked indexed property (indexer) for a 5-element scores array. Goal: The indexer should print "Invalid Index" when the user accesses beyond the last valid index.