Add office photos
Employer?
Claim Account for FREE

Morgan Stanley

3.7
based on 1.5k Reviews
Video summary
Filter interviews by

10+ Pierburg India Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Sort 0 and 1 Problem Statement

Given an integer array ARR of size N containing only integers 0 and 1, implement a function to sort this array. The solution should scan the array only once without using any addi...read more

Ans.

Implement a function to sort an array of 0s and 1s in linear time complexity without using additional arrays.

  • Iterate through the array and maintain two pointers, one for 0s and one for 1s.

  • Swap elements at the two pointers to sort the array in place.

  • Time complexity should be O(N) where N is the size of the array.

Add your answer

Q2. Minimum Number of Vertices to Reach All Nodes Problem Statement

In a directed acyclic graph with 'N' nodes, given a matrix 'edges' of size M x 2 representing 'M' edges where each edge is directed from node edge...read more

Ans.

The problem involves finding the smallest set of vertices from which all nodes in a directed acyclic graph are reachable.

  • Create a directed graph using the given edges.

  • Perform a topological sort to find the vertices that can reach all other nodes.

  • Output the smallest set of vertices in sorted order.

View 2 more answers

Q3. Flatten a Multilevel Sorted Linked List

You are given a linked list with 'N' nodes, where each node contains two pointers: one is 'NEXT' pointing to the next node in the list, and the other is 'CHILD', pointing...read more

Ans.

Flatten a multilevel sorted linked list while maintaining sorted order.

  • Iterate through the linked list nodes and maintain a stack to keep track of child nodes.

  • Merge the child nodes with the parent node in sorted order.

  • Update the pointers to create a single level flattened linked list.

Add your answer

Q4. Box Stacking Problem Statement

Consider you are provided with 'n' different types of rectangular 3D boxes. For each type of box, you have three separate arrays: height, width, and length that define the dimensi...read more

Ans.

The task is to stack different types of rectangular 3D boxes to achieve the maximum possible height by following certain constraints.

  • Sort the boxes based on their base dimensions in non-increasing order.

  • Use dynamic programming to find the maximum height achievable by stacking the boxes.

  • Consider all possible rotations of each box to maximize the height.

  • Ensure that the base dimensions of the boxes below are strictly larger than the ones above.

  • Handle multiple copies of the same ...read more

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

Q5. Sum of Digits Problem Statement

Given an integer 'N', continue summing its digits until the result is a single-digit number. Your task is to determine the final value of 'N' after applying this operation iterat...read more

Ans.

Given an integer, sum its digits until a single-digit number is obtained. Determine the final single-digit integer.

  • Iteratively sum the digits of the integer until a single-digit number is obtained

  • Output the final single-digit integer for each test case

  • Handle multiple test cases efficiently

  • Ensure the final value is less than 10

Add your answer

Q6. Implementing a Priority Queue Using Heap

Ninja has been tasked with implementing a priority queue using a heap data structure. However, he is currently busy preparing for a tournament and has requested your ass...read more

Ans.

Implement a priority queue using a heap data structure by completing the provided class functions.

  • Implement push(), pop(), getMaxElement(), and isEmpty() functions in the given class structure.

  • Use a heap data structure to maintain the priority queue.

  • Handle different types of queries (push, pop, getMaxElement, isEmpty) as per the given instructions.

  • Ensure the functions return the correct values based on the type of query.

  • Test the implementation with sample input and output pro...read more

Add your answer
Are these interview questions helpful?
Q7. How would you design a system where users can subscribe to specific topics, and receive messages whenever a new message is posted related to those topics?
Ans.

Design a system for users to subscribe to topics and receive notifications for new messages.

  • Create a user profile where they can select topics of interest to subscribe to.

  • Implement a messaging system that sends notifications to users when new messages are posted related to their subscribed topics.

  • Allow users to manage their subscriptions and preferences easily.

  • Utilize a database to store user subscriptions and messages for efficient retrieval.

  • Consider implementing push notifi...read more

Add your answer
Q8. What is the difference between an abstract class and an interface in Object-Oriented Programming?
Ans.

Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.

  • Abstract class can have constructors, fields, and methods, while interface cannot have any implementation.

  • A class can only extend one abstract class, but can implement multiple interfaces.

  • Abstract classes are used to define common characteristics of subclasses, while interfaces are used to define a contract for classes to implement.

  • Example: Abstract class 'Shape' wit...read more

Add your answer
Share interview questions and help millions of jobseekers 🌟
Q9. Why is the time complexity of Binary Search O(Log n)?
Ans.

Binary Search halves the search space in each iteration, leading to a time complexity of O(Log n).

  • Binary Search divides the array into two halves and compares the target value with the middle element.

  • If the target value is less than the middle element, it searches in the left half; otherwise, it searches in the right half.

  • This process continues until the target value is found or the subarray size becomes 0.

  • Since each comparison reduces the search space by half, the time compl...read more

Add your answer
Q10. What is the difference between HashMap and HashSet?
Ans.

HashMap is a collection of key-value pairs, while HashSet is a collection of unique elements.

  • HashMap allows duplicate values but keys must be unique

  • HashSet does not allow duplicate elements

  • HashMap uses key-value pairs for storing data, while HashSet only stores individual elements

  • Example: HashMap<String, Integer> map = new HashMap<>(); HashSet<String> set = new HashSet<>();

Add your answer
Q11. How is memory allocation handled in recursion?
Ans.

Memory allocation in recursion involves creating a new stack frame for each recursive call.

  • Each recursive call creates a new stack frame to store local variables and function parameters.

  • Memory is allocated on the stack for each stack frame, which can lead to stack overflow if too many recursive calls are made.

  • Once a recursive call returns, its stack frame is deallocated to free up memory.

  • Example: Factorial function recursively calls itself to calculate the factorial of a numb...read more

Add your answer
Q12. What is the Round Robin Algorithm?
Ans.

Round Robin Algorithm is a CPU scheduling algorithm where each process is assigned a fixed time slice in a cyclic manner.

  • Each process is given a small unit of time to execute, called a time slice or quantum.

  • Once a process's time slice expires, it is moved to the end of the ready queue.

  • The scheduler then moves to the next process in the queue and allocates it the CPU for its time slice.

  • This continues until all processes have had a turn to execute.

  • Example: If time slice is 10ms...read more

Add your answer
Q13. Why are virtual destructors needed?
Ans.

Virtual destructors are needed to ensure proper cleanup of resources in derived classes when using polymorphism.

  • Virtual destructors are necessary to ensure that the destructor of the most derived class is called when deleting a base class pointer to a derived class object.

  • Without virtual destructors, only the base class destructor would be called, leading to memory leaks and resource leaks in the derived class.

  • Virtual destructors allow for proper cleanup of resources allocate...read more

Add your answer

Q14. Given a number, print it in words

Ans.

A program to convert a given number into words.

  • Use a switch statement or if-else conditions to handle different cases

  • Break down the number into its individual digits and convert each digit into words

  • Handle special cases like numbers between 10 and 20

  • Consider adding a function to handle larger numbers with appropriate suffixes

Add your answer
Q15. What is an AVL Tree?
Ans.

An AVL tree is a self-balancing binary search tree where the heights of the two child subtrees of any node differ by at most one.

  • AVL trees are named after their inventors Adelson-Velsky and Landis.

  • They are used to maintain sorted data and ensure efficient search, insertion, and deletion operations.

  • Balancing in AVL trees is achieved through rotations to maintain the height balance factor.

  • Example: Inserting elements 1, 2, 3, 4, 5 into an AVL tree will result in a balanced tree ...read more

Add your answer
Q16. Why are threads needed?
Ans.

Threads are needed to allow a program to perform multiple tasks concurrently, improving performance and responsiveness.

  • Threads allow for parallel execution of tasks, utilizing multiple CPU cores efficiently.

  • Threads can improve responsiveness in applications by handling multiple tasks simultaneously.

  • Threads are essential for implementing features like background processing, multitasking, and handling user input concurrently.

  • Examples include web servers handling multiple client...read more

Add your answer

Q17. Explain Bubble Sort

Ans.

Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.

  • Bubble Sort compares adjacent elements and swaps them if they are in the wrong order.

  • It continues this process until the entire list is sorted.

  • It is called Bubble Sort because smaller elements 'bubble' to the top of the list.

  • Bubble Sort has a time complexity of O(n^2) in the average and worst case scenarios.

  • Example: Given a...read more

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

Interview Process at Pierburg India

based on 1 interviews
4 Interview rounds
Technical Round
HR Round
Aptitude Test Round
Group Activity Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Technology Analyst Interview Questions from Similar Companies

3.6
 • 165 Interview Questions
View all
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

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