Ms. Terkper's Digital Classroom

Basics of C# 1: Introduction to Syntax

Basics of C# This page introduces the fundamentals of C# syntax as covered in the first two modules of Microsoft Learn: Get Started with C#.

What is C#?

C# (pronounced "C-Sharp") is a modern, object-oriented programming language developed by Microsoft. It is used for building games (Unity), web apps (.NET), and automation scripts.

Basic C# Syntax

In C#, every program has a Main method, and statements end with a semicolon (;). Here’s a simple program:

            
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
    }
}
            
        

Questions

1. What is C# primarily used for?

2. Which method is required in every C# program?

3. What is the correct syntax to print "Hello, World!" in C#?

4. Which keyword is used to declare a variable in C#?

5. Which of the following is a correct single-line comment in C#?

6. What data type should be used for a decimal number in C#?