Intuit
90+ Hindustan Aeronautics Interview Questions and Answers
Q1. Word Presence in Sentence
Determine if a given word 'W' is present in the sentence 'S' as a complete word. The word should not merely be a substring of another word.
Input:
The first line contains an integer 'T...read more
Check if a given word is present in a sentence as a complete word.
Split the sentence into words using spaces as delimiter.
Check if the given word matches any of the words in the sentence.
Ensure the word is not just a substring of another word in the sentence.
Q2. Closest Distance Pair Problem Statement
Given an array containing 'N' points in a 2D plane, determine the minimum distance between the closest pair of points.
Note:
Distance between two points (x1, y1) and (x2,...read more
The problem involves finding the minimum distance between the closest pair of points in a 2D plane.
Iterate through all pairs of points and calculate the distance between them using the given formula.
Keep track of the minimum distance found so far.
Optimize the solution by using techniques like sorting the points based on x or y coordinates.
Q3. Grid Satisfaction Problem
In this problem, you are given a grid of size N*M containing two types of people: type ‘A’ and type ‘B’. You are given the number of people of each type: 'countA' denotes the number of...read more
Given a grid with type A and B people, maximize satisfaction based on neighbors.
Start with type A people for maximum satisfaction
Optimally place people to maximize satisfaction
Consider satisfaction levels for each type of person and their neighbors
Q4. Detect the First Node of the Loop in a Singly Linked List
You are provided with a singly linked list that may contain a cycle. Your task is to return the node where the cycle begins, if such a cycle exists.
A c...read more
To detect the first node of a loop in a singly linked list, we can use Floyd's Cycle Detection Algorithm.
Use Floyd's Cycle Detection Algorithm to detect the cycle in the linked list.
Once the cycle is detected, find the starting node of the cycle using two pointers approach.
The first pointer moves one step at a time while the second pointer moves two steps at a time until they meet at the starting node of the cycle.
Q5. Maximum Non-Adjacent Subsequence Sum
Given an array of integers, determine the maximum sum of a subsequence without choosing adjacent elements in the original array.
Input:
The first line consists of an integer...read more
Find the maximum sum of a subsequence without choosing adjacent elements in an array.
Use dynamic programming to keep track of the maximum sum at each index, considering whether to include the current element or not.
At each index, the maximum sum can be either the sum of the current element and the element two positions back, or the maximum sum at the previous index.
Iterate through the array and update the maximum sum accordingly.
Example: For the input [3, 2, 7, 10], the maxim...read more
Q6. 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
Reverse a singly linked list of integers and return the head of the reversed linked list.
Iterate through the linked list and reverse the pointers to point to the previous node instead of the next node.
Use three pointers to keep track of the current, previous, and next nodes while reversing the linked list.
Update the head of the reversed linked list as the last node encountered during the reversal process.
Q7. Greatest Common Divisor Problem Statement
You are tasked with finding the greatest common divisor (GCD) of two given numbers 'X' and 'Y'. The GCD is defined as the largest integer that divides both of the given...read more
Find the greatest common divisor (GCD) of two given numbers 'X' and 'Y'.
Implement a function to calculate GCD using Euclidean algorithm
Iteratively find the remainder of X divided by Y until Y becomes 0
The last non-zero remainder is the GCD of X and Y
Q8. N Queens Problem
Given an integer N
, find all possible placements of N
queens on an N x N
chessboard such that no two queens threaten each other.
Explanation:
A queen can attack another queen if they are in the...read more
The N Queens Problem involves finding all possible placements of N queens on an N x N chessboard without threatening each other.
Use backtracking algorithm to explore all possible configurations.
Keep track of rows, columns, and diagonals to ensure queens do not threaten each other.
Generate all valid configurations and print them out.
Q9. Sort 0 1 2 Problem Statement
Given an integer array arr
of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.
Input:
The first line contains an integer 'T' representing the number of...read more
Sort an array of 0s, 1s, and 2s in linear time complexity using a single scan.
Use three pointers to keep track of the positions of 0s, 1s, and 2s in the array.
Iterate through the array and swap elements based on their values and the pointers.
After a single scan, the array will be sorted in-place with 0s, 1s, and 2s in order.
Q10. Inorder Successor in a Binary Tree
Find the inorder successor of a given node in a binary tree. The inorder successor is the node that appears immediately after the given node during an inorder traversal. If th...read more
Find the inorder successor of a given node in a binary tree.
Perform an inorder traversal of the binary tree to find the successor node
If the given node has a right child, the successor is the leftmost node in the right subtree
If the given node does not have a right child, backtrack to find the ancestor whose left child is the given node
Q11. Boundary Traversal of Binary Tree Problem Statement
Given a binary tree consisting of integers, your task is to provide the boundary nodes of this tree in an anti-clockwise direction, starting with the root nod...read more
Boundary traversal of a binary tree to find left boundary, right boundary, and leaf nodes in an anti-clockwise direction.
Perform a pre-order traversal to get the left boundary nodes
Perform an in-order traversal to get the leaf nodes
Perform a post-order traversal to get the right boundary nodes
Combine the results in the required order to get the boundary nodes
Q12. 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
Handle cases where one linked list is longer than the other by padding with zeros
Create a new linked list to store the sum of the two numbers
Q13. Stack with getMin Operation
Create a stack data structure that supports not only the usual push and pop operations but also getMin(), which retrieves the minimum element, all in O(1) time complexity without usi...read more
Implement a stack with getMin operation in O(1) time complexity without using extra space.
Use two stacks - one to store the actual elements and another to store the minimum values encountered so far.
When pushing an element, check if it is smaller than the current minimum and if so, push it onto the minimum stack.
When popping an element, check if it is the current minimum and if so, pop from the minimum stack as well.
For getMin operation, simply return the top element of the m...read more
Q14. Balanced Parentheses Combinations
Given an integer N
representing the number of pairs of parentheses, find all the possible combinations of balanced parentheses using the given number of pairs.
Explanation:
Con...read more
Generate all possible combinations of balanced parentheses for a given number of pairs.
Use backtracking to generate all valid combinations of balanced parentheses.
Keep track of the number of open and close parentheses used in each combination.
Recursively build the combinations by adding open parentheses if there are remaining, and then adding close parentheses if the number of open parentheses is greater than the number of close parentheses.
Return the list of valid combinatio...read more
Q15. Sort a Stack Problem Statement
You are provided with a stack consisting of 'N' integers. The goal is to sort this stack in descending order by utilizing recursion.
Allowed Stack Operations:
is_empty(S) : Check ...read more
Sort a stack in descending order using recursion without using loop constructs.
Implement a recursive function to sort the stack in descending order.
Use the provided stack operations to manipulate the stack.
Recursively pop elements from the stack, sort them, and push them back in descending order.
Handle base cases such as an empty stack or a single element stack.
Ensure the stack is sorted in descending order after the recursive calls.
Avoid using loop constructs like while or f...read more
Q16. LCA of Binary Tree Problem Statement
You are given a binary tree consisting of distinct integers and two nodes, X
and Y
. Your task is to find and return the Lowest Common Ancestor (LCA) of these two nodes.
The ...read more
Find the Lowest Common Ancestor (LCA) of two nodes in a binary tree.
Traverse the binary tree to find the paths from the root to nodes X and Y.
Compare the paths to find the last common node, which is the LCA.
Handle cases where one node is an ancestor of the other.
Consider edge cases like when X or Y is the root node.
Implement a recursive or iterative solution to find the LCA efficiently.
Q17. Product Of Array Except Self Problem Statement
You are provided with an integer array ARR
of size N
. You need to return an array PRODUCT
such that PRODUCT[i]
equals the product of all the elements of ARR
except...read more
The problem requires returning an array where each element is the product of all elements in the input array except itself.
Iterate through the array twice to calculate the product of all elements to the left and right of each element.
Use two arrays to store the products to the left and right of each element.
Multiply the corresponding elements from the left and right arrays to get the final product array.
Handle integer overflow by taking modulo MOD = 10^9 + 7.
To solve with O(1...read more
Q18. LRU Cache Design Question
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherwise, re...read more
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.
Implement a doubly linked list to keep track of the order of keys based on their recent usage.
Use a hashmap to store key-value pairs for quick access and update.
When capacity is reached, evict the least recently used item before inserting a new item.
Update the order of keys in the linked list whenever a key is accessed or updated.
Handle get and put operations ...read more
Q19. Problem Statement: Delete Node In A Linked List
Given a singly linked list of integers and a reference to a node, your task is to delete that specific node from the linked list. Each node in the linked list has...read more
Delete a specific node from a singly linked list given the reference to the node.
Traverse the linked list to find the node to be deleted.
Update the pointers to skip over the node to be deleted.
Print the modified linked list after deletion.
Q20. Insertion Sort in a Linked List
Given a singly linked list with 'N' nodes containing integer values, your task is to sort the list using insertion sort and output the sorted list.
Insertion Sort is an algorithm...read more
Implement insertion sort algorithm on a singly linked list.
Traverse the linked list and for each node, find its correct position in the sorted list.
Keep track of the current node and the previous node to perform the insertion.
Repeat this process until all nodes are sorted in the linked list.
Ensure to handle edge cases like empty list or list with only one node.
Q21. Problem Statement: Find the Number of States
You are given ‘n’ cities, some of which are connected by bidirectional roads. You also have an ‘n x n’ matrix ‘roads’, where if city ‘i’ and city ‘j’ are connected b...read more
Find the number of states of cities connected by roads in a matrix.
Identify connected cities using DFS or Union-Find algorithm
Count the number of disjoint sets to determine the number of states
Handle self-connections of cities by setting roads[i][i] = 1
Q22. Generate All Parentheses Combinations
Given an integer N
, your task is to create all possible valid parentheses configurations that are well-formed using N
pairs. A sequence of parentheses is considered well-fo...read more
Generate all valid parentheses combinations for N pairs.
Use backtracking to generate all possible combinations of parentheses.
Keep track of the number of open and close parentheses used.
Add '(' if there are remaining open parentheses, and add ')' if there are remaining close parentheses.
Stop when the length of the generated string is 2*N.
Q23. Count Pairs with Given Sum
Given an integer array/list arr
and an integer 'Sum', determine the total number of unique pairs in the array whose elements sum up to the given 'Sum'.
Input:
The first line contains ...read more
Count the total number of unique pairs in an array whose elements sum up to a given value.
Use a hashmap to store the frequency of each element in the array.
Iterate through the array and for each element, check if (Sum - current element) exists in the hashmap.
Increment the count of pairs if the complement exists in the hashmap.
Divide the count by 2 to avoid counting duplicates like (arr[i], arr[j]) and (arr[j], arr[i]) separately.
Q24. Problem: Permutations of a String
Given a string STR
consisting of lowercase English letters, your task is to return all permutations of the given string in lexicographically increasing order.
Explanation:
A st...read more
Return all permutations of a given string in lexicographically increasing order.
Generate all permutations of the given string using backtracking.
Sort the permutations in lexicographical order.
Print the sorted permutations separated by space.
Q25. How do you design a website which displays say top 1000 products with product rating updating every second?
To design a website displaying top 1000 products with real-time rating updates, use a combination of backend and frontend technologies.
Implement a backend system to fetch and update product ratings from a database or API.
Use a frontend framework like React or Angular to create a dynamic user interface.
Implement pagination or lazy loading to handle the large number of products.
Optimize the website for performance by caching frequently accessed data.
Consider using websockets or...read more
Q26. Minimum Number Of Operations To Reach X Problem Statement
Given an array ARR
of 'N' integers and an integer 'X', determine the minimum number of operations required to make the sum of removed elements from eith...read more
Given an array of integers and a target sum, find the minimum number of operations to make the sum of removed elements equal to the target.
Iterate from both ends of the array, removing elements until the sum matches the target
Use a two-pointer approach to efficiently find the minimum number of operations
If achieving the target sum is not possible, return -1
Q27. Binary Tree Diameter Problem Statement
You are given a Binary Tree, and you need to determine the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path between any ...read more
The task is to find the diameter of a binary tree, which is the longest path between any two nodes in the tree.
Traverse the tree to find the longest path between two nodes.
Keep track of the maximum diameter found during traversal.
The diameter may or may not pass through the root node.
Consider the height of the left and right subtrees to calculate the diameter.
Q28. Triplets with Given Sum Problem
Given an array or list ARR
consisting of N
integers, your task is to identify all distinct triplets within the array that sum up to a specified number K
.
Explanation:
A triplet i...read more
Identify all distinct triplets within an array that sum up to a specified number.
Iterate through the array and use nested loops to find all possible triplets.
Use a set to store unique triplets and check if the sum equals the target.
Handle edge cases like duplicate elements and no valid triplets.
Return the triplets as space-separated integers or -1 if no triplets exist.
Q29. Median of Two Sorted Arrays
Given two sorted arrays A
and B
of sizes N
and M
, find the median of the merged array formed by combining arrays A
and B
. If the total number of elements, N + M
, is even, the median ...read more
Find the median of two sorted arrays by merging them and calculating the median of the combined array.
Merge the two sorted arrays into one sorted array.
Calculate the median of the merged array based on the total number of elements.
If the total number of elements is even, take the mean of the two middle elements as the median.
Q30. 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
Count the number of islands in a 2D matrix of 1s and 0s.
Use Depth First Search (DFS) or Breadth First Search (BFS) to traverse the matrix and identify connected groups of 1s.
Maintain a visited array to keep track of visited cells to avoid redundant traversal.
Increment the island count each time a new island is encountered.
Consider edge cases like boundary conditions and handling of diagonals while traversing.
Handle the input matrix efficiently to optimize the solution.
Example...read more
Q31. 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
Given a string, find the longest palindromic substring, prioritizing the one with the smallest start index.
Iterate through the string and expand around each character to find palindromes
Keep track of the longest palindrome found and its starting index
Return the longest palindromic substring with the smallest start index
Q32. Max Game Minimum Penalty Problem
In this game, you are given a collection of 'N' numbers. The objective is to minimize the total penalty incurred while playing by following these steps:
- Select any two numbers,...read more
The objective is to minimize total penalty by selecting two numbers, summing them, and accumulating the penalty until only one number remains.
Iteratively select two numbers, sum them, and accumulate the penalty until only one number remains.
Choose the two smallest numbers to minimize the penalty.
Repeat the process until only one number remains to find the minimum possible penalty.
Q33. 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.
Use two queues to simulate stack operations efficiently.
Maintain the top element in one of the queues for easy access.
Ensure proper handling of edge cases like empty stack.
Example: Push elements onto one queue, then dequeue and enqueue to the other queue for pop operation.
Example: Use a flag to track the top element and update it accordingly.
Use sliding window technique to find smallest subarray with k distinct values.
Use a sliding window approach to keep track of the subarray with k distinct values.
Use a hashmap to store the frequency of each element in the window.
Slide the window to the right until the hashmap contains k distinct elements.
Shrink the window from the left while maintaining k distinct elements.
Update the minimum subarray length as you slide the window.
Return the smallest subarray length found.
Exam...read more
Q35. Kth Largest Element Problem
Given an array containing N
distinct positive integers and a number K
, determine the Kth largest element in the array.
Example:
Input:
N = 6, K = 3, array = [2, 1, 5, 6, 3, 8]
Output...read more
Find the Kth largest element in an array of distinct positive integers.
Sort the array in non-increasing order and return the Kth element.
Use a priority queue or quick select algorithm for efficient solution.
Handle constraints like array size and element values properly.
Ensure all elements in the array are distinct for accurate results.
Q36. Rearrange Linked List Problem Statement
Given a singly linked list in the form 'L1' -> 'L2' -> 'L3' -> ... 'Ln', your task is to rearrange the nodes to the form 'L1' -> 'Ln' -> 'L2' -> 'Ln-1', etc. You must not...read more
Rearrange the nodes of a singly linked list in a specific order without altering the data of the nodes.
Use two pointers to split the linked list into two halves, reverse the second half, and then merge the two halves alternately.
Ensure to handle cases where the number of nodes is odd or even separately.
Time complexity: O(N), Space complexity: O(1)
Example: Input: 1 -> 2 -> 3 -> 4 -> 5 -> NULL, Output: 1 -> 5 -> 2 -> 4 -> 3 -> NULL
Q37. Find Duplicates in an Array
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any order. If n...read more
Find duplicates in an array of integers within a specified range.
Iterate through the array and keep track of the count of each element using a hashmap.
Return elements with count greater than 1 as duplicates.
Time complexity can be optimized to O(N) using a set to store duplicates.
Design a website to display top 1000 products with real-time ratings.
Utilize a backend server to fetch and update product ratings every second.
Implement a front-end framework like React to display the products and ratings dynamically.
Use a database to store and retrieve product information efficiently.
Consider implementing caching mechanisms to reduce server load.
Optimize the website for performance to handle frequent updates and large data sets.
Q39. Implement a specialStack class which should support O(1) push O(1) pop and should return minimum element in the stack in O(1) time
Implement a specialStack class with O(1) push, pop, and minimum element retrieval.
Use an additional stack to keep track of the minimum element at each step.
When pushing an element, compare it with the top of the minimum stack and update if necessary.
When popping an element, also pop from the minimum stack if the popped element is the current minimum.
Q40. Given an array and a number find a pair of integers in the array whose sum is equal to given number.
Find a pair of integers in an array whose sum is equal to a given number.
Iterate through the array and for each element, check if the difference between the given number and the current element exists in the array.
Use a hash set to store the elements of the array for efficient lookup.
Return the pair of integers if found, otherwise return a message indicating no such pair exists.
Design a system like Pastebin for sharing text snippets
Use a web application framework like Django or Flask for the backend
Store text snippets in a database with unique URLs for each snippet
Implement user authentication and permissions for private and public sharing
Include features like syntax highlighting, expiration dates, and password protection
Optimize for fast and efficient text retrieval and storage
To determine the top 3 fastest horses out of 25, race horses in groups of 5 and keep track of the fastest horses in each race.
Divide the 25 horses into 5 groups of 5 horses each.
Race all 5 horses in each group, keeping track of the top 3 fastest horses in each race.
After 5 races, you will have the top 3 fastest horses from each group.
Race the top 3 horses from each group in a final race to determine the overall top 3 fastest horses.
OOP is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
OOP focuses on creating objects that interact with each other to solve problems.
Key concepts include encapsulation, inheritance, and polymorphism.
Encapsulation involves bundling data and methods that operate on the data into a single unit.
Inheritance allows a class to inherit properties and behavior from another class.
Polymorphism allo...read more
Q44. Given an array of n elements which contains elements from 0 to n1, with any of these numbers appearing any number of times. Find these repeating numbers in O(n) and using only constant memory space
Find repeating numbers in an array of n elements containing numbers from 0 to n-1 in O(n) time and constant memory space.
Create an empty result array.
Iterate through the array and for each element, take its absolute value and subtract 1 from it.
If the element at the new index is positive, make it negative.
If it is already negative, add the original element to the result array.
Return the result array.
Fail-fast iterators throw ConcurrentModificationException if the collection is modified while iterating. Fail-safe iterators do not throw exceptions and operate on a cloned copy of the collection.
Fail-fast iterators throw ConcurrentModificationException if the collection is modified while iterating.
Fail-safe iterators do not throw exceptions and operate on a cloned copy of the collection.
Fail-fast iterators are used in most of the Collection classes like ArrayList, HashMap, e...read more
Different ways to traverse over a map in Java include using keySet(), entrySet(), and forEach() method.
Use keySet() method to iterate over keys in the map
Use entrySet() method to iterate over key-value pairs in the map
Use forEach() method to iterate over key-value pairs in the map
Q47. Given a word and dictionary, write a program to calculate the total number of valid words possible from the given word
Program to calculate total number of valid words possible from a given word and dictionary
Create a hash table of dictionary words
Generate all possible permutations of the given word
Check if each permutation is a valid word in the hash table
Return the count of valid words
Memory management in operating systems involves allocation, deallocation, and optimization of memory usage.
Memory management is crucial for efficient utilization of system resources.
Operating systems use techniques like paging, segmentation, and virtual memory to manage memory.
Memory management also involves handling memory leaks, fragmentation, and ensuring data integrity.
Examples include malloc() and free() functions in C programming for dynamic memory allocation.
Q49. Find lca of 2 nodes in a binary tree (write pseudocode)
The Lowest Common Ancestor (LCA) of two nodes in a binary tree is the deepest node that is a common ancestor of both nodes.
Start from the root node and traverse the tree to find the given nodes.
Store the paths from the root to each node.
Compare the paths to find the last common node, which is the LCA.
HashMap in Java is a data structure that stores key-value pairs and uses hashing to efficiently retrieve values.
HashMap uses an array of buckets to store key-value pairs.
The key is hashed to determine the index in the array where the value will be stored.
In case of hash collisions, a linked list or a balanced tree is used to store multiple values at the same index.
HashMap allows null keys and values.
Example: HashMap<String, Integer> map = new HashMap<>(); map.put("key1", 1);
Definite integral of a function within given limits a to b.
Use the definite integral formula: ∫[a, b] f(x) dx = F(b) - F(a), where F(x) is the antiderivative of f(x).
Calculate the antiderivative of the function and then evaluate it at the upper and lower limits.
Make sure to check for any discontinuities or singularities within the interval.
Example: Calculate ∫[0, 2] x^2 dx = (1/3)x^3 |[0, 2] = (1/3)(2^3) - (1/3)(0^3) = 8/3.
Q52. Given a million points and a new point P find a point closest to P(you can do preprocessing)
Find the point closest to a given point P among a million points.
Preprocess the million points to calculate their distances from P.
Store the distances and corresponding points in a data structure.
Sort the distances in ascending order.
Return the point corresponding to the smallest distance.
Q53. Why the particular technologies were used in the application I developed?
I chose the technologies based on their compatibility with the project requirements and my familiarity with them.
Chose React for front-end development due to its component-based architecture and ease of use
Used Node.js for back-end development because of its non-blocking I/O and scalability
Selected MongoDB as the database for its flexibility with unstructured data and ease of integration
The virtual keyword in C++ is used to declare a member function in a base class that can be overridden in derived classes.
Virtual functions allow for dynamic polymorphism in C++ by enabling late binding.
Virtual functions are declared in the base class with the 'virtual' keyword and can be overridden in derived classes.
When a derived class overrides a virtual function, the function in the derived class is called instead of the base class function.
Virtual functions are typicall...read more
C is a procedural language, C++ is an object-oriented language, and Java is a platform-independent language.
C is a procedural programming language, while C++ supports both procedural and object-oriented programming.
C++ is an extension of C with additional features like classes and inheritance.
Java is a platform-independent language that runs on a virtual machine and uses automatic memory management.
C is closer to the hardware and is used for system programming, while Java is ...read more
Collection Hierarchy in Java represents the relationship between various collection interfaces and classes.
Collection interface is the root interface in the Collection Hierarchy.
List and Set interfaces extend the Collection interface.
Map interface is not a subtype of Collection interface.
ArrayList, LinkedList, HashSet, and TreeSet are some of the classes that implement the Collection interfaces.
HashMap and TreeMap are classes that implement the Map interface.
Q57. For what all purposes is the virtual keyword used in C++?
The virtual keyword is used in C++ for creating virtual functions and implementing polymorphism.
Used to create virtual functions that can be overridden by derived classes
Allows for dynamic binding of functions at runtime
Used in implementing polymorphism
Can be used with multiple inheritance to resolve ambiguity
Example: virtual void functionName() = 0; creates a pure virtual function
Fragmentation in operating systems is the phenomenon where memory or disk space is divided into small chunks over time, leading to inefficient use of resources.
Fragmentation can occur in both memory (memory fragmentation) and disk space (disk fragmentation).
External fragmentation happens when free memory or disk space is broken into small pieces, making it difficult to allocate large contiguous blocks of memory or disk space.
Internal fragmentation occurs when allocated memory...read more
Q59. Which domain would I be interested to work in? (desktop apps or web apps)
I am interested in working with web apps.
Web apps have a wider reach and are more accessible.
They can be accessed from anywhere with an internet connection.
Web apps are easier to update and maintain.
Examples: Facebook, Google Docs, Amazon
AtomicInteger is a class in Java that provides atomic operations on integers.
It is used for operations that need to be performed atomically, without interference from other threads.
Common methods include get(), set(), incrementAndGet(), decrementAndGet(), etc.
Example: AtomicInteger count = new AtomicInteger(0); count.incrementAndGet();
Q61. Write a program to find the GCD of a set of numbers. (Euclid’s algorithm)
Program to find GCD of a set of numbers using Euclid's algorithm.
Take two numbers and find their GCD using Euclid's algorithm.
Repeat the process for all numbers in the set.
The final GCD will be the GCD of the entire set.
Use recursion to simplify the code.
If any number is 0, return the other number as GCD.
Q62. Explain the solution to the classical 25 horses and 5 lanes puzzle
The puzzle involves finding the fastest 3 horses out of 25, using only 5 lanes for races.
Divide the horses into groups of 5 and race them, identifying the fastest horse in each group.
Race the fastest horses from each group to identify the overall fastest horse.
Race the second fastest horse from each group to identify the second fastest overall horse.
Race the third fastest horse from each group against the two remaining untested horses to identify the third fastest overall hor...read more
Q63. Difference between IAAS, PAAS, SAAS. (cloud computing was listed on my resume)
IAAS, PAAS, and SAAS are different cloud computing models that offer varying levels of control and management to users.
IAAS (Infrastructure as a Service) provides users with access to virtualized computing resources such as servers, storage, and networking. Users have complete control over the infrastructure and are responsible for managing it.
PAAS (Platform as a Service) provides users with a platform to develop, run, and manage applications without having to worry about the...read more
Q64. Explain polymorphism and other OOPS concepts
Polymorphism is the ability of an object to take on many forms. Other OOPS concepts include inheritance, encapsulation, and abstraction.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
Inheritance allows a class to inherit properties and methods from another class.
Encapsulation is the bundling of data and methods within a class, hiding the internal details.
Abstraction focuses on providing only essential information to the outsid...read more
Q65. How to measure and ensure to not breach SLA
To measure and ensure not breaching SLA, track performance metrics, set alerts, prioritize tasks, and regularly review and adjust processes.
Track performance metrics such as response time, uptime, and error rates
Set up alerts for when performance metrics approach SLA thresholds
Prioritize tasks based on their impact on SLA compliance
Regularly review and adjust processes to optimize performance and prevent breaches
Q66. How to figure errors before customers report it
Implement automated monitoring and logging to proactively detect errors before customers report them.
Set up automated monitoring tools to track system performance and detect anomalies
Implement logging mechanisms to capture errors and exceptions in real-time
Utilize error tracking software to aggregate and analyze error data
Establish alerts and notifications for critical errors to prompt immediate action
Regularly review error logs and performance metrics to identify patterns an...read more
Q67. Min cost of painting the houses, given no two adjacent houses are of same color List input ={[17,2,17],[16,16,5],[14,3,19]} To be solved using dynamic programming
Dynamic programming solution to find minimum cost of painting houses with no adjacent houses of same color
Create a 2D dp array to store the minimum cost of painting each house with each color
Iterate through each house and each color option, updating the dp array with the minimum cost
Return the minimum cost of painting the last house
Q68. Program to delete a node in a singly linked list given only a pointer to the node to be deleted
Program to delete a node in a singly linked list given only a pointer to the node to be deleted
Copy the data from the next node to the current node and delete the next node
Update the pointer of the current node to point to the next node's next node
Handle edge cases where the node to be deleted is the last node in the list
Q69. Design the most optimal data structures for an LRU cache
Design optimal data structures for LRU cache
Use a doubly linked list to keep track of recently used items
Use a hash table to store key-value pairs for quick access
When an item is accessed, move it to the front of the linked list
When the cache is full, remove the least recently used item from the back of the linked list and hash table
Q70. How to build low latency systems
To build low latency systems, focus on optimizing code, reducing network latency, using efficient data structures, and leveraging caching.
Optimize code by reducing unnecessary computations and improving algorithms
Reduce network latency by minimizing round trips and using efficient protocols like UDP
Use efficient data structures like arrays and hash maps for quick access to data
Leverage caching to store frequently accessed data in memory for faster retrieval
Q71. Program to insert an element into a sorted linked list
Program to insert an element into a sorted linked list
Traverse the linked list until the correct position is found
Create a new node with the element to be inserted
Adjust the pointers of the previous and next nodes to point to the new node
Handle edge cases such as inserting at the beginning or end of the list
Q72. what do you think abobut intuit "?
Intuit is a financial software company known for products like QuickBooks and TurboTax.
Intuit is a leading provider of financial software solutions for individuals and businesses.
They are known for products like QuickBooks, TurboTax, and Mint.
Intuit's software helps users manage their finances, taxes, and accounting efficiently.
The company focuses on simplifying financial tasks for users through user-friendly interfaces and automation.
Intuit has a strong reputation for custom...read more
Design a bus seat booking system.
Use a database to store seat availability and bookings
Implement a user interface for customers to select and book seats
Consider implementing a payment system for reservations
Allow for seat selection based on preferences such as window or aisle
Q74. Given a string of parenthesis, determine if it forms valid parenthesis or not.
Check if a string of parenthesis is valid or not.
Use a stack to keep track of opening parenthesis.
Iterate through the string and push opening parenthesis onto the stack.
When encountering a closing parenthesis, pop from the stack and check if it matches the corresponding opening parenthesis.
If stack is empty at the end and all parenthesis have been matched, the string is valid.
Q75. AWS technologies on which you worked
I have worked on AWS technologies such as EC2, S3, Lambda, and RDS.
EC2 (Elastic Compute Cloud)
S3 (Simple Storage Service)
Lambda
RDS (Relational Database Service)
Q76. Difference between C, C++, and Java
C is a procedural language, C++ is an object-oriented language, and Java is a class-based object-oriented language.
C is a low-level language used for system programming and embedded systems.
C++ is an extension of C with added features like classes, inheritance, and polymorphism.
Java is platform-independent and has automatic memory management through garbage collection.
Java programs run on a virtual machine, while C and C++ programs compile to machine code.
C++ is often used fo...read more
Q77. Difference between Web 2.0 and Web 1.0
Web 2.0 is more interactive and user-generated content-driven, while Web 1.0 was static and read-only.
Web 2.0 allows for social networking and collaboration, while Web 1.0 was primarily informational.
Web 2.0 relies on user-generated content, while Web 1.0 was created by developers and publishers.
Web 2.0 is more dynamic and responsive, while Web 1.0 was static and slow to load.
Examples of Web 2.0 sites include Facebook, Twitter, and Wikipedia, while Web 1.0 sites include early...read more
Q78. How would you define the success metric.
Success metric is a quantifiable measure used to determine the effectiveness of a product or project.
Success metric should be aligned with the overall goals and objectives of the product or project.
It should be specific, measurable, achievable, relevant, and time-bound (SMART).
Examples of success metrics include revenue growth, customer satisfaction scores, user engagement metrics, and market share.
Regularly tracking and analyzing the success metrics can help in making data-d...read more
Q79. How many returns have you prepared
I have prepared over 100 tax returns for individuals and small businesses.
I have experience preparing both individual and small business tax returns
I am familiar with various tax forms such as 1040, Schedule C, and Schedule E
I have worked with clients to maximize deductions and credits
I have experience with tax software such as TurboTax and TaxAct
Q80. how agile working methods
Agile working methods involve iterative development, collaboration, flexibility, and continuous improvement.
Agile methods prioritize customer satisfaction through early and continuous delivery of valuable software.
Teams work in short iterations called sprints, focusing on delivering working software frequently.
Collaboration between team members, stakeholders, and customers is essential for success.
Flexibility to adapt to changing requirements and feedback is a key principle o...read more
Q81. Design event driven schedular
Design an event driven scheduler for managing tasks and events.
Use a message queue system to handle incoming events and tasks.
Implement event listeners to trigger actions based on specific events.
Utilize a scheduling algorithm to prioritize and manage tasks.
Include error handling mechanisms to handle failures gracefully.
Q82. Implementation of LRU cache
LRU cache is a data structure that stores the most recently used items, discarding the least recently used items when full.
Use a doubly linked list to keep track of the order of items based on their usage.
Use a hash map to quickly access items in the cache.
When a new item is accessed, move it to the front of the linked list. If the cache is full, remove the item at the end of the list.
Q83. Number of minimum platforms required
Minimum platforms required to avoid train collisions
Calculate the number of trains arriving and departing at each time slot
Find the maximum number of trains present at any given time
The minimum platforms required will be the maximum number of trains present at any given time
Q84. What is polymorphism?
Polymorphism is the ability of a function or method to behave differently based on the object it is acting upon.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
There are two types of polymorphism: compile-time (method overloading) and runtime (method overriding).
Example: Inheritance allows a child class to override a method from its parent class, exhibiting polymorphic behavior.
Q85. Write code for stack operations
Code for stack operations in C++ using array
Declare an array to store stack elements
Implement push operation to add elements to the top of the stack
Implement pop operation to remove elements from the top of the stack
Implement peek operation to view the top element without removing it
Q86. HLD of project worked previously
Designed a high-level architecture for a web-based project using microservices and RESTful APIs.
Utilized microservices architecture to break down the project into smaller, independent services.
Implemented RESTful APIs for communication between services.
Used a service discovery mechanism like Eureka or Consul for dynamic service registration and discovery.
Ensured scalability and fault tolerance by incorporating load balancing and circuit breaker patterns.
Secured communication ...read more
Q87. Integer to roman number
Convert integer to Roman numeral
Create a mapping of integer values to Roman numeral symbols
Iterate through the mapping to find the largest Roman numeral that fits the integer
Subtract the value of the Roman numeral from the integer and repeat until the integer becomes 0
Q88. normalization in DBMS
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.
Normalization involves breaking down a table into smaller tables and establishing relationships between them.
There are different levels of normalization, with each level addressing a specific type of data redundancy.
Normalization helps to prevent data inconsistencies and anomalies, and improves database performance.
Example: A customer table can be normalized into a cu...read more
Q89. Valid Binary Search Tree
A valid binary search tree is a binary tree where the left subtree of a node contains only nodes with keys less than the node's key, and the right subtree only nodes with keys greater than the node's key.
Nodes in the left subtree of a node must have keys less than the node's key.
Nodes in the right subtree of a node must have keys greater than the node's key.
In-order traversal of the tree should result in a sorted list of keys.
Q90. Share details of ITIL
ITIL stands for Information Technology Infrastructure Library, a set of best practices for IT service management.
ITIL provides a framework for organizations to plan, deliver, and support IT services.
It consists of five core publications covering different aspects of IT service management.
ITIL processes include incident management, problem management, change management, and more.
ITIL helps organizations improve efficiency, reduce costs, and enhance customer satisfaction.
Certif...read more
Q91. design uber nearest driver
Design a system to match users with the nearest available driver like Uber.
Use geolocation data from both users and drivers to calculate distances.
Implement a matching algorithm to pair users with the nearest available driver.
Consider factors like traffic conditions, driver availability, and user preferences.
Utilize real-time updates to continuously update driver availability and user locations.
Q92. vpc vs subnet ?
VPC is a virtual private cloud that allows you to create a logically isolated section of the AWS cloud. Subnets are segments of a VPC where you can place resources.
VPC is a virtual network dedicated to your AWS account.
Subnets are subdivisions of a VPC where you can place resources like EC2 instances.
VPC provides network-level security and isolation.
Subnets allow you to organize resources within a VPC based on security and operational needs.
More about working at Intuit
Top HR Questions asked in Hindustan Aeronautics
Interview Process at Hindustan Aeronautics
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month