Phenom
GSR Eduwizer Interview Questions and Answers
Q1. Integer to roman, sort an array containing only 0,1,2 in single iteration.
Use two pointers to swap 0s to the beginning and 2s to the end while keeping 1s in the middle.
Initialize two pointers, one for 0s (left) and one for 2s (right).
Iterate through the array and swap 0s to the left pointer and 2s to the right pointer.
Example: Input array = ['2', '1', '0', '2', '1', '0'], Output array = ['0', '0', '1', '1', '2', '2']
Q2. Advantages of async and threading and their scope.
Async and threading offer advantages in improving performance and responsiveness in software development.
Async allows for non-blocking operations, improving responsiveness by allowing other tasks to continue while waiting for a response.
Threading enables parallel execution of tasks, utilizing multiple CPU cores to improve performance.
Async is more suitable for I/O-bound operations, while threading is better for CPU-bound tasks.
Combining async and threading can maximize perfor...read more
Q3. How can swap the numbers without using the third variable
To swap numbers without using a third variable, use arithmetic operations.
Add the two numbers to get the first number
Subtract the second number from the sum to get the second number
Subtract the original first number from the sum to get the original second number
Q4. Exchanging numbers without third variable
To exchange numbers without a third variable, use addition and subtraction operations.
Add the two numbers to get the sum.
Subtract the first number from the sum to get the second number.
Subtract the second number from the sum to get the first number.
Q5. Explain about Global interpreter lock.
Global Interpreter Lock (GIL) is a mutex that protects access to Python objects, preventing multiple threads from executing Python bytecodes simultaneously.
GIL is a mechanism used in CPython to ensure that only one thread executes Python bytecode at a time.
It prevents multiple threads from executing Python code concurrently, which can cause issues with thread safety.
GIL can impact the performance of multi-threaded Python programs, as only one thread can execute Python code at...read more
Q6. Two sum leetcode model
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
Use a hashmap to store the difference between the target and each element as keys and their indices as values.
Iterate through the array and check if the current element's complement exists in the hashmap.
Return the indices of the two numbers that add up to the target.
Q7. DBMS Locking exmple with a scenario
DBMS locking is a mechanism to manage concurrent access to data in a database to prevent data corruption.
Locking is used to ensure data integrity and consistency in a multi-user environment.
Types of locks include shared locks, exclusive locks, and update locks.
Example scenario: Two users trying to update the same record simultaneously - one user gets an exclusive lock while the other waits.
Deadlocks can occur when two transactions are waiting for each other to release locks.
Q8. How to implement queue
A queue can be implemented using arrays or linked lists. It follows the FIFO principle.
Create an empty array or linked list
Enqueue elements at the end of the queue
Dequeue elements from the front of the queue
Implement methods like isEmpty, isFull, peek, etc.
Example: Queue implemented using an array - https://www.geeksforgeeks.org/queue-set-1introduction-and-array-implementation/
Q9. LRU cache program
LRU cache program is a data structure that stores the most recently used items.
LRU cache is typically implemented using a doubly linked list and a hashmap.
When a new item is accessed, it is moved to the front of the list.
If the cache is full, the least recently used item is removed from the end of the list.
Example: If the cache has a capacity of 3 and items A, B, C are accessed in that order, the cache will store C, B, A.
Example: If item B is accessed again, it will move to t...read more
More about working at Phenom
Interview Process at GSR Eduwizer
Reviews
Interviews
Salaries
Users/Month