C# Programming Lab — Free Notes & Tutorial
Free C# Lab practicals for BCA — C# programs, OOP exercises and .NET lab at SikshaSarovar. Free C# Lab course on SikshaSarovar.
This C# Programming Lab course is part of Siksha Sarovar and is 100% free for students in India — no sign-up required to read. It contains 14 structured lessons with examples, and pairs with our free online compiler and AI tutor.
What you will learn
- C# programs
- OOP
- Windows Forms
- .NET labs
Course content (14 lessons)
- Lab 0: Compiler Setup and Check — Aim To install and verify a complete C tool-chain (.NET SDK with the Roslyn compiler) and execute a first console program, confirming that source code travels the full…
- Practical 1: Check Character Case (Upper or Lower) — Aim To read a single character from the console and classify it as an uppercase letter, a lowercase letter, or a non-alphabetic character using the char type and the Unicode-aware…
- Practical 2: Check Whether Character is Vowel — Aim To accept a character from the keyboard and decide whether it is a vowel, demonstrating case normalisation with char.ToLower and short-circuit boolean composition. Theory A…
- Practical 3: Simple Calculator with Memory and Recall — Aim To implement a four-function calculator with Memory Store (MS) and Memory Recall (MR) operations, and to observe IEEE 754 double arithmetic and value-type copy semantics.…
- Practical 4: Fibonacci (With and Without Recursion) — Aim To generate the first n Fibonacci numbers both iteratively and recursively, and to contrast their time/space complexity and stack behaviour. Theory Fibonacci is the canonical…
- Practical 5: Armstrong Number Check — Aim To test whether an integer is an Armstrong (narcissistic) number — a number equal to the sum of its own digits each raised to the power of the digit count. Theory A number…
- Practical 6: Palindrome Number Check — Aim To check whether an integer reads the same forwards and backwards by reversing it arithmetically — with no string conversion and no heap allocation. Theory The arithmetic…
- Practical 7: Swap Two Numbers Without Third Variable — Aim To exchange the values of two integer variables without any temporary storage using arithmetic identities, and to evaluate the trade-offs against the XOR swap and the modern…
- Practical 8: Reverse a Number — Aim To reverse the decimal digits of an integer using modulo/division arithmetic, mastering the positional-notation mechanics that underlie palindrome checks, digit sums and base…
- Practical 9: Convert Number to Words — Aim To convert an integer in the range 0–999 into its English-words representation using lookup tables and quotient/remainder decomposition into hundreds, tens and ones. Theory…
- Practical 10: Date Selection – Day, Month, Year — Aim To accept a date from the user, decompose it into day, month and year components, and map the identical logic onto a WinForms MonthCalendar control feeding three TextBox…
- Practical 11: Timer-Based Quiz with 10 Questions — Aim To build a ten-question quiz that is scored against a time limit, using named value tuples for the question bank and System.Diagnostics.Stopwatch for high-resolution timing.…
- Practical 12: ADO.NET Store Student Details — Aim To store and display student records using ADO.NET's disconnected layer — DataSet , DataTable , DataColumn and DataRow — modelling a relational database entirely in memory.…
- Practical 13: ADO.NET Insert, Update, Modify, Delete — Aim To perform the full CRUD cycle — insert, update/modify and delete — on an ADO.NET DataTable , and to understand the row-state change-tracking model behind AcceptChanges .…
Lab 0: Compiler Setup and Check
Aim
To install and verify a complete C# tool-chain (.NET SDK with the Roslyn compiler) and execute a first console program, confirming that source code travels the full managed-execution pipeline: C# source → CIL → JIT → native machine code.
Theory
C# is a statically typed, object-oriented language whose compilation model differs fundamentally from C/C++. The Roslyn compiler (csc) does NOT emit native machine code; it emits CIL (Common Intermediate Language) — a stack-based, CPU-neutral instruction set — packaged into a managed assembly (a .dll containing IL, rich metadata and a manifest). At run time the CLR (Common Language Runtime) loads the assembly, verifies the IL for type safety, and RyuJIT (the Just-In-Time compiler) translates each method into native code the first time it executes, caching the result for subsequent calls. This two-stage design buys three things: portability (the same IL runs on Windows, Linux and macOS), safety (array bounds checks, managed references, garbage collection) and runtime optimisation (tiered compilation recompiles hot methods aggressively). Every C# program needs exactly one entry point — a static Main method — which the CLR locates through assembly metadata, not through a linker convention as in C.
Requirements
- .NET SDK 8.0 (LTS) or later — verify with
dotnet --version - Any editor: Visual Studio 2022, VS Code + C# Dev Kit, or plain Notepad
- Alternatively, the built-in RUN CODE compiler on this platform (no installation needed)
Procedure
- Install the .NET SDK and confirm the tool-chain:
dotnet --versionanddotnet --list-sdks. - Scaffold a project:
dotnet new console -n Lab0Setup, thencd Lab0Setup. - Replace the generated
Program.cswith the code shown here. - Compile and execute in one step:
dotnet run. Internally this runsdotnet build(producingbin/Debug/net8.0/Lab0Setup.dll) and then hosts the assembly in the CLR. - Optional: inspect the IL with
ildasm(Windows) or thedotnet-ildasmtool and findcall void [System.Console]System.Console::WriteLine(string)— visible proof of the two-stage model.
Explanation of the Code
using System;imports theSystemnamespace soConsolecan be used without full qualification (System.Console).class Program— in C# ALL executable code must live inside a type; there are no free functions as in C.static void Main()is the entry point.staticmeans the CLR can invoke it without instantiatingProgram;voidmeans no exit code is returned (anintreturn type is also legal
Frequently asked questions
Is the C# Programming Lab course really free?
Yes. The entire C# Programming Lab course on Siksha Sarovar is free to read with no account required. You can optionally sign in with Google to save your progress.
Do I get a certificate for C# Programming Lab?
Yes — finish the lessons and pass the quiz to earn a free, verifiable certificate you can share on LinkedIn or with recruiters.
Can I run code while learning?
Yes. The built-in online compiler runs C, C++, Python, Java, PHP, JavaScript, C# and SQL directly in your browser — no installation needed.