Samsung
40+ Sri Chaitanya Educational Institutions Interview Questions and Answers
Q1. Reverse Alternate K Nodes Problem Statement
You are given a singly linked list of integers along with a positive integer 'K'. The task is to modify the linked list by reversing every alternate 'K' nodes of the ...read more
Q2. Explain the memory layout of main memory of computer system? Give an example to make understand the memory layout means in which segment what type of variable will be store?
Explanation of memory layout in main memory of computer system.
Main memory is divided into four segments: stack, heap, data, and code.
Stack stores local variables and function calls.
Heap stores dynamically allocated memory.
Data stores global and static variables.
Code stores the program instructions.
Example: int x; //stored in data segment, int *p = new int; //stored in heap segment
Q3. How the operating system taking care of const int i=5; //tell the implementation so that we can't alter the value of i?
Operating system uses memory protection to prevent modification of const variables like const int i=5;
Operating system marks the memory page containing i as read-only
Any attempt to modify i will result in a segmentation fault
Compiler may optimize code by replacing i with its value at compile time
Q4. What do you think is an area of improvement for you?
I need to improve my time management skills.
Prioritize tasks based on urgency and importance
Set realistic deadlines and stick to them
Avoid multitasking and focus on one task at a time
Use tools like calendars and to-do lists to stay organized
Q5. By how many method we can allocate the memory in C and what is the difference between malloc and calloc. And which is faster and why?
Two methods to allocate memory in C are malloc and calloc. Malloc allocates memory block of given size while calloc initializes the allocated memory block to zero.
Malloc allocates memory block of given size while calloc initializes the allocated memory block to zero.
Malloc returns a pointer to the first byte of allocated memory block while calloc returns a pointer to the first byte of initialized memory block.
Malloc is faster than calloc as it does not initialize the memory b...read more
Q6. How many types of CPU scheduling are there and explain all. Which one is better and why and tell the feasibilty also?
There are 6 types of CPU scheduling: FCFS, SJF, SRTF, Priority, Round Robin, and Multilevel Queue. Each has its own advantages and disadvantages.
FCFS (First-Come-First-Serve) - processes are executed in the order they arrive
SJF (Shortest-Job-First) - shortest job is executed first
SRTF (Shortest-Remaining-Time-First) - preemptive version of SJF
Priority - processes with higher priority are executed first
Round Robin - each process is given a time slice to execute, then moved to ...read more
Q7. For statement const int *p = 5, which is true from given below two statement: a) int a; p = &a; b) *p = 0
Cannot modify value pointed by p, but can change the address it points to.
p is a pointer to a constant integer with value 5
a) is valid as p can point to a non-constant integer
b) is invalid as *p is a constant and cannot be modified
Q8. Write a C program that will COMPILE and RUN to reverse a string in-place
C program to reverse a string in-place
Use two pointers, one at the beginning and one at the end of the string
Swap the characters at the two pointers and move the pointers towards each other until they meet
Handle odd-length strings by leaving the middle character in place
Q9. What is the difference between malloc and new and which one is faster and why?
malloc and new are used to allocate memory dynamically. Malloc is faster but new is safer.
malloc is a C function while new is a C++ operator
malloc only allocates memory while new also initializes the memory
new throws an exception if allocation fails while malloc returns NULL
malloc is faster because it does not involve constructor calls
new is safer because it ensures type safety and prevents memory leaks
Q10. Difference between structure and union and what are the pros and cons of both?
Structure and union are data structures in C language. Union stores only one value at a time while structure stores multiple values.
Structure is used to store different data types while union is used to store only one data type at a time.
Structure allocates memory for all its members while union allocates memory for only the largest member.
Structure is used when we want to store multiple values of different data types while union is used when we want to store only one value a...read more
Q11. How do we know the linked list is a circular or not?
To check if a linked list is circular, we can use Floyd's cycle-finding algorithm.
Floyd's cycle-finding algorithm uses two pointers, one moving at twice the speed of the other.
If the linked list is circular, the fast pointer will eventually catch up to the slow pointer.
If the linked list is not circular, the fast pointer will reach the end of the list and the algorithm will terminate.
Q12. What is the structure byte padding and how does it form and depend? Is there any concept
Structure byte padding is the insertion of unused bytes between structure members to align them in memory.
Padding is added to ensure that each member of a structure is aligned on a memory boundary that is a multiple of its size.
The amount of padding added depends on the size and alignment requirements of the members.
Padding can affect the size of a structure and the performance of code that uses it.
For example, a structure with a 4-byte member followed by a 1-byte member will...read more
Q13. Can you say about the priority of mobile application which one is having higher priority?
The priority of a mobile application depends on the business goals and user needs.
The priority of a mobile application can vary depending on the business goals and user needs.
For example, a mobile banking app may have a higher priority than a social media app for a bank.
On the other hand, a social media app may have a higher priority for a media company.
The priority can also depend on the target audience and the market demand.
It is important to prioritize features and functio...read more
Q14. What are storage classes in C?Explain
Storage classes in C define the scope and lifetime of variables.
There are four storage classes in C: auto, register, static, and extern.
Auto variables are local to a block and have automatic storage duration.
Register variables are stored in CPU registers for faster access.
Static variables have a lifetime throughout the program and are initialized only once.
Extern variables are declared outside any function and can be accessed by any function in the program.
Q15. What is the self referential structure, write an example of self referential structure?
Self referential structure is a structure that contains a pointer to the same type of structure.
It allows a structure to reference itself within its own definition.
It is commonly used in linked lists, trees, and graphs.
Example: struct Node { int data; struct Node *next; };
Here, the Node structure contains a pointer to another Node structure.
Q16. How to set the priority of any process in windows and in linux?
To set process priority in Windows and Linux, use task manager and nice command respectively.
In Windows, open task manager, right-click on the process and select 'Set Priority'
In Linux, use the 'nice' command followed by the process name or ID and the priority level (values range from -20 to 19)
Higher priority levels mean the process will get more CPU time
Examples: 'nice -n 10 firefox' sets Firefox priority to 10 in Linux, 'Set Priority' in task manager allows setting priorit...read more
Q17. A piece of plain paper is torn into random number of pieces and how do you construct back the original paper?
Use jigsaw puzzle approach to reconstruct the paper.
Sort the pieces by edges and corners.
Identify patterns and colors to match adjacent pieces.
Use trial and error method to fit the pieces together.
Check for completeness and accuracy of the final paper.
Use computer vision and machine learning algorithms for automation.
Q18. which is faster x++ or ++x and why?
++x is faster than x++ because it increments the value before using it.
++x increments the value before using it, while x++ increments the value after using it.
++x is faster because it saves the overhead of creating a temporary variable.
In some cases, the difference in speed may be negligible and the choice between the two may depend on readability and coding standards.
Q19. What is the difference between these two statement: const int *p; int const *p;
The two statements are equivalent and declare a pointer to a constant integer.
Both statements declare a pointer to an integer that cannot be modified through the pointer.
The 'const' keyword can be placed before or after the 'int' keyword.
The pointer itself can still be modified to point to a different integer.
Example: const int *p; and int const *p; both declare a pointer to a constant integer.
Q20. Write a program to insert a node in linked list
Program to insert a node in linked list
Create a new node with the given data
Set the next pointer of the new node to the next pointer of the previous node
Set the next pointer of the previous node to the new node
Q21. Is there any ideal CPU scheduling possible? Justify your answer?
No, there is no ideal CPU scheduling possible.
CPU scheduling is a complex problem with many variables.
Different scheduling algorithms are suited for different scenarios.
The ideal scheduling algorithm would depend on the specific system and workload.
For example, a real-time system would require a different scheduling algorithm than a batch processing system.
Q22. Difference between extern and static and give an example to justify?
extern and static are storage classes in C programming language.
extern is used to declare a variable or function that is defined in another file or module.
static is used to declare a variable or function that is local to a file or module.
Example of extern: extern int count; //declares count variable defined in another file.
Example of static: static int count = 0; //declares count variable local to the file.
Q23. Write a program to find loop in linked list
Program to find loop in linked list
Use two pointers, slow and fast, to traverse the linked list
If there is a loop, the fast pointer will eventually catch up to the slow pointer
To find the start of the loop, reset the slow pointer to the head and move both pointers at the same pace
Q24. wat is a null object? is it conceptual?
A null object is an object that does not have a value or reference to any object.
A null object is different from an object with a value of zero or an empty string.
It is often used to represent the absence of an object or value.
Null objects can be used to avoid null pointer exceptions in programming.
It is a conceptual idea in programming and computer science.
Q25. What are its features?Explain
Which software are you referring to?
Please specify the software you are asking about
Without context, it is impossible to answer this question
Q26. What are virtual functions?
Virtual functions are functions that can be overridden by derived classes.
Virtual functions are declared in a base class and can be overridden in a derived class.
They allow for polymorphism, where a derived class can be treated as its base class.
Virtual functions are called based on the actual object type, not the pointer or reference type.
They are declared using the 'virtual' keyword in the base class and optionally overridden using the 'override' keyword in the derived clas...read more
Q27. What is the real time operating system?
A real-time operating system is an OS that processes data and events as they occur, without delay.
Real-time operating systems are used in applications that require immediate response, such as aviation, medical equipment, and industrial control systems.
They prioritize tasks based on their urgency and importance, and can handle multiple tasks simultaneously.
Examples of real-time operating systems include VxWorks, QNX, and FreeRTOS.
Q28. A pseudo code or solution(if you can) for solving the rubik's cube
A solution for solving the Rubik's cube
Use the layer-by-layer method
Solve the first layer cross
Solve the first layer corners
Solve the second layer
Solve the third layer cross
Solve the third layer corners
Orient the third layer corners
Permute the third layer corners
Permute the third layer edges
Q29. What is OOP?
OOP stands for Object-Oriented Programming, a programming paradigm that focuses on objects and their interactions.
OOP is based on the concepts of encapsulation, inheritance, and polymorphism.
It allows for modular and reusable code.
Examples of OOP languages include Java, C++, and Python.
Q30. What is C++?
C++ is a high-level programming language used for developing system software, application software, device drivers, and video games.
C++ was developed by Bjarne Stroustrup in 1983.
It is an extension of the C programming language.
C++ supports object-oriented programming, generic programming, and low-level memory manipulation.
It is widely used in industries such as finance, gaming, and operating systems development.
Examples of popular software written in C++ include Microsoft Wi...read more
Q31. What type of OS is Windows?
Windows is a proprietary operating system developed by Microsoft.
Windows is a graphical user interface (GUI) based operating system.
It is designed to run on personal computers, servers, and mobile devices.
Windows has different versions such as Windows 10, Windows 8, Windows 7, etc.
It supports a wide range of software applications and hardware devices.
Windows is known for its ease of use and user-friendly interface.
Q32. What is late binding
Late binding is a programming concept where the method or function to be executed is determined at runtime.
Also known as dynamic binding or runtime binding
Allows for greater flexibility in code execution
Commonly used in object-oriented programming languages
Example: virtual functions in C++
Q33. Tell about the spark architecture and data modelling
Spark architecture is a distributed computing system that provides high-level APIs for big data processing.
Spark architecture consists of a cluster manager, a distributed storage system, and a computing engine.
Data in Spark is represented as Resilient Distributed Datasets (RDDs) or DataFrames.
Spark supports various data models, including batch processing, streaming, machine learning, and graph processing.
Spark's architecture allows for in-memory data processing, which improve...read more
Q34. Explain logic of quick sort
Quick sort is a divide and conquer algorithm that sorts an array by partitioning it into two sub-arrays.
Choose a pivot element from the array
Partition the array around the pivot element
Recursively apply the above steps to the sub-arrays
Combine the sorted sub-arrays to get the final sorted array
Q35. Difference between UNIX and LINUX?
UNIX is an operating system developed in the 1970s, while LINUX is a free and open-source operating system based on UNIX.
UNIX is proprietary, while LINUX is open-source
UNIX is older and has a longer history, while LINUX is a newer development
UNIX is more stable and reliable, while LINUX is more customizable and flexible
UNIX has a more limited user base, while LINUX has a larger and more active community
Examples of UNIX-based operating systems include Solaris and macOS, while ...read more
Q36. Explain heap sort
Heap sort is a comparison-based sorting algorithm that uses a binary heap data structure.
Heap sort works by building a binary heap from the array to be sorted.
The largest element is then swapped with the root node and removed from the heap.
The heap is then restructured and the process is repeated until the array is sorted.
Heap sort has a time complexity of O(n log n) and is not stable.
It is often used in embedded systems and operating systems where memory is limited.
Q37. Implementation of new() in C++?
new() is an operator in C++ used for dynamic memory allocation.
new() returns a pointer to the allocated memory.
It can be used to allocate memory for primitive data types, arrays, and objects.
Memory allocated using new() must be deallocated using delete operator.
Example: int *ptr = new int;
Example: int *arr = new int[10];
Example: MyClass *obj = new MyClass();
Q38. Ballon Burst Problem
Balloon Burst Problem - Given n balloons, each with a number of coins, maximize the number of coins collected by bursting the balloons.
Use dynamic programming to solve the problem
Consider each balloon as the last balloon to be burst
Calculate the maximum coins that can be collected for each subarray of balloons
Use the calculated values to find the maximum coins for the entire array
Q39. Find loop in link list
Detecting a loop in a linked list
Use two pointers, one moving at double the speed of the other
If there is a loop, the two pointers will eventually meet
Use Floyd's Cycle Detection Algorithm for efficient solution
Q40. Snakes and ladder in leetcode
Implement the game of Snakes and Ladders on LeetCode.
Use a 1D array to represent the board of the game.
Use a queue to perform BFS to find the shortest path to reach the end.
Handle the special cases of snakes and ladders by updating the position accordingly.
More about working at Samsung
Top HR Questions asked in Sri Chaitanya Educational Institutions
Interview Process at Sri Chaitanya Educational Institutions
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month