Publicis Sapient
400+ Balwom Textiles Interview Questions and Answers
You are given an array of integers of size ‘N’. You have to make the elements of the array equal, and the cost of changing the element ‘x’ to ‘y’ is abs(x -y). Your task is to find the ...read more
You are given two sorted linked lists. You have to merge them to produce a combined sorted linked list. You need to return the head of the final linked list.
Note:
The given lin...read more
Q3. pirates of different ages have a treasure of 100 gold coins. On their ship, they decide to split the coins using this scheme: The oldest pirate proposes how to share the coins, the OTHER pirates (not including ...
read moreThe oldest pirate proposes to keep 98 coins for himself and give 1 coin to each of the other pirates.
The oldest pirate will propose to keep the majority of the coins for himself to ensure the vote passes.
The other pirates will vote in favor of the proposal to avoid being thrown overboard.
The proposed distribution will be 98 coins for the oldest pirate and 1 coin for each of the other pirates.
Given a singly linked list of integers. Your task is to return the head of the reversed linked list.
For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked lis...read more
You have been given ‘K’ different arrays/lists, which are sorted individually (in ascending order). You need to merge all the given arrays/list such that the output array/list should be sor...read more
Q6. There are 10 black socks and 10 white socks in a drawer. You have to go out wearing your shoes. So how many maximum number of times you need to remove a sock from drawer so that you can go out? You can remove o...
read moreYou have been given two singly Linked Lists, where each of them represents a positive number without any leading zeros.
Your task is to add these two numbers and print the summatio...read more
You are given a matrix ‘ARR’ with dimensions ‘N’ * ‘M’ and containing only 0s and 1s where each row is sorted.
Your task is to find the index of the row with a maximum number of 1s in it. Rows and col...read more
Q9. 3 men go into a hotel. The man behind the desk says a room is $30 so each man pays $10 and goes to the room. A while later the man behind the desk realized the room was only $25 so he sent the bellboy to the 3 ...
read moreGiven an array of integers ‘ARR’ and an integer ‘X’, you are supposed to find the number of subarrays of 'ARR' which have bitwise XOR of the elements equal to 'X'.
Note:
An array ‘B’ i...read more
You are given a string (STR) of length N.
Your task is to find the longest palindromic substring. If there is more than one palindromic substring with the maximum length, return the...read more
You have been given an array/list 'HEIGHTS' of length ‘N. 'HEIGHTS' represents the histogram and each element of 'HEIGHTS' represents the height of the histogram bar. Consider th...read more
Q13. Three friends rent a room for Rs.30 by paying Rs.10 each. The owner decides to give them a discount Rs.5 and gives it to the broker. The broker who a cunning man takes Rs.2. and returns one rupee to each of the...
read moreThe missing rupee is not actually missing. The calculation is misleading and does not account for the total amount paid.
The initial amount paid by each person was Rs.10, totaling Rs.30.
The owner gave them a discount of Rs.5, so they paid Rs.25 in total.
The broker took Rs.2, leaving them with Rs.23.
When the broker returned Rs.1 to each person, they each received Rs.1 back, totaling Rs.3.
So, the total amount paid by the three friends is Rs.25 + Rs.3 = Rs.28.
The remaining Rs.2 i...read more
You are given an array of integers. You need to sort the array in ascending order using quick sort.
Quick sort is a divide and conquer algorithm in which we choose a pivot point and ...read more
You are given an array arr of length N. You have to return a list of integers containing the NGE(next greater element) of each element of the given array. The NGE for an element X is the fir...read more
Q16. You have three bags and three labels. One bag has only red balls, one has only blue balls and one has both red and blue balls. Three labels are R, B and RB. R label was meant for the bag with only red balls, B ...
read moreYou have been given a long type array/list 'ARR' of size 'N'. It represents an elevation map wherein 'ARR[i]' denotes the elevation of the 'ith' bar. Print the total amount of rainwater that ...read more
You are given a string ‘STR’ of lowercase alphabets and an integer K. Your task is to count all the possible substrings that are not necessarily distinct but should have exactly...read more
A permutation is a mathematical technique that determines the number of possible arrangements in a set when the order of the arrangements matters. A string of length 'N' has 'N'! permutations.
Give...read more
You have been given an undirected graph with 'N' vertices and 'M' edges. The vertices are labelled from 1 to 'N'.
Your task is to find if the graph contains a cycle or not.
A ...read more
Q21. You have three bags and three labels. One bag has only apples, one has only oranges and one has both apples and oranges. Three labels are Ap,Or and ApOr.Ap label was meant for the bag with only Apples, Or label...
read moreNinja has been given two sorted integer arrays/lists ‘ARR1’ and ‘ARR2’ of size ‘M’ and ‘N’. Ninja has to merge these sorted arrays/lists into ‘ARR1’ as one sorted array. You may have to a...read more
The task is to merge two sorted arrays into one sorted array.
Create a new array with size M + N to store the merged array
Use two pointers to iterate through the elements of ARR1 and ARR2
Compare the elements at the current pointers and add the smaller element to the new array
Move the pointer of the array from which the element was added
Repeat the process until all elements are merged
If there are remaining elements in ARR2, add them to the new array
Return the merged array
Ninja found ‘N’ points on a 2D plane. The points are given in the form of a “N ✕ 2” size array “POINTS”. Ninja wants to find if there is a line such that it is parallel to the Y-axis and it refle...read more
Q24. You are given 2 eggs.You have access to a 100-storey sapient building.Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor....
read moreNinja started a gaming shop and for that shop, he is planning to make a new game ‘String Ka Khel’. In that game user is provided with ‘N’ number of strings and he has to find out the maximum lengt...read more
You are given an array/list ARR consisting of N integers. Your task is to find the maximum possible sum of a non-empty subarray(contagious) of this array.
Note: An array C is a subarray of a...read more
Given a singly linked list of integers. Your task is to return the head of the reversed linked list.
For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked ...read more
You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.
A cell is said to be connected to...read more
You are given a string 'STR' consisting of lowercase English alphabet letters. You can perform at most 'K' operations on this string. In one operation, you can choose any character of...read more
You're given string ‘STR’ consisting solely of “{“, “}”, “(“, “)”, “[“ and “]” . Determine whether the parentheses are balanced.
Input Format:
The first line contains an Integer 'T' which denot...read more
You are given an arbitrary binary tree consisting of 'N' nodes where each node is associated with a certain value. You need to find out the height of the tree.
Height of a binary tree is th...read more
The height of a binary tree is the maximum number of edges from the root to a leaf node.
Traverse the tree recursively and keep track of the maximum height
If the current node is null, return 0
Otherwise, calculate the height of the left and right subtrees and return the maximum height plus 1
Q32. You are at an unmarked intersection… one way is the City of Lies and another way is the City of Truth. Citizens of the City of Lies always lie. Citizens of the City of Truth always tell the truth. A citizen of ...
read moreQ33. Rajeev is trapped at top a building 200m high. He has with him a rope 150m long. There is a hook at the top where he stands. Looking down, he notices that midway between him and the ground, at a height of 100m,...
read moreYou have been given a matrix of ‘N’ rows and ‘M’ columns filled up with integers. Find the minimum sum that can be obtained from a path which from cell (x,y) and ends at the top left corner (1,...read more
Q35. You are given a match-box and two candles of equal size, which can burn 1 hour each. You have to measure 90 minutes with these candles. (There is no scale or clock). How do you do?
Use one candle as a timer and the other to measure 90 minutes.
Light both candles at the same time.
Let one candle burn for 30 minutes.
Then light the other candle.
When the second candle burns out, 90 minutes have passed.
The first candle will have burned for 60 minutes, serving as a timer.
A thief is robbing a store and can carry a maximum weight of ‘W’ into his knapsack. There are 'N' items available in the store and the weight and value of each item is known to the thief. Considerin...read more
Implement a Stack Data Structure specifically to store integer data using two Queues.
There should be two data members, both being Queues to store the data internally. You may use the inbuilt Q...read more
You're given string ‘STR’ consisting solely of “{“, “}”, “(“, “)”, “[“ and “]” . Determine whether the parentheses are balanced.
Input Format:
The first line contains an Integer 'T' which denot...read more
Q39. You have two ropes/candels. Each takes exactly 60 minutes to burn. They are made of different material so even though they take the same amount of time to burn, they burn at separate rates. In addition, each ro...
read moreQ40. I was to imagine a situation where there’s is an empty wet, water spilled room(ceiling to floor height- 12 ft), a dead man(7 ft height) hung by a 3 ft rope. I’m asked how could the man hung himself there?
The man stood on a block of ice, which melted and caused him to hang himself.
The man stood on a block of ice that was placed in the room.
Over time, the block of ice melted, causing the man to hang himself.
The length of the rope was initially longer than 3 ft, but as the ice melted, the rope became shorter.
The water from the melted ice filled the room, making it wet.
Q41. • What is Data Extensions? How it is different from Lists? • What is A/B testing and how to perform A/B Testing? • How do you filter data in Date extension? • What are Automation Studio Activities? • Can you ex...
read moreQuestions related to Salesforce Marketing Cloud features and functionalities.
Data Extensions are tables that store data in Marketing Cloud, while Lists are simple collections of subscribers.
A/B testing is a method of comparing two versions of a campaign to determine which one performs better.
Data in Data Extensions can be filtered using SQL queries or Filter Activities in Automation Studio.
Automation Studio Activities are pre-built actions that can be used to automate marketi...read more
You are given a string 'STR'. The string contains [a-z] [A-Z] [0-9] [special characters]. You have to find the reverse of the string.
For example:
If the given string is: STR = "abcde". You h...read more
Seven unit Gold bar puzzle
An employee works for an employer for 7 days. The employer has a gold rod of 7 units. How does the employer pay to the employee, so that the number of employee’s units increases...read more
What is OOPS . Tell the different OOps features. Implement method overloading in c++
What is Synchronisation. How can we implement synchronisation in C++
What is Normalisation? Also implement a...read more
Q45. If I give you 4 tablets which contain 2 for fever and 2 for cold.All 4 have same size, shape and color, No cover. You have to take 1 cold and 1 fever tablet right now. How will you choose correctly?
Q46. You have 4 wine bottles, one of which is poisoned. You want to determine which bottle is poisoned by feeding the wines to the rats. How many minimum rats are necessary to find the poisoned bottle?
Print the following pattern for the given N number of rows.
Pattern for N = 4
A BC CDE DEFG
Input format :
Integer N (Total no. of rows)
Output format :
Pattern in N lines
Constraints
0 <= N...read more
There are two gates, one to hell and the other to heaven. Two gatekeepers, one for each gate. One of them always speaks the truth and the other always lies but you don’t know which one guards which gate....read more
An instance where I resolved a conflict
An instance of my leadership skills
An instance where I brought or implemented a new idea and how it went
An instance where I made a mistake and what I lea...read more
Q50. You are given a 100 integers and these integers are in the range of 1 to 100. There are no duplicates in list. One of the integers is missing.Find the missing integer. What if 2 no is missing?
Q51. How many runs a single player can score in One day match (50 overs/ 300 balls)… No ‘no balls’, no wides, no extras, no over throws.So how much runs he can score max?
Q52. You have 8 balls which are identical(completely). You are given a weighing scale. How many times would you measure to get the odd ball out?
Weighing 3 times is enough to find the odd ball out.
Divide the balls into 3 groups of 3 each and weigh any 2 groups against each other.
If they are equal, the odd ball is in the third group. Weigh 2 balls from that group to find the odd one.
If they are not equal, the odd ball is in the heavier group. Weigh 2 balls from that group to find the odd one.
We already had C language then what was the need to create C++?
What are the basic concepts/pillars of object-oriented programming?
Give real-life examples of Inheritance, polymorphism and abstra...read more
Q54. An unsorted array has numbers. Find the duplicate numbers and return the array.
Find duplicate numbers in an unsorted array and return the array.
Iterate through the array and keep track of seen numbers using a hash table.
If a number is already in the hash table, it is a duplicate.
Add the duplicate number to a new array and return it.
Q55. How to you reverse a string without using any looping and inbuilt functions?
To reverse a string without using any looping and inbuilt functions, we can use recursion.
Create a function that takes a string as input.
If the length of the string is 0 or 1, return the string.
Otherwise, call the function recursively with the substring starting from the second character and concatenate the first character at the end.
Return the reversed string.
Example: reverseString('hello') returns 'olleh'.
Q56. What is a SSR and CSR website and when to use which one.
SSR and CSR websites refer to server-side rendering and client-side rendering respectively. SSR is used for better initial load performance and SEO, while CSR is suitable for dynamic and interactive content.
SSR (Server-Side Rendering) websites render the web pages on the server and send the fully rendered HTML to the client.
CSR (Client-Side Rendering) websites load a minimal HTML skeleton and then use JavaScript to fetch data and render the content on the client-side.
SSR is b...read more
Q57. There are three ants on three corners of an equilateral triangle. they can move in any direction but only along the triangle edges. probability that any two ants collide each other
Q58. What is limit for no of arguments passed to functions? if limit is 10 den how to pass more parameters? Ans:- either Array or Structure
The limit for the number of arguments passed to functions is not fixed. Arrays or structures can be used to pass more parameters.
The limit for the number of arguments passed to functions is not fixed and depends on the programming language and system architecture.
In C programming language, there is no limit on the number of arguments that can be passed to a function.
In Java, the maximum number of arguments that can be passed to a method is 255.
To pass more parameters than the...read more
What is Polymorphism?. Give real life examples of Polymorphism in OOPS
Q60. If I am ready to accept a project in Java, if Sapient had trained you in DotNet earlier
I would be ready to accept a project in Java even if I was trained in DotNet earlier.
I have a strong foundation in programming principles and concepts, which can be applied to any language.
I am confident in my ability to quickly learn and adapt to new technologies.
I have experience working with multiple programming languages and frameworks.
I can leverage my knowledge of DotNet to understand similar concepts in Java.
I am motivated and enthusiastic about taking on new challenge...read more
Q61. How do you cut a circular cake into eight equal pieces in just 3 cuts?
What is Early Binding and Late Binding in C++ ?
If you won a Rs.10-crore lottery, would you still work?
Give me an example of your creativity.
What makes you happy?
Q64. Explain Clean Architecture, how it works?
Clean Architecture is a software design principle that separates concerns and promotes testability, maintainability, and scalability.
Clean Architecture emphasizes separation of concerns by dividing the codebase into layers: Presentation, Domain, and Data.
Each layer has its own responsibilities and dependencies flow inward, ensuring loose coupling and high cohesion.
The Presentation layer handles user interactions and UI components.
The Domain layer contains business logic and u...read more
Q65. Without lifting the pen meet 9 point arranged in squre of 3×3, using 4 lines?
Connect 9 points in a 3x3 square using 4 lines without lifting the pen.
Start at any point and draw a line to the adjacent point
Continue drawing lines until all points are connected
Make sure the lines intersect to form a square
Q66. If you had to accommodate a CR in agile how would you do so?
To accommodate a CR in agile, the business analyst should follow a process that includes evaluating the impact, prioritizing, estimating effort, and incorporating the change into the sprint.
Evaluate the impact of the change request on the project scope, timeline, and resources.
Prioritize the change request based on its urgency and importance.
Estimate the effort required to implement the change and communicate it to the stakeholders.
Discuss the change request with the developm...read more
Q67. How many queues will you use to implement a priority queue?
A priority queue can be implemented using a single queue or multiple queues.
One approach is to use a single queue and assign priorities to elements using a separate data structure.
Another approach is to use multiple queues, each representing a different priority level.
For example, if there are three priority levels, three queues can be used to implement the priority queue.
What is Data Abstraction and how to achive it ?
Q69. 1. Explain oops concepts in coding. 2. Write a program to find missing no in a list 3. Write a program to count the alphabets in a string. 4. Explain project framework from scratch 5. Explain selenium code 6. B...
read moreThe interview questions cover OOP concepts, coding exercises, project frameworks, Selenium automation, BDD with Cucumber, and TestNG.
OOP concepts include inheritance, encapsulation, polymorphism, and abstraction.
Example: Inheritance - a class 'Car' can inherit properties from a class 'Vehicle'.
To find missing number in a list, iterate through the list and check for gaps in sequence.
Example: List {1, 2, 4, 5} - Missing number is 3.
To count alphabets in a string, iterate throug...read more
Q70. There is 2 pot one red and one blue. one pot contains tressure. Two statement are given 1. only one of the statement is correct. 2. Blue pot has the tressure. Find the tressure?
The treasure is in the red pot.
The statement 'only one of the statement is correct' means that one statement is true and the other is false.
If the blue pot has the treasure, then both statements would be true, which contradicts the given information.
Therefore, the statement 'Blue pot has the treasure' must be false, and the treasure must be in the other pot, which is the red pot.
What is Diamond Problem in C++ and how do we fix it?
Q72. If all players of a cricket team were out first ball, which player would be the last person not out?
Q73. What are the different meetings that happen in Agile style development?
Different meetings in Agile style development include daily stand-up, sprint planning, sprint review, and retrospective.
Daily stand-up: A short daily meeting where team members discuss their progress, plans, and any obstacles.
Sprint planning: A meeting at the beginning of each sprint to determine the work to be done and set priorities.
Sprint review: A meeting at the end of each sprint to demonstrate completed work to stakeholders and gather feedback.
Retrospective: A meeting a...read more
Q74. Which datastructure would you use to implement an heteregenous array?
An array of objects can be used to implement a heterogeneous array.
Each element in the array can be an object that represents a different data type.
The objects can have different properties and methods based on their respective data types.
For example, an element can be an object representing a string with a 'value' property and a 'length' method.
What is the difference between truncate, drop and delete?
Difference between UNIQUE and Primary Key. Which of these can be Null?
Q77. What will happen if job has failed in pipeline and data processing cycle is over?
If a job fails in the pipeline and data processing cycle is over, it can lead to incomplete or inaccurate data.
Incomplete data may affect downstream processes and analysis
Data quality may be compromised if errors are not addressed
Monitoring and alerting systems should be in place to detect and handle failures
Re-running the failed job or implementing error handling mechanisms can help prevent issues in the future
Q78. I was given 9 balls which all are identical except one which is hollow! How many trials would you take to figure out the hollow one!
Q79. What would be duration of a sprint and who leads it?
The duration of a sprint is typically 2-4 weeks and it is led by the Scrum Master or Agile Coach.
A sprint is a time-boxed iteration in Agile development.
The duration of a sprint is determined by the team, but it is usually between 2-4 weeks.
During a sprint, the team works on a set of prioritized user stories or tasks.
The Scrum Master or Agile Coach is responsible for leading the sprint and ensuring that the team follows the Agile principles and practices.
They facilitate the s...read more
Q80. Who is a stake holder and how do you classify them?
Stakeholders are individuals or groups who have an interest or influence in a project or organization.
Stakeholders can include employees, customers, suppliers, shareholders, government agencies, and community members.
They can be classified into internal stakeholders (e.g., employees, shareholders) and external stakeholders (e.g., customers, suppliers).
Stakeholders can also be categorized based on their level of influence or interest in the project.
Some stakeholders may have h...read more
Q81. What is difference between Static and Global Vaiable?
Static variables have local scope but retain their value between function calls, while global variables have global scope.
Static variables are declared inside a function and retain their value between function calls
Global variables are declared outside of any function and can be accessed from any part of the program
Static variables have local scope, while global variables have global scope
Static variables are initialized only once, while global variables are initialized at th...read more
Q82. What is difference between if else and switch case statements?
if else is used for simple conditions while switch case is used for multiple conditions.
if else is a sequential decision-making statement while switch case is a multi-branch decision-making statement
if else is used when there are only a few conditions to be checked while switch case is used when there are multiple conditions to be checked
if else can have multiple conditions in a single statement while switch case can only have one condition per case
if else is more readable an...read more
Q83. What are the documents that you had to create during the process
Various documents are created during the business analysis process.
Business requirements document (BRD)
Functional requirements document (FRD)
Use case document
Process flow diagrams
Data flow diagrams
User stories
Test plans
Training materials
Project charter
Risk assessment document
How will you convince a kirana wala to automate his data entry process ( which he does manually in a register) to use a computer for the process ?
Q85. How garbage collector identifies which object it should pick?
Garbage collector identifies objects to pick based on their reachability.
Garbage collector starts from a set of root objects and identifies all objects that are reachable from them.
Objects that are not reachable are considered garbage and are eligible for collection.
Reachability is determined by following object references from root objects.
Objects that are referenced by other reachable objects are also considered reachable.
Objects that are not referenced by any reachable obj...read more
Is Multiple inheritance possible in java?
How is it implemented in java?
Explain the concept of exception handling done in java.
What all sorting algorithms you know?
What are their complexities?
Where does quick sort fail?
Q88. In stack push & pop opration take O(1) time. Write function FindMin() which finds minimum element in stack with O(1) time complexity
Q89. Out of 8 balls one is less in weight find no of times u will use the scale to determine which one is defective?
Q90. Create a Login form and validate email input using Vanilla JS.
Create a Login form with email validation using Vanilla JS.
Create a form in HTML with input fields for email and password
Use JavaScript to validate the email input using regular expressions
Display error messages if the email input is not in the correct format
Q91. Can you describe the difference between FRD and BRD?
FRD and BRD are both documents used in the software development process, but they serve different purposes.
FRD stands for Functional Requirements Document and describes the functional requirements of a software system.
BRD stands for Business Requirements Document and outlines the business needs and objectives that the software system should fulfill.
FRD focuses on the specific functionalities and features of the software, while BRD focuses on the overall business goals and req...read more
Q92. What is the difference between C and C++?
C++ is an extension of C with object-oriented programming features.
C++ supports classes and objects while C does not.
C++ has better support for polymorphism and inheritance.
C++ has a standard template library (STL) which C does not have.
C++ allows function overloading while C does not.
C++ has exception handling while C does not.
What are Friend Functions in C++?
Q94. Draw a system diagram for ecommers system to place an order and get order history for a particular customer
System diagram for e-commerce order placement and history retrieval
Frontend: Customer interface for browsing products, adding to cart, and placing orders
Backend: Order processing system to handle order placement, payment processing, and order fulfillment
Database: Store customer information, order details, and order history for retrieval
APIs: Communication between frontend, backend, and database for seamless order processing
Analytics: Track order history and customer behavior ...read more
Q95. 1. remove duplicate from the list of object
Remove duplicates from a list of objects.
Create a new empty list.
Iterate through the original list.
For each object, check if it is already in the new list.
If not, add it to the new list.
Return the new list without duplicates.
Q96. What is the difference between for and while loop?
For loop is used for iterating over a sequence while while loop is used for iterating until a condition is met.
For loop is used when the number of iterations is known beforehand
While loop is used when the number of iterations is not known beforehand
For loop is faster than while loop for iterating over a sequence
While loop is useful for iterating until a specific condition is met
For loop can be used with range() function to iterate over a sequence
While loop can be used with br...read more
Q97. How to enhance web performance of a page.
To enhance web performance of a page, optimize images, minify code, reduce server response time, use caching, and enable compression.
Optimize images by compressing them and using appropriate file formats.
Minify code by removing unnecessary characters and whitespace.
Reduce server response time by using a content delivery network (CDN) and optimizing database queries.
Use caching to store frequently accessed data and reduce server requests.
Enable compression to reduce file sizes...read more
Q98. Plant 10 plants in 5 rows such that each row has 4 plants
10 plants can be planted in 5 rows with 4 plants in each row.
Divide the plants into groups of 4.
Arrange the groups in 5 rows.
Each row will have 4 plants.
Q99. How to verify code before at compile time?
Code can be verified before compile time using static code analysis tools.
Static code analysis tools can detect potential bugs, security vulnerabilities, and coding errors before compilation.
Examples of static code analysis tools include SonarQube, Checkstyle, and PMD.
These tools can be integrated into the development process to ensure code quality and reduce the risk of errors.
Static code analysis can also help enforce coding standards and best practices.
Regular use of stati...read more
Q100. What is the difference between Function definition and declaration
Function definition specifies the implementation of a function, while declaration provides the function signature.
Function definition includes the function body, while declaration only includes the function signature.
Function definition is used to define the behavior of a function, while declaration is used to announce the existence of a function.
Function definition can only appear once in a program, while declaration can appear multiple times.
Example of function definition: ...read more
Top HR Questions asked in Balwom Textiles
Interview Process at Balwom Textiles
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month