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 51–75 of 96

Career & HR topics

By tech stack

Junior PDF
What is denormalization and when would you use it?

Denormalization is the process of intentionally introducing redundancy into a database by merging tables or adding redundant data to reduce the complexity of database queries, improve read performance, and simplify the s…

Junior PDF
What is the difference between 1NF and 2NF? ● 1NF (First Normal Form): Ensures that the table has atomic columns (no multi-valued or repeating groups) and each row has a unique identifier (Primary Key). ● 2NF (Second Normal Form): The table must be in 1NF and all non-key columns must depend on the entire primary key (i.e., there should be no partial dependencies). Example: ● A table with a composite primary key (e.g., StudentID, CourseID) where non-key

Answer: ttributes like CourseName only depend on CourseID would violate 2NF because CourseName is partially dependent on the composite key. You would separate this into two tables (one for Courses and one for Students).…

Junior PDF
What is the difference between 1NF and 2NF?

1NF (First Normal Form): Ensures that the table has atomic columns (no multi-valued or repeating groups) and each row has a unique identifier (Primary Key). 2NF (Second Normal Form): The table must be in 1NF and all non-…

Junior PDF
What is the concept of referential integrity and how is it enforced in database design? Referential integrity ensures that relationships between tables are consistent. Specifically, it ensures that a foreign key in one table must match a primary key or a unique key in

nother table. This prevents invalid references from being made. Enforcing Referencing Integrity: Use foreign keys to create relationships between tables. Enforce actions like ON DELETE CASCADE, ON UPDATE CASCADE, or ON D…

Junior PDF
What is the concept of referential integrity and how is it enforced in database design?

Referential integrity ensures that relationships between tables are consistent. Specifically, it ensures that a foreign key in one table must match a primary key or a unique key in another table. This prevents invalid re…

Junior PDF
What is a composite key? How does it differ from a primary key?

composite key is a combination of two or more columns in a table that can uniquely identify each record in the table. It is used when a single column is not sufficient to uniquely identify a row. Composite Key: Consists…

Junior PDF
What is a composite key?

How does it differ from a primary key? A composite key is a combination of two or more columns in a table that can uniquely identify each record in the table. It is used when a single column is not sufficient to uniquely…

Junior PDF
What is an entity-relationship diagram (ERD)?

n Entity-Relationship Diagram (ERD) is a graphical representation of entities and their relationships to each other within a database. It is used to visualize the structure of a database and how tables (entities) relate…

Junior PDF
What is a surrogate key? How is it different from a natural key?

surrogate key is an artificial, system-generated key used to uniquely identify a record in a table. It has no business meaning and is typically a number (e.g., auto-incremented ID). Surrogate Key: No business meaning. Co…

Junior PDF
What is a surrogate key?

How is it different from a natural key? A surrogate key is an artificial, system-generated key used to uniquely identify a record in a table. It has no business meaning and is typically a number (e.g., auto-incremented I…

Junior PDF
What is MongoDB and how is it different from SQL databases?

MongoDB is a NoSQL document-oriented database that stores data in flexible, semi-structured documents rather than in rows and columns like SQL databases. Unlike SQL databases, which rely on rigid schemas, MongoDB uses a…

Junior PDF
What is a document in MongoDB? How does it differ from rows in SQL databases?

document in MongoDB is a record represented as a JSON-like object (BSON format) that contains field-value pairs. It can have a flexible structure, meaning each document in a collection may contain different fields and da…

Junior PDF
What is a document in MongoDB?

How does it differ from rows in SQL databases? A document in MongoDB is a record represented as a JSON-like object (BSON format) that contains field-value pairs. It can have a flexible structure, meaning each document in…

Junior PDF
What is indexing in MongoDB? How is it different from SQL indexes? Indexing in MongoDB is a mechanism to improve query performance by reducing the

mount of data the system needs to scan. MongoDB creates indexes on fields that are queried frequently. Differences from SQL indexes: MongoDB uses B-tree indexes (by default) but also supports other types like hashed inde…

Junior PDF
What is indexing in MongoDB?

How is it different from SQL indexes? Indexing in MongoDB is a mechanism to improve query performance by reducing the amount of data the system needs to scan. MongoDB creates indexes on fields that are queried frequently…

Junior PDF
What is the purpose of the $in operator in MongoDB?

The $in operator is used to match values in a specified array. It checks if the value of a field is equal to any value in the provided array. Example: db.collection.find({ age: { $in: [25, 30, 35] } }); This query finds…

Junior PDF
What is the difference between a replica set and a sharded cluster in MongoDB? ● Replica Set: A group of MongoDB servers that maintain the same data. It provides high availability and data redundancy by replicating data across multiple servers. If the primary server goes down, one of the secondaries can be promoted to primary

utomatically. Sharded Cluster: Used for horizontal scaling. It splits data across multiple servers (shards) based on a shard key. Each shard holds a portion of the data, and a mongos router directs queries to the correct…

Junior PDF
What is the difference between a replica set and a sharded cluster in MongoDB?

Replica Set: A group of MongoDB servers that maintain the same data. It provides high availability and data redundancy by replicating data across multiple servers. If the primary server goes down, one of the secondaries…

Junior PDF
What is the difference between the find() and findOne() methods in MongoDB?

find(): Returns a cursor to all documents that match the query. You can iterate over the results using .forEach() or convert them to an array with .toArray(). Example: db.collection.find({ age: { $gt: 30 } }); findOne():…

Junior PDF
What is the Aggregation framework in MongoDB? How do you use it? The Aggregation Framework in MongoDB is used to perform complex data processing tasks such as grouping, filtering, sorting, and reshaping documents. It uses a pipeline of stages to process documents: Example: db.collection.aggregate([ { $match: { status: "active" } }, // Filter documents { $group: { _id: "$age", count: { $sum: 1 } } }, // Group by age

Answer: nd count occurrences { $sort: { count: -1 } } // Sort by count in descending order ]); What interviewers expect A clear definition tied to SQL in SQL & Databases projects Trade-offs (performance, maintainabil…

Junior PDF
What is the Aggregation framework in MongoDB?

How do you use it? The Aggregation Framework in MongoDB is used to perform complex data processing tasks such as grouping, filtering, sorting, and reshaping documents. It uses a pipeline of stages to process documents: E…

Junior PDF
What is data modeling in MongoDB? Data modeling in MongoDB refers to the design of how data will be stored, organized, and

ccessed in the database. Since MongoDB is schema-less, data modeling involves deciding how to structure documents, collections, and their relationships (embedded vs. referenced documents) to balance performance, scalabil…

Junior PDF
What is data modeling in MongoDB?

Data modeling in MongoDB refers to the design of how data will be stored, organized, and accessed in the database. Since MongoDB is schema-less, data modeling involves deciding how to structure documents, collections, an…

Junior PDF
What is a MongoDB document schema?

document schema defines the structure, rules, and validations for documents in a collection. MongoDB is schema-less by default, but you can enforce schema validation rules using MongoDB schema validation. Example: db.cre…

Junior PDF
What is MongoDB Atlas and how does it work?

MongoDB Atlas is a fully-managed cloud database service provided by MongoDB Inc. It offers: Automated backups, scaling, and updates. Multi-cloud support (AWS, GCP, Azure). Advanced security features like encryption and I…

SQL & Databases SQL Server Tutorial · SQL

Denormalization is the process of intentionally introducing redundancy into a database by

merging tables or adding redundant data to reduce the complexity of database queries,

improve read performance, and simplify the schema.

  • When to use:
  • When read performance is more critical than data integrity and

normalization (e.g., in OLAP systems or reporting).

  • In cases where complex JOINs are causing performance bottlenecks.
  • In high-performance environments where frequently accessed data can be

stored redundantly to reduce query times.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

Answer: ttributes like CourseName only depend on CourseID would violate 2NF because CourseName is partially dependent on the composite key. You would separate this into two tables (one for Courses and one for Students).

What interviewers expect

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

Real-world example

In a production SQL & Databases 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 SQL & Databases 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

SQL & Databases SQL Server Tutorial · SQL

  • 1NF (First Normal Form): Ensures that the table has atomic columns (no

multi-valued or repeating groups) and each row has a unique identifier (Primary Key).

  • 2NF (Second Normal Form): The table must be in 1NF and all non-key columns

must depend on the entire primary key (i.e., there should be no partial

dependencies).

Example:

  • A table with a composite primary key (e.g., StudentID, CourseID) where non-key

attributes like CourseName only depend on CourseID would violate 2NF because

CourseName is partially dependent on the composite key. You would separate this

into two tables (one for Courses and one for Students).

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

nother table. This prevents invalid references from being made.

  • Enforcing Referencing Integrity:
  • Use foreign keys to create relationships between tables.
  • Enforce actions like ON DELETE CASCADE, ON UPDATE CASCADE, or

ON DELETE RESTRICT to define how changes in parent tables affect related

child tables.

Example:

  • A Foreign Key in the Orders table references the CustomerID in the Customers

table. If you try to delete a customer that has associated orders, referential integrity

will prevent the delete unless actions like CASCADE are specified.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

Referential integrity ensures that relationships between tables are consistent. Specifically,

it ensures that a foreign key in one table must match a primary key or a unique key in

another table. This prevents invalid references from being made.

  • Enforcing Referencing Integrity:
  • Use foreign keys to create relationships between tables.
  • Enforce actions like ON DELETE CASCADE, ON UPDATE CASCADE, or

ON DELETE RESTRICT to define how changes in parent tables affect related

child tables.

Example:

  • A Foreign Key in the Orders table references the CustomerID in the Customers

table. If you try to delete a customer that has associated orders, referential integrity

will prevent the delete unless actions like CASCADE are specified.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

composite key is a combination of two or more columns in a table that can uniquely

identify each record in the table. It is used when a single column is not sufficient to uniquely

identify a row.

  • Composite Key: Consists of multiple columns.

Example: A table storing student-course enrollments might use a composite key

consisting of StudentID and CourseID to uniquely identify each enrollment record.

  • Primary Key: A primary key is a single column (or a composite of columns) that

uniquely identifies each record in a table. It can be a single column or a composite

of multiple columns, but it must be unique for each row.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

How does it differ from a primary key?

A composite key is a combination of two or more columns in a table that can uniquely

identify each record in the table. It is used when a single column is not sufficient to uniquely

identify a row.

  • Composite Key: Consists of multiple columns.

Example: A table storing student-course enrollments might use a composite key

consisting of StudentID and CourseID to uniquely identify each enrollment record.

  • Primary Key: A primary key is a single column (or a composite of columns) that

uniquely identifies each record in a table. It can be a single column or a composite

of multiple columns, but it must be unique for each row.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

n Entity-Relationship Diagram (ERD) is a graphical representation of entities and their

relationships to each other within a database. It is used to visualize the structure of a

database and how tables (entities) relate to one another.

  • Entities are represented as rectangles.
  • Attributes are shown as ovals connected to their entities.
  • Relationships are represented as diamonds, showing how entities interact.

ERDs help in the conceptual design phase of a database, outlining entities, relationships,

nd keys before implementation.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

surrogate key is an artificial, system-generated key used to uniquely identify a record in a

table. It has no business meaning and is typically a number (e.g., auto-incremented ID).

  • Surrogate Key:
  • No business meaning.
  • Commonly used in data warehousing and large-scale systems.
  • Example: A column UserID that is generated automatically.
  • Natural Key: A key that has real-world business meaning and is used to uniquely

identify records.

  • Example: SocialSecurityNumber or EmailAddress could serve as

natural keys.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

How is it different from a natural key?

A surrogate key is an artificial, system-generated key used to uniquely identify a record in a

table. It has no business meaning and is typically a number (e.g., auto-incremented ID).

  • Surrogate Key:
  • No business meaning.
  • Commonly used in data warehousing and large-scale systems.
  • Example: A column UserID that is generated automatically.
  • Natural Key: A key that has real-world business meaning and is used to uniquely

identify records.

  • Example: SocialSecurityNumber or EmailAddress could serve as

natural keys.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

MongoDB is a NoSQL document-oriented database that stores data in flexible,

semi-structured documents rather than in rows and columns like SQL databases. Unlike

SQL databases, which rely on rigid schemas, MongoDB uses a schema-less approach

where each document can have different fields and structures.

Key differences:

  • SQL Databases: Store data in tables with a fixed schema and use ACID

transactions for consistency.

  • MongoDB: Uses a document model (e.g., JSON-like structures) and offers more

flexibility, scalability, and ease of replication but may sacrifice some consistency in

distributed environments.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

document in MongoDB is a record represented as a JSON-like object (BSON format)

that contains field-value pairs. It can have a flexible structure, meaning each document in a

collection may contain different fields and data types.

Differences from SQL Rows:

  • In SQL, a row is a fixed set of columns (defined by the schema), while in MongoDB,

document is more flexible and can vary in structure.

  • A row in SQL is constrained by a schema, whereas a document in MongoDB can

store complex, nested data structures (arrays, sub-documents).

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

How does it differ from rows in

SQL databases?

A document in MongoDB is a record represented as a JSON-like object (BSON format)

that contains field-value pairs. It can have a flexible structure, meaning each document in a

collection may contain different fields and data types.

Differences from SQL Rows:

  • In SQL, a row is a fixed set of columns (defined by the schema), while in MongoDB,

a document is more flexible and can vary in structure.

  • A row in SQL is constrained by a schema, whereas a document in MongoDB can

store complex, nested data structures (arrays, sub-documents).

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

mount of data the system needs to scan. MongoDB creates indexes on fields that are

queried frequently.

Differences from SQL indexes:

  • MongoDB uses B-tree indexes (by default) but also supports other types like

hashed indexes, geospatial indexes, and text indexes.

  • SQL indexes are typically built on a fixed schema and are more rigid, while MongoDB

indexes can be dynamic, allowing indexing on any field within a document.

  • MongoDB supports compound indexes and array indexes for more complex

queries.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

How is it different from SQL indexes?

Indexing in MongoDB is a mechanism to improve query performance by reducing the

amount of data the system needs to scan. MongoDB creates indexes on fields that are

queried frequently.

Differences from SQL indexes:

  • MongoDB uses B-tree indexes (by default) but also supports other types like

hashed indexes, geospatial indexes, and text indexes.

  • SQL indexes are typically built on a fixed schema and are more rigid, while MongoDB

indexes can be dynamic, allowing indexing on any field within a document.

  • MongoDB supports compound indexes and array indexes for more complex

queries.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

The $in operator is used to match values in a specified array. It checks if the value of a field

is equal to any value in the provided array.

Example:

db.collection.find({ age: { $in: [25, 30, 35] } });

This query finds all documents where the age field is 25, 30, or 35.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

utomatically.

  • Sharded Cluster: Used for horizontal scaling. It splits data across multiple servers

(shards) based on a shard key. Each shard holds a portion of the data, and a

mongos router directs queries to the correct shard. Sharding helps manage large

datasets by distributing the load.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

  • Replica Set: A group of MongoDB servers that maintain the same data. It provides

high availability and data redundancy by replicating data across multiple servers. If

the primary server goes down, one of the secondaries can be promoted to primary

automatically.

  • Sharded Cluster: Used for horizontal scaling. It splits data across multiple servers

(shards) based on a shard key. Each shard holds a portion of the data, and a

mongos router directs queries to the correct shard. Sharding helps manage large

datasets by distributing the load.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

find(): Returns a cursor to all documents that match the query. You can iterate over the

results using .forEach() or convert them to an array with .toArray().

Example:

db.collection.find({ age: { $gt: 30 } });

  • findOne(): Returns the first document that matches the query, or null if no document is

found.

Example:

db.collection.findOne({ name: "Alice" });

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

Answer: nd count occurrences { $sort: { count: -1 } } // Sort by count in descending order ]);

What interviewers expect

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

Real-world example

In a production SQL & Databases 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 SQL & Databases 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

SQL & Databases SQL Server Tutorial · SQL

How do you use

it?

The Aggregation Framework in MongoDB is used to perform complex data processing

tasks such as grouping, filtering, sorting, and reshaping documents.

It uses a pipeline of stages to process documents:

Example:

db.collection.aggregate([

{ $match: { status: "active" } }, // Filter documents

{ $group: { _id: "$age", count: { $sum: 1 } } }, // Group by age

and count occurrences

{ $sort: { count: -1 } } // Sort by count in descending order

]);

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

ccessed in the database. Since MongoDB is schema-less, data modeling involves deciding

how to structure documents, collections, and their relationships (embedded vs. referenced

documents) to balance performance, scalability, and ease of querying.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

Data modeling in MongoDB refers to the design of how data will be stored, organized, and

accessed in the database. Since MongoDB is schema-less, data modeling involves deciding

how to structure documents, collections, and their relationships (embedded vs. referenced

documents) to balance performance, scalability, and ease of querying.

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

document schema defines the structure, rules, and validations for documents in a

collection. MongoDB is schema-less by default, but you can enforce schema validation rules

using MongoDB schema validation.

Example:

db.createCollection("users", {

validator: {

$jsonSchema: {

bsonType: "object",

required: ["name", "email"],

properties: {

name: { bsonType: "string" },

email: { bsonType: "string" }

}
}
}

});

Permalink & share

SQL & Databases SQL Server Tutorial · SQL

MongoDB Atlas is a fully-managed cloud database service provided by MongoDB Inc. It

offers:

  • Automated backups, scaling, and updates.
  • Multi-cloud support (AWS, GCP, Azure).
  • Advanced security features like encryption and IP whitelisting.
  • Monitoring and performance optimization tools.
  • Global replication across different regions.
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