Publicis Sapient
400+ HDFC Bank Interview Questions and Answers
Q1. Make Array Elements Equal Problem Statement
Given an integer array, your objective is to change all elements to the same value, minimizing the cost. The cost of changing an element from x
to y
is defined as |x ...read more
Find the minimum cost to make all elements of an array equal by changing them to a common value.
Calculate the median of the array and find the sum of absolute differences between each element and the median.
Sort the array and find the median element, then calculate the sum of absolute differences between each element and the median.
If the array has an even number of elements, consider the average of the two middle elements as the median.
Q2. 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.
Q3. Reverse Linked List Problem Statement
Given a singly linked list of integers, return the head of the reversed linked list.
Example:
Initial linked list: 1 -> 2 -> 3 -> 4 -> NULL
Reversed linked list: 4 -> 3 -> 2...read more
Q4. Merge Two Sorted Lists (In-Place) Problem Statement
You are given two sorted linked lists. Your task is to merge them to form a combined sorted linked list and return the head of this final linked list.
Example...read more
Merge two sorted linked lists in-place to form a combined sorted linked list.
Create a dummy node to start the merged list
Compare nodes from both lists and link them accordingly
Update the pointer to the next node in the merged list
Handle cases where one list is longer than the other
Return the head of the merged list
Q5. 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 moreQ6. 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 moreQ7. Add Two Numbers as Linked Lists
You are given two singly linked lists, where each list represents a positive number without any leading zeros.
Your task is to add these two numbers and return the sum as a linke...read more
Add two numbers represented as linked lists and return the sum as a linked list.
Traverse both linked lists simultaneously while keeping track of carry from previous sum
Create a new linked list to store the sum of the two numbers
Handle cases where one linked list is longer than the other by padding with zeros
Update the current node with the sum of corresponding nodes from both lists and carry
Q8. Largest Rectangle in Histogram Problem Statement
You are given an array/list HEIGHTS
of length N
, where each element represents the height of a histogram bar. The width of each bar is considered to be 1.
Your t...read more
Q9. 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
Q10. 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 moreQ11. Cycle Detection in Undirected Graph Problem Statement
You are provided with an undirected graph containing 'N' vertices and 'M' edges. The vertices are numbered from 1 to 'N'. Your objective is to determine whe...read more
Q12. Permutations Problem Statement
Given an array of distinct integers, generate and return all the possible permutations of the array.
Example:
Input:
ARR = [1, 2]
Output:
[[1, 2], [2, 1]]
Explanation:
The array h...read more
Q13. Next Greater Element Problem Statement
You are given an array arr
of length N
. For each element in the array, find the next greater element (NGE) that appears to the right. If there is no such greater element, ...read more
The task is to find the next greater element for each element in an array to its right, if no greater element exists, return -1.
Iterate through the array from right to left and use a stack to keep track of elements.
Pop elements from the stack until a greater element is found or the stack is empty.
Store the next greater element for each element in the output array.
Q14. 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 moreQ15. Trapping Rain Water Problem Statement
You are given a long type array/list ARR
of size N
, representing an elevation map. The value ARR[i]
denotes the elevation of the ith
bar. Your task is to determine the tota...read more
The question asks to calculate the total amount of rainwater that can be trapped in the given elevation map.
Iterate through the array and find the maximum height on the left and right side of each bar.
Calculate the amount of water that can be trapped on each bar by subtracting its height from the minimum of the maximum heights on both sides.
Sum up the trapped water for all bars and return the total amount.
Q16. Merge Two Sorted Arrays Problem Statement
Given two sorted integer arrays ARR1
and ARR2
of size M and N, respectively, merge them into ARR1
as one sorted array. Assume that ARR1
has a size of M + N to hold all ...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
Q17. Count Subarrays with XOR=X Problem Statement
You are given an array of integers 'ARR' and an integer 'X'. Your task is to determine the number of subarrays in 'ARR' whose elements have a bitwise XOR equals to '...read more
Count the number of subarrays in an array whose elements have a bitwise XOR equal to a given value.
Iterate through all subarrays and calculate the XOR value for each subarray.
Keep track of the count of subarrays with XOR equal to the given value.
Use a hashmap to store the XOR values encountered and their frequencies for efficient lookup.
Handle edge cases like empty array or XOR value of 0 separately.
Example: For input [4, 2, 2, 6] and XOR value 6, there are 2 subarrays [4, 2]...read more
Q18. Merge K Sorted Arrays Problem Statement
Given 'K' different arrays that are individually sorted in ascending order, merge all these arrays into a single array that is also sorted in ascending order.
Input
The f...read more
Merge K sorted arrays into a single sorted array.
Iterate through all arrays and merge them using a min-heap.
Use a priority queue to efficiently merge the arrays.
Time complexity can be optimized to O(N log K) using a min-heap.
Q19. Maximum 1s in a Row Problem
Given a matrix ARR
with dimensions N
* M
, consisting only of 0s and 1s where each row is sorted, determine the index of the row that contains the highest number of 1s. If multiple ro...read more
Find the row with the maximum number of 1s in a sorted matrix.
Iterate through each row of the matrix and count the number of 1s in each row
Keep track of the row index with the maximum number of 1s
Return the index of the row with the highest count of 1s
Q20. 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 moreQ21. String Ka Khel Problem Statement
Ninja is creating a new game ‘String Ka Khel’ for his gaming shop. In this game, players are given ‘N’ strings. The objective is to find the maximum length of strings that can b...read more
Q22. Reverse a Linked List Problem Statement
Given a singly linked list of integers, your task is to return the head of the reversed linked list.
Example:
Input:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL.
Out...read more
Q23. Number of Islands Problem Statement
You are provided with a 2-dimensional matrix having N
rows and M
columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in this ma...read more
Q24. Longest Repeating Substring Problem Statement
Given a string str
consisting of lowercase English alphabet letters, and an integer K
, you are allowed to perform at most K
operations on this string. An operation ...read more
Q25. Height of a Binary Tree
You are provided with an arbitrary binary tree consisting of 'N' nodes where each node is associated with a certain value. The task is to determine the height of the tree.
Explanation:
T...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
Q26. 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 moreAsk 'Which way would someone from the other city point to?'
Ask the person which way they would point if they were from the other city
If they are from the City of Truth, they would point towards the City of Truth
If they are from the City of Lies, they would also point towards the City of Truth
Q27. Longest Palindromic Substring Problem Statement
You are provided with a string STR
of length N
. The goal is to identify the longest palindromic substring within this string. In cases where multiple palindromic ...read more
Identify the longest palindromic substring in a given string.
Iterate through the string and expand around each character to find palindromes
Keep track of the longest palindrome found
Return the longest palindrome with the smallest start index
Q28. 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 moreQ29. Quick Sort Algorithm
Sort the given array of integers in ascending order using the quick sort algorithm.
Explanation:
Quick sort is a divide and conquer algorithm where a pivot is chosen to partition the array ...read more
Yes, the quick sort algorithm can be optimized to achieve NlogN complexity in the worst case by choosing the pivot element strategically.
Choose the pivot element as the median of the first, middle, and last elements of the array to reduce the chances of worst-case scenarios.
Implement a hybrid sorting algorithm that switches to a different sorting algorithm like insertion sort for small subarrays to improve efficiency.
Randomize the selection of the pivot element to avoid predi...read more
Q30. Minimum Cost Path Problem Statement
Given an N x M
matrix filled with integers, determine the minimum sum obtainable from a path that starts at a specified cell (x, y)
and ends at the top left corner of the mat...read more
Find the minimum sum path from a specified cell to the top left corner of a matrix.
Use dynamic programming to keep track of the minimum sum at each cell
Consider all possible moves (down, right, diagonal) from each cell
Start from the specified cell and work towards the top left corner
Add the value of the current cell to the minimum sum of the previous cells
Q31. Line Reflection Problem Statement
You are given several sets of points on a 2D plane, each set represented as a list of coordinates. Your task is to determine if there exists a line parallel to the Y-axis that ...read more
The task is to determine if there exists a line parallel to the Y-axis that reflects given points symmetrically.
Iterate through each test case and check if a vertical reflection line exists for the given points
Calculate the midpoint of the x-coordinates and check if it reflects the points symmetrically
Consider edge cases where points are on the reflection line or have the same x-coordinate
Q32. 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.
Q33. Maximum Subarray Sum Problem Statement
Given an array ARR
consisting of N
integers, your goal is to determine the maximum possible sum of a non-empty contiguous subarray within this array.
Example of Subarrays:...read more
Find the maximum sum of a contiguous subarray within an array of integers.
Iterate through the array and keep track of the maximum sum of subarrays seen so far.
Use Kadane's algorithm to efficiently find the maximum subarray sum.
Consider edge cases like all negative numbers in the array.
Example: For input [-2, 1, -3, 4, -1], the maximum subarray sum is 4.
Q34. Valid Parenthesis Problem Statement
Given a string str
composed solely of the characters "{", "}", "(", ")", "[", and "]", determine whether the parentheses are balanced.
Input:
The first line contains an integ...read more
Q35. 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 moreQ36. 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.
Q37. 0/1 Knapsack Problem Statement
A thief plans to rob a store and can carry a knapsack with a maximum weight capacity of 'W'. The store contains 'N' items, each with a specified weight and value known to the thie...read more
The 0/1 Knapsack Problem involves maximizing profit by selecting items with specified weights and values within a knapsack's weight capacity.
Create a 2D array to store the maximum profit that can be achieved at each weight capacity and item index.
Iterate through each item and weight capacity, updating the maximum profit based on whether the item is included or not.
Return the maximum profit achievable with the given items and weight capacity.
Example: For N = 4, W = 10, weights...read more
Q38. Valid Parentheses Problem Statement
Given a string 'STR' consisting solely of the characters “{”, “}”, “(”, “)”, “[” and “]”, determine if the parentheses are balanced.
Input:
The first line contains an integer...read more
The task is to determine if a given string consisting of parentheses is balanced or not.
Iterate through the characters of the string and use a stack to keep track of opening parentheses.
If an opening parenthesis is encountered, push it onto the stack.
If a closing parenthesis is encountered, check if it matches the top of the stack. If it does, pop the stack, else the string is not balanced.
At the end, if the stack is empty, the string is balanced.
Example: For input '{}[]()', ...read more
Q39. • 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
Q40. Stack using Two Queues Problem Statement
Develop a Stack Data Structure to store integer values using two Queues internally.
Your stack implementation should provide these public functions:
Explanation:
1. Cons...read more
Implement a stack using two queues to store integer values with specified functions.
Use two queues to simulate stack operations efficiently.
Maintain one queue for storing elements and another for temporary storage during push operation.
Ensure to handle edge cases like empty stack and maximum size limit.
Example: Push operation involves transferring elements from one queue to another before adding the new element.
Example: Pop operation involves removing and returning the top el...read more
Q41. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
Reverse a given string containing alphabets, numbers, and special characters.
Iterate through the string from the end to the beginning and append each character to a new string.
Use built-in functions like reverse() or slicing to reverse the string.
Handle special characters and numbers while reversing the string.
Ensure to consider the constraints on the input string length and number of test cases.
Q42. Count Substrings with K Distinct Characters
Given a lowercase string 'STR' and an integer K, the task is to count all possible substrings that consist of exactly K distinct characters. These substrings are not ...read more
Count substrings with exactly K distinct characters in a given lowercase string.
Iterate through all substrings of the given string and count the number of distinct characters in each substring.
Keep track of substrings with exactly K distinct characters and increment the count.
Return the total count of substrings with exactly K distinct characters.
Q43. 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?
Q44. 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?
Q45. Character Pattern Problem Statement
Generate a pattern based on the input number of rows N. Each row i should start with the i-th letter of the alphabet, and the number of letters in the row should match the ro...read more
Generate a character pattern based on the input number of rows N, where each row starts with the i-th letter of the alphabet and contains i letters.
Create an array to store each row of the pattern
Iterate from 1 to N, for each row i, generate the string starting with the i-th letter of the alphabet and containing i letters
Add each generated string to the array
Return the array of strings as the output
Q46. 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?
Q47. 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?
Q48. 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.
Q49. 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.
Q50. 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'.
Q51. 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
Q52. 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
The probability of two ants colliding on an equilateral triangle is 1/3.
Each ant has an equal chance of moving towards either of the other two ants.
There are three possible scenarios where two ants can collide out of a total of nine possible scenarios.
Therefore, the probability of two ants colliding is 1/3.
The ants will end up colliding at the centroid of the triangle.
The ants will move towards each other in a straight line along the medians of the triangle.
They will eventually meet at the centroid of the triangle, which is the point where all three medians intersect.
Q54. 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
Q55. 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
Q56. How do you cut a circular cake into eight equal pieces in just 3 cuts?
By lighting both wires at the same time, the shorter wire will burn out first, allowing you to measure a specific duration of time.
Light both wires at the same time
Measure the time it takes for the shorter wire to burn out completely
The remaining length of the longer wire will indicate the specific duration of time
Early binding is resolved at compile time, while late binding is resolved at runtime in C++.
Early binding is also known as static binding, where the function call is resolved at compile time based on the type of the object.
Late binding is also known as dynamic binding, where the function call is resolved at runtime based on the actual type of the object.
Early binding is faster as the function call is directly mapped to the memory address at compile time.
Late binding allows fo...read more
Q59. 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
Q60. In stack push & pop opration take O(1) time. Write function FindMin() which finds minimum element in stack with O(1) time complexity
Use an auxiliary stack to keep track of minimum element at each level of the main stack.
Create an auxiliary stack to keep track of minimum element at each level of the main stack.
When pushing an element onto the main stack, compare it with the top element of the auxiliary stack and push the smaller one onto the auxiliary stack.
When popping an element from the main stack, also pop the top element from the auxiliary stack.
The top element of the auxiliary stack will always be th...read more
Q61. 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
Q62. 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
Q63. 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.
Q64. 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
Q65. 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.
Diamond Problem is a common issue in multiple inheritance in C++ where a class inherits from two classes that have a common base class.
Diamond Problem occurs when a class inherits from two classes that have a common base class, leading to ambiguity in accessing members.
It can be resolved in C++ using virtual inheritance, where the common base class is inherited virtually to avoid duplicate copies of base class members.
Example: class A is inherited by classes B and C, and then...read more
Q67. 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
Q68. If all players of a cricket team were out first ball, which player would be the last person not out?
Q69. 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.
Levels of data abstraction in a DBMS refer to the different views of data provided to users and applications.
Physical level: Deals with how data is stored on the storage media. Example: data blocks, pages, indexes.
Logical level: Focuses on how data is represented to users. Example: tables, views, constraints.
View level: Provides a customized view of the database for specific users or applications. Example: queries, reports.
Q71. 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!
It would take a maximum of 3 trials to figure out the hollow ball.
Divide the balls into 3 groups of 3 balls each.
Weigh 2 groups against each other. If one group is lighter, move to next step.
Weigh 2 balls from the lighter group. The lighter ball is the hollow one.
Q72. 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
Q73. 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
Q74. 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
Data abstraction is the process of hiding the implementation details of a data structure and only showing the necessary information to the user.
Data abstraction can be achieved through the use of abstract classes and interfaces in object-oriented programming.
It helps in reducing complexity by providing a simplified view of the data.
Example: In Java, abstract classes and interfaces are used to achieve data abstraction.
Example: Encapsulation is another technique used to achieve...read more
Q76. 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
Q77. 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
Q78. 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
Q80. 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
Q81. Out of 8 balls one is less in weight find no of times u will use the scale to determine which one is defective?
You will use the scale 2 times to determine which ball is defective.
First, divide the 8 balls into 3 groups - 3 balls, 3 balls, and 2 balls.
Weigh the first two groups of 3 balls against each other. If they balance, the defective ball is in the group of 2 balls.
If one group of 3 balls is lighter, weigh two of those balls against each other. If they balance, the defective ball is the third ball.
If one group of 3 balls is heavier, weigh two of those balls against each other. The...read more
ACID properties in DBMS ensure data integrity and consistency in transactions.
Atomicity: All operations in a transaction are completed successfully or none at all.
Consistency: Data is always in a valid state before and after a transaction.
Isolation: Transactions are isolated from each other to prevent interference.
Durability: Once a transaction is committed, changes are permanent and survive system failures.
Example: If a bank transfer involves debiting one account and crediti...read more
Q83. 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
Q84. 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
Q85. 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.
Q86. 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
Q87. 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.
Q88. 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
Q89. 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
Q90. Diffrences between list and tuples, OOPS concepts, Decorators, Mutable vs Immutable, list and tuple which is faster, lamda, reduce, filter,generators and iter objects.
Lists and tuples are both data structures in Python, but lists are mutable while tuples are immutable. OOP concepts include inheritance, encapsulation, and polymorphism. Decorators are used to modify functions or methods. Lambda functions are anonymous functions. Reduce, filter, generators, and iter objects are all related to functional programming in Python.
Lists are mutable, meaning they can be changed after creation. Tuples are immutable, meaning they cannot be changed aft...read more
Q91. 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.
Q92. 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
Q93. 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
Q94. what are 3 steps for using function in c?
Three steps for using functions in C.
Declare the function with its return type, name, and parameters.
Define the function by writing the code for it.
Call the function by using its name and passing arguments if necessary.
Q95. What is a stack and various operations on it?
A stack is a data structure that follows the Last In First Out (LIFO) principle.
Push: adds an element to the top of the stack
Pop: removes the top element from the stack
Peek: returns the top element without removing it
IsEmpty: checks if the stack is empty
Size: returns the number of elements in the stack
Q96. Difference between method overloading and methode overriding ?
Method overloading is having multiple methods with the same name but different parameters. Method overriding is having a subclass method with the same name and parameters as a superclass method.
Method overloading is used to provide different ways of calling the same method with different parameters.
Method overriding is used to provide a specific implementation of a method in a subclass that is already defined in the superclass.
Method overloading is resolved at compile-time ba...read more
Q97. Difference between switch case and if else statement?
Switch case is used for multiple conditions while if else is used for binary conditions.
Switch case is faster than if else for multiple conditions.
If else can handle complex conditions while switch case cannot.
Switch case can only compare values of the same data type.
If else can handle null values while switch case cannot.
Example: switch (day) { case 1: console.log('Monday'); break; case 2: console.log('Tuesday'); break; default: console.log('Invalid day'); }
Example: if (age ...read more
Q98. Sorting the list of strings based on the count of their occurrences/
Sorting a list of strings based on their occurrence count.
Create a dictionary to store the count of each string.
Use the dictionary to sort the list based on the count of occurrences.
If two strings have the same count, sort them alphabetically.
Return the sorted list.
Q99. How to swap numbers without using temporary variable
Swapping numbers without using a temporary variable
Use addition and subtraction to swap the numbers
Example: a = 5, b = 10. a = a + b (15), b = a - b (5), a = a - b (10)
Alternatively, use bitwise XOR operation to swap the numbers
Example: a = 5, b = 10. a = a ^ b (15), b = a ^ b (5), a = a ^ b (10)
Q100. what is function overloading and overriding (difference between them)
Function overloading and overriding are concepts in object-oriented programming.
Function overloading is when multiple functions with the same name but different parameters are defined in a class.
Function overriding is when a derived class provides a different implementation for a method that is already defined in the base class.
Overloading is resolved at compile-time based on the number, type, and order of arguments, while overriding is resolved at runtime based on the object...read more
Top HR Questions asked in HDFC Bank
Interview Process at HDFC Bank
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month