Samsung Research
10+ Interview Questions and Answers
Q1. 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
Q2. 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
Q3. 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.
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
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
Q7. 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.
Q8. 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
Q9. 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
Q10. 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.
Q11. 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 }
Q12. 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.
Q13. 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.
Q14. 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
Top HR Questions asked in null
Interview Process at null
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month