Friday, June 12, 2026

Frequently asked interview questions for Dot net developers

 

Dot Net Interview FAQ's

Some of the Frequently asked questions for Dot net developers

What is .NetFrameWork ?
  .Net Frame work for building and developing the  application by using .net
  it contains to major parts
  1. Common Language Runtime
  2.Class Libraries
OOPS Concepts 
   
Ans:  Object Oriented Programming (OOP) All Programming Language will support this OOP there are Three main concepts in OOP
    a)Abstraction
   b)Encapsulation
   c)Inheritance
   d)Polymorphism
Abstraction :
Reducing the Complexity and generalization
Encapsulation  :
Encapsulation is the process of Keeping the data and method together into Objects
OR
Simple Putting Together into one simple class Like.
OR
Means that a group of related properties, methods, and other members are treated as a single unit or object.
___________________________________________________________________________________
Class My Class
{
public MyClass()
{

}
int a;
int b;
Public void GetAdd()
{
 int C=a+b;
}

}
___________________________________________________________________________________
Inheritance:
Inheritance Enables  you to Create Class that Reuses
OR
Acquiring the Properties of Base Class(Parent Class)
OR
Means Provide Further Implementation ,Reusing of  Base Class
__________________________________________________________
Public Class MyClass
{
Public MyClass()
{
}
int a;
int b;
Public void GetMyMethod()
{
int c=a+b;
}
}
Public Class MyChildClass : MyClass
{
 Public MyChildClass()
{}
}
C# Doesn't Support Multiple Inheritance By Using Interfaces We Can 
_______________________________________________

Polymorphism
Polymorphism means same operation may Behave Differently in Different Classes

Example of Compile Time Polymorphism: Method Overloading
Example of Run Time Polymorphism: Method Overriding

Method Overloading- Method with same name but with different arguments is called method overloading.
- Method Overloading forms compile-time polymorphism.
- Example of Method Overloading:
class MyClass
{
Public string hello()
{
return "Hello";
}
public string hello(string s)
{
return "Hello"+S.Tostring();
}
}

Method Overriding- Method overriding occurs when child class declares a method that has the same type arguments as a method declared by one of its superclass.
- Method overriding forms Run-time polymorphism.
-Virtual Key word is required for Overriding
- Example of Method Overriding:
Public Class MyClass
{
virtual void hello()
{
Console.WriteLine(“Hello from MyClass”);
}
}
Public Class MyChildchild : MyClass
{
override void hello()
{
Console.WriteLine(“Hello from Child”); }
}
}__________________________________________________________________

3.Differences between Interface and Abstract Class?
Interfaces :
--An interface is not a class.
--It is an entity that is defined by the word Interface.
--An interface has no implementation;
--it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class
 ____________________________________
Public Interface ImyInterface

{
String Method1();
int Method2();


}
Public Class myClass :ImyInterface
{
string Method1()
{
//Code
}
int Method2()
{
//Code
}
}
____________________________________________________________________________
---Requires more time to find the actual method in the corresponding classes. (Slow )


The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn't support multiple inheritance, interfaces are used to implement multiple inheritance

  Abstract Class:
   These Classes Cannot be instantiated, 
 ---These are used if additional functionality is needed in derived classes,
 ---These Implemented partially or No Implementation
--Fast In Operation
 ____________________________________________________________
abstract class MyAbstractClass
{
public MyAbstractClass()
{
// Code to initialize the class goes here.
}

abstract public void Method1();
abstract public void Method2(int A);
abstract public long Method3(int B);
}
class MyClass : MyAbstractClass
{
public MyClass ()
{
// Initialization code goes here.
}

override public void Method1()
{
// code goes here.
}

override public void Method2(int A)
{
// code goes here.
}

override public long Method3(int B)
{
//code goes here.
}
}____________________________________________________________
Override and Overloading
  Override and Overloading Comes under Polymorphism
  --The Run time Polymorphism  Override
  --The Compile time polymorphism is Overloading Check it out in Above Polymorphism
Virtual Key
  --If U use virtual key before method it means we can able to Override method check the Polymorphism
Access modifiers in C #
    --Access Modifiers Specify the Accessibility of type or Member when u declare before the Class
    --Five Access Modifiers in C#
   Private :The Type or  Member Can be accessed by the in the Same Class
            --like With In Class
   Public  : The Type or Member Can be accessed by any other code with in same assembly or any
     other  assembly which reference it
    -- Like any where in the class and assembly,
   Protect: The type or member can be accessed only by code in the same class or struct, or in a class
              that is  derived from that class.
--Like Private But also Derived Class
   Internal: The type or member can be accessed by any code in the same assembly, but not from
      another assembly
   Protected Internal:
    The type or member can be accessed by any code in the assembly in which it is declared, or from within  a  derived class in another assembly. Access from another assembly must take place within a class         declaration that derives from the class in which the protected internal element is declared, and it must
    take place through an instance of the derived class type.


Constructors
 ---Constructors are Class Methods that are executed when a object  of a given type is created
 --- Constructors are have the same name as the  Class
 ---Initialize the data members of  the new Object
public class Myclass()
{
public bool mybool;
public Myclass()
{
 mybool=true;
}
}
--With parameters also we can create constructors 
Static Constructors :
A static Constructor is used to initialize any static data or perform a particular action that needs to be performed once only
______________________
public class  Myclass
{
static string time;
static myclass()
{
 time=DateTime.Now.Tostring();
}
}
______________________

--A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced.




Delegates :
Delegates holds method signature.
it passes the method as argument to another method

Generics
  Generic Classes and Methods combine re-usability 

10.New Features In C #

11.Sealed Class
     Restrict the class to inheritance 

12.Asp.Net Life Cycle
     Page Request
     Start
     Page Initializing
     Load
     Validation
     PostBack Event handling
     Rendering
     Unloading
    

Directives in Asp.Net

Session Management
    View state
    Hidden fields
    ControlState
    QueryString
    Cookies
    Application State
    Session State
    Profile Properties
  

15.Get and Post Method

16.Session Management in IIS

17.Authentication and Autherization

18.MasterPages

19.Cookies,Caching and View State

Caching :
It is a way to store the frequently used data into the server memory which can be retrieved very quickly. And so provides both scalability and performance. For example if user is required to fetch the same data from database frequently then the resultant data can be stored into the server memory and later retrieved in very less time (better performance). And the same time the application can serve more page request in the same time scalability. 

  1. Output caching - The rendered html page is stored into the cache before sending it to the client. Now, if the same page is requested by some other client the already rendered htm page is retrieved from the server memory and sent to the client, which saves the time requires rendering and processing the complete page.
  2. Data Caching - The important pieces of information, that are time consuming and frequently requested, are stored into the cache. For example a data set retrieved from the database. It is very similar to application state but it is more server friendly as the data gets removed once the cache is filled.
There are two more models which are built on the above two types:
  1. Fragment caching - Instead of caching the complete page, some portion of the rendered html page is cached. E.g.: User Control used into the page is cached and so it doesn’t get loaded every time the page is rendered. 
  2. Data Source Caching - It is caching built into the data source controls (eg. XmlDataSource, sqlDataSource etc). It is very similar to data caching but here the caching is not handled explicitly but the data source control manages it as per the settings made on the data controls.
Declaration
<@ OutputCache Duration="20" VaryByParam="None">

Cookies :
A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser. The cookie contains information the Web application can read whenever the user visits the site.
---Most browsers support cookies of up to 4096 bytes.
----Also, number of cookies is limited to 20 per website. If we create more than this it browser will delete ole Cookie





20.Gridview Events 
      --DataBinding
      --DataBound
      --Dispose
      --init
     --Load
     --PageIndexChanged
    --PageIndexChanging
    --PreRender
    --RowCancelEditing
    --RowCommand
    --RowCreated
   ---RowDataBound
    --RowDeleting
    ---RowDeleted
    ---RowEditing
    ---RowUpdated
     --RowUpdating
     --SelectIndexChanged
     --SelectIndexChanging
     --Sorting
     --Sorted
    -- unload

21.Ajax Controls and About Ajax

22.Validation Controls
23.JavaScript
24.Html/DHtml/CSS

25.Server.Transfer and Response.Redirect

26.Webservices,WindowServices,RemotingWCF,WPF

27.XML
28.SilverLight,
29.SharePoint
31.Extension Methods
32.HTTP Handlers/HTTP Modules
33.Sql Profiler
34.Union and Union All
35.Event and Delegates
36.How to Display Duplicate Values In SqlServer

37.IIS Life Cycle


38.Enterprise Library –Microsoft
     Microsoft Enterprise Library is a collection of reusable application blocks designed to assist software    developers with common enterprise development challenges
This release includes:
--Caching Application Block

--Cryptography Application Block
--Data Access Application Block
--Exception Handling Application Block
--Logging Application Block
--Application Block
--Validation Application Block
--Unity Application Block

39.What is the difference between ScriptManager and ScriptManagerProxy ?
Ans :

Complete TypeScript Tutorial: From Beginner to Experienced Developer

 

🚀 Introduction

As JavaScript applications grow larger, managing code becomes difficult. Developers often face problems such as:

  • Runtime errors

  • Difficult debugging

  • Poor code maintainability

  • Lack of type safety

To solve these problems, TypeScript was created by Anders Hejlsberg and is maintained by Microsoft.

TypeScript is a superset of JavaScript that adds:

✅ Static Typing
✅ Object-Oriented Features
✅ Better IDE Support
✅ Compile-Time Error Checking
✅ Improved Code Maintainability


What is TypeScript?

TypeScript is an open-source programming language that builds on JavaScript by adding type definitions.

JavaScript Example

let age = 25;
age = "Twenty Five";

console.log(age);

Output:

Twenty Five

No error occurs.

TypeScript Example

let age: number = 25;

age = "Twenty Five";

Output:

Type 'string' is not assignable to type 'number'

TypeScript catches the error before execution.


Why Use TypeScript?

1. Type Safety

let salary: number = 50000;

Only numbers are allowed.


2. Better IntelliSense

Modern editors provide:

  • Auto-completion

  • Suggestions

  • Refactoring support


3. Easier Maintenance

Large projects become easier to maintain.

Examples:

  • Angular Applications

  • Enterprise Applications

  • Microservices Frontends

  • E-commerce Platforms


4. Early Error Detection

Errors are caught during compilation instead of production.


Installing TypeScript

Install Node.js

Download from:

Node.js Official Website

Verify installation:

node -v
npm -v

Install TypeScript

npm install -g typescript

Check version:

tsc -v

Your First TypeScript Program

Create:

hello.ts
let message: string = "Hello TypeScript";

console.log(message);

Compile:

tsc hello.ts

Generated:

hello.js

Run:

node hello.js

Output:

Hello TypeScript

TypeScript Data Types

Number

let age: number = 30;

String

let name: string = "John";

Boolean

let isActive: boolean = true;

Array

let scores: number[] = [90, 80, 70];

Alternative:

let scores: Array<number> = [90, 80, 70];

Tuple

let employee: [number, string];

employee = [101, "David"];

Enum

enum Role {
    Admin,
    Manager,
    User
}

let userRole = Role.Admin;

Any

let data: any = "Hello";

data = 100;
data = true;

Avoid excessive use of any.


Unknown

let value: unknown;

value = "Hello";
value = 100;

Safer than any.


Void

function printMessage(): void {
    console.log("Hello");
}

Never

function throwError(): never {
    throw new Error("Something went wrong");
}

Variables

Let

let age = 25;

Can be reassigned.


Const

const pi = 3.14;

Cannot be reassigned.


Functions

Simple Function

function add(a: number, b: number): number {
    return a + b;
}

Optional Parameters

function greet(name: string, city?: string) {
    console.log(name, city);
}

Default Parameters

function greet(name: string = "Guest") {
    console.log(name);
}

Arrow Functions

const multiply = (a: number, b: number): number => {
    return a * b;
};

Interfaces

Interfaces define contracts.

interface Employee {
    id: number;
    name: string;
}

Usage:

let emp: Employee = {
    id: 1,
    name: "John"
};

Type Aliases

type Employee = {
    id: number;
    name: string;
};

Union Types

let id: string | number;

id = 101;
id = "EMP101";

Intersection Types

type Person = {
    name: string;
};

type Employee = {
    salary: number;
};

type Staff = Person & Employee;

Classes

Creating Class

class Employee {

    id: number;
    name: string;

    constructor(id: number, name: string) {
        this.id = id;
        this.name = name;
    }

    display() {
        console.log(this.name);
    }
}

Access Modifiers

Public

public name: string;

Default access.


Private

private salary: number;

Accessible only inside class.


Protected

protected department: string;

Accessible in derived classes.


Inheritance

class Person {
    name: string = "";
}

class Employee extends Person {
    salary: number = 0;
}

Polymorphism

class Animal {
    makeSound() {
        console.log("Animal Sound");
    }
}

class Dog extends Animal {
    makeSound() {
        console.log("Bark");
    }
}









Abstract Classes

abstract class Shape {
    abstract draw(): void;
}

Generics

Generics provide reusable code.

function getValue<T>(value: T): T {
    return value;
}

Usage:

getValue<string>("Hello");
getValue<number>(100);

Generic Interface

interface ApiResponse<T> {
    data: T;
    success: boolean;
}

Modules

Export:

export class Employee {
}

Import:

import { Employee } from "./employee";

Type Assertions

let value: any = "Hello";

let len = (value as string).length;

Decorators (Advanced)

function Logger(constructor: Function) {
    console.log("Logging...");
}

@Logger
class Employee {
}

Common in:

  • Angular

  • NestJS


Async Programming

Promise

let promise = new Promise((resolve) => {
    resolve("Success");
});

Async Await

async function getData() {
    let result = await fetch("/api/users");

    return result.json();
}

TypeScript with Angular

TypeScript is the primary language used in:

Angular Official Website

Example Component:

@Component({
 selector:'app-home'
})
export class HomeComponent {
 title:string="Welcome";
}

TypeScript with React

type Props = {
    name: string;
};

function Welcome({name}: Props) {
    return <h1>{name}</h1>;
}

TypeScript Best Practices

Use Strict Mode

{
 "strict": true
}

Avoid Any

let data: any;

let data: string;

Prefer Interfaces

interface User {
    id:number;
}

Use Readonly

readonly id:number;

Use Generics

Avoid duplicate code.


Common Interview Questions

What is TypeScript?

TypeScript is a strongly typed superset of JavaScript that compiles to JavaScript.


Difference Between Any and Unknown?

AnyUnknown
No Type CheckingType Safe
Less SecureMore Secure

Difference Between Interface and Type?

InterfaceType
ExtendableFlexible
Object ContractsUnions & Intersections

What are Generics?

Generics allow reusable and type-safe code.


What are Decorators?

Decorators add metadata and behavior to classes, methods, and properties.


Real-World Enterprise Usage

TypeScript is heavily used in:

  • Angular Applications

  • React Applications

  • Node.js APIs

  • NestJS Applications

  • Enterprise Portals

  • E-commerce Systems

  • Banking Applications

  • Microservices Dashboards

Companies using TypeScript include:


Conclusion

TypeScript has become the preferred language for modern web development because it combines JavaScript's flexibility with strong typing and enterprise-grade tooling. Whether you're building Angular applications, React frontends, Node.js APIs, or large-scale enterprise systems, learning TypeScript can significantly improve code quality, maintainability, and developer productivity.

Learning Path:

  1. Basics & Data Types

  2. Functions & Objects

  3. Interfaces & Types

  4. Classes & OOP

  5. Generics

  6. Modules

  7. Async Programming

  8. Advanced Types

  9. Decorators

  10. Angular/React/NestJS Integration

Master these topics, and you'll be ready for both TypeScript interviews and real-world enterprise development.

Don't Copy

Protected by Copyscape Online Plagiarism Checker