Premium Employer

Publicis Sapient

3.5
based on 3.2k Reviews
Filter interviews by

400+ HDFC Bank Interview Questions and Answers

Updated 1 Feb 2025
Popular Designations

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

Ans.

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.

Add your answer

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 more
Ans.

The 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.

Add your answer

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
Add your answer

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

Ans.

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

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

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 more
Add your answer

Q6. 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 more
Add your answer
Are these interview questions helpful?

Q7. 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

Ans.

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

Add your answer

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

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

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 more
Ans.

The 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

Add your answer

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 more
Add your answer

Q11. 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

Add your answer

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

Add your answer

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

Ans.

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.

Add your answer

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 more
Add your answer

Q15. 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

Ans.

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.

Add your answer

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

Ans.

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

Add your answer

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

Ans.

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

Add your answer

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
Ans.

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.

Add your answer

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

Ans.

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

Add your answer

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 more
Add your answer

Q21. 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

Add your answer

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
Add your answer

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

Add your answer

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

Add your answer

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

Ans.

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

Add your answer

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 more
Ans.

Ask '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

Add your answer

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

Ans.

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

Add your answer

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 more
Add your answer

Q29. 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

Ans.

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

Add your answer

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

Ans.

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

Add your answer

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

Ans.

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

Add your answer

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?

Ans.

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.

Add your answer

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

Ans.

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.

Add your answer

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
Add your answer

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 more
Add your answer

Q36. 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?

Ans.

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.

Add your answer

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

Ans.

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

Add your answer

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
Ans.

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

Add your answer

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 more
Ans.

Questions 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

Add your answer

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
Ans.

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

Add your answer

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

Ans.

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.

Add your answer

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

Ans.

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.

Add your answer

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?

Add your answer

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?

Add your answer

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

Ans.

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

Add your answer

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?

Add your answer

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?

Add your answer

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?

Ans.

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.

Add your answer

Q49. An unsorted array has numbers. Find the duplicate numbers and return the array.

Ans.

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.

Add your answer

Q50. How to you reverse a string without using any looping and inbuilt functions?

Ans.

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'.

Add your answer

Q51. What is a SSR and CSR website and when to use which one.

Ans.

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

View 1 answer

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

Ans.

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.

Add your answer
Q53. You have 3 ants located at the corners of a triangle. The challenge is to determine the movement pattern of the ants if they all start moving towards each other. What will be the outcome?
Ans.

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.

Add your answer

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

Ans.

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

Add your answer

Q55. If I am ready to accept a project in Java, if Sapient had trained you in DotNet earlier

Ans.

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

Add your answer

Q56. How do you cut a circular cake into eight equal pieces in just 3 cuts?

View 2 more answers
Q57. You have two wires of different lengths, each taking different amounts of time to burn completely. How can you use these wires to measure a specific duration of time?
Ans.

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

Add your answer
Q58. What is the difference between Early Binding and Late Binding in C++?
Ans.

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

Add your answer

Q59. Explain Clean Architecture, how it works?

Ans.

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

View 1 answer

Q60. In stack push & pop opration take O(1) time. Write function FindMin() which finds minimum element in stack with O(1) time complexity

Ans.

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

Add your answer

Q61. Without lifting the pen meet 9 point arranged in squre of 3×3, using 4 lines?

Ans.

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

Add your answer

Q62. If you had to accommodate a CR in agile how would you do so?

Ans.

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

Add your answer

Q63. How many queues will you use to implement a priority queue?

Ans.

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.

Add your answer

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 more
Ans.

The 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

Add your answer

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?

Ans.

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.

Add your answer
Q66. What is the Diamond Problem in C++ and how can it be resolved?
Ans.

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

Add your answer

Q67. What are the different meetings that happen in Agile style development?

Ans.

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

Add your answer

Q68. If all players of a cricket team were out first ball, which player would be the last person not out?

Add your answer

Q69. Which datastructure would you use to implement an heteregenous array?

Ans.

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.

Add your answer
Q70. Can you explain the different levels of data abstraction in a DBMS?
Ans.

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.

Add your answer

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!

Ans.

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.

Add your answer

Q72. What will happen if job has failed in pipeline and data processing cycle is over?

Ans.

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

Add your answer

Q73. What would be duration of a sprint and who leads it?

Ans.

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

Add your answer

Q74. Who is a stake holder and how do you classify them?

Ans.

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

Add your answer
Q75. What is data abstraction and how can it be achieved?
Ans.

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

Add your answer

Q76. What is difference between Static and Global Vaiable?

Ans.

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

Add your answer

Q77. What is difference between if else and switch case statements?

Ans.

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

Add your answer

Q78. What are the documents that you had to create during the process

Ans.

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

Add your answer
Q79. How would you convince a kirana store owner to automate his data entry process, which he currently does manually in a register, to use a computer instead?
Add your answer

Q80. How garbage collector identifies which object it should pick?

Ans.

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

View 2 more answers

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?

Ans.

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

Add your answer
Q82. Can you explain the concept of ACID properties in DBMS?
Ans.

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

Add your answer

Q83. Create a Login form and validate email input using Vanilla JS.

Ans.

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

Add your answer

Q84. Can you describe the difference between FRD and BRD?

Ans.

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

Add your answer

Q85. What is the difference between C and C++?

Ans.

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.

Add your answer

Q86. Draw a system diagram for ecommers system to place an order and get order history for a particular customer

Ans.

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

Add your answer

Q87. 1. remove duplicate from the list of object

Ans.

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.

View 2 more answers

Q88. What is the difference between for and while loop?

Ans.

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

Add your answer

Q89. How to enhance web performance of a page.

Ans.

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

Add your answer

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.

Ans.

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

Add your answer

Q91. Plant 10 plants in 5 rows such that each row has 4 plants

Ans.

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.

Add your answer

Q92. How to verify code before at compile time?

Ans.

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

Add your answer

Q93. What is the difference between Function definition and declaration

Ans.

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

Add your answer

Q94. what are 3 steps for using function in c?

Ans.

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.

Add your answer

Q95. What is a stack and various operations on it?

Ans.

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

Add your answer

Q96. Difference between method overloading and methode overriding ?

Ans.

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

Add your answer

Q97. Difference between switch case and if else statement?

Ans.

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

Add your answer

Q98. Sorting the list of strings based on the count of their occurrences/

Ans.

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.

Add your answer

Q99. How to swap numbers without using temporary variable

Ans.

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)

Add your answer

Q100. what is function overloading and overriding (difference between them)

Ans.

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

Add your answer
1
2
3
4
5
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at HDFC Bank

based on 442 interviews
Interview experience
4.0
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

3.7
 • 343 Interview Questions
4.2
 • 223 Interview Questions
4.1
 • 214 Interview Questions
3.7
 • 155 Interview Questions
3.7
 • 142 Interview Questions
3.3
 • 135 Interview Questions
View all
Top Publicis Sapient 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

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