0% found this document useful (0 votes)
293 views9 pages

Top 50 .NET Full Stack Developer Questions

The document lists the top 50 interview questions for .NET Full Stack Developers, covering topics such as .NET vs .NET Core, Dependency Injection, Middleware, and various C# concepts. Each question includes a brief explanation and an example to illustrate the concept. Additionally, it addresses Angular-related questions, API security, design patterns, and database operations.

Uploaded by

hqbazaarj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
293 views9 pages

Top 50 .NET Full Stack Developer Questions

The document lists the top 50 interview questions for .NET Full Stack Developers, covering topics such as .NET vs .NET Core, Dependency Injection, Middleware, and various C# concepts. Each question includes a brief explanation and an example to illustrate the concept. Additionally, it addresses Angular-related questions, API security, design patterns, and database operations.

Uploaded by

hqbazaarj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Top 50 .

NET Full Stack Developer Interview Questions

Top 50 .NET Full Stack Developer Interview Questions with Answers & Examples

1. What is the difference between .NET and .NET Core?

-> .NET Framework is Windows-only. .NET Core is cross-platform, faster, and used for modern apps.

Example: Use .NET Core to build REST APIs for web and mobile apps.

2. Why do we use the using keyword in C#?

-> For importing namespaces and disposing resources.

Example:

using (var file = new StreamReader("[Link]"))

var data = [Link]();

3. What is Dependency Injection? Types?

-> Injects services into classes instead of hardcoding.

Types: Constructor, Property, Method.

Example:

public class MyService

private readonly IRepo _repo;

public MyService(IRepo repo) { _repo = repo; }

4. What is Middleware in .NET Core?

Page 1
Top 50 .NET Full Stack Developer Interview Questions

-> Code that processes requests/responses in the pipeline.

Example:

[Link](async (context, next) => {

[Link]("Before request");

await [Link]();

[Link]("After response");

});

5. What is a Delegate?

-> Delegate is a reference to a method. Supports callbacks/events.

Example:

public delegate void Greet(string name);

Greet greet = name => [Link]("Hello " + name);

greet("John");

6. What is a Function in C#?

-> A block of code that performs a task and may return a value.

Example:

int Add(int a, int b) => a + b;

7. What are Access Specifiers in C#?

-> Define visibility of members. Types: public, private, protected, internal.

Example:

public class Car { private string model; }

Page 2
Top 50 .NET Full Stack Developer Interview Questions

8. What is a Constructor and its Types?

-> Initializes object. Types: Default, Parameterized, Static, Copy.

Example:

public Car(string name) { [Link] = name; }

9. Difference: Abstract Class vs Interface

-> Abstract class can have logic. Interface = full abstraction.

Example:

interface IRun { void Start(); }

10. What is DbContext in EF Core?

-> Manages database connections and operations.

Example:

public class AppDbContext : DbContext

public DbSet<Employee> Employees { get; set; }

11. What is Entity Framework Core?

-> ORM to interact with DB using C# instead of SQL.

12. What is LINQ?

-> Language Integrated Query to query collections/DB.

Example:

var result = [Link](s => [Link] > 18);

Page 3
Top 50 .NET Full Stack Developer Interview Questions

13. What is DTO and Why Use it?

-> Data Transfer Object: Sends only needed data between layers.

Improves security & performance.

14. What is [Link] in .NET Core?

-> Stores configuration settings.

Example:

"ConnectionStrings": { "Default": "Server=.;DB=AppDb;" }

15. Primary vs Composite vs Unique Key

-> Primary: Not null + unique. Composite: Multiple cols. Unique: Only unique.

16. Four Pillars of OOP?

-> Encapsulation, Abstraction, Inheritance, Polymorphism.

17. Value Type vs Reference Type?

-> Value: Holds data directly (int). Reference: Points to object (class).

18. Angular vs AngularJS?

-> Angular: TypeScript, Components. AngularJS: JavaScript, MVC.

19. What are Components and Modules?

-> Components = UI blocks. Modules = Group of components/services.

Page 4
Top 50 .NET Full Stack Developer Interview Questions

20. What is Lazy Loading in Angular?

-> Load modules only when needed.

Example: loadChildren in routes.

21. What is Data Binding in Angular?

-> Synchronizes UI and data.

Types: One-way, Two-way ([(ngModel)])

22. What are Directives?

-> DOM instructions.

Structural (*ngIf), Attribute (ngClass)

23. What are Pipes?

-> Format data in UI.

Example: {{ price | currency }}

24. Input vs Output Decorators?

-> @Input() = Receive data. @Output() = Send event to parent.

25. ViewChild vs ViewChildren?

-> ViewChild = 1 child. ViewChildren = list of children.

Example:

@ViewChild('input') inputEl: ElementRef;

26. Angular Lifecycle Hooks?

Page 5
Top 50 .NET Full Stack Developer Interview Questions

-> ngOnInit, ngOnDestroy, etc.

27. What is JWT Token?

-> JSON Web Token for stateless auth.

Stored in headers, verifies user.

28. Authentication vs Authorization?

-> Auth: Who you are. Authorization: What you can access.

29. How to secure API in .NET Core?

-> JWT token, [Authorize], role-based access.

30. What is [Link] Core Identity?

-> Built-in user auth and management system.

31. DROP vs DELETE vs TRUNCATE?

-> DELETE: with condition. TRUNCATE: all, fast. DROP: remove table.

32. IEnumerable vs IQueryable?

-> IEnumerable: in-memory. IQueryable: DB-level query.

33. SQL JOIN Example:

SELECT [Link], [Link] FROM Student s JOIN City c ON [Link] = [Link];

34. Count Students Across Subjects:

Page 6
Top 50 .NET Full Stack Developer Interview Questions

SELECT COUNT(DISTINCT StudentID) FROM StudentSubjects;

35. EF Core Migration:

Add-Migration InitialCreate

Update-Database

36. Reverse a String:

string s = "hello";

string rev = new string([Link]().ToArray());

37. Remove Duplicates:

int[] arr = {1,2,2,3};

var unique = [Link]().ToArray();

38. Count Vowels:

int count = "hello".Count(c => "aeiou".Contains(c));

39. Longest Word:

string[] words = [Link]();

string longest = [Link](w => [Link]).First();

40. CRUD in Angular + .NET:

POST - Create

GET - Read

PUT - Update

Page 7
Top 50 .NET Full Stack Developer Interview Questions

DELETE - Delete

41. Country-State Dropdown:

Load countries via API.

On change, fetch states by selected countryId.

42. Exception Handling:

Use try-catch, logging, UseExceptionHandler middleware.

43. What is a Design Pattern?

-> Standard solutions for recurring problems.

Example: Singleton, Factory, Repository

44. SOLID Principles:

S - Single Responsibility

O - Open/Closed

L - Liskov Substitution

I - Interface Segregation

D - Dependency Inversion

45. ViewModel in MVC:

-> Custom model for Views, not DB mapped.

46. Single() vs First():

Single() - exactly one match

Page 8
Top 50 .NET Full Stack Developer Interview Questions

First() - first match

OrDefault() returns default if none

47. HTTP Methods:

GET - Read

POST - Create

PUT - Update

DELETE - Remove

48. Why [Link]?

-> Store connection strings, secrets, keys.

49. Repository Pattern:

-> Abstraction over DB logic. Promotes testability.

50. .csproj vs .cs files:

.csproj - Project settings.

.cs - Source code files.

Page 9

Common questions

Powered by AI

Dependency injection enhances software design by decoupling the instantiation of services from their usage, thus promoting modularity, testability, and maintainability in code. In .NET, there are three types of dependency injection: Constructor Injection, which passes dependencies via a constructor; Property Injection, which uses property setters to inject dependencies; and Method Injection, which injects dependencies via method parameters. These different approaches provide flexibility on how dependencies can be mapped and managed based on the application's needs .

In .NET, abstract classes can include implementation code, which allows for concrete methods and state management. Interfaces, conversely, offer full abstraction by defining a contract that implementing classes must fulfill without providing any method body details. An abstract class is best used when creating a base class with common functionality that derived classes can inherit. An interface should be applied when you need to apply a common behavior across multiple, unrelated objects. For instance, if several unrelated classes benefit from a Start method, use an interface like 'interface IRun { void Start(); }' .

Middleware components in a .NET Core application are integrated pieces of code that can inspect, route, and modify requests and responses passing through the application's pipeline. Each middleware has the option to terminate the request or pass it on to the next component in the sequence. For example, a custom middleware can log requests before they reach the main application and responses after they leave the application, significantly influencing and monitoring the processing of both requests and responses .

ASP.NET Core supports several authentication methods such as JWT tokens, cookies, and ASP.NET Core Identity which provide various ways to authenticate users and secure web applications. JWT tokens offer a stateless, scalable approach for authorizing users and are particularly useful in microservice architectures. ASP.NET Core Identity provides a comprehensive system for user management, including user and role storage, password recovery, and multi-factor authentication allowing for extensive control over application security. These methods help ensure that only authenticated users access application resources and functionalities, enhancing security .

LINQ (Language Integrated Query) provides a concise and expressive syntax for querying data collections in .NET, allowing developers to work across various data sources like arrays, databases, or XML. Compared to traditional SQL queries, LINQ offers type safety and readability by utilizing C# syntax, reducing runtime errors and development time. It abstracts complex SQL and enables developers to focus on business logic, while seamlessly integrating with Entity Framework Core to optimize database interaction .

The DTO pattern is used to optimize communication by transmitting only the data needed between layers of an application, particularly across network boundaries. This approach reduces overhead, improves performance, and enhances security by limiting exposure of internal data structures. DTOs can be particularly beneficial in ASP.NET applications where data is frequently transferred between client-server or between various layers of the service to ensure encapsulation and isolation of data handling .

Entity Framework Core simplifies data access by allowing developers to interact with databases using high-level C# code rather than complex SQL queries, leading to increased productivity and reduced errors. It supports LINQ for querying, which can be more intuitive and less error-prone. The DbContext class manages database operations such as querying, saving, and updating data. It acts as a bridge between the database and application, maintaining the connection and ensuring effective transactions .

Lazy loading in Angular is implemented by loading feature modules only when they are required, particularly when their routes are accessed. This is done using the 'loadChildren' property in route declarations. The primary benefit of lazy loading is that it decreases the initial load time of the application, as not all modules are loaded upfront, improving the performance and responsiveness of the application especially in large apps with multiple features .

The SOLID principles collectively promote robust, scalable, and maintainable software architecture. 'Single Responsibility' encourages classes to have a single responsibility, reducing complexity. 'Open/Closed' supports extending functionality without changing existing code, easing integration with new features. 'Liskov Substitution' ensures derived classes can substitute base classes without exception, maintaining polymorphic behavior. 'Interface Segregation' promotes small, specific interfaces over large general ones, enhancing decoupling. 'Dependency Inversion' inverts the conventional dependency flow, favoring abstractions over concrete implementations, reinforcing module independence, and testability .

.NET Framework is intended for developing applications solely on Windows, offering full support for Windows Forms and Windows Presentation Foundation. Meanwhile, .NET Core is designed as a cross-platform solution, making it appropriate for modern application building across various operating systems like Windows, Linux, and macOS. This enhancement in versatility allows .NET Core to be particularly useful for developing RESTful services that can operate on any platform, thus benefitting organizations that require flexible and scalable app environments .

You might also like