🧩 Code Challenges Hub
Test your skills with hands-on coding challenges. Choose a topic and start practicing!
Showing 28 challenge(s)
Create a Class
Create a simple 'Person' class with a 'Name' property and an 'Introduce()' method.
Create an Object
Create an object of the Person class, set the Name to 'John', and call the Introduce() method.
Add a Constructor
Add a constructor to the Person class that takes a name parameter and sets the Name property.
Read User Input
Write a program that asks the user for their name and greets them.
Simple Calculator
Write a program that asks for two numbers and prints their sum.
Guessing Game
Write a program that generates a random number and asks the user to guess it.
Hello World
Write a program that prints 'Hello, C# Mastery Hub!' to the console.
Add Two Numbers
Write a program that adds two numbers (5 and 3) and prints the result.
Check Even or Odd
Write a program that checks if a number (e.g., 7) is even or odd.
Fix the Bug
The code below has a bug. Find and fix it so it prints 'Hello World!'
Calculate Average
Write a program that calculates the average of three numbers: 10, 20, and 30.
Find the Largest Number
Write a program that finds the largest of three numbers: 15, 8, and 22.
Create a GitHub Workflow
Create a GitHub Actions workflow that builds a .NET project.
Deploy to Azure
Write the steps to deploy an ASP.NET Core app to Azure App Service.
Create a MAUI Page
Create a simple ContentPage with a Label in XAML.
Add a Button
Add a Button to your MAUI page that displays a message when clicked.
Create a Razor Page
Create a Razor Page that displays a welcome message.
Pass Data to View
Pass a message from the PageModel to the view using ViewData.
Create a Dataset
Create a DataTable with columns: ProductId, Name, Price.
Add Data to Dataset
Add rows to the Products DataTable with sample data.
Use Parameterized Query
Write a SQL query that uses parameters to prevent SQL injection.
Add Security Headers
Add X-Content-Type-Options and X-Frame-Options headers to an ASP.NET Core app.
Write a SELECT Query
Write a SQL query that selects all columns from a 'Students' table.
Filter with WHERE
Write a SQL query that selects students with age greater than 18.
Create a Connection
Write C# code that creates a connection to SQL Server using a connection string.
Execute a Query
Write C# code that executes a SELECT query and reads the results using SqlDataReader.
Create a Simple Form
Create a Windows Forms app with a button that shows a message box when clicked.
Add a Label
Add a Label control to your form and update its text when a button is clicked.