Thoughtworks interview questions

161 questions from 20 interviews · updated from reports 2015-2024

Practise Thoughtworks-style

About

Thoughtworks is a technology consultancy that builds software, advises on digital product delivery, and helps organizations modernize systems. In India, it is known for hiring Software Engineers, Application Developers, and Consultant Application Developers for client-focused engineering work.

The roles that come up most are Software Engineer, Application Developer and Consultant Application Developer. This covers 20 candidate interviews reported from 2015 to 2024. Most sat it at entry level (14 of 19 that recorded a level). Among the 18 that recorded either route, arrivals split between campus drives (7, 39%) and off-campus applications (11, 61%). Most questions fall under CS fundamentals and DSA.

Category
Difficulty
Round

Interview questions

Q. Implement the Snake and Ladder game

asked 1xmediumOOPTechnical2015

Ans. Represent the board as an array where each index is a square and the value is either the same square or the destination after a snake or ladder. Keep player positions in an array. On each turn, roll the die, move if within bounds, then apply the board jump. Each move is O(1).

Q. Design a database schema for a bank.

asked 1xmediumDBMSTechnical2019

Ans. Use tables for customers, accounts, account_holders, transactions, and ledger_entries, with branches and employees if needed. Customers can own many accounts through account_holders. Each transaction creates immutable debit and credit ledger_entries against accounts, not direct balance edits. Balances can be cached but must be derived from the ledger for auditability.

Q. Derive the time complexity of Quick Sort.

asked 1xmediumSortingTechnical2018

Ans. Quick Sort runs in O(n log n) time on average and in the best case, but O(n²) in the worst case. Each partition step costs O(n). With balanced pivots, the recurrence is T(n) = 2T(n/2) + O(n), giving O(n log n). With highly unbalanced pivots, it becomes T(n) = T(n-1) + O(n).

Q. Design a movie recommendation application.

asked 1xmediumScalabilitySystem design2018

Ans. Build a service that combines collaborative filtering, content-based signals, and popularity trends to return personalised ranked movies through an API. The key detail is separating offline model training from online serving: collect views, ratings, searches, and skips, train embeddings in batch or streaming jobs, store candidates in a feature store or vector index, then rank with fresh context.

Q. Explain the internal working of a HashMap.

asked 1xmediumOOPTechnical2018

Ans. A HashMap stores key value pairs in an array of buckets, using the key’s hash code to choose a bucket index. If two keys map to the same bucket, it handles the collision, commonly with a linked list or tree. When the load factor grows too high, it resizes and rehashes. Average access is constant time.

Q. How will you balance a Binary Search Tree?

asked 1xmediumTreesTechnical2015

Ans. I would balance a Binary Search Tree by using rotations to keep subtree heights within a chosen rule, such as AVL or Red-Black balancing. After each insert or delete, update heights or colours, detect imbalance, and apply single or double rotations. This keeps search, insert, and delete at O(log n).

Q. Design a file system for an operating system.

asked 1xmediumOperating systemsTechnical2015

Ans. Design a layered file system with a VFS interface, inode-based metadata, directories mapping names to inode numbers, block allocation for file data, and a buffer cache over the block device. The most important detail is crash consistency, so use journalling or copy-on-write metadata updates to ensure recovery leaves the disk in a valid state.

Q. Explain how the Java Garbage Collector works.

asked 1xmediumOperating systemsTechnical2019

Ans. Java Garbage Collection automatically frees heap memory by finding objects no longer reachable from live references. It starts from GC roots such as stack variables and static fields, marks reachable objects, then reclaims the rest, often compacting memory. Most JVMs use generational collection because short-lived objects are very common.

Q. Check for duplicate elements in a binary tree.

asked 1xmediumTreesTechnical2015

Ans. Traverse the binary tree and store each visited value in a hash set; if a value is already present, the tree contains duplicates. Use any traversal such as DFS or BFS, because ordering does not matter. The time complexity is O(n), and the extra space is O(n) in the worst case.

Q. Find the minimum sum subarray in a given array

asked 1xmediumArraysOnline test2015

Ans. Use a modified Kadane’s algorithm to track the minimum sum ending at each position and the global minimum seen so far. For each element, set current minimum to the smaller of the element itself and current minimum plus the element. Update the best answer each time. It uses constant extra space and runs in O(n) time.

Q. How is a friend's list maintained in Facebook?

asked 1xmediumScalabilityTechnical2015

Ans. A friend list is maintained as a social graph, where each user is a node and each friendship is a bidirectional edge stored in an adjacency list. When a request is accepted, two entries are created, one for each user. The list is usually cached and sharded by user ID for fast reads at scale.

Q. Explain OOP concepts used in the implementation

asked 1xmediumOOPTechnical2024

Ans. The implementation uses encapsulation, abstraction, inheritance and polymorphism to organise code around objects. Encapsulation keeps state private and exposes behaviour through methods. Abstraction hides internal details behind clear interfaces. Inheritance reuses shared behaviour where classes have an is-a relationship. Polymorphism lets different implementations be used through the same interface.

Q. Explain DBMS basics and write common SQL queries

asked 1xmediumDBMSTechnical2024

Ans. A DBMS stores, organises and protects data, usually in tables with rows, columns, keys and relationships. SQL is used to create tables, insert data, read with SELECT, filter with WHERE, combine tables with JOIN, group with GROUP BY, sort with ORDER BY, and modify or remove data with UPDATE and DELETE.

Q. Explain the internal working of HashMap in depth.

asked 1xmediumData structuresTechnical2020

Ans. A HashMap stores key value pairs in an internal array of buckets, using the key’s hash code to choose a bucket index. On put, it hashes the key, finds the bucket, then updates an equal key or adds a new node. Collisions use linked lists, or balanced trees after a threshold. Resizing happens when load factor is exceeded.

Q. Draw a class diagram for a given problem scenario.

asked 1xmediumOOPTechnical2021

Ans. Identify the main domain entities as classes, add their key attributes and operations, then connect them with associations, inheritance, aggregation or composition. The most important detail is choosing correct relationships and multiplicities, such as one-to-many or many-to-many, because they show how objects actually depend on and collaborate with each other.

Q. How do you delete the nth node from a linked list?

asked 1xmediumLinked listsTechnical2016

Ans. Delete the nth node by walking the list to the node just before it, then changing that node’s next pointer to skip the target node. Handle edge cases such as deleting the head, an empty list, or n being out of range. This takes O(n) time and O(1) extra space.

Q. Design a database schema for a system like Netflix.

asked 1xmediumDBMSTechnical2023

Ans. Use relational tables for core entities: users, profiles, subscriptions, plans, titles, seasons, episodes, genres, cast, devices, payments, watch_history, ratings and my_list. Model title metadata separately from availability by region and licence window. The most important detail is that high-volume watch_history should be partitioned by user or time and optimised for recent reads.

Q. Check whether a binary tree is a complete binary tree

asked 1xmediumTreesTechnical2015

Ans. Use level order traversal with a queue. Visit nodes from left to right, and once you see a missing child, every later child position must also be missing. If any non-null node appears after that point, the tree is not complete. This takes O(n) time and O(n) space.

Q. Explain fundamental data structures and their use cases

asked 1xmediumGeneralTechnical2024

Ans. Fundamental data structures organise data for efficient access and updates: arrays for indexed lookup, linked lists for frequent insertions, stacks for last-in first-out tasks, queues for first-in first-out processing, hash tables for fast key lookup, trees for ordered or hierarchical data, and graphs for relationships. Choice depends mainly on required access pattern and time complexity.

Q. Explain basics of Computer Networking and Operating Systems

asked 1xmediumOperating systemsTechnical2024

Ans. Computer networking is how computers communicate, while an operating system manages hardware and provides services to programs. Networking uses protocols such as TCP/IP, IP addresses, ports, DNS, routing, and HTTP to move data reliably. An operating system manages processes, memory, files, devices, permissions, scheduling, and system calls.

Q. Explain SOLID design principles and how they apply to the code

asked 1xmediumOOPTechnical2024

Ans. SOLID is a set of object-oriented design principles that make code easier to change, test and maintain. Single responsibility keeps classes focused, open/closed extends behaviour without modifying stable code, Liskov preserves substitutability, interface segregation avoids bloated contracts, and dependency inversion makes high-level code depend on abstractions rather than concrete implementations.

Q. How does Java provide synchronized access to shared resources?

asked 1xmediumOperating systemsTechnical2017

Ans. Java provides synchronized access using intrinsic locks, mainly through the synchronized keyword on methods or blocks. A thread must acquire the object’s monitor before entering synchronized code, so only one thread can execute that protected section at a time. Releasing the lock also creates a happens-before relationship, ensuring memory visibility.

Q. How do you delete the second last node in a singly linked list?

asked 1xmediumLinked listsTechnical2016

Ans. Delete the second last node by finding the node just before it, then linking that node directly to the last node. In a singly linked list, handle lists with fewer than two nodes, and if there are exactly two nodes, delete the head. This takes one traversal, so time is O(n) and space is O(1).

Q. Write nested and complex SQL queries on a given database schema

asked 1xmediumSQLTechnical2015

Ans. I would start from the required result, identify the base tables and joins, then use subqueries or CTEs to isolate each condition or aggregation. For example, filter rows with a nested query, aggregate with GROUP BY, then join that result back to the main table. I would check keys, NULL handling, and indexes.

Q. Explain tree traversals and boundary traversal of a binary tree.

asked 1xmediumTreesTechnical2020

Ans. Tree traversals are ways to visit every node, such as inorder left-root-right, preorder root-left-right, postorder left-right-root, and level order by breadth. Boundary traversal prints the outer edge anticlockwise: root, left boundary excluding leaves, all leaves left to right, then right boundary excluding leaves in reverse. It takes O(n) time.

Q. Normalize the given database tables to appropriate normal forms.

asked 1xmediumDBMSTechnical2021

Ans. Normalise by identifying keys and dependencies, then decomposing tables until each fact is stored once. Put atomic values in 1NF, remove partial dependency on composite keys for 2NF, remove transitive dependency for 3NF, and use BCNF when every determinant should be a candidate key. Preserve lossless joins and required constraints.

Q. Answer conceptual questions related to cryptography fundamentals.

asked 1xmediumCryptographyTechnical2020

Ans. Cryptography protects information by providing confidentiality, integrity, authentication and sometimes non-repudiation. Symmetric encryption uses one shared secret key and is fast, while asymmetric cryptography uses public and private keys for key exchange, signatures and identity. Hash functions are one-way digests used to verify integrity, not to encrypt data.

Q. Design a database schema for a given application and normalize it

asked 1xmediumDBMSTechnical2015

Ans. Start by identifying entities, relationships, attributes and access patterns, then create tables with primary keys, foreign keys and suitable constraints. Normalise by removing repeating groups, ensuring non-key attributes depend on the whole key, and eliminating transitive dependencies, usually to third normal form. Denormalise only when measured performance needs justify it.

Q. Design and implement a card game using object-oriented principles

asked 1xmediumOop designTechnical2015

Ans. Model the game with Card, Deck, Hand, Player, Game, and RuleEngine classes, separating state from rules. Deck holds a list of Cards and supports shuffle and draw, Hand holds cards per player, and Game controls turns. Use enums for suit and rank. Shuffle is O(n), draw is O(1).

Q. Search for an element in a sorted rotated array in O(log n) time.

asked 1xmediumBinary searchTechnical2017

Ans. Use a modified binary search. Keep low and high pointers, find mid, and first check if mid is the target. One half of the array is always sorted. If the target lies within that sorted half, search there; otherwise search the other half. This gives O(log n) time and O(1) space.

Q. Explain core Java fundamentals and the Java Collections Framework.

asked 1xmediumOOPTechnical2023

Ans. Core Java fundamentals include object-oriented programming, classes, objects, inheritance, polymorphism, encapsulation, interfaces, exceptions, generics, threads, and memory management through garbage collection. The Java Collections Framework provides standard data structures such as List, Set, Queue, and Map, with implementations like ArrayList, HashSet, LinkedList, and HashMap for efficient storage, lookup, ordering, and iteration.

Q. Optimize the given codebase for better performance and readability

asked 1xmediumOOPTechnical2024

Ans. I would first profile the code, then optimise the slowest paths while refactoring for clarity. The key detail is to measure before changing anything, so performance work targets real bottlenecks. I would remove duplicate work, use suitable data structures such as maps or sets, reduce unnecessary I/O, and keep changes covered by tests.

Q. Design a data structure that can return a peak element in O(1) time.

asked 1xmediumData structuresTechnical2017

Ans. Store the elements in an array and maintain a separate set or linked list of indices that are currently peaks, so returning any peak is just reading the first stored index in O(1). On insertion, deletion, or update, only the changed position and its immediate neighbours can change peak status, so update those entries only.

Q. Design an iPod inventory management system to calculate minimum cost

asked 1xmediumOop designTechnical2015

Ans. Model it as an inventory optimisation service that forecasts demand, tracks stock and purchase options, then chooses the cheapest replenishment plan that satisfies demand without stockouts. The core is dynamic programming or min-cost flow over time periods, with state as current inventory and transitions as buy, hold or sell. Complexity depends on periods and inventory bounds.

Q. What is DNS lookup, what is a Load Balancer, and how does a server work?

asked 1xmediumNetworkingTechnical2020

Ans. DNS lookup translates a domain name into an IP address, a load balancer spreads client requests across multiple servers, and a server listens for requests, processes them, and returns responses. The key flow is: browser resolves the domain, connects to the chosen endpoint, the load balancer selects a healthy server, and that server handles the request.

Q. Design a Tree data structure using object-oriented programming principles

asked 1xmediumOop designTechnical2015

Ans. Model it with a Tree class holding a root Node, and a Node class holding a value, optional parent reference, and a list of child nodes. Keep mutation methods on Tree or Node to preserve invariants, such as no cycles. Search and traversal are O(n); adding a known child is O(1).

Q. Design the database schema and write SQL queries for a given requirement.

asked 1xmediumSQLTechnical2015

Ans. Start by identifying entities, relationships, cardinality and access patterns, then create normalised tables with primary keys, foreign keys, constraints and indexes on join and filter columns. Write queries using joins for related data, where clauses for filtering, group by for aggregates, and transactions where consistency matters. Check performance with expected data volume.

Q. Given an encoded string like '3(ab)4(cd)', expand it to 'abababcdcdcdcd'.

asked 1xmediumStringsOnline test2018

Ans. Use a stack to expand the string by scanning left to right, pushing previous text and repeat counts when you see an opening bracket, then rebuilding on a closing bracket. The key detail is that this naturally handles nesting. Time complexity is O(n + m), where m is the length of the expanded output.

Q. Explain Merge Sort, write its code, and explain the approach of Quick Sort.

asked 1xmediumSortingTechnical2020

Ans. Merge Sort recursively splits the array into halves, sorts each half, then merges two sorted halves using a temporary array. It is stable, uses extra space, and runs in O(n log n) time. Quick Sort chooses a pivot, partitions elements around it, then recursively sorts the partitions, averaging O(n log n).

Q. Given n numbers a1, a2, a3, ..., an, find the pair-wise XOR of the numbers.

asked 1xmediumBit manipulationOnline test2019

Ans. Compute ai XOR aj for every pair with i less than j. Use two nested loops and store or print each result as it is produced, so no special data structure is needed unless the output must be saved in a list. The time complexity is O(n²), with O(1) extra space excluding output.

Q. What are SOLID principles and how do they help in writing clean, modular code?

asked 1xmediumOOPTechnical2020

Ans. SOLID principles are five object oriented design rules: single responsibility, open closed, Liskov substitution, interface segregation, and dependency inversion. They help keep classes focused, extend behaviour without changing stable code, preserve correct inheritance, avoid bloated interfaces, and depend on abstractions, making code easier to test, change, reuse, and maintain.

Q. Explain Java's multithreading mechanism including shared resources and monitors.

asked 1xmediumOperating systemsTechnical2017

Ans. Java supports multithreading by running multiple Thread or Runnable tasks concurrently, each with its own call stack but sharing heap objects. Shared resources must be protected from race conditions. Every object has a monitor lock; synchronized methods or blocks acquire it, allowing only one thread inside, while wait and notify coordinate access.

Q. Explain the difference between Segmentation and Paging, and what is a Page Fault.

asked 1xmediumOperating systemsTechnical2020

Ans. Segmentation divides memory into logical variable sized parts such as code, stack and heap, while paging divides memory into fixed sized pages and frames. Paging avoids external fragmentation but may have internal fragmentation. A page fault occurs when a process accesses a page not currently in RAM, so the OS loads it from disk.

Q. How do you list running processes, get a process ID, and kill a process in Linux?

asked 1xmediumOperating systemsTechnical2015

Ans. List processes with ps aux, top, or htop, find the PID with ps aux | grep name, pgrep name, or pidof name, then stop it with kill PID. By default kill sends SIGTERM, allowing cleanup. If it will not stop, use kill -9 PID, which sends SIGKILL and cannot be handled.

Q. Given a city graph, how would you find all non-vegetarian restaurants in Siliguri?

asked 1xmediumGraphsTechnical2017

Ans. Start from the Siliguri city node and traverse its adjacent place or restaurant nodes, filtering nodes whose type is restaurant and whose food category includes non-vegetarian. Use BFS or DFS with a visited set if the graph can have cycles. The traversal costs O(V + E), or less if restaurants are indexed by city.

Q. Why is returning a Map from an API endpoint considered a bad practice in many cases?

asked 1xmediumOOPTechnical2021

Ans. Returning a Map is often bad because it creates a weak, unclear API contract. The keys and value shapes may be dynamic or undocumented, which makes validation, documentation, client generation, versioning and backwards compatibility harder. A typed response object is usually clearer, unless the endpoint genuinely returns arbitrary key-value data.

Q. How would you construct a SQL query involving joins between multiple tables using JPA?

asked 1xmediumDBMSTechnical2021

Ans. Use JPQL or the Criteria API to express joins through mapped entity relationships, such as many-to-one or one-to-many associations. In JPQL, select from the root entity and join its fields, not table names. The key detail is that JPA joins operate on entity mappings, while the provider generates the SQL.

Q. Given an array, reorder it so that elements are arranged in alternating peaks and valleys.

asked 1xmediumArraysTechnical2017

Ans. Scan the array once and make every odd index a peak by ensuring it is at least as large as its neighbours. At each odd index, find the largest among the element and its immediate neighbours, then swap it into the odd position. This gives alternating valleys and peaks in O(n) time and O(1) space.

Q. Write a program to find the different ways to get a given sum from the elements of an array.

asked 1xmediumDynamic programmingTechnical2018

Ans. Use dynamic programming to count subsets whose elements add to the given sum. Keep a one-dimensional array dp where dp[s] stores the number of ways to make sum s, starting with dp[0] = 1. For each element, update sums backwards to avoid reusing it. Time complexity is O(n × sum), space is O(sum).

Q. Explain commonly used design patterns and when you would use them in application development.

asked 1xmediumOOPTechnical2020

Ans. Common design patterns are reusable solutions to recurring design problems, used when they make code clearer, more flexible, and easier to maintain. Singleton controls one shared instance, Factory creates objects without exposing construction, Strategy swaps algorithms, Observer handles event notifications, Adapter connects incompatible interfaces, and MVC separates data, UI, and control logic.

Q. Given the schema of 4–5 database tables, write MySQL queries to retrieve required information.

asked 1xmediumSQLTechnical2021

Ans. Start by identifying the required output columns, then trace the relationships through primary keys and foreign keys, using joins between the relevant tables. Filter with where, group with group by for aggregates, and use having for aggregate conditions. Check join type carefully, because inner join and left join change missing-row results.

Q. Mars Rover Problem: Design a system to move a rover on a grid based on commands and directions

asked 1xmediumOop designTechnical2015

Ans. Model the rover with x, y and direction, parse each command sequentially, and update state using a direction list such as N, E, S, W. Left and right rotate by changing the index modulo four, while move changes coordinates. Validate boundaries and obstacles before committing movement. Time is O(commands), space is O(obstacles).

Q. Describe a situation where you felt significant pressure at work and explain how you handled it.

asked 1xmediumConflict resolutionHR2021

Ans. Choose a real, high-stakes situation with a deadline, client impact, outage, or competing priorities. Emphasise how you stayed calm, assessed priorities, communicated early, asked for help if needed, and delivered or managed expectations. Interviewers listen for ownership, judgement, resilience, teamwork, and learning, not heroic overwork or blame.

Q. How can a disk with concentric circular tracks and sectors be represented using data structures?

asked 1xmediumData structuresTechnical2019

Ans. A disk can be represented as a two-dimensional array or a list of tracks, where each track contains an array of sectors. The first index identifies the circular track and the second identifies the sector on that track. This gives direct access to a block by its track and sector number in constant time.

Q. How would you handle a leadership situation where you need to make a decision in a complex or ambiguous scenario?

asked 1xmediumLeadershipHR2021

Ans. Pick a real situation with unclear data, competing priorities, or time pressure. Emphasise how you clarified the goal, consulted the right people, assessed risks, made a timely decision, and communicated it clearly. Interviewers listen for judgement, ownership, calmness under uncertainty, and whether you balance collaboration with decisiveness.

Q. What are your views on equality versus equity, and how do you see the impact of the caste reservation system in India?

asked 1xmediumEthical reasoningHR2021

Ans. A strong answer should distinguish equality as same treatment and equity as fair support based on barriers. Pick a balanced situation, such as education or hiring access. Emphasise that reservations address historic exclusion, but need good implementation, periodic review, and wider social investment. Interviewers listen for empathy, nuance, constitutional awareness, and avoidance of caste bias.

Q. Solve the 25 horses puzzle to find the fastest horses with minimum races.

asked 1xhardLogical reasoningTechnical2017

Ans. Race five groups of five. Race the five winners. The winner of that race is fastest overall. For second and third, only horses that lost to possible faster horses remain: the second and third from the winner’s group, and the first and second from the runner-up group, plus the winner of the third group. Race those five. Total: 7 races.

Q. Solve simple mathematical riddles based on basic logic.

asked 1xeasyLogical reasoningTechnical2021

Ans. There is no single answer without the actual riddle. I would translate each statement into a simple equation or rule, check the order of operations, and test any hidden pattern. I would avoid guessing from the final line alone, because many riddles rely on changed values, missing terms, or visual details.

Q. Find the next term or missing term in a given number series.

asked 1xeasyLogical reasoningOnline test2021

Ans. Look for the rule connecting each term to the next. Check common patterns such as addition, subtraction, multiplication, division, squares, cubes, alternating steps, or differences between terms. If the first differences do not help, compare second differences. Test the rule on all given terms before choosing the missing or next number.

Q. Solve logical reasoning questions based on flowcharts to determine correct outputs

asked 1xeasyLogical reasoning2015

Ans. Trace the flowchart step by step using the given input values. Start at the beginning, follow each arrow, and update variables whenever an operation appears. At each decision box, test the condition carefully and choose the true or false path. Continue until the end box, then report the final value or output.

Showing 60 of 161 questions. Ranked by how often the same question came back across interviews.

Practise a Thoughtworks-style interview

A spoken interview built from these questions, scored when you finish; the feedback is yours.

Start practising

When you are ready, record The One: a single interview hiring teams watch, so you stop repeating first rounds.

Common questions

What questions does Thoughtworks ask?

Candidate interviews most often cover CS fundamentals (47%) and DSA (34%).

How many rounds does Thoughtworks interview have?

Candidate interviews show an average of 4.1 rounds per experience, with a typical sequence of Online test → Technical → Technical → HR. Individual interview paths can vary.

Is the Thoughtworks interview hard?

Among questions with a recorded difficulty, the mix is easy 38%, medium 57%, hard 5%.