Data Structures

Skill
Computer Science

Top 250 Data Structures Interview Questions and Answers 2024

250 questions found

Updated 13 Dec 2024

Q101. DSA : Search an element in infinite soted array

Ans.

Search an element in an infinite sorted array using binary search.

  • Initialize low as 0 and high as 1.

  • Double the high index until arr[high] is greater than the target element.

  • Perform binary search between low and high indexes.

Add your answer

Q102. what kinds of structures are used in looping

Ans.

Different structures like for loop, while loop, do-while loop, and foreach loop are used in looping.

  • For loop is used when the number of iterations is known

  • While loop is used when the number of iterations is unknown

  • Do-while loop is used when the loop needs to be executed at least once

  • Foreach loop is used to iterate over elements in an array or collection

  • Nested loops are used when a loop is placed inside another loop

Add your answer

Q103. How would you optimize it for a binary search tree?

Ans.

Optimizing for binary search tree

  • Ensure the tree is balanced to maintain O(log n) search time

  • Implement efficient insertion and deletion algorithms

  • Use in-order traversal for sorted output

  • Consider using AVL or Red-Black trees for self-balancing

  • Avoid using recursion for large trees to prevent stack overflow

Add your answer

Q104. How will you optimize the performance while reading a huge file with more than 100 columns and 1 lac rows?

Ans.

Use efficient file reading techniques like memory mapping, parallel processing, and columnar storage.

  • Utilize memory mapping to directly access file data without loading it into memory

  • Implement parallel processing to read and process data concurrently for faster performance

  • Consider using columnar storage to optimize data retrieval for specific columns

  • Use appropriate data structures and algorithms for efficient data processing

Add your answer
Are these interview questions helpful?

Q105. Merge two sorted linked list and write testcases

Ans.

Merging two sorted linked lists and writing test cases.

  • Create a new linked list to store the merged list

  • Compare the first nodes of both lists and add the smaller one to the new list

  • Repeat until one of the lists is empty, then add the remaining nodes to the new list

  • Write test cases to cover all possible scenarios, including empty lists and lists of different lengths

Add your answer

Q106. What is the use of mapping

Ans.

Mapping is used to visually represent spatial data and analyze relationships between different geographic features.

  • Mapping helps in visualizing data and identifying patterns or trends

  • It allows for spatial analysis and decision-making based on geographic information

  • Mapping is used in various industries such as urban planning, environmental management, and disaster response

  • GIS technology uses mapping to create interactive maps for data visualization and analysis

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

Q107. How many types of alignment?

Ans.

There are three types of alignment: shaft alignment, belt alignment, and gear alignment.

  • Shaft alignment involves aligning the rotating shafts of machines to ensure smooth operation and prevent damage.

  • Belt alignment refers to aligning the belts in machines such as conveyor systems to prevent slipping and maximize efficiency.

  • Gear alignment involves aligning the gears in machines to ensure proper meshing and smooth transmission of power.

View 2 more answers

Q108. What is scale and encoder.

Ans.

A scale is a device used to measure weight or mass, while an encoder is a device used to convert motion or position into digital signals.

  • A scale is commonly used in households to measure the weight of objects or people.

  • An encoder is often used in robotics or automation systems to determine the position or speed of a motor.

  • Scales can be analog or digital, with digital scales providing more accurate measurements.

  • Encoders can be rotary or linear, depending on the type of motion ...read more

Add your answer

Data Structures Jobs

Senior Developer - Java, Node.js, or JavaScript 7-9 years
SAP India Pvt.Ltd
4.2
₹ 16 L/yr - ₹ 39 L/yr
(AmbitionBox estimate)
Bangalore / Bengaluru
Applied Scientist II, Central Machine Learning 3-7 years
Amazon India Software Dev Centre Pvt Ltd
4.1
Bangalore / Bengaluru
Software Developer 3-5 years
IBM India Pvt. Limited
4.1
₹ 2 L/yr - ₹ 22 L/yr
(AmbitionBox estimate)
Pune

Q109. What is , insert delete

Ans.

Insert delete is a common operation performed on data structures like arrays and linked lists.

  • Insertion involves adding a new element to the data structure at a specific position.

  • Deletion involves removing an element from the data structure at a specific position.

  • Examples include inserting a new value into an array at index 3 or deleting a node from a linked list.

  • These operations can affect the size and order of the data structure.

Add your answer

Q110. why should we dictionaries?

Ans.

Dictionaries are useful for efficient key-value pair storage and retrieval.

  • Dictionaries provide fast access to values based on their keys.

  • They allow for efficient searching, insertion, and deletion of key-value pairs.

  • Dictionaries are commonly used in scenarios where quick lookup is required, such as caching or indexing.

  • They can be used to count occurrences of elements in a collection.

  • Dictionaries are helpful in solving problems that involve mapping or associating data.

  • Example...read more

View 2 more answers

Q111. What's is data?

Ans.

Data is information that is collected, stored, and analyzed for various purposes.

  • Data can be in the form of numbers, text, images, videos, etc.

  • Data can be structured or unstructured.

  • Data can be collected from various sources such as surveys, sensors, databases, etc.

  • Data is used for analysis, decision-making, and reporting.

  • Examples: customer information in a database, sales figures in a spreadsheet, medical records in a hospital system.

Add your answer

Q112. What is the storage?

Ans.

Storage refers to the physical space where goods or materials are kept until they are needed.

  • Storage is an essential part of any warehouse operation.

  • It involves organizing and maintaining inventory in a safe and efficient manner.

  • Different types of storage include pallet racking, shelving, and bulk storage.

  • Proper storage techniques can help prevent damage to goods and improve inventory management.

  • Examples of storage equipment include forklifts, pallet jacks, and conveyors.

Add your answer

Q113. what is buffer and explain its applications or usage?

Ans.

A buffer is a zone around a geographic feature that is used for analysis or visualization purposes.

  • Buffers are commonly used in GIS to analyze proximity, connectivity, and accessibility.

  • They can be used to identify areas within a certain distance of a feature, such as a buffer zone around a school to determine areas within a 1-mile radius.

  • Buffers can also be used for visualizing data, such as creating a buffer around a river to show areas that may be affected by flooding.

  • They...read more

Add your answer

Q114. When OOS results obtained how processed further.

Ans.

When OOS results are obtained, they need to be processed further to determine the cause and take appropriate actions.

  • Investigate the root cause of the OOS result

  • Review the testing procedures and equipment used

  • Check for any potential errors or deviations

  • Perform retesting or additional testing if necessary

  • Document all findings and actions taken

  • Notify relevant stakeholders and management

  • Implement corrective actions to prevent future OOS results

View 1 answer

Q115. Implement a dynamic 2D excel sheet using DS (underwent various levels of improvisations)

Ans.

Implement a dynamic 2D excel sheet using DS

  • Use a 2D array to store the data

  • Implement functions to add, delete, and modify data

  • Use data structures like linked lists or hash tables for efficient searching and sorting

  • Implement dynamic resizing to handle large amounts of data

  • Use GUI libraries like Tkinter or PyQt for user interface

Add your answer

Q116. Given a graph, print all the connected components in it.

Ans.

Print all the connected components in a given graph.

  • Traverse the graph using DFS or BFS algorithm.

  • Maintain a visited array to keep track of visited nodes.

  • For each unvisited node, perform DFS or BFS and add all visited nodes to a connected component.

  • Repeat until all nodes are visited.

  • Print all connected components.

Add your answer

Q117. How will you construct parse tree for ((a+b)*c)/d? what all data structures can you use?

Ans.

Constructing parse tree for ((a+b)*c)/d using data structures.

  • Use stack data structure to keep track of operators and operands.

  • Start with the innermost parentheses and work outwards.

  • Create a node for each operator and operand and link them together.

  • The root node will be the final result of the expression.

  • Example: ((a+b)*c)/d can be represented as / -> * -> + -> a, b, c, d.

Add your answer

Q118. There is 3*3 RUBIX cube, Can you find data structure for solving rubix cube

Ans.

A graph data structure can be used to solve a Rubix cube.

  • Each cubelet can be represented as a node in the graph.

  • Edges can be added between nodes to represent possible moves.

  • A search algorithm like BFS or DFS can be used to find the solution.

View 1 answer

Q119. SEARCH AN ELEMENT IN ROTATED SORTED LINKLIST .

Ans.

Search for an element in a rotated sorted linked list.

  • Find the pivot point where the list is rotated.

  • Divide the list into two sublists based on the pivot point.

  • Perform binary search on the appropriate sublist.

  • Handle edge cases such as empty list and list with only one element.

Add your answer

Q120. Given two linked lists both represent a number . Create a linked list that contains its sum

Ans.

Create a linked list that contains the sum of two given linked lists representing numbers.

  • Traverse both linked lists simultaneously and add the corresponding nodes' values. If the sum is greater than 9, carry over the 1 to the next node.

  • If one linked list is longer than the other, add the remaining nodes to the sum.

  • Create a new linked list with the sum in reverse order.

Add your answer

Q121. What is Linear and non linear ds

Ans.

Linear data structures have elements arranged in a sequential order, while non-linear data structures have elements connected in a non-sequential manner.

  • Linear data structures include arrays, linked lists, queues, and stacks.

  • Non-linear data structures include trees, graphs, and heaps.

  • Linear data structures have a single path to traverse elements, while non-linear data structures have multiple paths.

Add your answer

Q122. All Root to Leaf Paths in Binary Tree.<h4 id="you-are-given-an-arbitrary-binary-tree-consisting-of-39-n-39-nodes-numbered-from-1-to-39-n-39-your-task-is-to-print-all-the-root-to-leaf-paths-of-the-binary-tree">You are given an arbitrary binary tree consisting of 'N' nodes numbered from 1 to 'N'. Your task is to print all the root to leaf paths of the binary tree.</h4> <h4 id="a-leaf-of-a-binary-tree-is-the-node-which-does-not-have-a-left-child-and-a-right-child">A leaf of a bina</h4>...

read more
Ans.

The task is to print all the root to leaf paths of an arbitrary binary tree.

  • Traverse the binary tree using depth-first search (DFS) algorithm

  • Maintain a current path list to keep track of the nodes in the current path

  • When reaching a leaf node, add the current path to the result list

  • Recursively explore the left and right subtrees

  • Remove the last node from the current path after exploring each subtree

View 2 more answers

Q123. What is DSO?

Ans.

DSO stands for Days Sales Outstanding, a metric used to measure the average number of days it takes for a company to collect payment after a sale.

  • DSO is calculated by dividing accounts receivable by total credit sales and multiplying the result by the number of days in the period being measured.

  • A high DSO can indicate that a company is having trouble collecting payments from customers, while a low DSO can indicate that a company has efficient collections processes.

  • For example...read more

Add your answer

Q124. Internal implementation of hashmap is working?

Ans.

Yes, the internal implementation of hashmap is working.

  • Ensure that the hash function is distributing keys evenly across the buckets.

  • Check for collisions and how they are handled (e.g. chaining or open addressing).

  • Verify that resizing and rehashing are implemented correctly.

  • Test the performance of hashmap operations under different load factors and key distributions.

Add your answer

Q125. What is important in labeling?

Ans.

Accuracy, clarity, and compliance are important in labeling.

  • Accuracy: Labels should provide correct and precise information.

  • Clarity: Labels should be easy to read and understand.

  • Compliance: Labels must adhere to relevant regulations and standards.

  • Examples: Nutritional information, ingredient lists, warning labels.

View 2 more answers

Q126. What is WAH and it's standard

Ans.

WAH stands for Working at Heights. It refers to the practice of working in elevated areas and the safety standards associated with it.

  • WAH is an acronym for Working at Heights.

  • It involves working in elevated areas such as rooftops, scaffolding, or ladders.

  • The WAH standard includes guidelines and regulations to ensure the safety of workers.

  • It emphasizes the use of fall protection equipment like harnesses, guardrails, and safety nets.

  • Training and proper planning are essential fo...read more

View 2 more answers

Q127. What is the differnce between linear and non linear data structure?

Ans.

Linear data structures have a sequential arrangement of elements while non-linear data structures have a hierarchical arrangement.

  • Linear data structures have a fixed number of elements and are easy to traverse.

  • Non-linear data structures have an arbitrary number of elements and are difficult to traverse.

  • Arrays, linked lists, and stacks are examples of linear data structures.

  • Trees, graphs, and heaps are examples of non-linear data structures.

Add your answer

Q128. what is the non linear data structure

Ans.

Non-linear data structures are data structures where elements are not arranged in a sequential manner.

  • Non-linear data structures do not have elements stored in a sequential order like arrays or linked lists.

  • Examples include trees, graphs, and heaps.

  • In trees, each element can have multiple children, unlike linear structures where each element has only one successor.

  • Graphs consist of nodes connected by edges, allowing for complex relationships between elements.

  • Heaps are binary ...read more

Add your answer

Q129. What is fogging technique

Ans.

Fogging technique is a method used by optometrists to determine the patient's refractive error by temporarily blurring their vision.

  • Fogging technique involves placing a lens in front of the patient's eye to induce blur.

  • This technique helps to relax the patient's accommodation, allowing for a more accurate measurement of their refractive error.

  • By gradually increasing the power of the lens, the optometrist can determine the patient's optimal prescription.

  • Fogging technique is co...read more

View 1 answer

Q130. What we will do if void present in the structure

Ans.

The void in a structure needs to be identified and filled with appropriate materials to ensure structural integrity.

  • Identify the location and size of the void

  • Determine the cause of the void

  • Select appropriate materials to fill the void

  • Ensure proper compaction and curing of the materials

  • Perform necessary testing to ensure structural integrity

Add your answer

Q131. What's difference between ordered map and unordered map

Ans.

Ordered map maintains the order of insertion while unordered map does not.

  • Ordered map is implemented using a balanced binary search tree while unordered map is implemented using a hash table.

  • Ordered map is useful when we need to maintain the order of insertion while unordered map is useful when we need faster access to elements.

  • Example of ordered map: std::map in C++, Example of unordered map: std::unordered_map in C++

Add your answer

Q132. difference between ordered and unordered map

Ans.

Ordered map maintains the order of insertion while unordered map does not guarantee any specific order.

  • Ordered map: elements are stored in the order they were inserted

  • Unordered map: elements are stored in an unspecified order for faster access

  • Example: std::map vs std::unordered_map in C++

Add your answer

Q133. What is a TreeMap and highlights of using it

Ans.

TreeMap is a data structure in Java that stores key-value pairs in a sorted order based on the keys.

  • TreeMap implements the Map interface and uses a Red-Black tree for storage.

  • It provides efficient operations like insertion, deletion, and retrieval of elements.

  • Elements are sorted based on the natural ordering of keys or a custom Comparator.

  • Example: TreeMap treeMap = new TreeMap<>(); treeMap.put("A", 1);

Add your answer

Q134. What is deduplication

Ans.

Deduplication is a data compression technique that eliminates duplicate copies of data, reducing storage space and improving efficiency.

  • Deduplication is used to identify and remove redundant data.

  • It compares incoming data with existing data and stores only unique instances.

  • Deduplication can be performed at the file, block, or byte level.

  • It helps in reducing storage costs and improving backup and restore times.

  • Examples of deduplication technologies include inline deduplication...read more

View 2 more answers

Q135. How many types of graphs? Explain?

Ans.

There are several types of graphs, including line, bar, pie, scatter, and area graphs.

  • Line graphs show trends over time.

  • Bar graphs compare data between different categories.

  • Pie graphs show proportions of a whole.

  • Scatter graphs show the relationship between two variables.

  • Area graphs show the cumulative totals over time.

Add your answer

Q136. What is journal class types

Ans.

Journal class types are categories used to classify journal entries based on their purpose.

  • Journal class types include revenue, expense, asset, liability, equity, and contra accounts.

  • Revenue journal entries record income earned by the business.

  • Expense journal entries record expenses incurred by the business.

  • Asset journal entries record the acquisition or disposal of assets.

  • Liability journal entries record the incurrence or payment of debts.

  • Equity journal entries record change...read more

Add your answer

Q137. Solve a problem (DSA) and discuss/speak out the approaches over a zoom call

Ans.

Discussing approaches to solve a DSA problem in a Zoom call.

  • Understand the problem statement and constraints.

  • Choose an appropriate data structure and algorithm.

  • Implement the solution and test it with sample inputs.

  • Optimize the solution if possible.

  • Discuss the time and space complexity of the solution.

Add your answer

Q138. what is ml? what is data structure

Ans.

ML stands for machine learning, a branch of artificial intelligence that focuses on developing algorithms to learn from and make predictions based on data. Data structure refers to the way data is organized and stored in a computer system.

  • ML (machine learning) is a subset of AI that uses algorithms to learn from and make predictions based on data.

  • Data structure refers to the way data is organized and stored in a computer system, such as arrays, linked lists, trees, etc.

  • Exampl...read more

Add your answer

Q139. Why DS is callData Structure?

Ans.

DS stands for Data Structure because it is a way of organizing and storing data in a computer so that it can be accessed and used efficiently.

  • Data structures are used to organize and store data in a way that makes it easy to access and manipulate.

  • Examples of data structures include arrays, linked lists, stacks, queues, trees, and graphs.

  • Data structures are an important part of computer science and are used in many different applications, from databases to video games.

Add your answer

Q140. Implement linked list and its operations

Ans.

A linked list is a data structure where each element points to the next element. Operations include insertion, deletion, and traversal.

  • To insert a new element, create a new node and update the pointers of the previous and next nodes.

  • To delete an element, update the pointers of the previous and next nodes to skip the node to be deleted.

  • Traversal involves starting at the head node and following the pointers to each subsequent node.

Add your answer

Q141. What is the index value ?

Ans.

The index value is a numerical representation of the performance of a group of stocks or other assets.

  • Index value is calculated by taking the weighted average of the prices of the constituent stocks or assets.

  • It is used to track the overall performance of a particular market or sector.

  • Examples include the S&P 500, NASDAQ Composite, and Dow Jones Industrial Average.

  • Changes in the index value can indicate trends in the market or sector.

  • Investors can use index value to make info...read more

Add your answer

Q142. What is a Binary Tree? Could you implement it?

Ans.

A binary tree is a data structure where each node has at most two children.

  • Consists of nodes, each with a left and right child pointer

  • Root node is the topmost node

  • Examples: Binary search tree, expression tree

Add your answer

Q143. What is flows

Ans.

Flows in Mulesoft are sequences of message processors that define the logic of an integration application.

  • Flows are used to define the sequence of steps in an integration application

  • They consist of message processors that perform specific tasks

  • Flows can have multiple input and output points

  • They can be triggered by events or scheduled to run at specific times

  • Examples of flows include HTTP request-response flows, file processing flows, and database integration flows

View 1 answer

Q144. What is decorators, init? List and tuple difference

Ans.

Decorators in Python are functions that modify the behavior of other functions. __init__ is a special method used for initializing objects. Lists are mutable while tuples are immutable.

  • Decorators in Python are used to modify the behavior of functions without changing their code.

  • __init__ is a special method in Python classes used for initializing objects.

  • Lists in Python are mutable, meaning their elements can be changed after creation.

  • Tuples in Python are immutable, meaning th...read more

Add your answer

Q145. Check if a linkedlist is palindrome

Ans.

To check if a linkedlist is palindrome or not

  • Traverse the linkedlist and push each element into a stack

  • Traverse the linkedlist again and compare each element with the popped element from the stack

  • If all elements match, then the linkedlist is palindrome

Add your answer

Q146. what are the time complexities of various data structures.

Ans.

Time complexities of data structures vary based on operations like insertion, deletion, search, etc.

  • Arrays - O(1) for access, O(n) for insertion/deletion

  • Linked Lists - O(n) for access, O(1) for insertion/deletion at head/tail

  • Stacks - O(1) for push/pop operations

  • Queues - O(1) for enqueue/dequeue operations

  • Hash Tables - O(1) for average case search/insert/delete

  • Binary Trees - O(log n) for search/insert/delete in balanced trees

  • Heaps - O(log n) for insert/delete, O(1) for find-mi...read more

Add your answer

Q147. If you prepare OOPS,Data Structures it would be better to crack but can't did it and as usual they have final roundd

Ans.

Preparing OOPS and Data Structures is crucial for cracking interviews, but not being able to do so doesn't mean you can't succeed in the final round.

  • Focus on showcasing your problem-solving skills and ability to learn quickly during the final round.

  • Highlight any relevant projects or experiences that demonstrate your technical abilities.

  • Be honest about your areas of weakness and show a willingness to improve and learn.

  • Practice coding problems and algorithms to strengthen your ...read more

Add your answer

Q148. DSA Difference between tuples and list

Ans.

Tuples are immutable and ordered collections, while lists are mutable and ordered collections in Python.

  • Tuples are created using parentheses, while lists are created using square brackets.

  • Tuples cannot be modified after creation, while lists can be modified.

  • Tuples are faster than lists for iteration and accessing elements.

  • Lists are more flexible and have more built-in methods compared to tuples.

Add your answer

Q149. What are arrays and objects

Ans.

Arrays and objects are data structures used in programming to store multiple values or properties.

  • Arrays are ordered collections of values accessed by index.

  • Objects are collections of key-value pairs where values are accessed by keys.

  • Example of array: $colors = ['red', 'blue', 'green'];

  • Example of object: $person = ['name' => 'John', 'age' => 30];

Add your answer

Q150. Design Thread Safe implementation of HashMap

Ans.

Design a thread-safe implementation of HashMap.

  • Use synchronized methods or locks to ensure mutual exclusion.

  • Consider using ConcurrentHashMap instead of HashMap.

  • Use volatile keyword for variables accessed by multiple threads.

  • Avoid using iterators as they may cause ConcurrentModificationException.

  • Use atomic operations for read-modify-write operations.

  • Consider using immutable keys to avoid synchronization issues.

Add your answer

Q151. WHAT IS DYNAMIC ARRAY?

Ans.

Dynamic array is an array that can change its size during runtime.

  • Dynamic arrays are allocated memory at runtime.

  • They can be resized as needed.

  • They are useful when the size of the array is not known beforehand.

  • Examples include ArrayList in Java and List in Python.

Add your answer

Q152. What is the type of data and what is the good model for this problem

Ans.

The type of data is not specified.

  • Without knowing the specific problem, it is difficult to determine the type of data and the good model.

  • More information about the problem is needed to provide a suitable answer.

  • Examples of data types and models could include numerical data with a regression model, categorical data with a decision tree model, or text data with a natural language processing model.

View 1 answer

Q153. Difference between barcode and qr code

Ans.

Barcode is a linear code while QR code is a 2D code that can store more information.

  • Barcode is a series of vertical bars and spaces that represent numbers and letters.

  • QR code is a square matrix of black and white dots that can store more data than a barcode.

  • Barcode can only be read in one direction while QR code can be read in any direction.

  • Barcode is commonly used for product identification and inventory management while QR code is used for marketing and advertising.

  • Barcode ...read more

View 1 answer

Q154. What is the difference between a File Structure and Data Structure?

Ans.

File structure refers to the way data is stored on disk, while data structure refers to the way data is organized in memory.

  • File structure is concerned with how data is stored on disk, while data structure is concerned with how data is organized in memory.

  • File structure is typically hierarchical, with directories containing files, while data structures can take many forms such as arrays, linked lists, and trees.

  • Examples of file structures include FAT, NTFS, and HFS+, while ex...read more

Add your answer

Q155. What is this ct and cpt

Ans.

CT stands for Current Transformer and CPT stands for Capacitor Potential Transformer.

  • CT is used to measure the current flowing in a circuit and step down the current to a level that can be measured by instruments.

  • CPT is used to measure the voltage of a circuit and step down the voltage to a level that can be measured by instruments.

  • Both CT and CPT are types of transformers used in electrical systems.

  • CT and CPT are commonly used in power systems for protection and metering pur...read more

Add your answer

Q156. Difference between array and union?

Ans.

Arrays are a collection of similar data types while unions are a collection of different data types sharing the same memory space.

  • Arrays are used to store a fixed number of elements of the same data type.

  • Unions are used to store different data types in the same memory location.

  • Arrays are accessed using an index while unions are accessed using the same memory location.

  • Arrays are used for homogeneous data while unions are used for heterogeneous data.

Add your answer

Q157. what are hashmaps?

Ans.

Hashmaps are data structures that store key-value pairs and allow for efficient retrieval of values based on keys.

  • Hashmaps are also known as dictionaries or associative arrays.

  • Keys in a hashmap must be unique, but values can be duplicated.

  • Example: {"apple": 5, "banana": 3, "orange": 7}

Add your answer

Q158. Differences between comparable and comparator?

Ans.

Comparable is an interface used for natural ordering while Comparator is an interface used for custom ordering.

  • Comparable is implemented by the class itself while Comparator is implemented by a separate class.

  • Comparable provides a single method compareTo() while Comparator provides a single method compare().

  • Comparable is used for sorting elements in a collection while Comparator is used for custom sorting.

  • Example: String class implements Comparable interface while Collections...read more

Add your answer

Q159. What is Hash collusion

Ans.

Hash collusion is when two different inputs produce the same hash value.

  • It is a security vulnerability in hash functions.

  • Attackers can exploit this vulnerability to create a collision attack.

  • For example, an attacker can create a malicious file with the same hash value as a legitimate file to bypass security checks.

Add your answer

Q160. What is Spanning tree and how it works

Ans.

Spanning tree is a protocol that prevents loops in a network by selectively blocking redundant paths.

  • Spanning tree protocol (STP) is used to prevent network loops

  • It works by selectively blocking redundant paths

  • STP elects a root bridge and calculates the shortest path to it

  • It uses Bridge Protocol Data Units (BPDUs) to communicate with other switches

  • STP can be configured with different modes such as Rapid Spanning Tree Protocol (RSTP) and Multiple Spanning Tree Protocol (MSTP)

Add your answer

Q161. What's merge and append

Ans.

Merge combines two or more datasets into one, while append adds new rows to an existing dataset.

  • Merge is used when we want to combine two or more datasets with similar columns into one dataset.

  • Append is used when we want to add new rows to an existing dataset.

  • Merge can be done using different types of joins such as inner join, left join, right join, and outer join.

  • Append can be done using the 'concatenate' function in pandas library in Python.

  • Both merge and append are commonl...read more

Add your answer

Q162. What is the difference between set and groups

Ans.

Sets are used for creating custom fields based on conditions, while groups are used for combining related fields together.

  • Sets are dynamic and can change based on filters, while groups are static and do not change.

  • Sets can be used for creating calculated fields, while groups are used for organizing fields.

  • Example: Creating a set for 'High Sales' based on sales amount, and grouping 'Region' and 'City' fields together.

Add your answer

Q163. define array and slice

Ans.

Array is a fixed-size collection of elements of the same type. Slice is a dynamic-size sequence of elements of the same type.

  • Arrays have a fixed size and are declared using square brackets, e.g. var arr [5]int

  • Slices are dynamic and are declared using the make() function, e.g. var s []int = make([]int, 5)

  • Slices can also be created using a slice literal, e.g. s := []int{1, 2, 3}

Add your answer

Q164. What is data information?

Ans.

Data information refers to processed and organized data that is meaningful and useful for decision-making and understanding.

  • Data information is derived from raw data through processing and analysis.

  • It is organized in a structured format to provide insights and knowledge.

  • Data information is used for decision-making, problem-solving, and understanding patterns.

  • Examples include reports, charts, graphs, and summaries derived from data.

View 1 answer

Q165. Given an integer(consider 4 bytes) find which byte is zero

Ans.

Given an integer, determine which byte is zero.

  • Convert the integer to a byte array using bitwise operations.

  • Iterate through the byte array and check for a zero value.

  • Return the index of the zero byte.

  • Consider endianness when converting to byte array.

Add your answer

Q166. Give the data structure to represent N-ary tree and write to code for its BFS

Ans.

Data structure and code for BFS of N-ary tree

  • N-ary tree can be represented using a node class with a list of child nodes

  • BFS can be implemented using a queue data structure

  • Iterate through the queue and add child nodes to the queue

  • Pop the node from the queue and process it

  • Repeat until the queue is empty

Add your answer

Q167. What is the difference between Hashmap and LinkedHashmap?

Ans.

Hashmap is unordered while LinkedHashmap maintains insertion order.

  • Hashmap uses hashing to store key-value pairs while LinkedHashmap uses a doubly linked list to maintain order.

  • Hashmap allows null values and one null key while LinkedHashmap does not allow null keys or values.

  • Hashmap has O(1) time complexity for basic operations while LinkedHashmap has O(1) for insertion and deletion but O(n) for iteration.

  • Example: Hashmap - HashMap map = new HashMap<>(); LinkedHashmap - Linke...read more

Add your answer

Q168. What is DPN , what is pick list

Ans.

DPN stands for Direct Product Notification. A pick list is a document that lists the items to be picked from the inventory for fulfilling customer orders.

  • DPN is an acronym for Direct Product Notification.

  • A pick list is a document that outlines the items to be picked from the inventory.

  • DPN is used to notify the store about new products or updates.

  • Pick lists are used by store employees to gather the necessary items for fulfilling customer orders.

  • For example, when a new product ...read more

View 1 answer

Q169. 1. what are the difference between queue item and transaction item ?

Ans.

Queue item is a container for data that needs to be processed, while transaction item is a unit of work that is processed by a robot.

  • Queue item is a data container that can hold any type of data, while transaction item is a specific type of data that represents a unit of work.

  • Queue item can be added to a queue by any process, while transaction item is typically added to a queue by a robot.

  • Queue item can be processed by any robot, while transaction item is typically processed ...read more

Add your answer

Q170. Implement a phone book. You can search either by name or phone number. You can search by prefix also. Write whole code with proper syntax

Ans.

Implement a phone book with search by name or phone number and prefix.

  • Create an array of strings to store contacts

  • Implement a function to add contacts to the array

  • Implement a function to search by name or phone number

  • Implement a function to search by prefix

  • Use regular expressions to match prefixes

Add your answer

Q171. 1.00123456788 how will we store. How in Double floating precision format A:- I said I am not aware

Ans.

Storing 1.00123456788 in double floating precision format

  • Double floating precision format is a binary format that stores numbers with a fractional component.

  • It uses 64 bits to store the number, with 52 bits for the mantissa and 11 bits for the exponent.

  • To store 1.00123456788, we would use the double data type in most programming languages.

  • In Java, for example, we would declare a variable as 'double num = 1.00123456788;'

Add your answer

Q172. Simple DSA problem of DFS and BFS

Ans.

DFS and BFS are fundamental graph traversal algorithms used to explore nodes in a graph.

  • DFS (Depth First Search) explores as far as possible along each branch before backtracking. It uses a stack to keep track of nodes.

  • BFS (Breadth First Search) explores all the neighbor nodes at the present depth prior to moving on to the nodes at the next depth. It uses a queue to keep track of nodes.

  • Example: For a graph with nodes A, B, C, D and edges (A, B), (A, C), (B, D), DFS would visi...read more

Add your answer

Q173. Evaluate Postfix expression?

Ans.

Postfix expression can be evaluated using a stack data structure.

  • Create an empty stack

  • Scan the expression from left to right

  • If the scanned character is an operand, push it onto the stack

  • If the scanned character is an operator, pop two operands from the stack, perform the operation and push the result back

  • Repeat until the end of the expression

  • The final result is the top of the stack

Add your answer

Q174. What is the boundary problem in allocation of size of structures?

Ans.

Boundary problem refers to the difficulty in deciding the optimal size of structures to allocate resources.

  • It involves determining the trade-off between the benefits of larger structures and the costs of building and maintaining them.

  • The problem is particularly relevant in fields such as architecture, civil engineering, and urban planning.

  • For example, in urban planning, deciding the optimal size of roads, buildings, and parks can have a significant impact on the quality of li...read more

Add your answer

Q175. What are B+ trees?what is the advantage?

Ans.

B+ trees are balanced trees used for indexing and searching large amounts of data.

  • B+ trees are similar to binary search trees but have multiple keys per node.

  • They are commonly used in databases and file systems.

  • B+ trees have a high fanout, reducing the number of disk accesses required for searching.

  • They are also self-balancing, ensuring efficient performance even with large amounts of data.

  • Example: In a database, a B+ tree can be used to index customer records by last name.

Add your answer

Q176. Make a data structure such that it can store an image dynamically

Ans.

A dynamic data structure for storing images as arrays of strings.

  • Use a 2D array of strings to represent the image pixels.

  • Implement resizing methods to adjust the size of the image.

  • Include methods for adding, removing, and modifying pixels.

  • Consider using compression techniques to reduce memory usage.

  • Support various image formats such as JPEG, PNG, and BMP.

Add your answer

Q177. What are Parity Bits ?

Ans.

Parity bits are used in computer systems to detect errors in data transmission.

  • Parity bits are extra bits added to a binary code to make the total number of 1s either even or odd.

  • They are used to detect errors during data transmission by comparing the number of 1s in a code with the expected parity.

  • If the number of 1s doesn't match the expected parity, an error is detected.

  • Parity bits can be even parity (total number of 1s should be even) or odd parity (total number of 1s sho...read more

Add your answer

Q178. Make a function to delete nodes from Dequeue

Ans.

A function to delete nodes from a Dequeue.

  • Create a function that takes the Dequeue and the value of the node to be deleted as parameters.

  • Traverse the Dequeue to find the node with the given value.

  • If the node is found, update the pointers of the previous and next nodes to bypass the node to be deleted.

  • If the node is the first or last node, update the head or tail pointers accordingly.

  • Free the memory allocated to the node.

  • Handle cases where the Dequeue is empty or the node is n...read more

Add your answer

Q179. What is linked hash map and its works internally and their complexity.

Ans.

LinkedHashMap is a data structure that combines features of a linked list and a hash map.

  • Combines features of linked list and hash map

  • Maintains insertion order

  • Allows null keys and values

  • Access order can be maintained using constructor parameter

Add your answer

Q180. Design one encoding sheme

Ans.

One encoding scheme is the Huffman coding which assigns variable-length codes to symbols based on their frequency of occurrence.

  • Huffman coding is a lossless data compression algorithm

  • It is widely used in image and video compression

  • The most frequently occurring symbols are assigned the shortest codes

  • Example: 'A' - 00, 'B' - 01, 'C' - 10, 'D' - 11'

  • The encoded message can be decoded using the same Huffman tree

Add your answer

Q181. What is the capacity of bytes bits

Ans.

A byte consists of 8 bits, so the capacity of bytes is 8 times the capacity of bits.

  • A byte is a unit of digital information that consists of 8 bits.

  • The capacity of a single bit is either 0 or 1.

  • Therefore, the capacity of a byte is 2^8 or 256 possible values.

  • Bytes are commonly used to represent characters in computer systems.

Add your answer

Q182. Write code for designing the ADT (Abstract Data Type) for all the classes that might be required to represent the game of chess

Ans.

Design ADT for chess game classes

  • Create classes for pieces (king, queen, etc.), board, player, game

  • Use inheritance to represent different types of pieces

  • Implement methods for moving pieces, checking for checkmate, etc.

Add your answer

Q183. Write the code to find inorder successor of given node in binary tree

Ans.

Code to find inorder successor of given node in binary tree

  • Check if the given node has a right subtree, if yes then find the leftmost node in the right subtree

  • If the given node does not have a right subtree, then traverse up the tree until we reach a node which is the left child of its parent

  • If we reach the root and the given node is the rightmost node, then there is no inorder successor

Add your answer

Q184. What is jagged array?

Ans.

A jagged array is an array of arrays where each element can be of different sizes.

  • Each sub-array can have a different number of elements

  • Useful for representing data structures like matrices or tables

  • Example: [['apple', 'banana'], ['orange', 'grape', 'kiwi']]

View 1 answer

Q185. What is straightified sample ?

Ans.

A straightified sample is a representative subset of a larger dataset that has been organized in a linear or sequential manner.

  • Straightified sampling involves selecting data points in a systematic order.

  • It is often used in time series analysis or when data needs to be processed in a specific order.

  • For example, in analyzing stock market data, a straightified sample may involve selecting data points at regular intervals over a specific time period.

Add your answer

Q186. What is inverted deuty stracture.

Ans.

Inverted duty structure refers to a situation where the tax rate on inputs or raw materials is higher than the tax rate on the final product.

  • Inverted duty structure can lead to a distortion in the pricing of goods and can discourage domestic manufacturing.

  • It often occurs when the government wants to promote a particular industry by reducing the tax rate on the final product.

  • For example, if the tax rate on raw materials used in manufacturing a product is 18% and the tax rate o...read more

View 1 answer

Q187. What is immutable vs mutable data structures?

Ans.

Immutable data structures cannot be modified after creation, while mutable data structures can be changed.

  • Immutable data structures: values cannot be changed once created (e.g. strings, tuples)

  • Mutable data structures: values can be modified after creation (e.g. lists, dictionaries)

Add your answer

Q188. What are mutable and immutable data structures?

Ans.

Mutable data structures can be modified after creation, while immutable data structures cannot be changed once created.

  • Mutable data structures allow for in-place modifications, while immutable data structures require creating a new instance when modifications are needed.

  • Examples of mutable data structures include lists, dictionaries, and sets in Python.

  • Examples of immutable data structures include tuples and strings in Python.

Add your answer

Q189. What is hamming code

Ans.

Hamming code is a type of error-correcting code used in digital communication to detect and correct errors in data transmission.

  • Hamming code adds extra bits to data to create parity bits for error detection and correction.

  • It is commonly used in computer memory systems and communication networks.

  • Example: In a 7-bit Hamming code, 4 data bits are encoded with 3 parity bits to detect and correct errors.

View 1 answer

Q190. What is a container

Ans.

A container is a lightweight, standalone, executable package that includes everything needed to run a piece of software.

  • Containers are isolated environments that package an application and its dependencies together.

  • They are portable and can run on any platform that supports the container runtime.

  • Popular containerization tools include Docker and Kubernetes.

  • Containers are often used for microservices architecture and DevOps practices.

Add your answer

Q191. Create a custom string sorter

Ans.

A custom string sorter that sorts an array of strings in ascending order.

  • Use a sorting algorithm like bubble sort, selection sort, or merge sort to sort the array of strings.

  • Compare each pair of strings and swap them if they are in the wrong order.

  • Repeat the process until the array is sorted in ascending order.

View 1 answer

Q192. What is Tensor and how they are important in field of Data Structure?

Ans.

Tensors are multi-dimensional arrays used to represent data in the field of data analysis and machine learning.

  • Tensors are important in data structures as they can efficiently store and manipulate large amounts of data.

  • They are used in various data analysis tasks such as image recognition, natural language processing, and time series analysis.

  • Tensors allow for efficient computation and manipulation of multi-dimensional data, enabling complex mathematical operations.

  • In machine...read more

View 1 answer

Q193. What is reverse lookup

Ans.

Reverse lookup is the process of finding the hostname associated with a given IP address.

  • It is commonly used in network troubleshooting.

  • It can be performed using the 'nslookup' command in the command prompt.

  • Reverse lookup is the opposite of forward lookup, which finds the IP address associated with a given hostname.

Add your answer

Q194. Difference between eudmf and usdmf

Ans.

EUDMF is for EU market and USDMF is for US market. Both contain information about the quality, safety and efficacy of a drug.

  • EUDMF is submitted to the European Medicines Agency (EMA) while USDMF is submitted to the US Food and Drug Administration (FDA)

  • EUDMF contains information about the drug substance and its manufacturing process while USDMF contains information about the drug substance, drug product and its manufacturing process

  • Both DMFs are used to support the registratio...read more

Add your answer

Q195. difference between tree map and heat map

Ans.

Tree map displays hierarchical data using nested rectangles, while heat map visualizes data using colors.

  • Tree map organizes data in a hierarchical structure with nested rectangles

  • Heat map uses colors to represent data values on a matrix

  • Tree map is useful for showing proportions within a whole, while heat map is good for visualizing patterns or correlations in data

Add your answer

Q196. What kind of data you need to maintain

Ans.

As an O.T manager, the data I need to maintain includes patient records, treatment plans, progress reports, scheduling information, and equipment inventory.

  • Patient records: Demographic information, medical history, and assessment results.

  • Treatment plans: Details of the recommended interventions and goals for each patient.

  • Progress reports: Regular updates on the patient's progress and any modifications to the treatment plan.

  • Scheduling information: Appointments, therapy session...read more

Add your answer

Q197. What is compression ratio

Ans.

Compression ratio is the ratio of the volume of gas in the cylinder when the piston is at the bottom of its stroke to the volume of gas when the piston is at the top of its stroke.

  • It is a measure of the efficiency of an internal combustion engine.

  • Higher compression ratios result in higher engine efficiency and power output.

  • Compression ratio is calculated by dividing the volume of the combustion chamber when the piston is at the bottom of its stroke by the volume of the combus...read more

View 1 answer

Q198. What is hash? What is its purpose?

Ans.

A hash is a function that converts an input into a fixed-size string of bytes, typically used for data encryption and verification.

  • Hash functions are used to map data of arbitrary size to fixed-size values.

  • Hashes are commonly used in data structures like hash tables for quick data retrieval.

  • Hashes are also used in cryptography for data encryption and verification.

  • Examples of hash functions include MD5, SHA-1, and SHA-256.

View 1 answer

Q199. Explain about homogeneous elements

Ans.

Homogeneous elements are elements of the same type or kind.

  • Homogeneous elements have similar properties and characteristics.

  • They can be combined or compared easily.

  • Examples include a set of integers, a group of apples, or a collection of red flowers.

Add your answer

Q200. What is Threshold?

Ans.

Threshold is a predetermined limit or level that triggers a specific action or response.

  • Threshold is a boundary or limit that separates one state from another.

  • It is often used in decision-making processes to determine when a certain action should be taken.

  • For example, in product management, a threshold can be set to trigger a notification when the number of user complaints exceeds a certain number.

  • Thresholds can also be used in performance monitoring, where a certain level of...read more

View 1 answer
1
2
3
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
3.9
 • 7.7k Interviews
3.7
 • 7.3k Interviews
3.8
 • 5.4k Interviews
3.7
 • 5.1k Interviews
4.1
 • 4.8k Interviews
3.8
 • 4.6k Interviews
3.6
 • 3.6k Interviews
3.7
 • 857 Interviews
View all
Data Structures Interview Questions
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
Get AmbitionBox app

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