Top 250 Data Structures Interview Questions and Answers

Updated 23 Feb 2025

Q101. How to check if the tree is balanced?

Ans.

Check if a tree is balanced by comparing the heights of its left and right subtrees.

  • Calculate the height of the left subtree and the height of the right subtree.

  • If the difference between the heights is greater than 1, the tree is not balanced.

  • Recursively check if both the left and right subtrees are balanced.

  • If both subtrees are balanced and the height difference is less than or equal to 1, the tree is balanced.

Add your answer

Q102. What is mean roll for csa ,

Ans.

Mean roll for CSA refers to the average number of times a customer service agent handles a call or interaction.

  • Mean roll for CSA is calculated by dividing the total number of calls or interactions handled by the number of customer service agents.

  • It helps in determining the workload and efficiency of the customer service team.

  • For example, if there are 10 customer service agents and they collectively handle 100 calls in a day, the mean roll for CSA would be 10.

View 3 more answers

Q103. But amazon can do the search in O(n). Why it has to go for O(nk)? For data structures like Hash tables and for large data, n will be large. So O(nk) is better than O(n) (former n is smaller than latter n).

Ans.

O(nk) is better than O(n) for large data and hash tables.

  • O(nk) is better because it takes into account the size of the data and the number of keys.

  • For large data and hash tables, the size of n will be large, making O(nk) more efficient.

  • O(n) assumes a constant number of keys, which may not be the case in practice.

  • Amazon may have chosen O(nk) for better scalability and performance.

Add your answer
Frequently asked in

Q104. 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
Frequently asked in
Are these interview questions helpful?

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

Q106. What is the texonomy,?

Ans.

Taxonomy is the science of classification, categorization, and naming of organisms based on their characteristics.

  • Taxonomy is a branch of biology that deals with the identification, classification, and naming of organisms.

  • It involves organizing organisms into hierarchical groups based on their similarities and differences.

  • Taxonomy helps in understanding the relationships between different species and their evolutionary history.

  • The classification system in taxonomy includes va...read more

View 1 answer
Share interview questions and help millions of jobseekers 🌟

Q107. Which tree is used in TreeMap and what is the implementation of it?

Ans.

TreeMap in Java uses Red-Black tree for implementation.

  • TreeMap in Java uses Red-Black tree for implementation

  • Red-Black tree is a self-balancing binary search tree

  • Red-Black tree ensures logarithmic time complexity for operations like get, put, remove

Add your answer
Frequently asked in

Q108. Split the string

Ans.

Split a string into an array of strings

  • Use the split() method in JavaScript to split a string based on a delimiter

  • Specify the delimiter inside the split() method

  • Store the result in an array variable

Add your answer

Data Structures Jobs

Software Developer 3-8 years
IBM India Pvt. Limited
4.0
Bangalore / Bengaluru
Software Developer 3-8 years
IBM India Pvt. Limited
4.0
Bangalore / Bengaluru
Software Engineer III - IOT 4-8 years
Walmart Labs
3.8
Bangalore / Bengaluru

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

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

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

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

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

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

Q115. 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
Frequently asked in

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

Q117. implement serialization of tree

Ans.

Serialize a tree data structure

  • Use pre-order traversal to serialize the tree

  • Store null values as a special character

  • Use a delimiter to separate nodes

  • Example: 1,2,null,null,3,4,null,null,5,null,null

  • Deserialize by splitting the string and using a queue

Add your answer

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

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

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

Q121. 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
Frequently asked in

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

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

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

Q125. how does look up happens in a list when you do my_list[5]?

Ans.

my_list[5] retrieves the 6th element of the list.

  • Indexing starts from 0 in Python.

  • The integer inside the square brackets is the index of the element to retrieve.

  • If the index is out of range, an IndexError is raised.

Add your answer
Frequently asked in

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

Q127. 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
Frequently asked in

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

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

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

Q131. 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
Frequently asked in

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

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

Q134. 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
Q135. All Root to Leaf Paths in 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.

A leaf of a bina...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

Q136. 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
Frequently asked in, ,

Q137. what is internal implementation of set

Ans.

Internal implementation of set is typically based on hash table or balanced tree data structures.

  • Sets are typically implemented using hash tables for faster access and retrieval of elements.

  • Some sets, like TreeSet in Java, are implemented using balanced trees to maintain elements in sorted order.

  • Internal implementation may vary based on the specific set implementation in a programming language.

Add your answer

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

Q139. What is Diffrence between tree map and tree set

Ans.

Tree map is a map implementation while tree set is a set implementation in Java.

  • Tree map stores key-value pairs in sorted order based on keys.

  • Tree set stores unique elements in sorted order.

  • Tree map allows duplicate values but not duplicate keys.

  • Tree set does not allow duplicate elements.

  • Both are implemented using Red-Black tree data structure.

View 1 answer

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

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

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

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

Q144. 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
Frequently asked in

Q145. 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
Frequently asked in

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

Q147. What is journal class

Ans.

Journal class is a categorization of transactions based on their nature and purpose.

  • Journal class helps in organizing and analyzing financial transactions.

  • It is used to group similar transactions together for reporting purposes.

  • Examples of journal classes include sales, purchases, payroll, and general ledger.

  • Each journal class has its own set of rules and procedures for recording transactions.

Add your answer
Frequently asked in

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

Q149. 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
Frequently asked in

Q150. what is its types and define them

Ans.

Types of systems include physical, abstract, open, closed, deterministic, and non-deterministic systems.

  • Physical systems involve tangible components like machines or structures.

  • Abstract systems are conceptual and do not have physical form.

  • Open systems interact with their environment and exchange matter or energy.

  • Closed systems do not exchange matter or energy with their environment.

  • Deterministic systems have predictable outcomes based on initial conditions.

  • Non-deterministic s...read more

Add your answer
Frequently asked in

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

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

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

Q154. 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
Frequently asked in

Q155. 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
Frequently asked in

Q156. 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
Frequently asked in

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

Q158. Collect anagrams of the strings in an array, into separate objects and return the array of those objects. If no anagrams are present , store it alone in a separate obj.

Ans.

Collect anagrams of strings in an array into separate objects and return the array of those objects.

  • Iterate through the array of strings and sort each string alphabetically to find anagrams.

  • Store anagrams in separate objects and non-anagrams in a separate object.

  • Return the array of objects containing anagrams and non-anagrams.

Add your answer

Q159. 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
Frequently asked in

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

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

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

Q163. 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
Frequently asked in

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

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

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

Q167. DIFF BW GROUPS AND SET

Ans.

GROUP and SET are both Tableau functions used for creating subsets of data, but GROUP is used for combining data based on a common field, while SET is used for creating custom subsets based on conditions.

  • GROUP is used to combine data based on a common field, such as grouping sales data by region.

  • SET is used to create custom subsets of data based on conditions, such as creating a set of high-value customers.

  • GROUP can be used to aggregate data within a specific category, while ...read more

Add your answer

Q168. 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
Frequently asked in

Q169. 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
Frequently asked in

Q170. what is associatiev array ?

Ans.

An associative array is an array where each key is associated with a value.

  • Associative arrays use key-value pairs instead of numerical indices.

  • Keys can be strings or integers.

  • Example: $colors = array('red' => '#FF0000', 'blue' => '#0000FF');

Add your answer

Q171. 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
Frequently asked in

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

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

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

Q175. 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
Frequently asked in

Q176. 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
Frequently asked in

Q177. 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
Frequently asked in

Q178. bfs in binary tree

Ans.

Breadth-first search (BFS) is a traversal algorithm used to visit all nodes of a binary tree level by level.

  • Start at the root node and visit all nodes at the current level before moving to the next level.

  • Use a queue data structure to keep track of nodes to visit next.

  • Example: BFS traversal of a binary tree - 1 -> 2 -> 3 -> 4 -> 5

Add your answer
Frequently asked in

Q179. 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
Frequently asked in

Q180. 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
Frequently asked in

Q181. 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
Frequently asked in

Q182. 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
Frequently asked in

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

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

Q185. 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
Frequently asked in

Q186. 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
Frequently asked in

Q187. How priority queue works and its implementation using min heap

Ans.

Priority queue is a data structure that stores elements based on their priority, allowing for efficient retrieval of the highest priority element.

  • Priority queue can be implemented using a min heap, where the root node always contains the minimum element.

  • Insertion: Add the new element to the end of the heap and then heapify up to maintain the min heap property.

  • Deletion: Remove the root node (minimum element), move the last element to the root, and then heapify down to maintain...read more

Add your answer
Frequently asked in

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

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

Q190. 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
Frequently asked in

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

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

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

Q194. 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
Frequently asked in

Q195. 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
Frequently asked in

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

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

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

Q199. 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
Frequently asked in

Q200. 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
1
2
3
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.4k Interviews
3.8
 • 8.1k Interviews
3.6
 • 7.5k Interviews
3.7
 • 5.6k Interviews
3.8
 • 5.6k Interviews
4.1
 • 5k Interviews
3.7
 • 4.7k Interviews
3.5
 • 3.8k Interviews
3.7
 • 846 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

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