C# final quiz

  • Admin
  • 1 min read

Ten mixed questions covering the whole C# track, from the SDK to the capstone.

C#

C# final quiz

10 questions, instant feedback

Question 1 of 10
Question 1 of 10 What does dotnet run do?
Why this is the answer

dotnet run restores if needed, builds, and starts the program.

Question 2 of 10
Question 2 of 10 Which type is best for a count of items?
Why this is the answer

int holds whole numbers up to about 2.1 billion. Use long beyond that.

Question 3 of 10
Question 3 of 10 What does string.IsNullOrWhiteSpace check?
Why this is the answer

It covers the three cases that make a text field effectively empty, which is why it is the usual input check.

Question 4 of 10
Question 4 of 10 What is the difference between == and Equals for records?
Why this is the answer

Records generate Equals and also overload ==, so both compare the values of the fields.

Question 5 of 10
Question 5 of 10 Which collection preserves insertion order and allows duplicates?
Why this is the answer

A list is an ordered sequence with duplicates. A set removes duplicates; a dictionary maps unique keys.

Question 6 of 10
Question 6 of 10 What does FirstOrDefault return for an empty sequence?
Why this is the answer

It returns default(T), which is null for reference types and 0 for int, so an absent result can be ambiguous for value types.

Question 7 of 10
Question 7 of 10 What does await do to the calling method?
Why this is the answer

await returns control to the caller while the operation runs, then resumes the method when it finishes.

Question 8 of 10
Question 8 of 10 What does a nullable int? mean?
Why this is the answer

int? is Nullable, which adds HasValue and Value so a missing number can be represented.

Question 9 of 10
Question 9 of 10 What does an ASP.NET Core minimal API define?
Why this is the answer

Minimal APIs map a route and an HTTP method to a delegate, which is enough for small services.

Question 10 of 10
Question 10 of 10 What makes a unit test useful?
Why this is the answer

One rule per test keeps failures diagnosable. A test that checks five things tells you little when it fails.

Your answers stay in this browser. Nothing is sent to a server.