VividQuiz
Home
Quizzes
Explore all quizzes
Open the complete quiz library
Browse by category
Choose a topic that interests you
Start a quick quiz
Jump straight into a featured challenge
Home
Quizzes
Category
Programming & Software Development
Subcategory
C# & .NET
Quiz Zone
C# Fundamentals
Questions
Programming & Software Development · C# & .NET
C# Fundamentals
Question 1 of 15
Next
Submit quiz
Question 1
Architect: Why must overflow be considered in balances, counters, and quantities?
Fixed-width types have limits.
int has arbitrary precision
Out-of-range results can wrap or throw depending on context
Overflow affects only strings
The CLR always upgrades int to long
Question 2
Senior: If two variables reference the same mutable class instance, what happens when one changes a property?
Both variables reference one object.
The change is visible through the other reference
The property becomes static
The runtime clones first
The second becomes null
Question 3
Fresher: In static int Add(int a, int b), what does the first int mean?
Look before the method name.
Access modifier
Namespace
Number of parameters
The return type
Question 4
Architect: What is wrong with catch(Exception) followed by doing nothing?
Think hidden failures.
It always improves availability
It can hide serious failures and allow invalid state to continue
It converts exceptions to null
It recompiles the app
Question 5
Architect: How can a static collection retain objects too long?
Reachability matters.
Entries clear after every request
GC ignores all static fields
It forces objects to disk
Its references can keep objects reachable and therefore not collectible
Question 6
Fresher: What is the purpose of condition ? a : b?
It chooses between two expressions.
Catch exceptions
Declare a nullable variable
Repeat code
Return one of two values based on a Boolean condition
Question 7
Fresher: In a traditional C# console application, what is the role of Main?
Think about where execution starts.
It defines the namespace
It is the application entry point
It must contain every method
It performs garbage collection
Question 8
Senior: Why can direct floating-point == comparisons be risky after arithmetic?
Binary floating-point has representation limits.
== is undefined for double
All doubles are NaN
double is stored as string
Expected mathematical values can differ slightly due to representation and rounding
Question 9
Architect: Why doesn't readonly imply deep immutability?
Reference versus referenced object.
It converts objects to strings
It has no effect
It prevents field reassignment but not mutation of the referenced object
readonly works only on int
Question 10
Architect: Why are finalizers usually avoided unless necessary?
Finalization adds lifecycle overhead.
Finalizers cannot contain code
They convert classes to structs
They require extra runtime processing and delay reclamation
They run after every method
Question 11
Senior: What does an init accessor communicate?
Think initialization-only assignment.
Assignment is allowed during initialization but not normal later mutation
The property becomes static
The property can never be assigned
The value is always computed
Question 12
Fresher: What is the difference between = and ==?
One assigns; one compares.
= assigns, while == compares equality
= compares while == declares
Both assign
There is no difference
Question 13
Fresher: When is switch commonly useful?
Think multiple branches.
Only for arrays
Only for exceptions
Only when creating objects
When selecting among several cases based on a value or pattern
Question 14
Fresher: What does public string Name { get; set; } define?
Think properties.
A constant
A method
A namespace alias
An automatically implemented property
Question 15
Architect: Why doesn't Dispose immediately free managed object memory?
Dispose and GC have different roles.
Dispose always calls GC.Collect
Dispose releases resources; GC later reclaims managed memory when the object is unreachable
Disposed objects become constants
Managed memory is never reclaimed