Coder Interview Questions

1,374 coder interview questions shared by candidates

Question 11: A bucket contains a mix of blue and red balls. The ratio of blue to red balls is 3:7. If 20 blue balls are added to the bucket, the ratio becomes 1:2. How many red balls are in the bucket? Question 12: What will be the output of the following code? Question 13: Once upon a time, a group of detectives were presented with a challenge to identify which of the 1000 candies was poisoned, before it caused harm to any living species. They had to act fast, as the poison would take effect within an hour of consumption. The detectives knew they could use test subjects, but they needed to determine the minimum number required to solve the mystery in time. Can you help them find the solution before it's too late? Question 14: In the Agile Model, what is the primary purpose of a "sprint"? Question 15: What does the static keyword mean when used with a method? Question 16: Why are immutable objects often preferred in OOP design? Question 17: You are given an undirected graph with weighted edges. Which algorithm would you use to find the Minimum Spanning Tree (MST)? Question 18: Find the output of the following question: Question 19: What is the time complexity of searching for an element in a balanced binary search tree? Question 20: There are 100 light bulbs and 100 people. Initially, all bulbs are off. Person 1 flips every bulb (1, 2, 3, 4, …). Person 2 flips every 2nd bulb (2, 4, 6, …). Person 3 flips every 3rd bulb (3, 6, 9, …), and so on, until all 100 people have acted. How many people would have flipped bulb number 72? Question 21 & 22: A circular queue has a size of 5 and currently contains 3 elements. How many more elements can you insert? Question 23: You are given the head of a circular singly linked list and an integer nn. How would you remove the nnth node from the end of the list efficiently? Question 24: You are working with a binary search tree (BST) and need to find the lowest common ancestor (LCA) of two nodes, uu and vv. Which of the following is the most efficient approach for finding the LCA in a BST, assuming no additional balancing is applied? Question 25: What is the next term in the series: 1, 4, 9, 16, 25, __? Question 26: In a many-to-many relationship between two database tables, which of the following is typically used to model the relationship? Question 27: Which of the following OOP features is not used in the code above? Question 28: Which of the following is NOT a valid SQL data type? Question 29: Which of the following statements is false for dynamic programming? Question 30: Which following statement is false about Relational Database Management System? Question 31: A train traveling at 60 km/h leaves Station A at 7:00 AM. Another train traveling at 90 km/h leaves Station A at 8:00 AM in the same direction. At what time will the second train overtake the first? Question 32: A game development team is working on a character system where all characters have a fight() method. Characters like Warrior, Mage, and Archer implement this method differently. Which concept ensures the correct method is executed based on the character type? Question 33: In the following code snippet, what does the keyword ‘this’ refer to? Question 34: In the context of the Software Development Life Cycle (SDLC), which model emphasizes the continuous iteration of the development and testing phases throughout the project, accommodating changes in requirements even late in the development process? Question 35: In which of the following situations would a stack be most appropriate? Question 36: In a network of cities and roads, you are given nn cities and mm roads between them. Your task is to determine the minimum number of new roads required to ensure that there is a path between every pair of cities. What is the most suitable approach to solve this problem? Question 37: In the SDLC, which of the following best describes the purpose of the "Iteration" concept in Agile methodology? Question 38: What is the shortest path from A to F using BFS? Question 39: Which of the following is an example of compile-time polymorphism? Answer: a. Method overloading Feel free to ask if you need further clarification or have more questions! Question 40: You are given a list of n unique room numbers belonging to guests at a hotel. These numbers are in the range [0, n], but one guest's room number is missing from the list. What is the best possible space complexity for solving this problem? Question 41: What type of casting is demonstrated in the following code? Question 42: Which of the following is not a bipartite graph? Question 43: What is the purpose of the final keyword in OOP? Question 44: Write a SQL query to retrieve the names of all customers who have placed an order with a total value greater than $1000. Orders are in the orders table and customer information is in the customers table. Question 45: Which of the following statements about database keys is incorrect?
avatar

Star Coder Program

Interviewed at Brain Station-23

3.9
Jan 24, 2025

Question 11: A bucket contains a mix of blue and red balls. The ratio of blue to red balls is 3:7. If 20 blue balls are added to the bucket, the ratio becomes 1:2. How many red balls are in the bucket? Question 12: What will be the output of the following code? Question 13: Once upon a time, a group of detectives were presented with a challenge to identify which of the 1000 candies was poisoned, before it caused harm to any living species. They had to act fast, as the poison would take effect within an hour of consumption. The detectives knew they could use test subjects, but they needed to determine the minimum number required to solve the mystery in time. Can you help them find the solution before it's too late? Question 14: In the Agile Model, what is the primary purpose of a "sprint"? Question 15: What does the static keyword mean when used with a method? Question 16: Why are immutable objects often preferred in OOP design? Question 17: You are given an undirected graph with weighted edges. Which algorithm would you use to find the Minimum Spanning Tree (MST)? Question 18: Find the output of the following question: Question 19: What is the time complexity of searching for an element in a balanced binary search tree? Question 20: There are 100 light bulbs and 100 people. Initially, all bulbs are off. Person 1 flips every bulb (1, 2, 3, 4, …). Person 2 flips every 2nd bulb (2, 4, 6, …). Person 3 flips every 3rd bulb (3, 6, 9, …), and so on, until all 100 people have acted. How many people would have flipped bulb number 72? Question 21 & 22: A circular queue has a size of 5 and currently contains 3 elements. How many more elements can you insert? Question 23: You are given the head of a circular singly linked list and an integer nn. How would you remove the nnth node from the end of the list efficiently? Question 24: You are working with a binary search tree (BST) and need to find the lowest common ancestor (LCA) of two nodes, uu and vv. Which of the following is the most efficient approach for finding the LCA in a BST, assuming no additional balancing is applied? Question 25: What is the next term in the series: 1, 4, 9, 16, 25, __? Question 26: In a many-to-many relationship between two database tables, which of the following is typically used to model the relationship? Question 27: Which of the following OOP features is not used in the code above? Question 28: Which of the following is NOT a valid SQL data type? Question 29: Which of the following statements is false for dynamic programming? Question 30: Which following statement is false about Relational Database Management System? Question 31: A train traveling at 60 km/h leaves Station A at 7:00 AM. Another train traveling at 90 km/h leaves Station A at 8:00 AM in the same direction. At what time will the second train overtake the first? Question 32: A game development team is working on a character system where all characters have a fight() method. Characters like Warrior, Mage, and Archer implement this method differently. Which concept ensures the correct method is executed based on the character type? Question 33: In the following code snippet, what does the keyword ‘this’ refer to? Question 34: In the context of the Software Development Life Cycle (SDLC), which model emphasizes the continuous iteration of the development and testing phases throughout the project, accommodating changes in requirements even late in the development process? Question 35: In which of the following situations would a stack be most appropriate? Question 36: In a network of cities and roads, you are given nn cities and mm roads between them. Your task is to determine the minimum number of new roads required to ensure that there is a path between every pair of cities. What is the most suitable approach to solve this problem? Question 37: In the SDLC, which of the following best describes the purpose of the "Iteration" concept in Agile methodology? Question 38: What is the shortest path from A to F using BFS? Question 39: Which of the following is an example of compile-time polymorphism? Answer: a. Method overloading Feel free to ask if you need further clarification or have more questions! Question 40: You are given a list of n unique room numbers belonging to guests at a hotel. These numbers are in the range [0, n], but one guest's room number is missing from the list. What is the best possible space complexity for solving this problem? Question 41: What type of casting is demonstrated in the following code? Question 42: Which of the following is not a bipartite graph? Question 43: What is the purpose of the final keyword in OOP? Question 44: Write a SQL query to retrieve the names of all customers who have placed an order with a total value greater than $1000. Orders are in the orders table and customer information is in the customers table. Question 45: Which of the following statements about database keys is incorrect?

Viewing 1061 - 1070 interview questions

See Interview Questions for Similar Jobs

Glassdoor has 1,374 interview questions and reports from Coder interviews. Prepare for your interview. Get hired. Love your job.