Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

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)

  1. 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…
  2. 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…
  3. 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…
  4. 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.…
  5. 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…
  6. 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…
  7. 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…
  8. 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…
  9. 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…
  10. 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…
  11. 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…
  12. 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.…
  13. 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.…
  14. 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

  1. Install the .NET SDK and confirm the tool-chain: dotnet --version and dotnet --list-sdks.
  2. Scaffold a project: dotnet new console -n Lab0Setup, then cd Lab0Setup.
  3. Replace the generated Program.cs with the code shown here.
  4. Compile and execute in one step: dotnet run. Internally this runs dotnet build (producing bin/Debug/net8.0/Lab0Setup.dll) and then hosts the assembly in the CLR.
  5. Optional: inspect the IL with ildasm (Windows) or the dotnet-ildasm tool and find call void [System.Console]System.Console::WriteLine(string) — visible proof of the two-stage model.

Explanation of the Code

  • using System; imports the System namespace so Console can 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. static means the CLR can invoke it without instantiating Program; void means no exit code is returned (an int return type is also legal

Continue reading: Lab 0: Compiler Setup and Check →

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.