Quantiphi Analytics Solutions Private Limited
Mageba Bridge Products Interview Questions and Answers
Q1. Fruits and Baskets Problem Statement
You are given 'n' fruit trees planted along a road, numbered from 0 to n-1. Each tree bears a fruit type represented by an uppercase English alphabet. A Ninja walking along ...read more
The problem is to find the maximum number of fruits the Ninja can put in both baskets after satisfying given conditions.
The Ninja can start at any tree and end at any tree, but cannot skip a tree.
He can pick one fruit from each tree until he cannot, i.e., when he has to pick a fruit of the third type.
The restriction is that each basket can have only one type of fruit.
We need to find the maximum number of fruits that can be put in both baskets.
Q2. Sort 0 1 2 Problem Statement
Given an integer array arr
of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.
Input:
The first line contains an integer 'T' representing the number of...read more
The problem requires sorting an array of 0s, 1s, and 2s in a single scan.
Use three pointers to keep track of the positions of 0s, 1s, and 2s.
Initialize the low pointer at the beginning of the array and the high pointer at the end.
Iterate through the array using a current pointer and swap elements based on their values.
Move the pointers accordingly until the array is sorted.
The time complexity of this solution is O(N) as we only iterate through the array once.
Q3. What is treeset and weakhashmap?
TreeSet is a sorted set implementation in Java. WeakHashMap is a hash table-based Map implementation with weak keys.
TreeSet is implemented using a tree structure and maintains elements in sorted order.
WeakHashMap is a Map implementation that allows keys to be garbage collected when they are no longer referenced.
WeakHashMap is useful for caching or memoization where the keys are not always needed and can be garbage collected to free up memory.
Q4. What is comparable and comparator?
Comparable and Comparator are interfaces used for sorting objects in Java.
Comparable interface is used to define the natural ordering of objects based on their own class.
Comparator interface is used to define the ordering of objects based on a separate class.
Comparable interface has compareTo() method while Comparator interface has compare() method.
Comparable interface is implemented by the class whose objects need to be sorted while Comparator interface is implemented by a s...read more
Q5. oops concept, explain each of them
Object-oriented programming concepts that help in organizing and structuring code.
Encapsulation: Bundling data and methods that operate on the data into a single unit (class).
Inheritance: Allowing a class to inherit properties and behavior from another class.
Polymorphism: Ability to present the same interface for different data types.
Abstraction: Hiding the complex implementation details and showing only the necessary features of an object.
Q6. REST API for User CRUD
Design a RESTful API for CRUD operations on user resources.
Use HTTP methods like GET, POST, PUT, DELETE for CRUD operations
Create endpoints like /users for listing all users, /users/{id} for specific user
Use status codes like 200 for success, 404 for not found, 400 for bad request
Implement authentication and authorization mechanisms for security
Include request and response body formats like JSON or XML
Interview Process at Mageba Bridge Products
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month