Home »
Aptitude Questions and Answers »
C# Aptitude Questions and Answers
C# Properties Aptitude Questions and Answers | Set 1
C# Properties Aptitude Questions | Set 1: This section contains aptitude questions and answers on C# Properties.
Submitted by Nidhi, on April 10, 2020
1) There are following statements are given below, which of them are correct about properties in C#.NET?
- Normally, properties are used to set and get values in private members of the class.
- Properties cannot be overloaded.
- Properties can be overloaded.
- In the new version on C#.NET, properties are not supported.
Options:
- Only A
- Only C
- B and D
- A and C
Correct answer: 4
A and C
In the given statements, A and C are correct statements.
2) Is it true, we can only create read-only properties in C#.NET?
- True
- False
Correct answer: 2
False
No, we can create both read and write properties in C#.NET.
3) What is the keyword is used to create read property in C#.NET?
- read
- getProp
- get
- readProp
Correct answer: 3
get
In C#.NET get keyword is used to create a read property.
4) What is the keyword is used to create write property in C#.NET?
- write
- put
- save
- set
Correct answer: 4
set
In C#.NET set keyword is used to create a written property.
5) There are following statements are given below, which of them are correct about properties in C#.NET?
- A property can be read and write simultaneously.
- A property can be either read or write-only.
- To create a write-only property we should use only to get accessor.
- To create a write-only property we should use only set accessor.
Options:
- Only A
- Only B
- A and D
- B and C
Correct answer: 3
A and D
In the given statements, A and D are correct regarding properties in C#.NET.