Unit 3: Advanced C# Programming - Subjective Questions

CSE253 — .Net Programming • Practice Questions with Detailed Answers

20 questions

1

Define LINQ in C#. Explain its purpose, major features, and advantages over traditional collection-processing techniques.

2

Explain the difference between LINQ query syntax and LINQ method syntax with suitable C# examples.

3

Describe how LINQ can be used with collections. Write a C# example that filters, transforms, and sorts a collection of objects.

4

Explain deferred execution and immediate execution in LINQ. Discuss their effects with an example.

5

What is a delegate in C#? Explain its declaration, instantiation, invocation, and use as a callback with an example.

6

Distinguish between delegates and events in C#. Explain how events are declared and handled using a suitable example.

7

Define an interface in C#. Explain how interfaces support abstraction, multiple inheritance of behavior contracts, and loose coupling.

8

Explain generics in C#. Discuss generic classes, methods, type safety, and performance benefits with examples.

9

Compare synchronous and asynchronous programming in C#. Explain the role of Task, async, and await.

10

Write and explain an asynchronous C# method that performs two independent operations concurrently and returns both results.

11

Explain exception handling and cancellation in asynchronous C# programming. Show how CancellationToken can be used.

12

State the Single Responsibility Principle (SRP). Identify an SRP violation and show how it can be refactored in C#.

13

Explain the Open/Closed Principle (OCP) with a C# example. How does polymorphism help a design remain open for extension but closed for modification?

14

Define the Liskov Substitution Principle (LSP). Explain how an incorrect inheritance relationship can violate it.

15

What is the Interface Segregation Principle (ISP)? Demonstrate how a large interface can be divided into smaller, client-specific interfaces.

16

Explain the Dependency Inversion Principle (DIP). Show how dependency injection can remove a high-level module's dependency on a concrete class.

17

Compare the five SOLID principles and explain how they collectively improve the design of C# applications.

18

Explain lambda expressions in C# and describe their relationship with delegates and LINQ.

19

Describe grouping, joining, and aggregation in LINQ. Provide examples using collections.

20

Differentiate between IEnumerable<T> and IQueryable<T> in the context of LINQ. When is each one appropriate?