Skip to main content

C#

Which of the following is a correct way to declare an anonymous type in C#?

Subject

Correct answer position
1
Answer option 1
var anon = new { Name = "John", Age = 30 };
Answer option 2
var anon = new { "John", 30 };
Answer option 3
var anon = new { Name: "John", Age: 30 };
English

Which of the following is a correct way to declare a partial class in C#?

Subject

Correct answer position
1
Answer option 1
public partial class MyClass {}
Answer option 2
partial public class MyClass {}
Answer option 3
public class partial MyClass {}
English

What is the purpose of the 'unchecked' keyword in C#?

Subject

Correct answer position
1
Answer option 1
To suppress overflow-checking for integral-type arithmetic operations.
Answer option 2
To declare a method as static.
Answer option 3
To declare a method as virtual.
English

What is the purpose of the 'checked' keyword in C#?

Subject

Correct answer position
1
Answer option 1
To explicitly enable overflow checking for integral-type arithmetic operations.
Answer option 2
To declare a method as static.
Answer option 3
To declare a method as virtual.
English