ThoughtWorks
10+ Ducat Interview Questions and Answers
Q1. 2. How will you design a database to manage the songs playlist on Spotify?
A database for managing songs on Spotify playlists.
Create a table for playlists with columns for name, description, and user ID
Create a table for songs with columns for title, artist, album, and duration
Create a table for playlist-songs with columns for playlist ID and song ID
Use foreign keys to link tables together
Allow for CRUD operations on playlists and songs
Q2. 4. Design a list to show songs in the year in which they were published.
Create an array of song titles sorted by year of publication.
Create an array of song objects with properties for title and year of publication.
Sort the array by year of publication.
Extract the titles of the songs into a separate array.
Return the array of song titles.
Q3. add a new feature using SOLID principles and explain your thought process
Adding a new feature using SOLID principles
Identify the new feature and its requirements
Analyze the existing codebase and identify areas that need modification
Apply SOLID principles to design the new feature
Implement the feature using clean code practices
Test the feature thoroughly to ensure it meets the requirements
Q4. 3. Middle element of linked list in a single traversal
To find the middle element of a linked list in a single traversal.
Use two pointers, one moving at twice the speed of the other.
When the faster pointer reaches the end, the slower pointer will be at the middle.
If the linked list has even number of elements, the middle will be the second of the two middle elements.
Q5. explain the HTTP status code for your tests
HTTP status codes indicate the status of a web request.
1xx - Informational
2xx - Success
3xx - Redirection
4xx - Client Error
5xx - Server Error
Examples: 200 OK, 404 Not Found, 500 Internal Server Error
Q6. 1. Permutations of the string.
Permutations of a string can be generated using recursion and swapping characters.
Use recursion to generate all possible permutations
Swap characters to create new permutations
Store permutations in an array of strings
Handle duplicate characters to avoid repetition
Q7. Add 20% discount code, Implement cashback
To add a 20% discount code and implement cashback in an application.
Create a discount code field in the application where users can enter the code to avail 20% off.
Calculate the discounted price by applying the 20% discount on the original price.
Implement a cashback feature where users receive a certain percentage of the purchase amount back as cashback.
Ensure that the cashback amount is credited to the user's account after the purchase is completed.
Q8. Why python is used for data science
Python is used for data science due to its simplicity, readability, extensive libraries, and community support.
Python is easy to learn and read, making it accessible for beginners and experts alike
Python has a wide range of libraries like NumPy, Pandas, and Scikit-learn for data manipulation and analysis
Python has a strong community support with active forums and resources for data science enthusiasts
Python's versatility allows for integration with other tools and languages c...read more
Q9. What is better java or c?
Both Java and C have their own strengths and weaknesses, and the choice depends on the specific requirements of the project.
Java is better for developing enterprise-level applications due to its platform independence and robustness.
C is better for developing system-level software and applications that require high performance and low-level access to hardware.
Java has a larger community and more libraries and frameworks available, making it easier to find solutions to common p...read more
Q10. How does multithreading work
Multithreading allows multiple threads to execute concurrently within a single process.
Multithreading allows for parallel execution of tasks within a single process.
Each thread has its own stack and runs independently of other threads.
Threads share the same memory space, allowing for communication and data sharing.
Multithreading can improve performance by utilizing multiple CPU cores efficiently.
Examples of multithreading include web servers handling multiple client requests ...read more
Q11. Fav sorting algorithm and explanation
Quick Sort - efficient, divide and conquer approach
Efficient sorting algorithm with average time complexity of O(n log n)
Uses divide and conquer approach by selecting a 'pivot' element and partitioning the array around the pivot
Example: Sorting an array of integers in ascending order
Q12. How does HTTP work?
HTTP is a protocol used for transferring data over the internet.
HTTP stands for Hypertext Transfer Protocol.
It is the foundation of data communication on the World Wide Web.
HTTP works by establishing a connection between a client and a server, where the client sends a request and the server responds with the requested data.
HTTP uses methods like GET, POST, PUT, DELETE to specify the action to be performed on a resource.
HTTP messages consist of a header and an optional body, w...read more
Q13. Hasmap working on the backend
HashMap is a data structure commonly used in backend development for efficient key-value storage and retrieval.
HashMap is a collection that stores key-value pairs and allows for fast retrieval of values based on keys.
It is commonly used in backend development for caching, session management, and data storage.
Example: HashMap
employeeSalaries = new HashMap<>(); employeeSalaries.put("Alice", 50000); int salary = employeeSalaries.get("Alice");
Q14. Design a HashMap
A HashMap is a data structure that stores key-value pairs and allows for fast retrieval of values based on keys.
Use an array of linked lists to handle collisions
Implement methods for adding, removing, and retrieving key-value pairs
Use a hash function to determine the index of the array where each key-value pair should be stored
More about working at ThoughtWorks
Interview Process at Ducat
Top Application Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month