Professional Documents
Culture Documents
C# quiz
C# quiz
- A) int x;
- B) int x = 10;
- C) var x = 10;
- D) All of the above
- Answer: D) All of the above
3. Which of the following is the correct way to create an object of the `Person` class in C#?
- A) Person p = new Person();
- B) Person p;
- C) p = Person();
- D) new Person p;
- Answer: A) Person p = new Person();
4. Which of the following access modi ers makes a member accessible only within its own class?
- A) public
- B) private
- C) protected
- D) internal
- Answer: B) private
```csharp
int a = 5;
int b = 10;
Console.WriteLine(a + b);
```
- A) 510
- B) 15
- C) 5 + 10
- D) Error
- Answer: B) 15
10. Which of the following LINQ methods is used to lter elements in a collection?
- A) Select
- B) Where
- C) OrderBy
- D) GroupBy
- Answer: B) Where
fi