TCS NQT 2027 Campus Drive
300 Important Technical Interview Questions
Last-Minute Preparation Guide · Ninja | Prime | Digital
Category Coverage Questions
C / C++ / Java / Python Core Programming Q1 – Q50
DBMS & SQL Database Fundamentals Q51 – Q90
OOPs Concepts Object-Oriented Programming Q91 – Q120
OS & Computer Networks Systems Fundamentals Q121 – Q160
DSA & Algorithms Data Structures & Algo Q161 – Q210
AI / ML / GenAI Artificial Intelligence Q211 – Q250
System Design & Cloud Architecture & Cloud Q251 – Q275
HR / MR Quick Revision Soft Skills Q276 – Q300
■ Designed for 1–2 Day Rapid Revision | Covers Ninja · Prime · Digital Levels
How to Use This Guide
• Day 1 Focus: C/C++/Java/Python (Q1-50), DBMS/SQL (Q51-90), OOPs (Q91-120)
• Day 2 Focus: OS/Networks (Q121-160), DSA (Q161-210), AI/ML (Q211-250)
• Last 2 Hours: System Design (Q251-275) + HR/MR Quick Revision (Q276-300)
• Level Tags: Ninja = Fresher level | Prime = Mid-level | Digital = Advanced
• Strategy: Read Q first, try answering, then verify. Mark weak areas, revise again.
SECTION 1: C / C++ / Java / Python (Q1 – Q50)
C Programming (Q1–Q12)
Q1. What is the difference between a compiler and an interpreter?
Answer: A compiler translates the entire source code to machine code at once before execution. An interpreter
translates and executes line by line. C uses a compiler; Python uses an interpreter.
Level: Ninja | Topic: C Basics
Q2. What is a pointer in C? Give an example.
Answer: A pointer is a variable that stores the memory address of another variable. Example: int a=5; int *p=&a; —
*p gives value 5.
Level: Ninja | Topic: Pointers
Q3. Explain the difference between malloc() and calloc().
Answer: malloc(n) allocates n bytes without initializing memory. calloc(n,size) allocates n*size bytes and initializes
all to zero. Both return void*.
Level: Ninja | Topic: Memory
Q4. What is a dangling pointer?
Answer: A pointer that points to memory that has already been freed/deallocated. Accessing it causes undefined
behavior. Always set pointer to NULL after freeing.
Level: Ninja | Topic: Pointers
Q5. What is the difference between stack and heap memory?
Answer: Stack: automatically managed, stores local variables, LIFO structure, limited size. Heap: manually
managed (malloc/free), used for dynamic allocation, larger size, slower access.
Level: Ninja | Topic: Memory
Q6. What is a static variable in C?
Answer: A static variable retains its value between function calls. If declared globally, it restricts scope to the file.
Declared with keyword 'static'.
Level: Ninja | Topic: C Basics
Q7. What is the use of the 'volatile' keyword?
Answer: Tells the compiler not to optimize that variable — its value may change unexpectedly (e.g., hardware
registers, signal handlers). Used in embedded systems.
Level: Prime | Topic: C Advanced
Q8. Explain structure vs union in C.
Answer: Structure allocates separate memory for each member (total = sum of all). Union shares the same memory
for all members (size = largest member). Union saves memory but only one member is active at a time.
Level: Ninja | Topic: C Basics
Q9. What is a memory leak?
Answer: When dynamically allocated memory is not freed after use, it remains occupied indefinitely, reducing
available memory. Prevented by always calling free() after malloc().
Level: Ninja | Topic: Memory
Q10. What is the difference between pass by value and pass by reference?
Answer: Pass by value: a copy of the variable is passed; changes inside function don't affect original. Pass by
reference (using pointers in C): address is passed; changes affect original.
Level: Ninja | Topic: C Basics
Q11. What are preprocessor directives? Give examples.
Answer: Instructions processed before compilation. Examples: #include (includes files), #define (macros),
#ifdef/#endif (conditional compilation), #pragma (compiler-specific).
Level: Ninja | Topic: C Basics
Q12. What is a segmentation fault?
Answer: A runtime error when a program tries to access memory it's not allowed to (e.g., dereferencing NULL
pointer, array out of bounds). OS terminates the program.
Level: Ninja | Topic: C Basics
C++ Programming (Q13–Q22)
Q13. What is the difference between C and C++?
Answer: C is procedural; C++ is multi-paradigm (procedural + OOP). C++ adds classes, objects, inheritance,
polymorphism, templates, exception handling, and STL.
Level: Ninja | Topic: C++ Basics
Q14. What are constructors and destructors?
Answer: Constructor: special member function called automatically when object is created, used for initialization.
Destructor: called when object is destroyed, used for cleanup. Destructor uses ~ symbol.
Level: Ninja | Topic: OOP
Q15. What is operator overloading in C++?
Answer: Giving additional meaning to existing operators for user-defined types. Example: overloading '+' to add two
Complex number objects using 'operator+' function.
Level: Prime | Topic: C++ Advanced
Q16. What is the difference between new and malloc?
Answer: new is C++ specific, calls constructor, returns correct type pointer, throws exception on failure. malloc is C,
doesn't call constructor, returns void*, returns NULL on failure.
Level: Ninja | Topic: C++
Q17. What are templates in C++?
Answer: Templates allow writing generic code that works with any data type. Function templates and class
templates. Example: template T add(T a, T b) { return a+b; }
Level: Prime | Topic: C++ Templates
Q18. What is STL in C++?
Answer: Standard Template Library — provides reusable generic classes and functions. Components: Containers
(vector, list, map, set), Iterators, Algorithms (sort, find, binary_search).
Level: Prime | Topic: STL
Q19. What is a virtual function?
Answer: A function in base class declared with 'virtual' keyword that can be overridden in derived classes. Enables
runtime polymorphism. Pure virtual function (=0) makes class abstract.
Level: Prime | Topic: OOP
Q20. What is the difference between reference and pointer in C++?
Answer: Reference is an alias for existing variable, must be initialized, cannot be null, cannot be reassigned.
Pointer stores address, can be null, can be reassigned, uses * and &.
Level: Ninja | Topic: C++
Q21. What is exception handling in C++?
Answer: Mechanism to handle runtime errors gracefully using try, catch, and throw. Code in try block is monitored;
if exception thrown, matching catch block handles it.
Level: Ninja | Topic: C++ Exception
Q22. What is RAII in C++?
Answer: Resource Acquisition Is Initialization — resources (memory, files) are acquired in constructor and released
in destructor. Smart pointers (unique_ptr, shared_ptr) implement RAII.
Level: Digital | Topic: C++ Advanced
Java (Q23–Q35)
Q23. What is the JVM, JRE, and JDK?
Answer: JVM (Java Virtual Machine): executes bytecode. JRE (Java Runtime Environment): JVM + libraries
needed to run Java. JDK (Java Development Kit): JRE + compiler + dev tools.
Level: Ninja | Topic: Java Basics
Q24. What is platform independence in Java?
Answer: 'Write Once, Run Anywhere' — Java code compiles to bytecode (.class file) which runs on any OS with
JVM installed, not tied to a specific processor architecture.
Level: Ninja | Topic: Java Basics
Q25. Explain the difference between == and .equals() in Java.
Answer: == compares object references (memory addresses). .equals() compares object content/values. For
Strings, use .equals(); == checks if both point to same object.
Level: Ninja | Topic: Java
Q26. What is the difference between ArrayList and LinkedList?
Answer: ArrayList: dynamic array, fast random access O(1), slow insertion/deletion in middle O(n). LinkedList:
doubly linked, slow access O(n), fast insertion/deletion O(1) with iterator.
Level: Prime | Topic: Collections
Q27. What is garbage collection in Java?
Answer: Automatic memory management — JVM periodically identifies and frees objects no longer referenced.
Uses generational GC (Young, Old, PermGen/Metaspace). Cannot be forced but [Link]() suggests it.
Level: Ninja | Topic: Java Memory
Q28. What is multithreading in Java?
Answer: Concurrent execution of two or more threads. Threads can be created by extending Thread class or
implementing Runnable interface. Managed via start(), run(), sleep(), join(), synchronized.
Level: Prime | Topic: Java Threads
Q29. What is the difference between abstract class and interface?
Answer: Abstract class: can have concrete methods, constructors, instance variables; single inheritance. Interface:
all methods abstract by default (Java 8+ allows default/static methods), multiple inheritance supported.
Level: Ninja | Topic: OOP
Q30. What is exception handling in Java?
Answer: try-catch-finally blocks handle runtime errors. Checked exceptions (must handle: IOException). Unchecked
exceptions (RuntimeException). throw to raise, throws in method signature.
Level: Ninja | Topic: Java
Q31. What is Java 8 Stream API?
Answer: Functional-style operations on sequences of elements. Supports filter(), map(), reduce(), collect(). Enables
declarative programming and parallel processing. Works with lambda expressions.
Level: Prime | Topic: Java 8
Q32. What is synchronization in Java?
Answer: Mechanism to control access to shared resources by multiple threads. 'synchronized' keyword on
methods/blocks ensures only one thread executes at a time, preventing race conditions.
Level: Prime | Topic: Java Threads
Q33. What is the difference between String, StringBuilder, and StringBuffer?
Answer: String: immutable, thread-safe. StringBuilder: mutable, not thread-safe, faster. StringBuffer: mutable,
thread-safe (synchronized), slower than StringBuilder. Use StringBuilder for single-threaded string manipulation.
Level: Ninja | Topic: Java
Q34. What are lambda expressions in Java?
Answer: Anonymous functions introduced in Java 8. Syntax: (parameters) -> expression. Used with functional
interfaces. Example: [Link](s -> [Link](s));
Level: Prime | Topic: Java 8
Q35. What is Spring Framework and why is it used?
Answer: Lightweight Java framework for enterprise apps. Core: IoC (Inversion of Control) and DI (Dependency
Injection). Modules: Spring MVC (web), Spring Boot (auto-configuration), Spring Data (DB), Spring Security.
Level: Digital | Topic: Java Framework
Python (Q36–Q50)
Q36. What are Python's key features?
Answer: Interpreted, dynamically typed, high-level, multi-paradigm (OOP + functional), extensive standard library,
readable syntax, cross-platform, used in web, AI, data science, automation.
Level: Ninja | Topic: Python Basics
Q37. What is the difference between a list and a tuple?
Answer: List: mutable (can change), uses [], can add/remove elements. Tuple: immutable (cannot change), uses (),
faster, hashable so can be dict key. Use tuple for fixed data.
Level: Ninja | Topic: Python
Q38. What is a dictionary in Python?
Answer: Key-value data structure (hash map). Keys must be unique and hashable. Created with {} or dict(). O(1)
average for get/set. Ordered since Python 3.7.
Level: Ninja | Topic: Python
Q39. What are *args and **kwargs?
Answer: *args allows passing variable number of positional arguments as tuple. **kwargs allows variable keyword
arguments as dict. Example: def func(*args, **kwargs).
Level: Ninja | Topic: Python
Q40. What is a decorator in Python?
Answer: A function that takes another function as argument and extends its behavior without modifying it. Uses
@syntax. Common examples: @staticmethod, @classmethod, @property, @login_required.
Level: Prime | Topic: Python Advanced
Q41. What is list comprehension?
Answer: Concise way to create lists. Syntax: [expression for item in iterable if condition]. Example: squares = [x**2
for x in range(10) if x%2==0]. Faster than for loop.
Level: Ninja | Topic: Python
Q42. What is the difference between deep copy and shallow copy?
Answer: Shallow copy: copies object but nested objects share references ([Link]()). Deep copy: copies object
and all nested objects recursively ([Link]()). Changes to deep copy don't affect original.
Level: Prime | Topic: Python
Q43. What are Python generators?
Answer: Functions that return an iterator using 'yield' keyword. Lazy evaluation — values generated on demand.
Memory efficient for large datasets. Example: def gen(): yield 1; yield 2.
Level: Prime | Topic: Python Advanced
Q44. What is the GIL in Python?
Answer: Global Interpreter Lock — mutex that allows only one thread to execute Python bytecode at a time.
Prevents true multi-threading for CPU-bound tasks. Use multiprocessing for CPU tasks.
Level: Prime | Topic: Python Advanced
Q45. What are Python's built-in data types?
Answer: Numeric: int, float, complex. Sequence: list, tuple, range, str. Mapping: dict. Set: set, frozenset. Boolean:
bool. Binary: bytes, bytearray, memoryview. None type.
Level: Ninja | Topic: Python Basics
Q46. Explain OOP in Python with an example.
Answer: Python supports encapsulation, inheritance, polymorphism, abstraction. class Animal: def __init__(self): ...
class Dog(Animal): def speak(self): return 'Woof'
Level: Ninja | Topic: Python OOP
Q47. What is Pandas and NumPy used for?
Answer: NumPy: numerical computing, n-dimensional arrays, mathematical functions. Pandas: data manipulation,
DataFrame/Series structures, data cleaning, CSV/Excel handling. Both essential for data science.
Level: Prime | Topic: Python DS
Q48. What is exception handling in Python?
Answer: try-except-else-finally blocks. try: risky code. except ExceptionType: handle error. else: runs if no
exception. finally: always runs. raise keyword to throw exceptions.
Level: Ninja | Topic: Python
Q49. What is PIP and virtual environment?
Answer: PIP: package installer for Python (pip install package). Virtual environment: isolated Python environment
per project using venv or conda. Prevents package version conflicts between projects.
Level: Ninja | Topic: Python Tools
Q50. What are Python's file handling modes?
Answer: 'r': read, 'w': write (overwrites), 'a': append, 'rb'/'wb': binary mode, 'r+': read and write. Use with statement
for automatic file closing: with open('[Link]','r') as f:
Level: Ninja | Topic: Python
SECTION 2: DBMS & SQL (Q51 – Q90)
Database Concepts (Q51–Q68)
Q51. What is a DBMS and why is it used?
Answer: Database Management System — software to create, store, retrieve, update data efficiently. Advantages:
data integrity, security, concurrency control, backup/recovery, reduced redundancy.
Level: Ninja | Topic: DBMS
Q52. What is the difference between DBMS and RDBMS?
Answer: DBMS stores data as files without strict relationships. RDBMS stores data in tables with defined
relationships and follows ACID properties. Examples: MySQL, PostgreSQL, Oracle are RDBMS.
Level: Ninja | Topic: DBMS
Q53. What are ACID properties?
Answer: Atomicity (all or nothing), Consistency (data remains valid), Isolation (transactions don't interfere),
Durability (committed data persists even after failure). Ensures reliable DB transactions.
Level: Prime | Topic: DBMS
Q54. What is normalization? Explain 1NF, 2NF, 3NF.
Answer: Process to reduce redundancy. 1NF: atomic values, no repeating groups. 2NF: 1NF + no partial
dependency. 3NF: 2NF + no transitive dependency. BCNF is stricter form of 3NF.
Level: Prime | Topic: DBMS
Q55. What is a primary key vs foreign key?
Answer: Primary key: uniquely identifies each row in a table, cannot be null. Foreign key: column in one table
referencing primary key of another table, enforces referential integrity.
Level: Ninja | Topic: DBMS
Q56. What are the types of keys in DBMS?
Answer: Primary key, Foreign key, Candidate key (minimal superkey), Super key (set of attributes uniquely
identifying row), Composite key (multiple columns), Alternate key (candidate keys not chosen as primary).
Level: Ninja | Topic: DBMS
Q57. What is an ER diagram?
Answer: Entity-Relationship diagram — visual representation of entities (tables), their attributes (columns), and
relationships (one-to-one, one-to-many, many-to-many) in a database.
Level: Ninja | Topic: DBMS
Q58. What is a transaction in DBMS?
Answer: A sequence of database operations treated as a single unit. Either all operations succeed (commit) or all
fail (rollback). Follows ACID properties. Commands: BEGIN, COMMIT, ROLLBACK.
Level: Prime | Topic: DBMS
Q59. What is indexing in databases?
Answer: Data structure that speeds up data retrieval without scanning entire table. Types: clustered (changes
physical order of data), non-clustered (separate structure). Trade-off: faster reads, slower writes.
Level: Prime | Topic: DBMS
Q60. What is the difference between clustered and non-clustered index?
Answer: Clustered: physically reorders data rows, only one per table, faster range queries. Non-clustered: separate
structure pointing to data, multiple allowed per table, stores copy of indexed columns.
Level: Prime | Topic: Indexing
Q61. What is a view in SQL?
Answer: A virtual table based on a SELECT query. Doesn't store data physically. Used for security (hiding
columns), simplifying complex queries, and data abstraction. Created with CREATE VIEW.
Level: Prime | Topic: SQL
Q62. What is a stored procedure?
Answer: Precompiled SQL code stored in database that can be reused. Accepts parameters, returns results. Faster
than raw SQL (compiled once). CREATE PROCEDURE proc_name AS BEGIN...END.
Level: Prime | Topic: SQL
Q63. What are triggers in SQL?
Answer: Automatic procedures that execute in response to INSERT, UPDATE, or DELETE events on a table.
Types: BEFORE/AFTER triggers. Used for auditing, validation, maintaining derived data.
Level: Prime | Topic: SQL
Q64. What is the difference between DELETE, TRUNCATE, and DROP?
Answer: DELETE: removes specific rows, can rollback, fires triggers, WHERE clause allowed. TRUNCATE:
removes all rows, faster, no WHERE clause, auto-commit. DROP: removes entire table structure and data
permanently.
Level: Ninja | Topic: SQL
Q65. What is denormalization?
Answer: Intentionally introducing redundancy for performance improvement. Reduces complex JOIN operations by
combining tables. Trade-off: better read performance but more storage and update anomalies.
Level: Prime | Topic: DBMS
Q66. What is a deadlock in DBMS?
Answer: Situation where two or more transactions are waiting for each other to release locks, resulting in none
progressing. Prevention: timeout, deadlock detection algorithms, resource ordering.
Level: Prime | Topic: DBMS
Q67. What is concurrency control?
Answer: Techniques to manage simultaneous transaction execution ensuring data consistency. Methods: locking
(shared/exclusive), timestamp ordering, MVCC (Multi-Version Concurrency Control).
Level: Digital | Topic: DBMS
Q68. What is the difference between OLTP and OLAP?
Answer: OLTP (Online Transaction Processing): handles day-to-day transactions, many short queries, high
concurrency (MySQL, PostgreSQL). OLAP (Online Analytical Processing): complex queries on large data for
analytics (data warehouses).
Level: Prime | Topic: DBMS
SQL Queries (Q69–Q90)
Q69. What are the types of SQL commands?
Answer: DDL (CREATE, ALTER, DROP, TRUNCATE): defines schema. DML (INSERT, UPDATE, DELETE):
manipulates data. DQL (SELECT): queries data. DCL (GRANT, REVOKE): permissions. TCL (COMMIT,
ROLLBACK): transactions.
Level: Ninja | Topic: SQL
Q70. Explain different types of JOINs in SQL.
Answer: INNER JOIN: matching rows in both tables. LEFT JOIN: all left rows + matching right. RIGHT JOIN: all
right rows + matching left. FULL OUTER JOIN: all rows from both. CROSS JOIN: cartesian product. SELF JOIN:
table joined with itself.
Level: Ninja | Topic: SQL Joins
Q71. What is the difference between WHERE and HAVING?
Answer: WHERE filters rows before grouping (cannot use aggregate functions). HAVING filters after GROUP BY
(can use aggregates like COUNT, SUM). WHERE is faster as it filters early.
Level: Ninja | Topic: SQL
Q72. What is a subquery? Give an example.
Answer: A query nested inside another query. Example: SELECT name FROM emp WHERE salary > (SELECT
AVG(salary) FROM emp); Correlated subquery: references outer query column in each row iteration.
Level: Prime | Topic: SQL
Q73. What is the difference between UNION and UNION ALL?
Answer: UNION: combines results of two SELECTs and removes duplicate rows. UNION ALL: combines results
including duplicates, faster. Both require same number of columns with compatible data types.
Level: Ninja | Topic: SQL
Q74. Write a SQL query to find the second highest salary.
Answer: SELECT MAX(salary) FROM emp WHERE salary < (SELECT MAX(salary) FROM emp); OR SELECT
salary FROM emp ORDER BY salary DESC LIMIT 1 OFFSET 1;
Level: Prime | Topic: SQL Query
Q75. What is GROUP BY in SQL?
Answer: Groups rows with same values into summary rows. Used with aggregate functions (COUNT, SUM, AVG,
MIN, MAX). Example: SELECT dept, COUNT(*) FROM emp GROUP BY dept;
Level: Ninja | Topic: SQL
Q76. What are aggregate functions in SQL?
Answer: Functions that perform calculations on a set of values: COUNT(*) - count rows, SUM(col) - total, AVG(col) -
average, MIN(col) - minimum, MAX(col) - maximum. Used with GROUP BY.
Level: Ninja | Topic: SQL
Q77. What is an index and how to create one?
Answer: CREATE INDEX idx_name ON table(column); Speeds up SELECT queries. DROP INDEX to remove.
Composite index on multiple columns. Unique index enforces uniqueness: CREATE UNIQUE INDEX.
Level: Prime | Topic: SQL
Q78. What is a self join? Give example.
Answer: Joining a table with itself. Example: Find employees and their managers: SELECT [Link], [Link] AS
manager FROM emp e JOIN emp m ON e.manager_id = m.emp_id;
Level: Prime | Topic: SQL Joins
Q79. Write SQL to find duplicate records in a table.
Answer: SELECT column, COUNT(*) as cnt FROM table GROUP BY column HAVING COUNT(*) > 1; This finds
values appearing more than once.
Level: Prime | Topic: SQL Query
Q80. What is the CASE statement in SQL?
Answer: Conditional logic in SQL. SELECT name, CASE WHEN salary>50000 THEN 'High' WHEN salary>30000
THEN 'Medium' ELSE 'Low' END AS salary_band FROM emp;
Level: Prime | Topic: SQL
Q81. What is the difference between CHAR and VARCHAR?
Answer: CHAR(n): fixed length, pads with spaces, faster for fixed-size data. VARCHAR(n): variable length, stores
only actual characters + 1-2 bytes overhead, more efficient for variable data.
Level: Ninja | Topic: SQL
Q82. What is a CTE (Common Table Expression)?
Answer: Temporary named result set defined using WITH clause. WITH cte AS (SELECT ...) SELECT * FROM cte
WHERE ...; Improves readability, can be recursive for hierarchical data.
Level: Digital | Topic: SQL Advanced
Q83. What is the ROW_NUMBER() function?
Answer: Window function assigning sequential integers to rows. SELECT name, ROW_NUMBER() OVER
(PARTITION BY dept ORDER BY salary DESC) as rank FROM emp; Used for ranking within groups.
Level: Digital | Topic: SQL Window
Q84. Difference between RANK(), DENSE_RANK(), ROW_NUMBER()?
Answer: ROW_NUMBER(): unique sequential number, no ties. RANK(): same rank for ties, gaps after tied ranks
(1,1,3). DENSE_RANK(): same rank for ties, no gaps (1,1,2). All are window functions.
Level: Digital | Topic: SQL Window
Q85. What is a foreign key constraint?
Answer: Ensures referential integrity. A column value must match a value in the referenced primary key column.
ON DELETE CASCADE deletes child rows when parent deleted. ON UPDATE CASCADE propagates updates.
Level: Prime | Topic: SQL
Q86. What is the difference between IN and EXISTS?
Answer: IN: checks if value exists in a list/subquery result set. EXISTS: returns true if subquery returns any rows.
EXISTS is faster for large datasets (stops at first match); IN evaluates entire subquery.
Level: Prime | Topic: SQL
Q87. What are NULL values in SQL and how to handle them?
Answer: NULL represents missing/unknown data. Not equal to anything, including itself. Use IS NULL / IS NOT
NULL to check. COALESCE(col, default) returns first non-null value. NULLIF(a,b) returns NULL if a=b.
Level: Ninja | Topic: SQL
Q88. Write SQL to get the 3rd highest salary without using LIMIT/TOP.
Answer: SELECT MIN(salary) FROM (SELECT DISTINCT salary FROM emp ORDER BY salary DESC LIMIT 3)
temp; Or use: SELECT salary FROM emp e1 WHERE 2 = (SELECT COUNT(DISTINCT salary) FROM emp e2
WHERE [Link] > [Link]);
Level: Digital | Topic: SQL Query
Q89. What is a materialized view?
Answer: Like a view but physically stores query results on disk. Needs periodic refresh (REFRESH
MATERIALIZED VIEW). Faster query performance but may show stale data. Used in data warehousing.
Level: Digital | Topic: SQL Advanced
Q90. Explain ACID in context of a bank transfer.
Answer: Transfer Rs.1000 from A to B: Atomicity (both debit+credit happen or neither), Consistency (total money
unchanged), Isolation (concurrent transfers don't interfere), Durability (after commit, survives crash).
Level: Prime | Topic: DBMS
SECTION 3: Object-Oriented Programming (Q91 – Q120)
Core OOP Concepts (Q91–Q120)
Q91. What are the four pillars of OOP?
Answer: Encapsulation (binding data + methods, hiding internal state), Inheritance (child class inherits parent),
Polymorphism (same interface, different implementations), Abstraction (hiding complexity, showing essentials).
Level: Ninja | Topic: OOP
Q92. What is encapsulation?
Answer: Bundling data (attributes) and methods that operate on data in a single unit (class). Access modifiers
(private, protected, public) control visibility. Use getters/setters for controlled access.
Level: Ninja | Topic: OOP
Q93. What is inheritance and its types?
Answer: Mechanism where a child class acquires properties of parent class. Types: Single (A->B), Multiple (A,B->C
— Java uses interfaces), Multilevel (A->B->C), Hierarchical (A->B, A->C), Hybrid.
Level: Ninja | Topic: OOP
Q94. What is polymorphism? Explain types.
Answer: Compile-time (static) polymorphism: method overloading (same name, different parameters). Runtime
(dynamic) polymorphism: method overriding (redefining parent method in child). Both allow 'one interface, many
forms'.
Level: Ninja | Topic: OOP
Q95. What is the difference between method overloading and overriding?
Answer: Overloading: same method name, different signature (compile-time polymorphism). Overriding: same
signature in child class replacing parent's method (runtime polymorphism). Overriding requires inheritance.
Level: Ninja | Topic: OOP
Q96. What is abstraction?
Answer: Hiding implementation details and showing only functionality. Achieved via abstract classes (partial
abstraction) and interfaces (full abstraction). User interacts with interface without knowing internals.
Level: Ninja | Topic: OOP
Q97. What is the difference between abstract class and interface? (OOP)
Answer: Abstract class: can have state, concrete methods, constructors; single inheritance. Interface: no state
(Java 8+ has default methods), no constructors; multiple inheritance supported. Use interface for contracts.
Level: Prime | Topic: OOP
Q98. What is a constructor and its types?
Answer: Special method called on object creation for initialization. Types: Default constructor (no params,
auto-created if none defined), Parameterized constructor (accepts arguments), Copy constructor (creates copy of
object).
Level: Ninja | Topic: OOP
Q99. What is method hiding vs method overriding?
Answer: Method overriding: non-static method in child class with same signature — runtime polymorphism via
virtual dispatch. Method hiding: static method in child with same name — resolved at compile time.
Level: Digital | Topic: OOP
Q100. What is the 'this' keyword?
Answer: Reference to the current object inside a method or constructor. Used to resolve naming conflicts between
parameters and instance variables, call another constructor (this()), or pass current object.
Level: Ninja | Topic: OOP
Q101. What is the 'super' keyword?
Answer: Used in child class to refer to parent class. super() calls parent constructor, [Link]() calls parent
method, [Link] accesses parent variable. Must be first statement in constructor.
Level: Ninja | Topic: OOP
Q102. What is a static method vs instance method?
Answer: Static method: belongs to class, called via [Link](), no access to 'this', loaded once. Instance
method: belongs to object, requires object creation, can access instance variables.
Level: Ninja | Topic: OOP
Q103. What is final keyword in Java/C++?
Answer: Java: final class (cannot be inherited), final method (cannot be overridden), final variable (constant). C++:
final class/method (C++11). const in C++ for variables.
Level: Ninja | Topic: OOP
Q104. What is coupling and cohesion?
Answer: Coupling: degree of dependency between modules (aim for loose coupling). Cohesion: degree of
relatedness within a module (aim for high cohesion). Good design = low coupling + high cohesion.
Level: Prime | Topic: OOP Design
Q105. What are design patterns? Name some.
Answer: Reusable solutions to common problems. Creational: Singleton, Factory, Builder. Structural: Adapter,
Decorator, Proxy, Facade. Behavioral: Observer, Strategy, Command, Iterator.
Level: Digital | Topic: Design Patterns
Q106. What is Singleton pattern?
Answer: Ensures only one instance of a class exists. Private constructor, static instance variable, public static
getInstance() method. Used for logging, database connections, configuration.
Level: Prime | Topic: Design Patterns
Q107. What is Factory pattern?
Answer: Creates objects without specifying exact class to create. A factory method in an interface/abstract class,
concrete classes implement it. Decouples object creation from usage.
Level: Prime | Topic: Design Patterns
Q108. What is SOLID principles?
Answer: S: Single Responsibility. O: Open/Closed (open for extension, closed for modification). L: Liskov
Substitution. I: Interface Segregation. D: Dependency Inversion. Guidelines for maintainable OOP design.
Level: Digital | Topic: OOP Design
Q109. What is multiple inheritance and the diamond problem?
Answer: Diamond problem: class D inherits from B and C which both inherit from A — ambiguity in which A's
method to call. Java solves by not allowing multiple class inheritance (use interfaces instead).
Level: Prime | Topic: OOP
Q110. What is the difference between composition and inheritance?
Answer: Inheritance: 'is-a' relationship (Dog is an Animal). Composition: 'has-a' relationship (Car has an Engine).
Composition is preferred for flexibility — change behavior at runtime; inheritance is static.
Level: Prime | Topic: OOP Design
Q111. What is an inner class?
Answer: Class defined inside another class. Types: Static nested class, Inner class (non-static), Local class (inside
method), Anonymous class (no name). Inner class has access to outer class members.
Level: Prime | Topic: Java OOP
Q112. What is garbage collection's role in OOP?
Answer: Automatically reclaims memory from objects no longer referenced. In Java: GC handles this. In C++:
manual delete or RAII/smart pointers. Python: reference counting + cyclic GC.
Level: Prime | Topic: Memory Management
Q113. What is upcasting and downcasting?
Answer: Upcasting: converting child object to parent type (implicit, safe). Downcasting: converting parent reference
back to child type (explicit, may throw ClassCastException — use instanceof check first).
Level: Prime | Topic: OOP
Q114. What is method chaining?
Answer: Calling multiple methods on same object in a single statement. Each method returns 'this' (current object).
Example: [Link]('A').setAge(25).build(); Common in Builder pattern.
Level: Prime | Topic: OOP
Q115. What is the Observer pattern?
Answer: Defines one-to-many dependency — when one object (Subject) changes state, all its dependents
(Observers) are notified and updated automatically. Used in event handling, MVC architecture.
Level: Digital | Topic: Design Patterns
Q116. What is an abstract class with example?
Answer: Class with at least one abstract method, cannot be instantiated. abstract class Shape { abstract double
area(); } class Circle extends Shape { double area() { return [Link]*r*r; } }
Level: Ninja | Topic: OOP
Q117. What is a marker interface?
Answer: Interface with no methods, used to mark a class for special behavior. Examples in Java: Serializable,
Cloneable, Remote. JVM/framework checks instanceof to apply special handling.
Level: Prime | Topic: Java
Q118. What is object cloning?
Answer: Creating a copy of an existing object. In Java: implement Cloneable, override clone() method. Shallow
clone: copies object but shares references. Deep clone: copies all nested objects too.
Level: Prime | Topic: OOP
Q119. Difference between checked and unchecked exceptions in OOP context?
Answer: Checked: must be declared in method signature or handled (IOException, SQLException) — enforced at
compile time. Unchecked: RuntimeException subclasses (NullPointerException, ArrayIndexOutOfBounds) —
optional handling.
Level: Prime | Topic: Exception Handling
Q120. What is the difference between early binding and late binding?
Answer: Early binding (static): method call resolved at compile time (overloading, static methods). Late binding
(dynamic): method call resolved at runtime via virtual dispatch (overriding). Late binding enables polymorphism.
Level: Digital | Topic: OOP
SECTION 4: Operating Systems & Computer Networks (Q121 – Q160)
Operating Systems (Q121–Q140)
Q121. What is an operating system and its functions?
Answer: Software that manages hardware and software resources. Functions: process management, memory
management, file system management, I/O management, security, networking, user interface.
Level: Ninja | Topic: OS
Q122. What is a process vs thread?
Answer: Process: independent program in execution with its own memory space. Thread: lightweight unit within a
process sharing the same memory space. Thread creation faster; context switch cheaper than process.
Level: Ninja | Topic: OS
Q123. What is context switching?
Answer: OS saving state of current process/thread and loading state of next one. State saved in PCB (Process
Control Block). Overhead due to cache misses. Needed for multitasking.
Level: Prime | Topic: OS
Q124. What is deadlock? What are its four conditions?
Answer: Deadlock: processes waiting for each other indefinitely. Four conditions (Coffman): Mutual exclusion, Hold
and wait, No preemption, Circular wait. All must hold for deadlock. Remove any one to prevent.
Level: Prime | Topic: OS
Q125. What is paging and segmentation?
Answer: Paging: divides memory into fixed-size pages (physical) mapped to frames; eliminates external
fragmentation. Segmentation: divides into variable-size logical segments (code, data, stack); may cause external
fragmentation.
Level: Prime | Topic: OS Memory
Q126. What is virtual memory?
Answer: Technique allowing processes to use more memory than physically available by using disk (swap space)
as extension of RAM. Uses demand paging — load pages only when needed (page fault triggers loading).
Level: Prime | Topic: OS Memory
Q127. What are the CPU scheduling algorithms?
Answer: FCFS (non-preemptive, convoy effect), SJF (shortest job first, may starve), Round Robin (time quantum,
fair), Priority Scheduling (higher priority first), Multilevel Queue, MLFQ (adaptive).
Level: Prime | Topic: OS Scheduling
Q128. What is thrashing?
Answer: When CPU spends more time swapping pages than executing processes — too many processes, not
enough physical memory for working sets. Solution: reduce multiprogramming, increase RAM, use working set
model.
Level: Digital | Topic: OS Memory
Q129. What is the difference between preemptive and non-preemptive scheduling?
Answer: Preemptive: OS can interrupt running process to give CPU to another (Round Robin, Priority preemptive).
Non-preemptive: process runs until it voluntarily gives up CPU (FCFS, SJF non-preemptive).
Level: Prime | Topic: OS
Q130. What is semaphore?
Answer: Synchronization tool to control access to shared resources. Binary semaphore (0 or 1, like mutex).
Counting semaphore (track multiple instances). Operations: wait()/P() decrements, signal()/V() increments.
Level: Prime | Topic: OS Sync
Q131. What is a mutex?
Answer: Mutual exclusion lock — ensures only one thread accesses critical section at a time. Unlike semaphore,
only the thread that locked it can unlock it. Used to prevent race conditions.
Level: Prime | Topic: OS Sync
Q132. What is the difference between monolithic and microkernel?
Answer: Monolithic kernel: all OS services (memory, file, drivers) run in kernel space — fast but large, harder to
maintain (Linux, Unix). Microkernel: minimal kernel, services in user space — more stable, slower (Mach).
Level: Digital | Topic: OS Architecture
Q133. Explain page replacement algorithms.
Answer: FIFO: replace oldest page (Belady's anomaly). LRU: replace least recently used (good performance).
Optimal: replace page not needed for longest future time (theoretical). Clock (Second Chance): approximates LRU.
Level: Prime | Topic: OS Memory
Q134. What is the banker's algorithm?
Answer: Deadlock avoidance algorithm by Dijkstra. Simulates resource allocation to check if system stays in safe
state before granting request. Uses available, allocation, and max matrices.
Level: Digital | Topic: OS
Q135. What is inter-process communication (IPC)?
Answer: Mechanisms for processes to exchange data: Shared memory (fast, need sync), Message passing
(send/receive), Pipes (unidirectional), Named pipes, Sockets, Signals, Semaphores.
Level: Prime | Topic: OS IPC
Q136. What is a system call?
Answer: Interface between user program and OS. When process needs OS service, it makes a system call (e.g.,
read(), write(), fork(), exec()). Switches from user mode to kernel mode.
Level: Prime | Topic: OS
Q137. What is the difference between process states?
Answer: New: being created. Ready: waiting for CPU. Running: currently executing. Blocked/Waiting: waiting for
I/O or event. Terminated: finished execution. Transitions managed by OS scheduler.
Level: Ninja | Topic: OS
Q138. What is a file system?
Answer: Organizes and stores data on storage devices. Components: directory structure, metadata (inodes), file
allocation (contiguous, linked, indexed). Examples: NTFS (Windows), ext4 (Linux), APFS (macOS).
Level: Prime | Topic: OS
Q139. What is the difference between internal and external fragmentation?
Answer: Internal: allocated memory larger than requested (wasted space inside block) — caused by fixed
partitions. External: free memory exists but scattered in non-contiguous chunks — caused by variable-size
allocation.
Level: Prime | Topic: OS Memory
Q140. What is a kernel and its role?
Answer: Core of OS, always in memory. Manages CPU, memory, device drivers, system calls. Types: Monolithic,
Microkernel, Hybrid, Exokernel. Operates in privileged mode (kernel mode vs user mode).
Level: Ninja | Topic: OS
Computer Networks (Q141–Q160)
Q141. What are the 7 layers of the OSI model?
Answer: [Link] (bits, cables), [Link] Link (frames, MAC, switches), [Link] (packets, IP, routers),
[Link] (segments, TCP/UDP, ports), [Link], [Link] (encryption, encoding), [Link] (HTTP,
FTP, DNS).
Level: Ninja | Topic: Networks
Q142. What is the difference between TCP and UDP?
Answer: TCP: connection-oriented, reliable, ordered delivery, error checking, flow control (HTTP, FTP, email).
UDP: connectionless, unreliable, no ordering, faster, lower overhead (video streaming, DNS, gaming).
Level: Ninja | Topic: Networks
Q143. What is the three-way handshake in TCP?
Answer: Connection establishment: [Link] sends SYN. [Link] responds SYN-ACK. [Link] sends ACK.
Connection now established. Closing uses four-way: FIN, ACK, FIN, ACK.
Level: Ninja | Topic: TCP/IP
Q144. What is IP addressing? Difference between IPv4 and IPv6.
Answer: IPv4: 32-bit, 4 billion addresses (e.g., [Link]), nearly exhausted. IPv6: 128-bit, ~3.4x10^38
addresses, hexadecimal (e.g., 2001:db8::1), supports auto-configuration, no NAT needed.
Level: Ninja | Topic: Networks
Q145. What is subnetting and CIDR?
Answer: Subnetting: dividing network into smaller subnets using subnet mask. CIDR (Classless Inter-Domain
Routing): IP/prefix notation ([Link]/24 means first 24 bits are network, 8 bits for hosts = 254 hosts).
Level: Prime | Topic: Networks
Q146. What is the difference between a hub, switch, and router?
Answer: Hub: broadcasts to all ports (Layer 1). Switch: forwards to specific port using MAC table (Layer 2). Router:
connects different networks using IP routing table, determines best path (Layer 3).
Level: Ninja | Topic: Networks
Q147. What is DNS? How does it work?
Answer: Domain Name System — translates domain names to IP addresses. Process: browser checks cache ->
OS cache -> DNS resolver -> Root nameserver -> TLD server -> Authoritative nameserver -> returns IP.
Level: Ninja | Topic: Networks
Q148. What is HTTP vs HTTPS?
Answer: HTTP: HyperText Transfer Protocol, unencrypted, port 80. HTTPS: HTTP + TLS/SSL encryption, port 443.
HTTPS prevents eavesdropping, man-in-the-middle attacks. Uses certificates for authentication.
Level: Ninja | Topic: Networks
Q149. What is a firewall?
Answer: Network security device (hardware or software) that monitors and controls incoming/outgoing traffic based
on defined rules. Types: packet filtering, stateful inspection, application layer, next-generation firewall.
Level: Ninja | Topic: Network Security
Q150. What is NAT (Network Address Translation)?
Answer: Maps private IP addresses to public IPs for internet access. Allows many devices to share one public IP.
Types: Static NAT (1:1), Dynamic NAT (pool), PAT/Overload (port-based, most common).
Level: Prime | Topic: Networks
Q151. What is ARP and its working?
Answer: Address Resolution Protocol — maps IP address to MAC address within a local network. Device
broadcasts ARP request, target device replies with its MAC. Result cached in ARP table for future use.
Level: Prime | Topic: Networks
Q152. What is the difference between TCP/IP model and OSI model?
Answer: OSI: 7 layers (theoretical reference). TCP/IP: 4 layers (Application, Transport, Internet, Network Access)
— practical implementation. TCP/IP Application = OSI Application+Presentation+Session. TCP/IP Network Access
= OSI Physical+Data Link.
Level: Ninja | Topic: Networks
Q153. What is a VPN?
Answer: Virtual Private Network — creates encrypted tunnel over public internet for secure remote access. Hides
real IP, encrypts traffic. Types: site-to-site VPN (connects networks), remote access VPN (user to network).
Level: Prime | Topic: Network Security
Q154. What is DHCP?
Answer: Dynamic Host Configuration Protocol — automatically assigns IP addresses to devices. Process (DORA):
Discover (broadcast), Offer (server), Request (client), Acknowledge (server). Uses UDP ports 67/68.
Level: Prime | Topic: Networks
Q155. What is the difference between unicast, multicast, and broadcast?
Answer: Unicast: one sender to one receiver. Multicast: one sender to group of subscribed receivers (IPTV).
Broadcast: one sender to all devices on network segment. IPv6 uses anycast (nearest receiver) instead of
broadcast.
Level: Prime | Topic: Networks
Q156. What is HTTPS and SSL/TLS handshake?
Answer: [Link] Hello (supported cipher suites). [Link] Hello + certificate. [Link] verifies cert, generates
pre-master secret, encrypts with server's public key. [Link] derive session keys. [Link] communication
begins.
Level: Digital | Topic: Network Security
Q157. What is a CDN (Content Delivery Network)?
Answer: Distributed network of servers delivering web content from location closest to user. Reduces latency,
improves load times, reduces origin server load. Caches static content (images, CSS, JS).
Level: Digital | Topic: Networks
Q158. What is the difference between symmetric and asymmetric encryption?
Answer: Symmetric: same key for encryption/decryption (AES, DES) — fast but key distribution problem.
Asymmetric: public key encrypts, private key decrypts (RSA, ECC) — slower but solves key distribution.
Level: Prime | Topic: Security
Q159. What is socket programming?
Answer: API for network communication. Socket = endpoint for communication. Steps: create socket -> bind
(server) -> listen/connect -> accept/connect -> send/receive -> close. Uses TCP or UDP.
Level: Digital | Topic: Networks
Q160. What is load balancing?
Answer: Distributing network traffic across multiple servers to ensure no single server is overwhelmed. Algorithms:
Round Robin, Least Connections, IP Hash, Weighted. Ensures high availability and scalability.
Level: Digital | Topic: System Design
SECTION 5: Data Structures & Algorithms (Q161 – Q210)
Data Structures (Q161–Q185)
Q161. What is the time complexity of common operations?
Answer: Array: access O(1), search O(n), insert O(n). LinkedList: access O(n), insert O(1). HashMap: O(1) avg.
BST: O(log n) avg. Sorting: O(n log n) for merge/quick sort. Binary search: O(log n).
Level: Prime | Topic: DSA
Q162. What is the difference between array and linked list?
Answer: Array: contiguous memory, O(1) access, O(n) insert/delete, fixed size (static), cache-friendly. Linked List:
non-contiguous, O(n) access, O(1) insert/delete at known node, dynamic size.
Level: Ninja | Topic: DSA
Q163. What is a stack and its applications?
Answer: LIFO data structure (Last In First Out). Operations: push, pop, peek — all O(1). Applications: function call
stack, expression evaluation, undo/redo, browser history, syntax checking (parentheses).
Level: Ninja | Topic: DSA
Q164. What is a queue and its types?
Answer: FIFO data structure. Types: Simple Queue, Circular Queue (avoids wasted space), Deque (double-ended),
Priority Queue (highest priority first). Applications: BFS, task scheduling, printer queue.
Level: Ninja | Topic: DSA
Q165. What is a binary tree?
Answer: Tree where each node has at most two children (left, right). Types: Full BT (all nodes have 0 or 2 children),
Complete BT (all levels filled except last), Perfect BT (all leaf nodes at same level).
Level: Ninja | Topic: DSA
Q166. What is a Binary Search Tree (BST)?
Answer: Binary tree where left child < parent < right child. Search/Insert/Delete: O(log n) average, O(n) worst
(skewed). Inorder traversal gives sorted sequence. Used in databases, symbol tables.
Level: Prime | Topic: DSA
Q167. What is tree traversal? Explain types.
Answer: Inorder (Left-Root-Right): gives sorted BST. Preorder (Root-Left-Right): copy/expression trees. Postorder
(Left-Right-Root): delete tree. Level-order (BFS): uses queue. DFS uses stack/recursion.
Level: Ninja | Topic: DSA
Q168. What is a hash table? Explain collision resolution.
Answer: Data structure for O(1) average key-value lookups using hash function. Collisions resolved by: Chaining
(linked list at each bucket) or Open Addressing (linear probing, quadratic probing, double hashing).
Level: Prime | Topic: DSA
Q169. What is a heap?
Answer: Complete binary tree. Max-heap: parent >= children. Min-heap: parent <= children. Implemented as array.
Used in priority queues, heap sort, Dijkstra's algorithm. Insert/delete: O(log n). Build: O(n).
Level: Prime | Topic: DSA
Q170. What is a graph? Explain representation.
Answer: Collection of vertices (nodes) and edges. Directed vs Undirected. Representations: Adjacency Matrix
(O(V^2) space, O(1) edge check), Adjacency List (O(V+E) space, better for sparse graphs).
Level: Prime | Topic: DSA
Q171. What is BFS vs DFS?
Answer: BFS (Breadth-First Search): explores level by level, uses queue, O(V+E), finds shortest path in
unweighted graph. DFS (Depth-First Search): explores as deep as possible, uses stack/recursion, detects cycles.
Level: Prime | Topic: DSA
Q172. What is a dynamic array?
Answer: Array that resizes automatically when full. Python list, Java ArrayList use this. When full, creates new array
(typically 2x size), copies elements — amortized O(1) for append. Occasional O(n) resize.
Level: Ninja | Topic: DSA
Q173. What is a trie (prefix tree)?
Answer: Tree data structure for storing strings. Each node represents a character. Path from root to node
represents a prefix/string. Used in autocomplete, spell check, IP routing. Search/insert O(L) where L=length.
Level: Digital | Topic: DSA
Q174. What is a segment tree?
Answer: Binary tree for range queries and point updates. Build O(n), query/update O(log n). Used for range sum,
range minimum/maximum queries. Useful in competitive programming.
Level: Digital | Topic: DSA
Q175. What is a doubly linked list vs singly linked list?
Answer: Singly: each node has data + next pointer. Doubly: each node has data + next + prev pointer. Doubly
allows backward traversal and O(1) deletion with node reference. Uses more memory.
Level: Ninja | Topic: DSA
Q176. What is a balanced BST? Name types.
Answer: BST with height O(log n) to ensure efficient operations. Types: AVL tree (height-balanced, strict),
Red-Black tree (color-balanced, used in Java TreeMap/TreeSet), B-Tree (used in databases).
Level: Digital | Topic: DSA
Q177. What is the difference between ArrayList and LinkedList in Java?
Answer: ArrayList: backed by dynamic array, O(1) random access, O(n) insert/delete in middle, better for
read-heavy. LinkedList: doubly linked, O(n) access, O(1) insert/delete at known position, better for write-heavy.
Level: Prime | Topic: DSA
Q178. What is memoization vs tabulation?
Answer: Both are dynamic programming techniques. Memoization: top-down, recursive, stores computed results
(lazy evaluation). Tabulation: bottom-up, iterative, fills table from base case (eager evaluation). Tabulation avoids
recursion overhead.
Level: Prime | Topic: DSA
Q179. What is a circular linked list?
Answer: Linked list where last node points to first node. Types: singly circular, doubly circular. Useful for
round-robin scheduling, circular buffer. No null pointer at end.
Level: Prime | Topic: DSA
Q180. What is stack overflow?
Answer: Error when call stack exceeds its limit, usually from infinite/very deep recursion. Each function call adds a
stack frame; when stack memory is exhausted, stack overflow occurs.
Level: Ninja | Topic: DSA
Q181. What is a deque?
Answer: Double-ended queue — elements can be added/removed from both front and rear. Supports all queue and
stack operations. Python: [Link]. Java: ArrayDeque. O(1) for all operations.
Level: Prime | Topic: DSA
Q182. What is a priority queue?
Answer: Abstract data type where each element has a priority; highest priority element dequeued first. Typically
implemented using a min/max heap. Java: PriorityQueue. Used in Dijkstra, Huffman coding.
Level: Prime | Topic: DSA
Q183. What is a sparse matrix and how to represent it efficiently?
Answer: Matrix with most elements as zero. Naive storage wastes memory. Efficient representations: Compressed
Sparse Row (CSR), Coordinate list (COO), Dictionary of Keys (DOK), Linked list.
Level: Digital | Topic: DSA
Q184. Explain LRU Cache design.
Answer: Least Recently Used cache: evicts least recently accessed item when full. Implemented using HashMap +
Doubly Linked List. HashMap for O(1) lookup; DLL for O(1) insertion/deletion of access order.
Level: Digital | Topic: DSA Design
Q185. What is a graph cycle detection algorithm?
Answer: Undirected graph: DFS using visited array, or Union-Find. Directed graph: DFS using three states
(white/gray/black or visited/in-stack/done). Back edge indicates cycle in directed graph.
Level: Digital | Topic: DSA Graph
Algorithms (Q186–Q210)
Q186. What are the common sorting algorithms and their complexities?
Answer: Bubble O(n^2), Selection O(n^2), Insertion O(n^2): simple. Merge Sort O(n log n) stable: divide & conquer.
Quick Sort O(n log n) avg, O(n^2) worst: pivot-based. Heap Sort O(n log n): uses heap.
Level: Prime | Topic: Algorithms
Q187. Explain merge sort algorithm.
Answer: Divide array into halves recursively until single elements, then merge sorted halves. O(n log n) time
always, O(n) extra space. Stable sort. Preferred for linked lists and external sorting.
Level: Prime | Topic: Sorting
Q188. Explain quick sort and its average case.
Answer: Choose pivot, partition array (elements < pivot left, > pivot right), recursively sort partitions. Average O(n
log n), Worst O(n^2) (sorted array with bad pivot). Randomized pivot avoids worst case.
Level: Prime | Topic: Sorting
Q189. What is binary search and its complexity?
Answer: Searches sorted array by repeatedly halving search space. Compare mid element with target: if equal
return; if less, search right half; if greater, search left half. O(log n) time, O(1) space (iterative).
Level: Ninja | Topic: Algorithms
Q190. What is dynamic programming?
Answer: Optimization technique solving problems by breaking into overlapping subproblems, storing results
(memoization/tabulation). Key properties: optimal substructure + overlapping subproblems. Classic: Fibonacci,
knapsack, LCS.
Level: Prime | Topic: DP
Q191. Explain the knapsack problem.
Answer: 0/1 Knapsack: given items with weight and value, maximize value without exceeding capacity. Each item
taken once. DP solution: dp[i][w] = max(exclude item i, include item i). O(n*W) time and space.
Level: Prime | Topic: DP
Q192. What is the longest common subsequence (LCS)?
Answer: Find longest subsequence common to two strings (not necessarily contiguous). DP: dp[i][j] = dp[i-1][j-1]+1
if chars match, else max(dp[i-1][j], dp[i][j-1]). O(m*n) time and space.
Level: Digital | Topic: DP
Q193. What is Dijkstra's algorithm?
Answer: Finds shortest path from source to all vertices in weighted graph (non-negative weights). Uses greedy +
min-heap. O((V+E) log V). Cannot handle negative weights (use Bellman-Ford instead).
Level: Digital | Topic: Graph Algorithms
Q194. What is greedy algorithm? Give example.
Answer: Makes locally optimal choice at each step hoping for global optimum. Not always correct. Examples:
Activity selection, Huffman coding, Prim's/Kruskal's MST. Works when greedy choice property holds.
Level: Prime | Topic: Algorithms
Q195. What is a sliding window technique?
Answer: Maintains a window of elements, slides it across array. Avoids nested loops. Used for: maximum sum
subarray of size k (O(n) vs O(n*k)), longest substring without repeating characters.
Level: Prime | Topic: Algorithms
Q196. What is two-pointer technique?
Answer: Use two pointers traversing array from different ends or same direction. Useful for sorted arrays: pair sum
= target (O(n)), remove duplicates, container with most water. Reduces O(n^2) to O(n).
Level: Prime | Topic: Algorithms
Q197. What is recursion and how to avoid stack overflow?
Answer: Function calling itself with base case. Stack overflow from excessive recursion depth. Solutions: tail
recursion optimization, iterative approach, memoization to reduce calls, increase stack size.
Level: Prime | Topic: Algorithms
Q198. What is backtracking?
Answer: Build solution incrementally, abandoning path (backtrack) when it can't lead to valid solution. Used for:
N-Queens, Sudoku solver, permutations, subset sum. Time: exponential but pruning helps.
Level: Digital | Topic: Algorithms
Q199. What is topological sorting?
Answer: Linear ordering of vertices in DAG (Directed Acyclic Graph) where u comes before v for every edge u->v.
Algorithms: Kahn's (BFS-based, uses in-degree), DFS-based. Used in build systems, task scheduling.
Level: Digital | Topic: Graph Algorithms
Q200. What is Floyd-Warshall algorithm?
Answer: Finds shortest paths between all pairs of vertices. DP: dp[i][j][k] = min(dp[i][j][k-1], dp[i][k][k-1]+dp[k][j][k-1]).
O(V^3) time. Handles negative weights (not negative cycles).
Level: Digital | Topic: Graph Algorithms
Q201. What is a divide and conquer algorithm?
Answer: Solve by dividing into smaller subproblems, solving independently, combining results. Examples: Merge
Sort, Quick Sort, Binary Search, Strassen's matrix multiplication. T(n) = aT(n/b) + f(n).
Level: Prime | Topic: Algorithms
Q202. What is Big O notation?
Answer: Describes upper bound of algorithm's growth rate. O(1): constant. O(log n): logarithmic. O(n): linear. O(n
log n): linearithmic. O(n^2): quadratic. O(2^n): exponential. Ignores constants, lower terms.
Level: Ninja | Topic: Complexity
Q203. What is the difference between best, average, and worst case?
Answer: Best case: most favorable input (already sorted for insertion sort: O(n)). Average case: random input
expected behavior. Worst case: most unfavorable input (sorted for quick sort with first pivot: O(n^2)).
Level: Ninja | Topic: Complexity
Q204. What is a spanning tree and minimum spanning tree?
Answer: Spanning tree: tree containing all vertices with V-1 edges. MST: spanning tree with minimum total edge
weight. Algorithms: Kruskal's (sort edges, use Union-Find), Prim's (greedy, grow from vertex).
Level: Digital | Topic: Graph Algorithms
Q205. What is string matching algorithm?
Answer: KMP (Knuth-Morris-Pratt): O(n+m) using failure function to avoid re-comparison. Rabin-Karp: O(n+m)
average using rolling hash. Boyer-Moore: O(n/m) best case. Naive: O(n*m).
Level: Digital | Topic: String Algorithms
Q206. Explain the coin change problem.
Answer: Find minimum coins to make amount S. DP: dp[i] = min coins for amount i. dp[0]=0, dp[i] =
min(dp[i-coin]+1) for each coin <= i. O(amount * coins). Greedy doesn't always work.
Level: Prime | Topic: DP
Q207. What is the two-sum problem? Solve efficiently.
Answer: Find two numbers in array that sum to target. Naive: O(n^2). Optimal: HashMap — store each number as
key with index as value. For each number, check if (target-number) exists in map. O(n).
Level: Prime | Topic: Algorithms
Q208. What is matrix chain multiplication?
Answer: Find optimal order to multiply matrices minimizing scalar multiplications. DP: dp[i][j] = min cost to multiply
matrices from i to j. O(n^3) time. Classic interval DP problem.
Level: Digital | Topic: DP
Q209. What is Union-Find (Disjoint Set Union)?
Answer: Data structure to track elements in disjoint sets. Operations: Find (which set) and Union (merge sets). With
path compression + union by rank: O(alpha(n)) — nearly constant. Used in Kruskal's MST, cycle detection.
Level: Digital | Topic: DSA
Q210. What is amortized analysis?
Answer: Analysis of average performance over sequence of operations. Even if individual operation is expensive
occasionally, amortized cost may be small. Example: ArrayList append is O(1) amortized despite occasional O(n)
resize.
Level: Digital | Topic: Complexity
SECTION 6: Artificial Intelligence / ML / GenAI (Q211 – Q250)
AI & ML Fundamentals (Q211–Q232)
Q211. What is Artificial Intelligence?
Answer: Simulation of human intelligence in machines — ability to learn, reason, problem-solve, understand
language, perceive. Branches: ML, Deep Learning, NLP, Computer Vision, Robotics.
Level: Ninja | Topic: AI
Q212. What is Machine Learning?
Answer: Subset of AI — systems learn from data to improve performance without being explicitly programmed.
Types: Supervised, Unsupervised, Reinforcement, Semi-supervised, Self-supervised.
Level: Ninja | Topic: ML
Q213. Explain supervised vs unsupervised learning.
Answer: Supervised: labeled training data (input-output pairs). Algorithms: regression, classification. Unsupervised:
no labels, find patterns. Algorithms: clustering (k-means), dimensionality reduction (PCA). Reinforcement:
reward-based.
Level: Ninja | Topic: ML
Q214. What is overfitting and underfitting?
Answer: Overfitting: model memorizes training data, performs poorly on new data (high variance). Underfitting:
model too simple, fails even on training data (high bias). Solutions: regularization, more data, cross-validation.
Level: Prime | Topic: ML
Q215. What is the bias-variance tradeoff?
Answer: Bias: error from wrong assumptions (underfitting). Variance: error from sensitivity to small data fluctuations
(overfitting). Total error = Bias^2 + Variance + Irreducible noise. Goal: minimize both.
Level: Prime | Topic: ML
Q216. What is cross-validation?
Answer: Technique to evaluate model performance on unseen data. k-fold: divide data into k folds, train on k-1, test
on 1, repeat k times, average results. Prevents overfitting evaluation on single train/test split.
Level: Prime | Topic: ML
Q217. What is the difference between classification and regression?
Answer: Classification: predicts discrete labels/categories (spam/not spam, digit 0-9). Algorithms: logistic
regression, SVM, decision tree, random forest, KNN. Regression: predicts continuous values (price, temperature).
Linear regression.
Level: Ninja | Topic: ML
Q218. What is a neural network?
Answer: Computational model inspired by brain's neurons. Layers: Input, Hidden (one or more), Output. Neurons
connected with weights. Activation functions introduce non-linearity. Trained via backpropagation and gradient
descent.
Level: Prime | Topic: Deep Learning
Q219. What is deep learning?
Answer: Subset of ML using neural networks with many layers (deep architectures) to learn representations from
raw data. Excels in vision (CNN), NLP (Transformer), speech. Requires large data and compute.
Level: Prime | Topic: Deep Learning
Q220. What is gradient descent?
Answer: Optimization algorithm to minimize loss function by iteratively moving in direction of steepest descent
(negative gradient). Types: Batch GD, Stochastic GD (SGD), Mini-batch GD. Learning rate controls step size.
Level: Prime | Topic: ML Training
Q221. What are activation functions?
Answer: Introduce non-linearity to neural networks. ReLU (max(0,x)): most common, avoids vanishing gradient.
Sigmoid (0 to 1): output layer binary classification. Tanh (-1 to 1). Softmax: multiclass output probabilities.
Level: Prime | Topic: Deep Learning
Q222. What is regularization in ML?
Answer: Techniques to prevent overfitting. L1 (Lasso): adds |weights| to loss, promotes sparsity. L2 (Ridge): adds
weights^2, prevents large weights. Dropout: randomly disables neurons during training. Early stopping.
Level: Prime | Topic: ML
Q223. What is Random Forest?
Answer: Ensemble method building multiple decision trees on random subsets of data and features (bagging). Final
prediction: majority vote (classification) or average (regression). Reduces overfitting vs single tree.
Level: Prime | Topic: ML Algorithms
Q224. What is the difference between precision and recall?
Answer: Precision: of all predicted positives, how many are truly positive (TP/(TP+FP)). Recall/Sensitivity: of all
actual positives, how many detected (TP/(TP+FN)). F1 score: harmonic mean of precision and recall.
Level: Prime | Topic: ML Evaluation
Q225. What is a confusion matrix?
Answer: Table showing TP (correct positive), FP (false alarm), TN (correct negative), FN (missed positive). From it:
Accuracy=(TP+TN)/total, Precision, Recall, F1 score, AUC-ROC.
Level: Prime | Topic: ML Evaluation
Q226. What is transfer learning?
Answer: Using a pre-trained model (trained on large dataset) and fine-tuning it for a specific task. Reduces training
time and data requirements. Example: using ResNet trained on ImageNet for medical imaging.
Level: Digital | Topic: Deep Learning
Q227. What is a CNN (Convolutional Neural Network)?
Answer: Deep learning architecture for image processing. Layers: Convolutional (feature extraction with filters),
Pooling (dimensionality reduction), Fully Connected (classification). Key: weight sharing, translation invariance.
Level: Prime | Topic: Deep Learning
Q228. What is an RNN and its limitations?
Answer: Recurrent Neural Network: processes sequential data with memory (hidden state). Limitations:
vanishing/exploding gradients, difficulty learning long-term dependencies. Solutions: LSTM, GRU.
Level: Digital | Topic: Deep Learning
Q229. What is LSTM?
Answer: Long Short-Term Memory: RNN variant with gates (input, forget, output) controlling information flow.
Solves vanishing gradient problem, learns long-term dependencies. Used in NLP, time-series, speech recognition.
Level: Digital | Topic: Deep Learning
Q230. What is the ROC curve and AUC?
Answer: ROC (Receiver Operating Characteristic): plots True Positive Rate vs False Positive Rate at various
thresholds. AUC (Area Under Curve): ranges 0-1, higher is better (1=perfect, 0.5=random). Model comparison
metric.
Level: Prime | Topic: ML Evaluation
Q231. What is K-means clustering?
Answer: Unsupervised algorithm: partition n observations into k clusters. Steps: initialize k centroids, assign each
point to nearest centroid, update centroids (mean of cluster), repeat until convergence. Choose k using elbow
method.
Level: Prime | Topic: ML Algorithms
Q232. What is PCA (Principal Component Analysis)?
Answer: Dimensionality reduction technique. Finds principal components (directions of maximum variance),
projects data onto lower dimensions. Reduces features while preserving maximum information. Used for
visualization, noise reduction.
Level: Digital | Topic: ML
Generative AI & LLMs (Q233–Q250)
Q233. What is Generative AI?
Answer: AI that can generate new content — text, images, audio, video, code — by learning patterns from training
data. Examples: ChatGPT (text), DALL-E (images), GitHub Copilot (code), Suno (music).
Level: Ninja | Topic: GenAI
Q234. What is a Large Language Model (LLM)?
Answer: Neural network trained on massive text data to understand and generate human language. Based on
Transformer architecture. Examples: GPT-4, Claude, Gemini, LLaMA. Capabilities: text generation, Q&A;,
summarization, code.
Level: Ninja | Topic: LLM
Q235. What is the Transformer architecture?
Answer: Deep learning model introduced in 'Attention is All You Need' (2017). Key component: self-attention
mechanism allows model to weigh importance of different tokens. Components: encoder, decoder, multi-head
attention, positional encoding.
Level: Prime | Topic: LLM
Q236. What is attention mechanism?
Answer: Allows model to focus on relevant parts of input when generating each output token. Self-attention: each
token attends to all others. Scaled dot-product attention: Q(query), K(key), V(value) matrices. Enables
parallelization.
Level: Digital | Topic: LLM
Q237. What is prompt engineering?
Answer: Craft of designing input prompts to get optimal outputs from LLMs. Techniques: zero-shot (no examples),
few-shot (2-5 examples), chain-of-thought (step-by-step reasoning), role prompting, structured output specification.
Level: Prime | Topic: Prompt Engineering
Q238. What is RAG (Retrieval Augmented Generation)?
Answer: Combines retrieval system with LLM. Process: query -> retrieve relevant documents from knowledge base
(vector similarity) -> augment prompt with retrieved context -> LLM generates grounded response. Reduces
hallucinations.
Level: Prime | Topic: GenAI
Q239. What is fine-tuning an LLM?
Answer: Training pre-trained LLM on domain-specific data to adapt it for specific tasks. More efficient than training
from scratch. Types: full fine-tuning (all params), LoRA (Low-Rank Adaptation, fewer params), RLHF.
Level: Digital | Topic: LLM
Q240. What are AI hallucinations?
Answer: When AI generates confident but factually incorrect, fabricated, or inconsistent information. Causes:
training data gaps, pattern completion without factual grounding. Mitigations: RAG, temperature reduction,
fact-checking, human oversight.
Level: Prime | Topic: Responsible AI
Q241. What is temperature in LLM inference?
Answer: Parameter controlling randomness of output. Low temperature (0-0.3): deterministic, focused, factual. High
temperature (0.7-1.0+): creative, diverse, random. Temperature=0 gives most likely token always.
Level: Prime | Topic: LLM
Q242. What are embedding vectors?
Answer: Numerical representations of text (words/sentences) in high-dimensional space where semantically similar
texts are closer. Used in search, recommendation, RAG. Models: text-embedding-ada-002, all-MiniLM-L6-v2.
Level: Digital | Topic: GenAI
Q243. What is RLHF?
Answer: Reinforcement Learning from Human Feedback — technique to align LLM behavior with human
preferences. Steps: supervised fine-tuning, train reward model from human comparisons, optimize LLM using PPO.
Used in ChatGPT.
Level: Digital | Topic: LLM Training
Q244. What are AI Agents?
Answer: AI systems that can perceive environment, plan, and take actions autonomously to achieve goals.
Components: LLM backbone, memory, tools (web search, code execution), planning. Examples: AutoGPT,
LangChain agents.
Level: Digital | Topic: AI Agents
Q245. What is a vector database?
Answer: Database optimized for storing and querying high-dimensional vectors (embeddings). Supports similarity
search (nearest neighbor). Examples: Pinecone, Weaviate, Chroma, Milvus, pgvector. Essential for RAG systems.
Level: Digital | Topic: GenAI
Q246. What is the difference between GPT, Claude, and Gemini?
Answer: GPT-4 (OpenAI): strong reasoning, widespread API adoption. Claude (Anthropic): focused on safety, long
context window, Constitutional AI. Gemini (Google): multimodal, integrated with Google ecosystem. All are LLMs
with different training approaches.
Level: Prime | Topic: AI Tools
Q247. What is responsible AI?
Answer: Framework ensuring AI is fair, transparent, accountable, safe, and privacy-preserving. Key concerns: bias
(training data), fairness, explainability (XAI), privacy (GDPR), misuse prevention, environmental impact.
Level: Prime | Topic: Responsible AI
Q248. What is AI bias and how to mitigate it?
Answer: AI bias: systematic errors in AI outputs due to biased training data or flawed algorithms. Types: selection
bias, measurement bias. Mitigation: diverse training data, fairness metrics, bias testing, algorithmic auditing.
Level: Prime | Topic: Responsible AI
Q249. What is the difference between discriminative and generative models?
Answer: Discriminative: learn decision boundary between classes (SVM, logistic regression, BERT for
classification). Generative: learn data distribution, can generate new samples (GANs, VAEs, GPT). Different goals.
Level: Digital | Topic: ML
Q250. What is LangChain?
Answer: Framework for building applications with LLMs. Provides: chains (sequence of calls), agents (LLM + tools),
memory (conversation history), retrieval (RAG), prompt templates. Simplifies LLM app development in Python/JS.
Level: Digital | Topic: GenAI
SECTION 7: System Design & Cloud (Q251 – Q275)
System Design (Q251–Q263)
Q251. What is system design?
Answer: Process of defining architecture, components, modules, interfaces for a system to satisfy specified
requirements. Covers: scalability, reliability, availability, maintainability, performance, security.
Level: Digital | Topic: System Design
Q252. What is scalability? Horizontal vs vertical.
Answer: Ability to handle growing load. Vertical scaling (scale up): more CPU/RAM to existing server — limited,
expensive. Horizontal scaling (scale out): add more servers — preferred, requires load balancing and stateless
design.
Level: Prime | Topic: System Design
Q253. What is a microservices architecture?
Answer: Application structured as collection of small, independent, loosely-coupled services each running its own
process. Benefits: independent deployment, tech flexibility, fault isolation. Challenges: distributed system
complexity, network latency.
Level: Digital | Topic: Microservices
Q254. What is REST API? Explain principles.
Answer: Representational State Transfer. Principles: Stateless (no session on server), Client-Server separation,
Uniform Interface (CRUD via HTTP methods: GET, POST, PUT, DELETE), Cacheable, Layered System.
Level: Prime | Topic: APIs
Q255. What is the difference between REST and GraphQL?
Answer: REST: multiple endpoints, fixed data structure, over/under-fetching. GraphQL: single endpoint, client
specifies exact data needed (no over-fetching), strongly typed schema. GraphQL better for complex, flexible data
requirements.
Level: Digital | Topic: APIs
Q256. What is a message queue? Examples.
Answer: Middleware for async communication between services. Producer puts messages in queue; consumer
processes at own pace. Decouples services, handles traffic spikes. Examples: RabbitMQ, Kafka, Amazon SQS,
Azure Service Bus.
Level: Digital | Topic: System Design
Q257. What is Apache Kafka?
Answer: Distributed event streaming platform. High-throughput, fault-tolerant, real-time data pipelines. Key
concepts: Producer, Consumer, Topic, Partition, Broker, Consumer Group, Offset. Used for event sourcing, log
aggregation.
Level: Digital | Topic: Messaging
Q258. What is database sharding?
Answer: Horizontal partitioning of data across multiple databases. Each shard holds subset of data. Strategies:
range-based, hash-based, geographic. Improves performance and scalability but increases complexity.
Level: Digital | Topic: System Design
Q259. What is CAP theorem?
Answer: Distributed system can guarantee only 2 of 3: Consistency (all nodes see same data), Availability (every
request gets response), Partition tolerance (works despite network partitions). P is unavoidable, choose C or A.
Level: Digital | Topic: System Design
Q260. What is eventual consistency?
Answer: In distributed systems, all replicas will converge to same state eventually (not immediately). Used in DNS,
shopping carts (Amazon Dynamo). Trade-off: higher availability but temporary inconsistency.
Level: Digital | Topic: System Design
Q261. What is a cache? Types.
Answer: Fast storage for frequently accessed data. Types: In-memory (Redis, Memcached — fastest), CDN (static
assets), Browser cache, Database query cache. Cache strategies: LRU, LFU. Cache invalidation is hardest
problem.
Level: Prime | Topic: System Design
Q262. What are design patterns in system design? (not code)
Answer: Architectural patterns: MVC, CQRS (Command Query Responsibility Segregation), Event Sourcing, Saga
pattern (distributed transactions), Circuit Breaker (fault tolerance), API Gateway, Service Mesh.
Level: Digital | Topic: System Design
Q263. What is a reverse proxy?
Answer: Server that sits between clients and backend servers, forwarding client requests. Benefits: load balancing,
SSL termination, caching, security (hides backend), compression. Examples: Nginx, HAProxy, Cloudflare.
Level: Digital | Topic: System Design
Cloud Computing (Q264–Q275)
Q264. What is cloud computing? Service models.
Answer: Delivery of computing services over internet. IaaS (Infrastructure): VMs, storage, networking (AWS EC2).
PaaS (Platform): development platform (AWS Elastic Beanstalk). SaaS (Software): ready-to-use apps (Gmail,
Salesforce).
Level: Ninja | Topic: Cloud
Q265. What are the major cloud providers and their flagship services?
Answer: AWS: EC2 (compute), S3 (storage), RDS (database), Lambda (serverless). Azure: VMs, Blob Storage,
Azure SQL, Azure Functions. GCP: Compute Engine, Cloud Storage, BigQuery, Cloud Run.
Level: Ninja | Topic: Cloud
Q266. What is serverless computing?
Answer: Run code without managing servers. Cloud provider manages infrastructure. Pay per execution, not idle
time. AWS Lambda, Azure Functions, GCP Cloud Run. Ideal for event-driven, sporadic workloads.
Level: Prime | Topic: Cloud
Q267. What is Docker and containerization?
Answer: Docker packages application and dependencies into containers — lightweight, portable, isolated.
Container shares host OS kernel (vs VM which has full OS). Dockerfile defines image; docker-compose for
multi-container.
Level: Prime | Topic: DevOps
Q268. What is Kubernetes?
Answer: Container orchestration platform — automates deployment, scaling, management of containerized apps.
Key concepts: Pod (container group), Service, Deployment, Node, Cluster, Ingress, Helm charts.
Level: Digital | Topic: DevOps
Q269. What is CI/CD?
Answer: CI (Continuous Integration): automatically build and test code on each commit. CD (Continuous
Delivery/Deployment): automatically deploy tested code to staging/production. Tools: Jenkins, GitHub Actions,
GitLab CI, CircleCI.
Level: Prime | Topic: DevOps
Q270. What is AWS S3?
Answer: Simple Storage Service — object storage for files, images, videos, backups. Highly durable
(99.999999999%), scalable, pay-per-use. Storage classes: Standard, Intelligent-Tiering, Glacier (archival). Supports
versioning, lifecycle policies.
Level: Prime | Topic: AWS
Q271. What is the difference between SQL and NoSQL databases?
Answer: SQL: structured schema, ACID, tables, vertical scaling, complex queries (MySQL, PostgreSQL). NoSQL:
flexible schema, BASE, horizontal scaling, high performance for specific access patterns. Types: document
(MongoDB), key-value (Redis), columnar (Cassandra), graph (Neo4j).
Level: Prime | Topic: Cloud DB
Q272. What is auto-scaling in cloud?
Answer: Automatically adjust compute resources based on demand. Scale out when traffic increases, scale in
when low. Maintains performance during peaks, reduces cost during quiet periods. AWS Auto Scaling Groups.
Level: Prime | Topic: Cloud
Q273. What is a cloud region and availability zone?
Answer: Region: geographic area with multiple data centers (us-east-1, eu-west-1). Availability Zone (AZ): isolated
location within region with independent power/cooling. Deploy across AZs for high availability.
Level: Prime | Topic: Cloud
Q274. What is Infrastructure as Code (IaC)?
Answer: Managing and provisioning infrastructure through code instead of manual processes. Tools: Terraform
(multi-cloud), AWS CloudFormation, Ansible. Benefits: version control, reproducibility, automation, consistency.
Level: Digital | Topic: DevOps
Q275. What is a Service Level Agreement (SLA)?
Answer: Formal contract between service provider and customer defining expected service levels. Key metrics:
Uptime % (99.9% = 8.7 hrs downtime/year, 99.99% = 52 min/year), RTO (Recovery Time Objective), RPO
(Recovery Point Objective).
Level: Prime | Topic: Cloud
SECTION 8: HR & Managerial Round Quick Revision (Q276 – Q300)
HR Questions (Q276–Q290)
Q276. Tell me about yourself.
Model Answer: Structure: Name + Branch + Key Skills (2-3) + Academic achievement + Project highlight +
Certification + Why you're excited about TCS. Keep it 90 seconds. End with: 'I'm eager to contribute to TCS's
mission of leveraging technology for good.'
Q277. Why do you want to join TCS?
Model Answer: TCS is a global leader in IT services present in 55+ countries. I admire TCS's investment in
continuous learning (TCS iON, Fresco Play), its focus on emerging tech (AI, Cloud, Blockchain), and the opportunity
to work with global clients from Day 1.
Q278. What are your strengths?
Model Answer: Choose 2-3 relevant to TCS: Problem-solving with examples, Quick learning ability (certification
you got), Team collaboration (project example), Attention to detail. Back every strength with a specific example.
Q279. What is your greatest weakness?
Model Answer: Choose a real weakness being actively improved: 'I sometimes spend too much time perfecting
solutions. I'm addressing this by setting time-boxes for tasks and using Agile sprint discipline.' Never say 'I work too
hard.'
Q280. Where do you see yourself in 5 years?
Model Answer: Be honest and TCS-aligned: 'In 5 years, I see myself as a technical lead working on enterprise
AI/cloud solutions, having completed TCS's internal certifications, contributing to client projects, and mentoring
junior developers.'
Q281. Why should we hire you?
Model Answer: Connect your skills to TCS needs: 'I bring strong [your skill], demonstrated through
[project/achievement]. I'm a quick learner who adapts to new technologies — I learned [tech] in [time]. I'm committed
to TCS's values of integrity and innovation.'
Q282. Are you willing to relocate?
Model Answer: Yes — 'I'm flexible and open to relocation anywhere in India or internationally. I understand TCS
assigns projects based on client needs and I'm prepared for that.' (Be honest if you have genuine constraints.)
Q283. Are you okay with the service agreement / bond?
Model Answer: 'Yes, absolutely. I view this as a mutual commitment — TCS invests in my training and I commit to
contributing my best. I'm fully committed to a long-term career at TCS.'
Q284. What do you know about TCS?
Model Answer: Tata Consultancy Services — founded 1968, HQ Mumbai, part of Tata Group. Revenue ~$29B
FY24. Operations in 55+ countries, 600,000+ employees. Services: IT, BPS, Consulting, Engineering. Known for
TCS BaNCS, iQSTEEL, ignio AI.
Q285. How do you handle work under pressure?
Model Answer: Use STAR method: 'During my final year project, we had a deadline conflict with exams. I created a
priority list, divided tasks among team, worked in focused sprints, and delivered both. I thrive under pressure with
proper planning.'
Q286. What are your salary expectations?
Model Answer: 'I'm aware of TCS's Ninja/Prime/Digital package structure and I'm comfortable with the standard
package offered for this role. I'm more focused on learning, growth, and contributing value at this stage of my
career.'
Q287. Do you have any questions for us?
Model Answer: Always say YES: 'What does the onboarding and initial training program look like? What
technologies does the team I'd be joining primarily work with? What opportunities exist for upskilling in AI/Cloud at
TCS?'
Q288. Tell me about a failure and what you learned.
Model Answer: Be honest, show growth: 'In my 2nd year, I failed to complete a hackathon project because I
underestimated the timeline. I learned to break problems into smaller tasks, estimate time with buffers, and start
earlier. I applied this in my final year project successfully.'
Q289. How do you handle conflict in a team?
Model Answer: Use STAR: 'In my project, there was a disagreement on technology choice. I organized a structured
discussion where each person presented pros/cons. We made a data-driven decision. The conflict led to a better
solution and stronger team understanding.'
Q290. Are you a team player or individual contributor?
Model Answer: 'I'm comfortable in both roles and adapt based on what the situation requires. In group projects, I've
led teams and also contributed as a specialist. I believe great teams need both collaborative spirit and individual
accountability.'
Managerial Round Questions (Q291–Q300)
Q291. Tell me about your major project.
Strategy: Structure: Problem → Technology Used → Your Role → Challenges → Outcome → Learnings. Prepare
to answer: What problem does it solve? Why this tech stack? How would you scale it? What would you do
differently?
Q292. What is your understanding of Agile methodology?
Strategy: Agile: iterative software development. Key values: working software over documentation, customer
collaboration, responding to change. Scrum framework: sprints (2-4 weeks), daily standups, sprint review,
retrospective. Roles: PO, Scrum Master, Dev Team.
Q293. How do you prioritize tasks when you have multiple deadlines?
Strategy: I use the Eisenhower Matrix: categorize by urgency and importance. Tackle
high-importance/high-urgency first. I also communicate proactively with stakeholders if timelines conflict. I track
tasks using tools like Trello or even a simple to-do list.
Q294. How would you explain a technical concept to a non-technical client?
Strategy: I use analogies and avoid jargon. For example, I explain an API as a 'waiter in a restaurant — you don't
go to the kitchen yourself, the waiter takes your order to the kitchen and brings back results.' I also use visuals when
possible.
Q295. What AI tools have you used in your work or studies?
Strategy: Be specific: 'I've used GitHub Copilot for code assistance, ChatGPT/Claude for research and debugging
explanations, DALL-E for generating project diagrams, and Grammarly (AI writing assistance). I also explored
Hugging Face for ML model experimentation.'
Q296. Describe your leadership experience.
Strategy: Use a real example: 'As project lead for [project], I coordinated a 4-person team, divided tasks based on
strengths, resolved conflicts, and ensured we met our presentation deadline. I learned that good leadership is more
about enabling others than controlling them.'
Q297. How would you handle a situation where you disagree with your manager?
Strategy: 'I would first seek to understand my manager's perspective fully. Then I'd present my viewpoint
respectfully with data and reasoning. Ultimately, I would respect the final decision and implement it professionally,
while flagging concerns through proper channels.'
Q298. What do you know about TCS's Digital transformation services?
Strategy: TCS offers: Cloud Migration (TCS Cloud), AI/ML Services, Digital Workplace solutions, Cybersecurity, IoT
platforms, Blockchain, and their proprietary platforms like TCS BaNCS (banking), ignio (AI for IT ops), and TCS iON
(EdTech).
Q299. How do you keep yourself updated with technology trends?
Strategy: 'I follow technology blogs (TechCrunch, ArXiv for AI papers), take online courses (Coursera, Udemy),
participate in hackathons, contribute to GitHub, and engage with communities on LinkedIn and Stack Overflow.
Recently I completed [specific certification].'
Q300. What values do you bring to TCS?
Strategy: 'I bring curiosity to continuously learn new technologies, integrity in all my work, a collaborative spirit to
work effectively in global teams, and problem-solving focus to deliver value to clients. I align strongly with Tata's
values of excellence and ethics.'
Quick Reference: Complexity Cheat Sheet
Algorithm/Structure Best Average Worst Space
Array Access O(1) O(1) O(1) O(n)
Binary Search O(1) O(log n) O(log n) O(1)
Bubble Sort O(n) O(n²) O(n²) O(1)
Merge Sort O(n log n) O(n log n) O(n log n) O(n)
Quick Sort O(n log n) O(n log n) O(n²) O(log n)
Heap Sort O(n log n) O(n log n) O(n log n) O(1)
BST Search O(1) O(log n) O(n) O(n)
Hash Table Get O(1) O(1) O(n) O(n)
BFS / DFS O(V+E) O(V+E) O(V+E) O(V)
Dijkstra (heap) O(E log V) O(E log V) O(E log V) O(V)
Last-Minute Interview Day Tips
1. Sleep at least 7 hours. Your brain needs rest to recall information under pressure.
2. Re-read this guide's Quick Revision sections (Sections 1-4) in the morning.
3. Keep answers to technical questions structured: define -> explain -> example -> use case.
4. For coding questions: clarify, write approach, code, trace with example, discuss complexity.
5. For HR rounds: always use STAR format (Situation, Task, Action, Result) for behavioral questions.
6. Ask at least 1-2 intelligent questions to the interviewer — shows genuine interest.
7. Mention your AI Foundation knowledge proactively — it's a key differentiator in 2027 hiring.
8. Dress professionally, arrive 15 minutes early, and carry printed copies of your resume.
9. Stay calm. If you don't know an answer, say so honestly and share what related concept you do know.
10. End every round positively: 'Thank you for this opportunity. I'm very excited about joining TCS.'
Best of Luck for Your TCS Interview! You've Got This!