QuestionBank_ProgrammingInCSharp
QuestionBank_ProgrammingInCSharp
Theory
Unit 1: Introduction to C#
Very Short Answer Questions
1. What is C#?
2. Compare C# with C++.
3. Compare C# with Java.
4. List any three features of C#.
5. Define a variable in C#.
6. Name two data types in C#.
7. What are operators in C#?
8. Mention the use of comments in C#.
9. What is the difference between a while loop and a do-while loop?
10. Define the "break" statement in C#.
Short Answer Questions
1. Explain the history of C#.
2. What are the main features of C#?
3. How is a variable declared in C#? Provide an example.
4. Differentiate between if-else and switch statements in C#.
5. Write a short note on the "goto" statement.
6. Illustrate the use of "continue" in a for loop.
Long Answer Questions
1. Discuss the advantages of C# over C++ and Java.
2. Explain the various data types available in C# with examples.
Program
1. Write a program in C# demonstrating the use of if-else, switch, and loops.
2. Write a program to demonstrate the use of variables and data types in C#.
3. Create a program to perform arithmetic operations using operators in C#.
4. Write a program to check whether a given number is even or odd using if-else.
5. Create a program to display a day of the week using the switch statement.
6. Write a program to print the first 10 numbers in reverse order using a for loop.
7. Implement a program to calculate the sum of digits of a number using a while loop.
8. Write a program to demonstrate the use of break and continue statements in a loop.
9. Create a program that uses the goto statement to jump between labeled sections of code.
10. Write a program to calculate the factorial of a number using a do-while loop.
Program:
1. Write a program to demonstrate single dimensional array
2. Write a program to demonstrate 2D array
3. Write a program to demonstrate 3D array
4. Create a program to find the maximum and minimum element in an array.
5. Write a program to sort an array in ascending order using a loop.
6. Implement a program to demonstrate the concept of method overloading.
7. Write a program to define a class and create objects of the class to access its methods.
8. Create a program to demonstrate the concept of inheritance.
9. Write a program to implement method overriding using a base and derived class.
10. Create a program to demonstrate encapsulation by creating private fields and public properties.
Program :
1. Write a program to demonstrate the use of properties in C#.
2. Implement a program to show aggregation by creating a class within another class.
3. Write a program to create an interface and implement it in a class.
4. Create a program to demonstrate the use of sealed classes and methods.
5. Write a program to show the difference between public, private, and protected access modifiers.
Program:
1. Write a program to find the frequency of characters in a string.
2. Create a program to reverse a string without using built-in functions.
3. Write a program to demonstrate the use of try-catch-finally for exception handling.
4. Implement a program to create a custom exception and throw it under specific conditions.
Program:
1. Write a program to find the frequency of characters in a string.
2. Create a program to reverse a string without using built-in functions.
3. Write a program to demonstrate the use of try-catch-finally for exception handling.
4. Implement a program to create a custom exception and throw it under specific conditions.