Phase 1: Beginner (28 problems)

Total: 28 problems


Problem 1: Simple Calculator ⭐

Concepts: Variables, Arithmetic Operators, Switch Statement, User Input

What You'll Learn:

  • How to declare and use variables

  • Reading user input with Console.ReadLine()

  • Using switch statements for menu logic

  • Basic error handling with try-catch

Requirements:

  1. Ask user to enter two numbers

  2. Display a menu: +, -, *, /

  3. Perform the selected operation

  4. Display the result

  5. Handle division by zero

Bonus Challenges:

  • Add modulo % operation

  • Validate numeric input using int.TryParse()

  • Allow continuous calculations (loop until user exits)

  • Keep a history of last 5 calculations

Sample Output:



Problem 2: Grade Calculator ⭐

Concepts: If-Else Chains, Comparison Operators, Input Validation

What You'll Learn:

  • Using if-else-if ladder for range checking

  • Validating input boundaries

  • Converting numbers to letter grades

Requirements:

  1. Accept a numeric score (0-100)

  2. Convert to letter grade:

    • 90-100: A

    • 80-89: B

    • 70-79: C

    • 60-69: D

    • Below 60: F

  3. Reject invalid scores (negative or >100)

Bonus Challenges:

  • Add plus/minus grades (A+, B-, etc.)

  • Calculate GPA (A=4.0, B=3.0, etc.)

  • Handle multiple students

  • Calculate class average



Problem 3: Even/Odd Checker ⭐

Concepts: Modulo Operator, Loops, Boolean Logic

What You'll Learn:

  • Using % operator to check divisibility

  • Creating a loop for repeated checks

  • Breaking out of loops

Requirements:

  1. Ask user for a number

  2. Determine if even or odd

  3. Display result

  4. Allow checking multiple numbers

Bonus Challenges:

  • Check for prime numbers

  • Find next even/odd number

  • Count even and odd numbers in a range



Problem 4: Swap Numbers (3 Ways) ⭐

Concepts: Variables, Arithmetic Operations, XOR Operator

What You'll Learn:

  • Using a temporary variable

  • Arithmetic swap without temp

  • Bitwise XOR swap

Requirements: Implement three different methods to swap two numbers:

  1. Using temporary variable

  2. Using arithmetic operations (a = a + b; b = a - b; a = a - b)

  3. Using XOR bitwise operation

Bonus Challenges:

  • Compare performance of each method

  • Swap three variables in one line

  • Implement swap as a generic method



Problem 5: Temperature Converter ⭐

Concepts: Methods, Parameters, Return Values, Formatting

What You'll Learn:

  • Creating methods with parameters

  • Returning calculated values

  • String formatting with $ interpolation

Requirements: Create methods for:

  1. CelsiusToFahrenheit(double c)

  2. FahrenheitToCelsius(double f)

  3. CelsiusToKelvin(double c)

  4. Display results with 2 decimal places

Bonus Challenges:

  • Create a conversion table (0-100°C)

  • Add Kelvin to all other conversions

  • Validate temperature ranges (Kelvin can't be negative)



Problem 6: Number Properties Analyzer ⭐

Concepts: Math Operations, Multiple Conditions, Boolean Methods

What You'll Learn:

  • Checking multiple properties of a number

  • Using boolean methods

  • Combining logical operators

Requirements: For a given number, determine:

  1. Is it even or odd?

  2. Is it positive, negative, or zero?

  3. Is it divisible by 3?

  4. Is it divisible by 5?

  5. Is it a perfect square?

Bonus Challenges:

  • Check if it's a perfect cube

  • Find all divisors

  • Classify as abundant, perfect, or deficient number



Problem 7: Simple Interest Calculator ⭐

Concepts: Arithmetic, Formula Application, Validation

What You'll Learn:

  • Applying mathematical formulas

  • Using decimal for financial calculations

  • Validating realistic inputs

Requirements: Calculate Simple Interest: SI = (P × R × T) / 100

  1. Accept Principal (P), Rate (R), Time (T)

  2. Calculate and display SI

  3. Display total amount = P + SI

Bonus Challenges:

  • Add compound interest calculation

  • Compare simple vs compound interest

  • Calculate monthly EMI



Problem 8: Time Format Converter ⭐

Concepts: String Parsing, Validation, Formatting

What You'll Learn:

  • Parsing time strings

  • Converting between 12-hour and 24-hour formats

  • Handling AM/PM

Requirements:

  1. Accept time in 12-hour format (e.g., "2:30 PM")

  2. Convert to 24-hour format (e.g., "14:30")

  3. Handle edge cases (12:00 AM, 12:00 PM)

Bonus Challenges:

  • Reverse conversion (24-hour to 12-hour)

  • Add time zone conversion

  • Validate time format



Problem 9: Bill Calculator with Discount ⭐

Concepts: Arithmetic, Conditional Logic, Multiple Operations

What You'll Learn:

  • Calculating percentages

  • Applying conditional discounts

  • Chaining calculations

Requirements:

  1. Accept item price and quantity

  2. Calculate subtotal

  3. Apply discount rules:

    • 5% if subtotal > $100

    • 10% if subtotal > $500

  4. Add tax (8%)

  5. Display itemized bill

Bonus Challenges:

  • Handle multiple items

  • Different tax rates by category

  • Apply loyalty points



Problem 10: BMI Calculator ⭐

Concepts: Formula Application, Classification, Formatting

What You'll Learn:

  • Using formulas with real-world data

  • Classifying results into categories

  • Displaying health-related output

Requirements:

  1. Accept weight (kg) and height (m)

  2. Calculate BMI = weight / (height²)

  3. Classify:

    • < 18.5: Underweight

    • 18.5-24.9: Normal

    • 25-29.9: Overweight

    • ≥ 30: Obese

Bonus Challenges:

  • Accept imperial units (lbs, inches)

  • Calculate ideal weight range

  • Track BMI over time


Section 1.2: Loops & Iterations

Focus: Mastering for, while, do-while loops, and iteration patterns


Problem 11: Multiplication Table Generator ⭐

Concepts: For Loop, Formatting, String Interpolation

What You'll Learn:

  • Using for loops effectively

  • String formatting for aligned output

  • Nesting loops for complex patterns

Requirements:

  1. Accept a number from user

  2. Print multiplication table from 1 to 12

  3. Format output nicely

Sample Output:

Bonus Challenges:

  • Generate tables for multiple numbers

  • Create a full 12×12 multiplication grid

  • Allow custom range (e.g., 5 to 20)



Problem 15: Factorial Calculator ⭐

Concepts: Loops, Accumulation, Large Numbers

What You'll Learn:

  • Using loops for accumulation

  • Handling large numbers with long

  • Understanding factorial growth

Requirements:

  1. Calculate factorial using a loop

  2. Handle 0! = 1

  3. Display result

Bonus Challenges:

  • Use recursion instead

  • Compare loop vs recursion performance

  • Calculate using BigInteger for very large numbers



Problem 17: Digit Sum Calculator ⭐

Concepts: While Loop, Integer Math

What You'll Learn:

  • Extracting individual digits

  • Using modulo and integer division

  • Processing digits one by one

Requirements:

  1. Accept a number

  2. Calculate sum of its digits

  3. Example: 1234 → 1+2+3+4 = 10

Bonus Challenges:

  • Calculate product of digits

  • Count number of digits

  • Find largest and smallest digit



Problem 18: Reverse a Number ⭐

Concepts: Loop, Math Operations

What You'll Learn:

  • Building numbers from digits

  • Reversing without strings

  • Handling negative numbers

Requirements:

  1. Reverse digits of a number

  2. Example: 1234 → 4321

  3. Handle negative numbers

Bonus Challenges:

  • Check if number equals its reverse (palindrome)

  • Reverse and add until palindrome

  • Handle trailing zeros



Problem 21: Right-Angled Triangle ⭐

Concepts: Nested Loops, Pattern Logic

What You'll Learn:

  • Using nested loops for 2D patterns

  • Controlling row and column iteration

  • Building patterns incrementally

Requirements: Print right-angled triangle of stars:

Bonus Challenges:

  • Inverted triangle

  • Right-aligned triangle

  • Hollow triangle



Problem 27: Word Counter ⭐

Concepts: String Methods, Split, Loops

What You'll Learn:

  • Using String.Split()

  • Handling multiple spaces

  • String array manipulation

Requirements: Create method int CountWords(string sentence):

  1. Handle multiple spaces between words

  2. Ignore leading/trailing spaces

  3. Return word count

Bonus Challenges:

  • Count unique words

  • Find longest word

  • Calculate average word length



Problem 36: Car Class with Methods ⭐

Concepts: Class Definition, Objects, Methods

What You'll Learn:

  • Creating a class with fields and methods

  • Instantiating objects

  • Calling methods on objects

Requirements: Create a Car class with:

  • Fields: brand, model, year, mileage

  • Methods: DisplayInfo(), Drive(int miles)

  • Create 3 car objects with different data


Problem 37: Constructors Demo ⭐

Concepts: Default Constructor, Parameterized Constructor

Requirements: Enhance the Car class with:

  1. Default constructor (sets default values)

  2. Parameterized constructor (accepts all fields)

  3. Constructor overloading (partial parameters)

  4. Demonstrate all three constructors

Bonus: Add a copy constructor



Problem 40: Access Modifiers Demo ⭐

Concepts: public, private, protected, internal

Requirements: Create a class demonstrating all access modifiers:

Create another class to test which fields are accessible.



Problem 44: Animal Hierarchy ⭐

Concepts: Base Class, Derived Classes, Method Overriding

Requirements:

Test polymorphic behavior with Animal references.



Problem 47: Method Overloading Demo ⭐

Concepts: Method Overloading, Signature Differences

Requirements: Create Calculator class with overloaded Add methods:

Demonstrate all variants.



Problem 51: Sealed Class Usage ⭐

Concepts: sealed keyword, Preventing Inheritance

Requirements:

Demonstrate when and why to use sealed.


Section 2.3: Advanced OOP (9 Problems)


Problem 61: Reverse Array In-Place ⭐

What You'll Learn: Array manipulation, in-place algorithms

Requirements: Reverse array without creating new array:

Bonus: Reverse only a portion of array


Problem 62: Find Min/Max in Array ⭐


Problem 71: List vs Array Comparison ⭐

What You'll Learn: When to use List vs arrays

Requirements: Create side-by-side comparison showing:

  1. Dynamic sizing (List wins)

  2. Performance (Array wins for known size)

  3. Methods available (List wins)

  4. Memory efficiency (Array wins)


Problem 72: Dynamic List Operations ⭐


Problem 94: Static Utility Library ⭐

Concepts: Static Classes, Static Methods, Math Utilities, Encapsulation

What You'll Learn:

  • Creating static classes

  • When to use static vs instance

  • Static utility methods

  • Math helper libraries

  • Static constructors

Requirements: Create a static MathHelper class with:

  1. Common math operations

  2. Validation methods

  3. Conversion utilities

  4. Cannot be instantiated

Complete Implementation:

Static vs Instance Comparison:

When to Use Static: ✅ Utility methods (no state needed) ✅ Math libraries ✅ Extension methods ✅ Factory methods ✅ Configuration helpers

When NOT to Use Static: ❌ Need to maintain state ❌ Need polymorphism ❌ Need inheritance ❌ Testing is harder (can't mock easily)

Bonus Challenges:

  • ⭐⭐ Add string utility methods (static class StringHelper)

  • ⭐⭐ Add validation utilities (static class Validator)

  • ⭐⭐⭐ Create extension methods using static class

  • ⭐⭐⭐ Add thread-safe singleton using static



Problem 95: Partial Class Implementation ⭐

Concepts: Partial Classes, Code Organization, File Splitting, Auto-Generated Code

What You'll Learn:

  • Splitting class definition across files

  • Organizing large classes

  • Working with auto-generated code

  • Partial methods

  • When partial classes are useful

Requirements: Create an Employee class split across multiple files:

  1. File 1: Properties and basic info

  2. File 2: Business logic and calculations

  3. Demonstrate they compile into single class

Implementation - File 1 (Employee.Properties.cs):

Implementation - File 2 (Employee.BusinessLogic.cs):

Demonstration:

When to Use Partial Classes:

Large Classes: Split into logical files

Auto-Generated Code: Keep generated code separate

Team Collaboration: Different files for different developers

Separation of Concerns:

Partial Methods:

Real-World Example - WinForms:

Test Cases:

Bonus Challenges:

  • ⭐ Split into 3 files (add Validation.cs)

  • ⭐⭐ Use partial methods for logging

  • ⭐⭐ Create partial interface (advanced C# 13)

Interview Tips: 💡 Mention: "Partial classes are used in auto-generated code (WinForms, WPF)" 💡 Explain: "All parts must have 'partial' keyword" 💡 Know limitation: "All parts must be in same assembly and namespace"



Last updated