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 276–300 of 517

Career & HR topics

By tech stack

Junior PDF
What is a real-world example of OOP?

Answer: Car object: Class → Car Objects → myCar, yourCar Properties → Color, Model, Speed Methods → Start(), Stop(), Accelerate() Shows encapsulation, inheritance (e.g., ElectricCar : Car), and polymorphism in ction. Wha…

Junior PDF
What is encapsulation in OOP?

Encapsulation is the mechanism of hiding internal details of an object and exposing only necessary functionalities. It helps in protecting data and maintaining control over how it is accessed or modified. Example: A Bank…

Mid PDF
How does encapsulation help in security?

By making fields private, external code cannot directly modify sensitive data. Access is controlled via methods or properties, enforcing validation rules. Example: Prevent withdrawing more than the account balance: publi…

Mid PDF
How is encapsulation implemented in C#?

Use private fields to store data. Expose controlled access via public properties or methods. Apply validation logic inside these methods/properties. private int age; public int Age { get { return age; } set { if (value &…

Mid PDF
What are access modifiers?

Keywords that define visibility of class members. Common C# modifiers: private → accessible only inside the class public → accessible from anywhere protected → accessible in class and derived classes internal → accessibl…

Junior PDF
What is the role of private and public access modifiers in encapsulation?

Private → Hides data from outside access, ensuring security. Public → Provides controlled access through properties or methods. Example: private decimal balance; // hidden public decimal Balance { get { return balance; }…

Junior PDF
What is the use of internal, protected, and protected internal?

Internal → Accessible only within the same assembly. Protected → Accessible in the class and derived classes. Protected Internal → Accessible in derived classes or within the same assembly. Example: protected string acco…

Mid PDF
Can fields be made public directly?

Answer: Technically yes, but not recommended. Makes the data vulnerable to invalid modifications. Encapsulation recommends private fields + public properties. What interviewers expect A clear definition tied to OOP in C#…

Junior PDF
What is the use of properties in encapsulation?

Properties provide controlled access to private fields. Enable validation, read-only/write-only access, and future flexibility. Example: private int score; public int Score { get { return score; } set { if (value >= 0…

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…

C# OOP C# Programming Tutorial · OOP

Answer: Car object: Class → Car Objects → myCar, yourCar Properties → Color, Model, Speed Methods → Start(), Stop(), Accelerate() Shows encapsulation, inheritance (e.g., ElectricCar : Car), and polymorphism in ction.

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

  • Encapsulation is the mechanism of hiding internal details of an object and

exposing only necessary functionalities.

  • It helps in protecting data and maintaining control over how it is accessed or

modified.

Example: A BankAccount class hides its balance and only allows deposit/withdraw

operations:

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

mount; }

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • By making fields private, external code cannot directly modify sensitive data.
  • Access is controlled via methods or properties, enforcing validation rules.

Example: Prevent withdrawing more than the account balance:

public void Withdraw(decimal amount)
{
if (amount <= balance) balance -= amount;

else throw new InvalidOperationException("Insufficient

balance");

}
Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Use private fields to store data.
  • Expose controlled access via public properties or methods.
  • Apply validation logic inside these methods/properties.
private int age;
public int Age
{

get { return age; }

set { if (value > 0) age = value; }
}
Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Keywords that define visibility of class members.
  • Common C# modifiers:
  • private → accessible only inside the class
  • public → accessible from anywhere
  • protected → accessible in class and derived classes
  • internal → accessible within the same assembly
  • protected internal → accessible in derived classes or same assembly
Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Private → Hides data from outside access, ensuring security.
  • Public → Provides controlled access through properties or methods.

Example:

private decimal balance; // hidden
public decimal Balance { get { return balance; } } // read-only

ccess

Permalink & share

C# OOP C# Programming Tutorial · OOP

  • Internal → Accessible only within the same assembly.
  • Protected → Accessible in the class and derived classes.
  • Protected Internal → Accessible in derived classes or within the same assembly.

Example:

protected string accountType; // accessible in derived classes

internal string branchCode; 	// accessible within same assembly
Permalink & share

C# OOP C# Programming Tutorial · OOP

Answer: Technically yes, but not recommended. Makes the data vulnerable to invalid modifications. Encapsulation recommends private fields + public properties.

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

  • Properties provide controlled access to private fields.
  • Enable validation, read-only/write-only access, and future flexibility.

Example:

private int score;
public int Score
{

get { return score; }

set { if (value >= 0) score = value; } // validation
}
Permalink & share

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
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