Questions For Lab Report of C#
1. Write a C# program to print "Hello, World!" to the console.
2. Write a program to swap two numbers using a temporary variable.
3. Write a C# program to check if a number is prime or not.
4. Write a program to calculate the factorial of a number using loops.
5. Write a program to find the largest and smallest element in an array.
6. Create a C# program to showcase the use of namespaces to organize classes.
7. Write a program to calculate sum of two matrices.
8. Write a program to demonstrate passing argument by value.
9. Write a program to display greatest number among 3 numbers using Ternary Operator.
10. Write a program to demonstrate concept of constructor and Destructor.
11. Create a class Car with properties like Make, Model, and Year. Instantiate it and print the details
of the car.
12. Implement a class Book that includes properties for title, author, and price, and create multiple
instances of it
13. Write a C# program that defines a class Employee with fields for name, ID, and salary. Create
methods to set and get these values.
14. Implement a base class Animal and derived classes Dog and Cat. Write a method Sound() in the
base class and override it in the derived classes.
15. Write a program to demonstrate multiple inheritance.
16. Write a program to Demonstrate Multilevel Inheritence.
17. Write a C# code to demonstrate unary and Binary Operator Overloading.
18. Write a program to demonstrate method overloading.
19. Write a C# program that uses a delegate to pass methods as parameters to another method.
20. Write a C# program to demonstrate concept of Stack with it’s different methods.
21. Create a C# program to demonstrate the use of lambda expressions for filtering a list of
numbers.
22. Implement a C# program that demonstrates exception handling (try, catch, and finally) for error
management to handle division by Zero Exception and Index out of Range Exception.
23. Write a LINQ query to filter out students who scored more than 75% from a list of students.
24. Write a C# program using LINQ to query and sort data from a collection of objects.
25. Implement a C# program that performs CRUD (Create, Read, Update, Delete) operations on a
database using LINQ to SQL.
26. Write a C# program that connects to a database and retrieves records from a Student table.
27. Write a ASP.Net web application to calculate Sum of two numbers .
28. Implement an ASP.NET web application to display user details submitted via a form.
29. Provided that a mysql database named “company” with table named “product” with following
columns (productId as int,productname as varchar(20) and unitprice as float). Write a c#
program to connect to the database and display product records that have unitprice is greater
than Rs 1000 and update the product records(such as unit price =4500 from database whose
productid=50.
30. Write ASP.NET web application to calculate profit or loss amount according to entered cost and
selling price in web form.