Samsung Research
60+ Interview Questions and Answers
Alex has bought a new machine that does photocopies of photos in batches of minimum size ‘K’. Alex has ‘N’ photos, whose resolution is given in an integer array ‘photos’. The machine has some d...read more
This is the time when Dr. Stephen wants to distribute chocolates. He has N number of boxes in a row, and each box contains some chocolates. Now, He wants to distribute chocolates to K childre...read more
Given an array of length N, you need to find and print the sum of all elements of the array.
Input Format :
Line 1 : An Integer N i.e. size of array Line 2 : N integers which are elements of the ...read more
You have been given an integer array/list(ARR) of size 'N'. It only contains 0s, 1s and 2s. Write a solution to sort this array/list.
Note :
Try to solve the problem in 'Single Scan'. ' Single Scan' r...read more
For a given Singly Linked List of integers, sort the list using the 'Merge Sort' algorithm.
Input format :
The first and the only line of input contains the elements of the linked list sepa...read more
You are given 'N' rectangular buildings in a 2-dimensional city. Your task is to compute the skyline of these buildings, eliminating hidden lines return the skyline formed by these buildings ...read more
You are Harshad Mehta’s friend. He told you the price of a particular stock for the next ‘N’ days. You can either buy or sell a stock. Also, you can only complete at most 2-transactions. Find ...read more
You are given a Singly Linked List of integers. You need to reverse the Linked List by changing the links between nodes.
Input Format :
The first line of input contains a single integer T, re...read more
An alien spaceship arrived at our planet Earth. An alien dropped his dictionary of words on the way back to his planet. Ninja found that dictionary and now wants to create the order of the charac...read more
Q10. Difference between dfs and bfs and code any one algo in trees and graphs. Two sum problem A puzzle 1/2 more coding questions mostly on basics
Explaining the difference between DFS and BFS and coding an algorithm for trees and graphs.
DFS (Depth First Search) explores as far as possible along each branch before backtracking. BFS (Breadth First Search) explores all the vertices at the same level before moving to the next level.
DFS is useful for finding a path to a target node, while BFS is useful for finding the shortest path to a target node.
DFS can be implemented using recursion or a stack, while BFS can be implemen...read more
Q11. How will you approach a problem?
I will approach a problem by breaking it down into smaller parts and analyzing each part individually.
Identify the problem and its scope
Gather all relevant information and data
Break down the problem into smaller parts
Analyze each part individually
Develop a plan of action
Implement the plan and monitor progress
Make adjustments as necessary
Q12. Write the code for the Dijkstra
Dijkstra's algorithm finds the shortest path in a graph from a starting node to all other nodes.
Use a priority queue to keep track of the shortest distance to each node
Initialize distances to all nodes as infinity except the starting node as 0
Iterate through all nodes and update distances if a shorter path is found
Repeat until all nodes are visited and shortest paths are calculated
Q13. graph theory question - find diameter of tree
The diameter of a tree is the longest path between any two nodes in the tree.
Find the longest path between any two nodes in the tree.
This can be done by running two depth-first searches (DFS) on the tree.
The diameter of the tree is the length of the path found by the second DFS.
Q14. Given binary tree is binary search or not
A binary tree is considered a binary search tree if the left subtree of a node contains only nodes with keys less than the node's key and the right subtree contains only nodes with keys greater than the node's key.
Check if the left child of a node is less than the node's key and the right child is greater than the node's key
Recursively check all nodes in the tree to ensure they follow the binary search tree property
Inorder traversal of the tree should result in a sorted list ...read more
Q15. Dry run on a sample test.
Dry run on a sample test involves mentally executing the code to understand its flow and output.
Understand the code logic and variables
Step through each line of code
Keep track of variable values at each step
Predict the output based on the code execution
Q16. What's the best way to find majority element in an array?
The best way to find the majority element in an array is by using the Boyer-Moore Voting Algorithm.
Initialize a candidate variable and a count variable.
Iterate through the array and for each element:
- If the count is 0, set the current element as the candidate.
- If the current element is the same as the candidate, increment the count.
- Otherwise, decrement the count.
After the iteration, the candidate will be the majority element.
To verify if it is indeed the majority eleme...read more
Q17. find common ancestors of 2 nodes in tree
To find common ancestors of 2 nodes in a tree, traverse from both nodes to root and store paths. Then find the intersection of paths.
Traverse from both nodes to root and store paths
Find the intersection of paths to get common ancestors
Q18. Best Time to buy and sell stocks
The best time to buy stocks is when the price is low and the best time to sell is when the price is high.
Buy stocks when the market is down or during a recession to get them at a lower price.
Sell stocks when the market is up or during a boom to maximize profits.
Consider factors like company performance, market trends, and economic indicators before buying or selling stocks.
Q19. 1. What was past company work process and roles and responsibilities? 2. Write test cases on pen and atm machine. 3. Manual testing interview questions.
Answering questions related to past work experience, test cases, and manual testing in an engineering interview.
Past company work process involved collaborating with team members to design and implement engineering solutions.
Roles and responsibilities included coding, testing, and debugging software, as well as participating in project meetings and providing technical support.
Test cases for a pen could include checking ink flow, writing on different surfaces, and testing dura...read more
Q20. You are given a thread and you are unlocked in a room.Measure the height of the room using string.
Measure the height of a room using a thread.
Tie one end of the thread to a known height point, such as a door handle.
Hold the other end of the thread and let it hang down to the floor.
Mark the point where the thread touches the floor.
Repeat the process at different points in the room to get multiple measurements.
Take the average of the measurements to estimate the height of the room.
Q21. Design FSM - halway with 2 detectors, accuire amout of pepole in room - only one person can pass halway each time.
Design a finite state machine to count the number of people passing through a hallway with 2 detectors, allowing only one person at a time.
Create states for each detector and the hallway
Transition between states based on detector inputs
Use counters to keep track of the number of people passing through
Implement logic to prevent multiple people from passing simultaneously
Q22. 1. ArrayList 2. Types of locaters in Appium 3. D/b UI automator1 and ui Automator 2?
ArrayList is a resizable array implementation in Java. Appium locators include ID, name, class name, xpath, etc. UI Automator 1 and 2 are tools for testing Android apps.
ArrayList is a dynamic array that can grow or shrink in size. Example: ArrayList
list = new ArrayList<>(); Appium locators include ID, name, class name, xpath, etc. Example: driver.findElement(By.id("elementID"));
UI Automator 1 is a testing framework for Android apps. UI Automator 2 is an updated version with m...read more
Q23. Calculate the number of complete squares inscribed in a circle
The number of complete squares inscribed in a circle can be calculated using a formula based on the number of sides of the square.
The formula to calculate the number of complete squares inscribed in a circle is n*(n+1)*(2n+1)/6, where n is the number of sides of the square.
For example, if the circle has a square with 4 sides inscribed in it, the number of complete squares would be 30 (4*(4+1)*(2*4+1)/6 = 30).
Q24. Swap 2 numbers without using a third variable
Swap 2 numbers without using a third variable
Use the XOR operation to swap the numbers
Assign the first number to the second number using XOR
Assign the second number to the first number using XOR
Q25. Reverse a linked list in K groups.
Reverse a linked list in K groups
Iterate through the linked list in groups of size K
Reverse each group of nodes using a temporary pointer
Connect the reversed groups to form the final reversed linked list
Q26. Write a Java program to print 2nd largest element in an array
Java program to find 2nd largest element in an array of strings
Convert array elements to integers for comparison
Sort the array in descending order
Return the element at index 1 as the 2nd largest element
Q27. Print linked list in reverse order
To print a linked list in reverse order, we can use recursion or a stack data structure.
Recursion: Traverse the linked list recursively until the end, then print the current node.
Stack: Traverse the linked list and push each node onto a stack. Then pop and print the nodes from the stack.
Q28. Design an traffic control using Moore state machine,digital electronics
Design a traffic control using Moore state machine
Identify the states of the traffic control system
Design the state transition diagram
Implement the state machine using digital electronics
Test the system with different traffic scenarios
Q29. Test cases and test usess of pratical scenario
Test cases and test uses of practical scenarios involve creating scenarios to test the functionality of a system or application.
Identify the key functionalities of the system or application to be tested
Create test cases based on different scenarios such as positive, negative, boundary, and edge cases
Execute the test cases to validate the functionality of the system or application
Document the test results and report any defects found during testing
Q30. Process Scheduling in operating system
Process scheduling is the method by which the operating system decides the order in which processes are executed.
Process scheduling determines the fairness and efficiency of resource allocation.
Different scheduling algorithms prioritize different factors such as CPU utilization, response time, and throughput.
Examples of scheduling algorithms include First-Come, First-Served (FCFS), Round Robin, and Shortest Job Next (SJN).
Q31. Volatile keywords in c work in which way
Volatile keyword in C is used to indicate that a variable may be changed unexpectedly by external factors.
Volatile keyword tells the compiler not to optimize the variable because it can be changed by external factors.
Commonly used for memory-mapped hardware registers or variables accessed by multiple threads.
Example: volatile int *ptr = (int *)0x1234; // pointer to a memory-mapped hardware register
Q32. What is pointers in c?
Pointers in C are variables that store the memory address of another variable.
Pointers are declared using the * symbol.
They can be used to access and manipulate data stored in memory.
Pointers can be used to pass values by reference.
Example: int *ptr; ptr = # *ptr = 10; // num now equals 10
Arrays in C are also implemented using pointers.
Q33. What is function overloading?
Function overloading is the ability to have multiple functions with the same name but different parameters.
Functions with the same name but different parameters can be defined in the same scope.
The compiler determines which function to call based on the number and types of arguments passed.
Function overloading is commonly used in object-oriented programming languages like C++ and Java.
Q34. Deadlock in operating system
Deadlock is a situation in which two or more processes are unable to proceed because each is waiting for the other to release a resource.
Deadlock occurs when two or more processes are stuck in a circular wait.
Four necessary conditions for deadlock are mutual exclusion, hold and wait, no preemption, and circular wait.
Examples of deadlock prevention techniques include resource allocation graphs and bankers' algorithm.
Deadlock avoidance techniques involve resource scheduling alg...read more
Q35. Which features will you build first?
I will prioritize building features based on customer needs, market demand, and impact on business goals.
Prioritize features that address core customer pain points
Focus on features that align with company's strategic goals
Consider building features that have high demand in the market
Iterate based on user feedback and data analytics
Start with minimum viable product (MVP) to test assumptions
Q36. Memory taken by pointers and stuff
Pointers in programming languages store memory addresses of variables or objects.
Pointers take up memory to store the memory address they point to
Pointers can be used to access and manipulate data indirectly
Example: int* ptr = # // ptr stores the memory address of num
Q37. Why testing over development?
Testing is crucial to ensure quality, identify defects early, and prevent issues in production.
Testing helps identify defects early in the development process.
Testing ensures that the software meets the specified requirements.
Testing helps prevent issues in production and improves overall quality.
Testing provides feedback to developers for continuous improvement.
Testing helps build confidence in the software's reliability and performance.
Q38. Find the middle of the linked list.
To find the middle of a linked list, use the slow and fast pointer technique.
Initialize two pointers, slow and fast, both pointing to the head of the linked list.
Move the slow pointer by one step and the fast pointer by two steps until the fast pointer reaches the end of the list.
The position of the slow pointer at this point will be the middle of the linked list.
Q39. What is bug life cycle?
Bug life cycle is the process of a bug from identification to resolution in software testing.
Bug is identified by tester
Bug is reported in bug tracking system
Bug is assigned to developer
Developer fixes the bug
Bug is retested by tester
Bug is closed if fixed successfully
Q40. Dfs write whole pseudo code.
Depth First Search (DFS) pseudo code
Initialize a stack to keep track of nodes to visit
Start with the initial node and push it onto the stack
While the stack is not empty, pop a node from the stack and visit its neighbors
Push unvisited neighbors onto the stack
Repeat until all nodes are visited
Q41. Bfs write whole pseudo code.
BFS (Breadth First Search) algorithm pseudo code
Start by enqueueing the starting node
While the queue is not empty, dequeue a node and process it
Enqueue all adjacent nodes that have not been visited yet
Repeat until all nodes have been visited
Q42. Implement Linked list and all the operation
Implementing a linked list and its operations.
Create a Node class with data and next pointer
Create a LinkedList class with head pointer
Implement insert, delete, search, and print operations
Handle edge cases like empty list, inserting at beginning/end
Example: LinkedList ll = new LinkedList(); ll.insert(5); ll.print();
Q43. Sum queries on a 2D matrix
Sum queries on a 2D matrix
Iterate through each query and calculate the sum of elements in the given range
Use prefix sum technique to optimize the solution
Preprocess the matrix to store the sum of elements in each row and column for faster calculation
Q44. Number of cut vertices , Maximum nodes sum
The question is unclear and lacks context. More information is needed to provide an answer.
Please provide more context and information about the problem.
What is the problem domain and what are the requirements?
What is the input and output format?
What algorithms or techniques are allowed or preferred?
Without more information, it is impossible to provide a meaningful answer.
Q45. Dijkstra algorithm
Dijkstra algorithm is a graph search algorithm that finds the shortest path between nodes in a weighted graph.
Dijkstra algorithm uses a priority queue to select the node with the smallest distance from the source node.
It maintains a distance array to keep track of the shortest distance from the source node to each node in the graph.
The algorithm iteratively selects the node with the smallest distance and updates the distances of its neighboring nodes.
It continues until all no...read more
Q46. Height of a binary tree
Height of a binary tree is the maximum number of edges from the root node to any leaf node.
The height of an empty tree is 0.
The height of a tree with only one node is 1.
The height of a tree can be calculated recursively by finding the height of its left and right subtrees and adding 1 to the maximum of the two heights.
The time complexity of finding the height of a binary tree is O(n), where n is the number of nodes in the tree.
Q47. What is software testing?
Software testing is the process of evaluating a software application or system to find defects and ensure it meets the specified requirements.
Software testing involves executing a program or application with the intent of finding errors.
It is done to ensure that the software meets the specified requirements and is of high quality.
Testing can be done manually or using automated tools.
Types of testing include functional, performance, security, usability, and compatibility testi...read more
Q48. Explain Polymorphism, Overloading & Overriding
Polymorphism is the ability of an object to take on many forms. Overloading is having multiple methods with the same name but different parameters. Overriding is having a method in a subclass with the same name and parameters as a method in the superclass.
Polymorphism allows objects to be treated as if they are of different types, depending on the context in which they are used.
Overloading allows methods to have the same name but different parameters, allowing for more flexib...read more
Q49. Reverse a linked list
Reverse a linked list
Iterate through the linked list and change the direction of the pointers
Use three pointers to keep track of the current, previous, and next nodes
Make sure to update the head and tail pointers accordingly
Q50. Bankers algorithm
Banker's algorithm is a resource allocation and deadlock avoidance algorithm used in operating systems.
Banker's algorithm is used to prevent deadlock in a system with multiple processes and resources.
It works by simulating the allocation of resources to processes and checking if it leads to a safe state.
The algorithm considers the current allocation, maximum needs, and available resources to make decisions.
If a request for resources cannot be granted without leading to an uns...read more
Q51. Search in a rotated array.
Searching in a rotated array involves finding a target element in an array that has been rotated at an unknown pivot point.
Use binary search to efficiently search in a rotated array.
Check if the target element is in the left or right half of the array based on the pivot point.
Adjust the binary search algorithm based on the rotation to find the target element.
Q52. Implementation of linkedlist
A linked list is a data structure where each element points to the next element in the sequence.
Create a Node class with data and a reference to the next Node
Initialize a LinkedList class with a head Node
Implement methods to add, remove, search, and traverse the linked list
Q53. What are locators in selenium
Locators in Selenium are used to identify web elements on a web page. They are essential for interacting with elements during test automation.
Locators are used to find and interact with web elements on a web page.
Common types of locators include ID, name, class name, tag name, link text, and XPath.
Using the right locator strategy is crucial for stable and reliable test automation.
Example: driver.findElement(By.id("username"));
Q54. Implement Stack using Linked List.
Stack can be implemented using a singly linked list where each node points to the next node.
Create a Node class with data and next pointer
Create a Stack class with top pointer
Push operation: create a new node and make it the top node
Pop operation: remove the top node and make the next node the new top node
Peek operation: return the data of the top node
isEmpty operation: check if the top node is null
Q55. write monitor for APB protocol
A monitor for APB protocol is a verification component that checks for protocol compliance in APB transactions.
Monitor should check for valid address, data, and control signals in APB transactions
It should detect and report any protocol violations or errors
Monitor should be able to track the state of the APB bus and ensure proper communication between master and slave devices
Q56. Explain 5G Architecture
5G architecture is a network of multiple technologies that work together to provide faster and more reliable wireless communication.
5G architecture includes a core network, radio access network, and user equipment.
The core network is responsible for managing and routing data traffic.
The radio access network connects user equipment to the core network.
User equipment includes devices like smartphones and tablets.
5G architecture also includes technologies like beamforming and ma...read more
Q57. Different Types of testing
Different types of testing include functional testing, non-functional testing, manual testing, automated testing, regression testing, and performance testing.
Functional testing: Testing the functionality of the software against the requirements.
Non-functional testing: Testing aspects like performance, usability, and security.
Manual testing: Testing performed manually by testers without the use of automation tools.
Automated testing: Testing performed using automation tools to ...read more
Q58. Binary lifting ancestors problem
Binary lifting ancestors problem involves finding the k-th ancestor of a node in a binary tree efficiently.
Binary lifting is a technique used to find ancestors in a binary tree.
It involves precomputing the ancestors of each node using dynamic programming.
The k-th ancestor of a node can be found by repeatedly jumping up the tree in powers of 2.
Example: Given a binary tree with nodes 1, 2, 3, 4, 5, 6, 7, the 2nd ancestor of node 5 is node 3.
Q59. Whats c
C is a general-purpose programming language developed by Dennis Ritchie in 1972.
C is used for developing operating systems, embedded systems, and system software.
It is a compiled language and has a low-level memory access.
C is the predecessor of many modern programming languages like C++, Java, and Python.
Q60. Whats loop
A loop is a programming structure that repeats a set of instructions until a certain condition is met.
Loops are used to iterate over a collection of data or to repeat a set of instructions a certain number of times.
There are three types of loops in most programming languages: for, while, and do-while.
Example: for (int i = 0; i < 10; i++) { // do something }
Q61. Trie Implementation
Trie is a tree data structure used for efficient retrieval of key-value pairs.
Trie is also known as prefix tree.
Each node in a trie represents a single character of a key.
Trie is commonly used in autocomplete and spell checking algorithms.
Example: Inserting 'apple' and 'app' into a trie would result in a structure where 'app' is a prefix of 'apple'.
Q62. LRU Implementation
LRU (Least Recently Used) is a cache eviction policy that removes the least recently used items first.
LRU cache stores key-value pairs with a maximum capacity.
When the cache is full, the least recently used item is removed to make space for new items.
Each time a key is accessed, it is moved to the front of the cache to indicate it was recently used.
Q63. explain decision tree
Decision tree is a predictive modeling tool that uses a tree-like graph of decisions and their possible consequences.
Decision tree is a supervised learning algorithm used for classification and regression tasks.
It breaks down a dataset into smaller subsets based on different attributes.
Each internal node represents a feature or attribute, each branch represents a decision rule, and each leaf node represents the outcome.
Example: A decision tree can be used to predict whether a...read more
Q64. Types of control valve
Control valves are used to regulate the flow of fluids in a system by varying the size of the flow passage.
Types of control valves include globe valves, butterfly valves, ball valves, and diaphragm valves.
Control valves can be classified based on their action (linear or rotary), flow characteristics (equal percentage, linear, or quick opening), and body type (single-seated, double-seated, or cage).
Globe valves are commonly used for throttling applications, while butterfly val...read more
Q65. Median of running streams
The median of running streams is the middle value when all values are arranged in ascending order.
To find the median of running streams, first arrange all the values in ascending order.
If the number of values is odd, the median is the middle value.
If the number of values is even, the median is the average of the two middle values.
For example, if the running stream values are 5, 8, 12, 15, 20, the median is 12.
If the running stream values are 4, 7, 10, 15, the median is (7+10)...read more
Q66. Risc vs cisc arch
RISC architecture has simpler instructions and fewer addressing modes, while CISC architecture has complex instructions and more addressing modes.
RISC architecture focuses on simplicity and efficiency, with a smaller instruction set and a simpler design.
CISC architecture focuses on versatility and flexibility, with a larger instruction set and a more complex design.
Examples of RISC processors include ARM and MIPS, while examples of CISC processors include x86 and AMD.
RISC arc...read more
Q67. Explain xgboost
XGBoost is a popular machine learning algorithm known for its speed and performance in gradient boosting.
XGBoost stands for eXtreme Gradient Boosting.
It is an implementation of gradient boosted decision trees designed for speed and performance.
XGBoost is widely used in machine learning competitions and has become a popular choice for data scientists.
It can handle missing data and is optimized for parallel processing.
XGBoost has parameters for regularization to prevent overfit...read more
Q68. Types of instruments
Instruments used in electrical and instrumentation engineering include sensors, transmitters, controllers, and recorders.
Sensors: devices that detect changes in physical properties and convert them into electrical signals (e.g. temperature sensors)
Transmitters: devices that send signals from sensors to control systems (e.g. pressure transmitters)
Controllers: devices that regulate the operation of systems based on input signals (e.g. PID controllers)
Recorders: devices that cap...read more
Q69. Find no of islands
To find the number of islands, we can use depth-first search (DFS) or breadth-first search (BFS) algorithms.
Use DFS or BFS to traverse the grid and mark visited islands
Count the number of times DFS or BFS is called to find the number of islands
Consider diagonal connections if applicable
Example: [['1', '1', '0', '0', '0'], ['1', '1', '0', '0', '0'], ['0', '0', '1', '0', '0'], ['0', '0', '0', '1', '1']]
Top HR Questions asked in null
Interview Process at null
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month