Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 26–50 of 157

Popular tracks

Mid PDF
How does encapsulation differ from abstraction?

Answer: Encapsulation → Hides internal data, focuses on data protection. Abstraction → Hides implementation details, focuses on simplifying complex systems. What interviewers expect A clear definition tied to OOP in C# O…

Mid PDF
Give an example of encapsulation in C#.?

Real-World Example: Bank Account Management public class BankAccount { private string accountNumber; // private field private decimal balance; // private field public string AccountNumber { get { return accountNumber; }…

Junior PDF
What is abstraction in OOP?

Abstraction is the process of hiding the internal implementation details of a system and exposing only the essential features. It allows developers to focus on what an object does, not how it does it. Example: A Vehicle…

Mid PDF
Why is abstraction important?

Answer: Simplifies complex systems by exposing only relevant functionality. Enhances maintainability, readability, and reusability of code. Reduces dependency on implementation details, making systems more flexible. What…

Mid PDF
How do you implement abstraction in C#?

Answer: Using abstract classes or interfaces. Abstract classes can have abstract and non-abstract methods. Interfaces define method signatures only. bstract class Vehicle { public abstract void Start(); } interface IDriv…

Mid PDF
What are abstract classes?

Classes that cannot be instantiated directly and may contain abstract methods (without implementation). Can have fields, constructors, and concrete methods. bstract class Animal { public abstract void MakeSound(); public…

Mid PDF
What are interfaces?

Answer: Interfaces define a contract of methods, properties, or events that implementing classes must follow. Interfaces provide full abstraction without any implementation (C# 8+ allows default methods). interface IFlya…

Mid PDF
How do interfaces support abstraction?

By exposing method signatures only, interfaces hide the implementation. Allows multiple classes to implement the interface differently, providing flexibility nd decoupling. class Bird : IFlyable { public void Fly() =>…

Junior PDF
What is the difference between interface-based and abstract class-based abstraction?

Feature Abstract Class Interface Methods Can have abstract + concrete methods Only abstract methods (C# 8+ allows default implementation) Fields Can have fields Cannot have fields Inheritance Single inheritance Multiple…

Mid PDF
Can you instantiate an abstract class?

No, abstract classes cannot be instantiated directly. Must be inherited by a derived class which implements abstract methods. bstract class Shape { public abstract void Draw(); } // Shape s = new Shape(); // Not allowed…

Mid PDF
Can abstract classes have constructors?

Answer: Yes, constructors are used to initialize fields in derived classes. bstract class Vehicle { protected string Brand; public Vehicle(string brand) { Brand = brand; } } class Car : Vehicle { public Car(string brand)…

Mid PDF
Can abstract classes have non-abstract methods?

Answer: Yes, abstract classes can have concrete methods with implementation. Allows shared behavior for derived classes. bstract class Animal { public void Sleep() => Console.WriteLine("Sleeping"); public abstract…

Junior PDF
What is the purpose of abstraction in large systems?

Answer: Reduces system complexity by focusing on essential features. Decouples modules, making large systems easier to maintain and extend. Promotes code reuse and flexibility. What interviewers expect A clear definition…

Mid PDF
How does abstraction reduce complexity?

Answer: Hides implementation details, exposing only what is necessary. Users interact with interfaces or abstract methods, not the full system logic. Simplifies testing, maintenance, and understanding of code. What inter…

Mid PDF
Give an example of abstraction in C#.?

Real-World Example: Payment Processing // Abstract class bstract class Payment { public abstract void Pay(decimal amount); public void ShowReceipt(decimal amount) => Console.WriteLine($"Paid: {amount:C}"); } // Derive…

Junior PDF
What is the base class and derived class?

Answer: Base Class (Parent) → Class whose members are inherited. Derived Class (Child) → Class that inherits from base class. class Vehicle { public void Start() {} } // Base class Car : Vehicle {} // Derived What interv…

Mid PDF
How is inheritance implemented in C#?

Using the colon (:) symbol. Derived class can access public/protected members of the base class. class Vehicle { public void Start() => Console.WriteLine("Start"); } class Car : Vehicle { } Car myCar = new Car(); myCa…

Junior PDF
What is the : base() keyword used for?

Calls the constructor of the base class from a derived class. Ensures base class initialization before derived class constructor runs. class Vehicle { public Vehicle(string brand) { Console.WriteLine(brand); } } class Ca…

Mid PDF
Can you inherit multiple classes in C#?

No, C# does not support multiple class inheritance to avoid ambiguity. What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (performance, maintainability, security, cost) When you would a…

Junior PDF
What is the workaround for multiple inheritance in C#?

Use interfaces to achieve multiple inheritance. A class can implement multiple interfaces. interface IFlyable { void Fly(); } interface IDriveable { void Drive(); } class FlyingCar : IFlyable, IDriveable { public void Fl…

Junior PDF
What is the difference between inheritance and composition?

Answer: Feature Inheritance Composition Relationship "is-a" "has-a" Reuse Derived class reuses base class Object contains other objects Flexibility Less flexible More flexible Example: Inheritance → Car is a Vehicle Comp…

Junior PDF
What is method overriding?

Derived class provides a new implementation for a virtual method in base class. Enables runtime polymorphism. class Vehicle { public virtual void Start() => Console.WriteLine("Vehicle starts"); } class Car : Vehicle {…

Junior PDF
What is the use of the virtual and override keywords?

Answer: virtual → Marks a base class method as overridable. override → Overrides a virtual method in the derived class. What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (performance,…

Junior PDF
What is the sealed keyword?

Answer: Prevents a class from being inherited or a method from being overridden. sealed class FinalClass { } class Car : FinalClass { } // Not allowed What interviewers expect A clear definition tied to OOP in C# OOP pro…

Junior PDF
What is the difference between new and override in inheritance?

override → Overrides a virtual method in base class (runtime polymorphism). new → Hides a base class method (compile-time hiding, not true overriding). class Vehicle { public void Start() => Console.WriteLine("Vehicle…

C# OOP C# Programming Tutorial · OOP

Answer: Encapsulation → Hides internal data, focuses on data protection. Abstraction → Hides implementation details, focuses on simplifying complex systems.

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

Real-World Example: Bank Account Management

public class BankAccount
{
private string accountNumber; // private field
private decimal balance; 	// private field
public string AccountNumber { get { return accountNumber; } } //

read-only

public decimal Balance { get { return balance; } } 	//

read-only

public BankAccount(string accNum, decimal initialBalance)
{
ccountNumber = accNum;

balance = initialBalance >= 0 ? initialBalance : throw new

rgumentException("Invalid balance");

}
public void Deposit(decimal amount)
{
if(amount > 0) balance += amount;

else throw new ArgumentException("Deposit must be

positive");

}
public void Withdraw(decimal amount)
{
if(amount > 0 && amount <= balance) balance -= amount;

else throw new InvalidOperationException("Insufficient

balance");

}
}

// Usage

BankAccount myAccount = new BankAccount("ACC123", 1000);

myAccount.Deposit(500); // Balance becomes 1500

myAccount.Withdraw(200); // Balance becomes 1300

Console.WriteLine($"Account: {myAccount.AccountNumber}, Balance:

{myAccount.Balance}");

Explanation:

  • accountNumber and balance are private, protecting sensitive data.
  • Controlled access via methods ensures data integrity.
  • Demonstrates real-world encapsulation in action.
Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Abstraction is the process of hiding the internal implementation details of a

system and exposing only the essential features.

  • It allows developers to focus on what an object does, not how it does it.

Example: A Vehicle class exposes Start() method without revealing engine details.

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Simplifies complex systems by exposing only relevant functionality. Enhances maintainability, readability, and reusability of code. Reduces dependency on implementation details, making systems more flexible.

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Using abstract classes or interfaces. Abstract classes can have abstract and non-abstract methods. Interfaces define method signatures only. bstract class Vehicle { public abstract void Start(); } interface IDriveable { void Drive(); }

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Classes that cannot be instantiated directly and may contain abstract methods

(without implementation).

  • Can have fields, constructors, and concrete methods.

bstract class Animal

{
public abstract void MakeSound();
public void Sleep() => Console.WriteLine("Sleeping");
}
Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Interfaces define a contract of methods, properties, or events that implementing classes must follow. Interfaces provide full abstraction without any implementation (C# 8+ allows default methods). interface IFlyable { void Fly(); }

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • By exposing method signatures only, interfaces hide the implementation.
  • Allows multiple classes to implement the interface differently, providing flexibility

nd decoupling.

class Bird : IFlyable
{
public void Fly() => Console.WriteLine("Bird is flying");
}
class Airplane : IFlyable
{
public void Fly() => Console.WriteLine("Airplane is flying");
}
Permalink & share

C# OOP C# Programming Tutorial · OOP

Feature Abstract Class Interface

Methods Can have abstract +

concrete methods

Only abstract methods (C# 8+ allows default

implementation)

Fields Can have fields Cannot have fields

Inheritance Single inheritance Multiple interfaces can be implemented

Constructo

Can have constructors Cannot have constructors

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • No, abstract classes cannot be instantiated directly.
  • Must be inherited by a derived class which implements abstract methods.

bstract class Shape { public abstract void Draw(); }

// Shape s = new Shape(); // Not allowed
class Circle : Shape { public override void Draw() =>

Console.WriteLine("Circle"); }

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Yes, constructors are used to initialize fields in derived classes. bstract class Vehicle { protected string Brand; public Vehicle(string brand) { Brand = brand; } } class Car : Vehicle { public Car(string brand) : base(brand) { } }

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Yes, abstract classes can have concrete methods with implementation. Allows shared behavior for derived classes. bstract class Animal { public void Sleep() =&gt; Console.WriteLine("Sleeping"); public abstract void MakeSound(); }

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Reduces system complexity by focusing on essential features. Decouples modules, making large systems easier to maintain and extend. Promotes code reuse and flexibility.

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Hides implementation details, exposing only what is necessary. Users interact with interfaces or abstract methods, not the full system logic. Simplifies testing, maintenance, and understanding of code.

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

Real-World Example: Payment Processing

// Abstract class

bstract class Payment

{
public abstract void Pay(decimal amount);
public void ShowReceipt(decimal amount) =>

Console.WriteLine($"Paid: {amount:C}");

}

// Derived classes implement abstraction

class CreditCardPayment : Payment
{
public override void Pay(decimal amount) =>

Console.WriteLine($"Paid {amount:C} using Credit Card");

}
class PayPalPayment : Payment
{
public override void Pay(decimal amount) =>

Console.WriteLine($"Paid {amount:C} using PayPal");

}

// Usage

Payment payment1 = new CreditCardPayment();

payment1.Pay(500);

payment1.ShowReceipt(500);

Payment payment2 = new PayPalPayment();

payment2.Pay(300);

payment2.ShowReceipt(300);

Explanation:

  • Payment defines what a payment should do (abstract method Pay).
  • Derived classes (CreditCardPayment, PayPalPayment) define how payment is

made.

  • Users interact only with the abstract interface, not the internal logic.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Base Class (Parent) → Class whose members are inherited. Derived Class (Child) → Class that inherits from base class. class Vehicle { public void Start() {} } // Base class Car : Vehicle {} // Derived

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Using the colon (:) symbol.
  • Derived class can access public/protected members of the base class.
class Vehicle { public void Start() => Console.WriteLine("Start"); }
class Car : Vehicle { }
Car myCar = new Car();

myCar.Start(); // Inherited method

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Calls the constructor of the base class from a derived class.
  • Ensures base class initialization before derived class constructor runs.
class Vehicle { public Vehicle(string brand) {

Console.WriteLine(brand); } }

class Car : Vehicle
{
public Car(string brand) : base(brand) { Console.WriteLine("Car

created"); }

}
Permalink & share

C# OOP C# Programming Tutorial · OOP

No, C# does not support multiple class inheritance to avoid ambiguity.

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Use interfaces to achieve multiple inheritance.
  • A class can implement multiple interfaces.
interface IFlyable { void Fly(); }
interface IDriveable { void Drive(); }
class FlyingCar : IFlyable, IDriveable { public void Fly() {} public

void Drive() {} }

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Feature Inheritance Composition Relationship "is-a" "has-a" Reuse Derived class reuses base class Object contains other objects Flexibility Less flexible More flexible Example: Inheritance → Car is a Vehicle Composition → Car has a Engine

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Derived class provides a new implementation for a virtual method in base class.
  • Enables runtime polymorphism.
class Vehicle { public virtual void Start() =>

Console.WriteLine("Vehicle starts"); }

class Car : Vehicle { public override void Start() =>

Console.WriteLine("Car starts"); }

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: virtual → Marks a base class method as overridable. override → Overrides a virtual method in the derived class.

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Prevents a class from being inherited or a method from being overridden. sealed class FinalClass { } class Car : FinalClass { } // Not allowed

What interviewers expect

  • A clear definition tied to OOP in C# OOP projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# OOP architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • override → Overrides a virtual method in base class (runtime polymorphism).
  • new → Hides a base class method (compile-time hiding, not true overriding).
class Vehicle { public void Start() => Console.WriteLine("Vehicle");
}
class Car : Vehicle { public new void Start() =>

Console.WriteLine("Car"); }

Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details