23. What are the Async and Await keyword.
Answer: Async and Await are used in C# for asynchronous programming. 'async' marks a method as
asynchronous, allowing the use of 'await' inside it. 'await' pauses the execution until the awaited task
completes, making it non-blocking. It's useful for I/O-bound operations and enhances application
responsiveness.
24. What are Left, Right, Full, Union and Union all and Intersection in SQL.
Answer: - LEFT JOIN: All records from the left table and matched from the right.
- RIGHT JOIN: All from right table and matched from left.
- FULL JOIN: All records from both tables with matches where possible.
- UNION: Combines two SELECTs and removes duplicates.
- UNION ALL: Combines including duplicates.
- INTERSECT: Returns only common rows from both SELECTs.
25. What is Inheritance.
Answer: Inheritance allows a class to acquire properties and methods of another class. Promotes code reuse
and establishes parent-child relationship between classes.
26. What is Interface.
Answer: An interface defines a contract with method signatures but no implementation. Classes implementing
the interface must define its members.
27. What is Abstraction.
Answer: Abstraction hides complex implementation details and exposes only essential features. Achieved
using abstract classes and interfaces.
28. What is Class type. Abstract class, Sealed Class, Static Class, Partial Class
Answer: - Abstract Class: Cannot be instantiated; can contain abstract and concrete methods.
- Sealed Class: Cannot be inherited.
- Static Class: Cannot be instantiated; all members are static.
- Partial Class: Allows a class to be split across multiple files.
29. What is View in MVC.
Answer: View is responsible for rendering UI. Uses Razor syntax to embed C# into HTML and displays data
passed from controller.
30. What is Temp table.
Answer: A temporary table in SQL Server used for storing data temporarily within a session or procedure.
31. What is difference between View Data and TempData.
Answer: - ViewData: Used to pass data from controller to view. Valid only for current request.
- TempData: Used to pass data between controller actions. Persists for one redirect.
32. How to send Controller to Controller data send.
Answer: Use TempData or RedirectToAction with route values.
Example: TempData["Key"] = value; RedirectToAction("Action", "Controller");
33. What is Looping in C#.
Answer: Looping executes a block of code repeatedly. Types include: for, while, do-while, foreach.
34. What is Dependency Injection.
Answer: A design pattern that provides objects that a class depends on. Improves modularity and testability.
Built-in in .NET Core.
35. What is Indexers in SQL.
Answer: Indexes are database objects that speed up data retrieval. Common types: clustered and
non-clustered indexes.
36. What is User Defined Function in SQL.
Answer: A function created by user for reuse. Returns scalar or table values. Cannot change DB state.
37. What is Aggregate Function in SQL.
Answer: Performs calculations on multiple rows. Examples: COUNT, SUM, AVG, MAX, MIN.
38. What is Cursors in SQL.
Answer: A database object to retrieve data row-by-row. Useful when row-level operations are needed.
39. What is Function in SQL.
Answer: Reusable logic unit that returns a value. Can be scalar-valued or table-valued.
40. What is Magic Table.
Answer: Internal tables (Inserted and Deleted) in SQL Server used in triggers to hold old/new row data.