Add office photos
Employer?
Claim Account for FREE

Carwale

3.4
based on 153 Reviews
Filter interviews by

50+ Interview Questions and Answers

Updated 16 Sep 2024
Popular Designations

Q1. A string is given consisting of lowercase alphabets. Write a function which returns yes if the string has all the lowercase letters appearing in it at least once. O(N) time and without using extra space

Ans.

Function to check if a string has all lowercase letters appearing at least once without extra space in O(N) time.

  • Create a boolean array of size 26 to keep track of the occurrence of each letter.

  • Iterate through the string and mark the corresponding index in the array as true.

  • Check if all the elements in the array are true and return yes if so.

  • Alternatively, use a bit vector to keep track of the occurrence of each letter.

View 2 more answers

Q2. Given a balance and 100 coins;out of which,one is heavier. Find minimum number of weighing required to find out heavier coin?

Ans.

Find minimum number of weighings required to find the heavier coin out of 100 coins with a balance.

  • Divide the coins into 3 groups of 33 each and weigh 2 groups against each other.

  • If one group is heavier, divide it into 3 groups of 11 each and weigh 2 groups against each other.

  • Repeat the process until the heavier coin is found.

  • Minimum number of weighings required is 4.

Add your answer

Q3. Delete nodes in linkedlist which have a greater value on right side?

Ans.

Delete nodes in linkedlist with greater value on right side

  • Traverse the linked list from right to left

  • Compare each node with the maximum value seen so far

  • If the current node has a greater value, delete it

  • Update the maximum value seen so far

Add your answer

Q4. Explain priority scheduling (preemptive , non-preemptive). Explain a case when a low priority process will preempt a high priority process

Ans.

Priority scheduling is a scheduling algorithm where processes are assigned priorities and executed based on their priority level.

  • Preemptive priority scheduling allows a higher priority process to interrupt a lower priority process that is currently running.

  • Non-preemptive priority scheduling allows a higher priority process to wait until the lower priority process finishes executing.

  • A low priority process can preempt a high priority process if the high priority process is wait...read more

Add your answer
Discover null interview dos and don'ts from real experiences

Q5. Make 24 using 8, 8, 3, 3 using + = / * ( ) .

Ans.

Make 24 using 8, 8, 3, 3 using + = / * ( )

  • Use multiplication to get 8*3=24

  • Add the remaining 8 to get 32

  • Divide by the remaining 3 to get 10.67

  • Subtract the other 3 to get 7.67

  • Multiply by the remaining 3 to get 23.01

  • Add the remaining 8 to get 31.01

  • Divide by the remaining 8 to get 3.88

  • Add the other 3 to get 6.88

  • Multiply by the remaining 3 to get 20.64

  • Add the other 8 to get 28.64

View 1 answer

Q6. What is runtime polymorphism and compile time polymorphism? Difference between them?

Ans.

Runtime polymorphism is when the method to be executed is determined at runtime, while compile-time polymorphism is determined at compile-time.

  • Runtime polymorphism is achieved through method overriding.

  • Compile-time polymorphism is achieved through method overloading.

  • Runtime polymorphism is also known as dynamic polymorphism.

  • Compile-time polymorphism is also known as static polymorphism.

  • Runtime polymorphism is associated with inheritance.

  • Compile-time polymorphism is associated...read more

Add your answer
Are these interview questions helpful?

Q7. Given an array of size 98 and it has natural numbers from 1-100 but 2 numbers are missing. find them

Ans.

Given an array of size 98 with natural numbers from 1-100 but 2 numbers are missing, find them.

  • Calculate the sum of all numbers from 1-100 using the formula n(n+1)/2

  • Calculate the sum of all numbers in the array

  • Subtract the sum of array from the sum of all numbers to get the sum of missing numbers

  • Find the missing numbers by iterating through the array and checking which numbers are not present

Add your answer

Q8. Develop tic-tac-toe game and write code using concepts of OOPS in CPP. (Initially told me to include artificial intelligence also but was later satisfied without it

Ans.

Develop tic-tac-toe game using OOPS concepts in CPP.

  • Create a class for the game board

  • Create a class for the players

  • Create a class for the game logic

  • Use inheritance and polymorphism for game objects

  • Implement functions for checking win/lose/draw conditions

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Delete nodes in a linked list which have greater value on right side

Ans.

Delete nodes in a linked list which have greater value on right side

  • Traverse the linked list and compare each node with its right side node

  • If the current node's value is less than its right side node, delete the current node

  • Repeat the process until the end of the linked list is reached

Add your answer

Q10. Now implement one extra funtion called max() with give the maximum of all elements in the above stack with optimized time and space complexity?

Ans.

Implement max() function to find the maximum element in a stack with optimized time and space complexity.

  • Use an additional stack to keep track of the maximum element at each step.

  • When pushing an element onto the stack, compare it with the top element of the maximum stack and push the larger one.

  • When popping an element from the stack, also pop the top element from the maximum stack if they are equal.

  • The top element of the maximum stack will always be the maximum element in the...read more

Add your answer

Q11. What is inheritance? What are diffence types of inheritance?

Ans.

Inheritance is a mechanism in object-oriented programming where a class inherits properties and behaviors from another class.

  • Inheritance allows code reuse and promotes code organization.

  • There are different types of inheritance: single inheritance, multiple inheritance, multilevel inheritance, hierarchical inheritance, and hybrid inheritance.

  • Single inheritance involves a class inheriting from a single base class.

  • Multiple inheritance involves a class inheriting from multiple ba...read more

Add your answer

Q12. In the above question calculate sum of only even numbers of fibonaaci series?

Ans.

The sum of even numbers in the Fibonacci series is calculated.

  • Generate the Fibonacci series up to a given limit

  • Iterate through the series and check if each number is even

  • If the number is even, add it to the sum

  • Return the sum of the even numbers

Add your answer

Q13. Find all permutations of a given string. (Not in lexicographic order)

Ans.

Find all permutations of a given string.

  • Use recursion to swap each character with every other character in the string.

  • Repeat the process for each substring.

  • Add the permutation to an array.

Add your answer

Q14. given two arrays that one array consists of the arrival time of trains and the other one consists of the departure time of trains. find out the minimum number of platforms so that none of them should crash.

Ans.

The minimum number of platforms needed to avoid train crashes based on arrival and departure times.

  • Sort the arrival and departure arrays in ascending order.

  • Initialize a variable to keep track of the maximum number of platforms needed.

  • Iterate through the arrival and departure arrays simultaneously.

  • If the current arrival time is less than or equal to the current departure time, increment the platform count.

  • If the current arrival time is greater than the current departure time, ...read more

View 1 answer

Q15. Difference between Methods and Constructors.(At least five)

Ans.

Methods are functions that perform a specific task, while constructors are special methods that initialize objects.

  • Constructors have the same name as the class they belong to.

  • Constructors are called automatically when an object is created.

  • Constructors can be overloaded with different parameters.

  • Methods can be called multiple times with different arguments.

  • Methods can have a return type, while constructors do not.

Add your answer

Q16. What is OOP? Describe its properties?

Ans.

OOP is a programming paradigm that organizes code into objects with properties and behaviors.

  • OOP stands for Object-Oriented Programming.

  • It focuses on creating reusable code by organizing it into objects.

  • Objects have properties (attributes) and behaviors (methods).

  • Encapsulation, inheritance, and polymorphism are key principles of OOP.

  • Example: In Java, a class represents an object with its properties and methods.

Add your answer

Q17. What are stacks and its properties?

Ans.

Stacks are a data structure that follows the Last-In-First-Out (LIFO) principle.

  • Stacks have two main operations: push (adds an element to the top) and pop (removes the top element).

  • Stacks can be implemented using arrays or linked lists.

  • Common applications of stacks include function call stack, undo/redo operations, and expression evaluation.

  • Example: A stack of books, where the last book placed is the first one to be removed.

Add your answer

Q18. Print fibonaaci series less than equal to 1000?

Ans.

Print Fibonacci series less than or equal to 1000.

  • Start with two variables, a and b, initialized to 0 and 1 respectively.

  • Print a and update a to the value of b, and b to the sum of the previous a and b.

  • Repeat until a exceeds 1000.

Add your answer

Q19. Convert a given number to its hexadecimal form

Ans.

Convert a number to its hexadecimal form

  • Use the built-in function to convert the number to hexadecimal

  • Alternatively, use the algorithm to convert the number to hexadecimal manually

  • Ensure to handle negative numbers appropriately

Add your answer

Q20. Explain singleton class and write code for it.

Ans.

Singleton class is a class that can only have one instance at a time.

  • Singleton pattern is used when we need to ensure that only one instance of a class is created and that instance can be accessed globally.

  • The constructor of a singleton class is always private to prevent direct instantiation.

  • A static method is used to access the singleton instance.

  • Example: public class Singleton { private static Singleton instance = new Singleton(); private Singleton() {} public static Single...read more

Add your answer

Q21. Detect and remove cycle in a linked list

Ans.

Detect and remove cycle in a linked list

  • Use two pointers, one slow and one fast, to detect a cycle

  • Once a cycle is detected, move one pointer to the head and iterate both pointers until they meet again

  • Set the next node of the last node in the cycle to null to remove the cycle

Add your answer

Q22. Check if given tree is BST or not?

Ans.

Check if given tree is BST or not

  • A binary tree is a BST if the value of each node is greater than all the values in its left subtree and less than all the values in its right subtree

  • Perform an in-order traversal of the tree and check if the values are in ascending order

  • Alternatively, for each node, check if its value is within the range defined by its left and right subtrees

Add your answer

Q23. Fnd if a binary tree is bst or not

Ans.

Check if a binary tree is a binary search tree or not.

  • Traverse the tree in-order and check if the elements are in sorted order.

  • Check if the left child is less than the parent and the right child is greater than the parent.

  • Use recursion to check if all the subtrees are BSTs.

  • Maintain a range for each node and check if the node value is within that range.

Add your answer

Q24. What are virtual functions?

Ans.

Virtual functions are functions in a base class that can be overridden by derived classes to provide different implementations.

  • Virtual functions are declared in a base class and can be overridden in derived classes.

  • They allow polymorphism, where a pointer to a base class can invoke different derived class implementations.

  • Virtual functions are resolved at runtime based on the actual object type.

  • They are used to achieve runtime polymorphism and dynamic binding.

Add your answer

Q25. What is abstract class?

Ans.

An abstract class is a class that cannot be instantiated and is meant to be subclassed.

  • An abstract class can have both abstract and non-abstract methods.

  • It can provide a common interface for its subclasses.

  • Subclasses of an abstract class must implement all the abstract methods.

  • Abstract classes can have constructors.

  • An abstract class cannot be instantiated directly, but its subclasses can be.

Add your answer

Q26. Write code for reversing the linked list

Ans.

Code for reversing a linked list

  • Create a new empty linked list

  • Traverse the original linked list and insert each node at the beginning of the new list

  • Return the new list

Add your answer

Q27. What will be the time complexity to add an element to the Singly Linked List? Note* there are 2 types to add an element: 1st: to add at the end using Tail pointer so O(1) 2nd: to add anywhere in the middle so O...

read more
Ans.

Time complexity to add an element to a Singly Linked List is O(1) if added at the end using Tail pointer, and O(n) if added anywhere in the middle.

  • Adding an element at the end of a Singly Linked List using the Tail pointer is a constant time operation, hence O(1).

  • Adding an element anywhere in the middle of a Singly Linked List requires traversing the list to find the insertion point, resulting in a time complexity of O(n).

  • For example, if we have a Singly Linked List with 5 el...read more

Add your answer

Q28. Explain Prims and Kruskal’s algorithms

Ans.

Prims and Kruskal's algorithms are used to find the minimum spanning tree in a graph.

  • Prims algorithm starts with a single vertex and adds the minimum weight edge to the tree until all vertices are included.

  • Kruskal's algorithm starts with all vertices as separate trees and merges them by adding the minimum weight edge until all vertices are included.

  • Both algorithms have a time complexity of O(E log V) where E is the number of edges and V is the number of vertices.

  • Prims algorit...read more

Add your answer

Q29. find two missing number from a given array ,without sorting and o(n)

Ans.

Find two missing numbers from an unsorted array in O(n) time complexity.

  • Calculate the sum of all numbers from 1 to n using the formula n*(n+1)/2

  • Calculate the sum of all numbers in the given array

  • Subtract the sum of array from the sum of all numbers to get the sum of missing numbers

  • Use the sum of missing numbers and the sum of squares of all numbers from 1 to n to calculate the missing numbers using simultaneous equations

Add your answer

Q30. What is caching and why do we need to do caching

Ans.

Caching is the process of storing frequently accessed data in a temporary storage to improve performance.

  • Caching reduces the need to fetch data from the original source, improving response time.

  • It helps in reducing network traffic and server load.

  • Caching can be done at various levels like browser caching, CDN caching, and server-side caching.

  • Examples of caching include browser caching of website assets, CDN caching of static content, and database query result caching.

View 1 answer

Q31. What can be done to balance the load of requests coming to a single server

Ans.

To balance the load of requests on a single server, one can implement load balancing techniques.

  • Implementing a load balancer to distribute incoming requests evenly across multiple servers

  • Using round-robin algorithm to route requests to different servers in a sequential manner

  • Utilizing server health checks to monitor the performance of each server and adjust the load distribution accordingly

Add your answer

Q32. one golden bricks n divide it to min number of part so that u can pay each day salary to a worker

Ans.

Divide a golden brick into minimum parts to pay daily salary to a worker.

  • The number of parts needed will depend on the daily salary of the worker.

  • The size of the parts should be equal.

  • The parts should be small enough to cover the daily salary but large enough to minimize the number of parts.

  • The formula to calculate the number of parts is: number of parts = total value of the golden brick / daily salary

Add your answer

Q33. make 4 equal shape part of a cake if u cut 1/4 part already

Ans.

Cut the cake in half horizontally and vertically to get 4 equal shape parts.

  • Cut the cake in half horizontally.

  • Cut the cake in half vertically.

  • Arrange the resulting pieces to form 4 equal shape parts.

  • Ensure each part has the same amount of cake.

  • Use a knife or cake slicer to make the cuts.

  • Be careful not to break the cake while cutting.

Add your answer

Q34. JSON How to optimize JSON? Wrote a Py code to convert optimized JSON into normal JSON. An alternative method of storing JSON data in another DS

Ans.

Optimizing JSON involves minimizing redundant data, using efficient data structures, and compressing data when necessary.

  • Minimize redundant data by using references or IDs instead of repeating the same information multiple times.

  • Use efficient data structures like arrays or dictionaries to store JSON data in a more organized and accessible way.

  • Compress JSON data using techniques like gzip or deflate to reduce file size and improve loading times.

  • Example: Instead of storing the ...read more

Add your answer

Q35. find ave salary without disclosing any one salary

Ans.

To find average salary without disclosing any one salary

  • Collect salaries of all employees

  • Add all salaries and divide by total number of employees

  • Do not disclose any individual salary

Add your answer

Q36. React What's the difference between using NextJs and ReactJs? Routing in NextJs. VDOM? Event Listeners. Some Hooks in NextJs.

Ans.

NextJs is a framework built on top of ReactJs, providing server-side rendering and other features for easier development.

  • NextJs is a framework built on top of ReactJs, providing server-side rendering, routing, and other features for easier development.

  • ReactJs is a JavaScript library for building user interfaces, while NextJs is a framework that adds functionality like server-side rendering and routing to React applications.

  • NextJs simplifies the process of building React appli...read more

Add your answer

Q37. find right veiw of a binary tree

Ans.

To find the right view of a binary tree, we need to traverse the tree and keep track of the rightmost node at each level.

  • Traverse the tree using level order traversal

  • At each level, keep track of the rightmost node

  • Add the rightmost node to the result array

  • Return the result array

Add your answer

Q38. 1.Find next greater element for each element in the given array of integers

Ans.

Use stack to find next greater element for each element in the array

  • Create an empty stack to store indices of elements

  • Iterate through the array and for each element, pop elements from stack until finding a greater element

  • Store the next greater element in a result array

Add your answer

Q39. 2.In an array, find triplets such that their sum is 0.

Ans.

Use three pointers to find triplets with sum 0 in an array.

  • Sort the array first to easily find triplets.

  • Use three pointers - one fixed, one moving from left, one moving from right.

  • Check if the sum of the three pointers is 0, if not adjust pointers accordingly.

Add your answer

Q40. Do you own a bike? If you don't own one can you manage to own one?

Ans.

Yes, I own a bike and I am an avid cyclist.

  • Yes, I own a bike and use it for commuting and recreational purposes.

  • I am familiar with bike maintenance and safety practices.

  • I have participated in cycling events and races.

Add your answer

Q41. Design a database for a blogging website

Ans.

Database design for a blogging website

  • Create tables for users, blog posts, comments, and categories

  • Use primary and foreign keys to establish relationships between tables

  • Include fields such as title, content, author, date, and tags

  • Implement indexing for faster retrieval of data

  • Consider implementing a caching mechanism for improved performance

Add your answer

Q42. Given an array, remove all duplicates in place

Ans.

Remove duplicates from array of strings in place

  • Use a HashSet to keep track of unique elements

  • Iterate through the array and remove duplicates by checking if element is already in the HashSet

  • Update the array in place by shifting elements to fill in the removed duplicates

Add your answer

Q43. Pseudo code to validate password

Ans.

Pseudo code to validate password

  • Create a function that takes a password as input

  • Check if the password meets the required criteria (e.g. length, special characters)

  • Return true if the password is valid, false otherwise

Add your answer

Q44. reverse linked list with multiple approach

Ans.

Reverse a linked list using multiple approaches.

  • Iterative approach: Use three pointers to reverse the links between nodes.

  • Recursive approach: Recursively reverse the rest of the list and adjust the links.

  • Stack approach: Push all the nodes onto a stack and then pop them to create the reversed list.

Add your answer

Q45. system design for twitter.

Ans.

Twitter system design involves multiple components such as servers, databases, caching, and APIs.

  • Use sharding to distribute data across multiple servers

  • Implement caching to reduce database load

  • Use message queues for handling high traffic

  • Implement APIs for user authentication and data retrieval

  • Use load balancers to distribute traffic evenly

  • Implement a search engine for efficient search functionality

Add your answer

Q46. Commuting to work by train?

Ans.

Yes, I prefer commuting to work by train for its reliability and eco-friendliness.

  • I find commuting by train to be more reliable than other modes of transportation, as it is not affected by traffic congestion.

  • Taking the train is also more eco-friendly compared to driving a car, as it reduces carbon emissions.

  • Commuting by train allows me to relax, read, or work during the journey, making it a productive use of time.

Add your answer

Q47. Design database for my college

Ans.

Design a database for a college

  • Create tables for students, courses, professors, departments, and grades

  • Establish relationships between tables using foreign keys

  • Include attributes such as student ID, course ID, professor ID, department ID, and grade

  • Consider normalization to reduce redundancy and improve data integrity

Add your answer

Q48. Angle between minute and hour hand at 3:15

Ans.

Angle between minute and hour hand at 3:15

  • At 3:15, the hour hand is at 3 and the minute hand is at 15

  • Calculate the angle between the two hands using the formula: |(30*H) - (11/2)*M|

  • Where H is the hour and M is the minute

  • The angle between the hands at 3:15 is 7.5 degrees

Add your answer

Q49. What happen when we visit Url

Ans.

When we visit a URL, the browser sends a request to the server hosting the website, which then responds with the requested web page.

  • Browser sends a request to the server hosting the website

  • Server processes the request and responds with the requested web page

  • Web page is displayed in the browser for the user to interact with

Add your answer

Q50. What you know about carwale?

Ans.

CarWale is an online platform that provides information about new and used cars, including prices, specifications, and reviews.

  • CarWale is a popular website in India for car buyers and enthusiasts.

  • It offers a wide range of car models from various manufacturers.

  • Users can compare different cars based on their features, prices, and user reviews.

  • CarWale also provides information about car dealerships and offers assistance in buying and selling cars.

  • The platform offers news and art...read more

View 1 answer

Q51. Subarray with sum 0

Ans.

Find subarray in an array with sum 0

  • Iterate through the array and keep track of the running sum

  • Store the running sum in a hashmap and check if the same sum has been seen before

  • If the sum is 0 or if the running sum is already in the hashmap, a subarray with sum 0 exists

Add your answer

Q52. Journey through school life till now

Ans.

I have always been a dedicated student, excelling in academics and extracurricular activities.

  • Consistently achieved top grades in all subjects

  • Participated in various school competitions and won awards

  • Served as a class representative and organized events

  • Took part in sports teams and cultural activities

Add your answer

Q53. find element in rotated sorted array

Ans.

Use binary search to find the target element in a rotated sorted array.

  • Perform binary search to find the pivot element where the array is rotated.

  • Based on the pivot element, determine which half of the array to search for the target element.

  • Continue binary search in the appropriate half of the array to find the target element.

Add your answer

Q54. Dsa on arrays and strings

Ans.

DSA on arrays and strings is essential for efficient coding and problem-solving.

  • Arrays and strings are fundamental data structures in programming.

  • Knowledge of sorting and searching algorithms is crucial for array manipulation.

  • String manipulation techniques like substring, concatenation, and comparison are important.

  • Dynamic programming is a useful technique for solving problems on arrays and strings.

  • Examples: finding the largest element in an array, reversing a string, checkin...read more

View 1 answer

Q55. Caching and its uses

Ans.

Caching is the process of storing data in a temporary location to reduce access time and improve performance.

  • Caching helps reduce the load on servers by serving frequently accessed data quickly

  • It can improve performance by reducing the time needed to retrieve data from the original source

  • Examples include browser caching, CDN caching, and database caching

Add your answer

Q56. Implement 2 stacks in an array

Ans.

Implement 2 stacks in an array

  • Divide the array into two halves

  • Use top1 and top2 to keep track of top elements of stacks

  • Push and pop elements from respective halves

  • Check for overflow and underflow conditions

Add your answer

Q57. Difference B/w Http and https

Ans.

HTTP is a protocol used for transferring data over the internet, while HTTPS is a secure version of HTTP that encrypts data.

  • HTTP stands for Hypertext Transfer Protocol, used for transmitting data over the internet.

  • HTTPS stands for Hypertext Transfer Protocol Secure, which adds a layer of security by encrypting data.

  • HTTP operates on port 80, while HTTPS operates on port 443.

  • HTTPS uses SSL/TLS certificates to establish a secure connection between the client and server.

  • HTTPS is ...read more

Add your answer

Q58. Implement LRU Cache

Ans.

LRU Cache is a data structure that stores the most recently used items and discards the least recently used items.

  • Use a hash table to store key-value pairs

  • Use a doubly linked list to keep track of the order of items

  • When an item is accessed, move it to the front of the list

  • When the cache is full, remove the least recently used item from the back of the list

  • Lookup and insertion should be O(1) time complexity

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at null

based on 10 interviews in the last 1 year
Interview experience
4.1
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

4.2
 • 288 Interview Questions
4.1
 • 222 Interview Questions
4.2
 • 206 Interview Questions
4.0
 • 161 Interview Questions
4.2
 • 147 Interview Questions
3.8
 • 138 Interview Questions
View all
Top Carwale Interview Questions And Answers
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter