Programming & Software Development · C# & .NET

C# Fundamentals

Question 1 of 15
Question 1
Architect: Why must overflow be considered in balances, counters, and quantities?
Fixed-width types have limits.
Question 2
Senior: If two variables reference the same mutable class instance, what happens when one changes a property?
Both variables reference one object.
Question 3
Fresher: In static int Add(int a, int b), what does the first int mean?
Look before the method name.
Question 4
Architect: What is wrong with catch(Exception) followed by doing nothing?
Think hidden failures.
Question 5
Architect: How can a static collection retain objects too long?
Reachability matters.
Question 6
Fresher: What is the purpose of condition ? a : b?
It chooses between two expressions.
Question 7
Fresher: In a traditional C# console application, what is the role of Main?
Think about where execution starts.
Question 8
Senior: Why can direct floating-point == comparisons be risky after arithmetic?
Binary floating-point has representation limits.
Question 9
Architect: Why doesn't readonly imply deep immutability?
Reference versus referenced object.
Question 10
Architect: Why are finalizers usually avoided unless necessary?
Finalization adds lifecycle overhead.
Question 11
Senior: What does an init accessor communicate?
Think initialization-only assignment.
Question 12
Fresher: What is the difference between = and ==?
One assigns; one compares.
Question 13
Fresher: When is switch commonly useful?
Think multiple branches.
Question 14
Fresher: What does public string Name { get; set; } define?
Think properties.
Question 15
Architect: Why doesn't Dispose immediately free managed object memory?
Dispose and GC have different roles.