Q. What is the difference between a process and a thread?
asked 8xeasyOperating systemsTechnical2017-2023
Ans. A process is an independent running program with its own memory space, while a thread is a smaller unit of execution within a process that shares that process’s memory. Processes are more isolated and cost more to create or switch between. Threads are lighter, but shared memory makes synchronisation and race conditions important.
Q. Detect a loop in a linked list.
asked 5xeasyLinked listsTechnical2017-2021
Ans. Use Floyd’s cycle detection with two pointers, slow and fast, starting at the head. Move slow one node at a time and fast two nodes at a time. If they ever meet, there is a loop. If fast reaches null, there is no loop. This runs in O(n) time and O(1) space.
Q. Explain the memory layout of a C program.
asked 4xmediumOperating systemsTechnical2020-2021
Ans. C++ program memory is commonly divided into code, static data, heap and stack areas. Code stores instructions, static data stores globals and static variables, including zero-initialised data. The stack holds function calls and local automatic variables. The heap holds dynamically allocated objects. The key detail is lifetime: stack objects end automatically, heap objects must be managed.
Q. Reverse a linked list
asked 4xeasyLinked listsTechnical2017-2021
Ans. Reverse a linked list by iterating through it and changing each node’s next pointer to point to the previous node. Keep three pointers: previous, current, and next, so you do not lose the rest of the list. At the end, previous is the new head. Time complexity is O(n), space complexity is O(1).
Q. Explain storage classes in C.
asked 4xeasyOOPTechnical2016-2021
Ans. Storage classes in C++ define an object’s lifetime, visibility, and linkage. The main specifiers are static, extern, thread_local, and mutable. Historically, auto and register were also storage class specifiers, but auto now means type deduction and register is obsolete. The key idea is how long data exists and where it can be accessed.
Q. Reverse a singly linked list.
asked 4xeasyLinked listsTechnical2016-2023
Ans. Reverse it by walking through the list once and redirecting each node’s next pointer to the previous node. Keep three pointers: previous, current, and next, so you do not lose the remaining list. At the end, previous becomes the new head. Time is O(n), space is O(1).
Q. Implement a queue using a linked list
asked 4xeasyLinked listsTechnical2017-2020
Ans. Use a singly linked list with two pointers: front for dequeue and rear for enqueue. To enqueue, create a new node and attach it after rear, updating rear. To dequeue, remove the front node and move front forward. If the queue becomes empty, set rear to null. Both operations are O(1).
Q. Reverse bits of a number
asked 3xeasyBit manipulationTechnical2017-2021
Ans. Reverse bits by scanning the number from right to left and building the answer from left to right. For each of the fixed 32 bits, shift the result left, add the current least significant bit, then shift the input right. Use integer variables only. Time is O(32), space is O(1).
Q. What is the volatile keyword in C?
asked 3xeasyOOPTechnical2019-2021
Ans. volatile tells the C compiler that an object’s value may change in ways it cannot see, so it must not optimise away or cache accesses to it. Each read or write must be performed as written. It is mainly used for memory-mapped hardware registers and signal-shared variables. It does not make operations atomic or thread-safe.
Q. Explain virtual memory and paging
asked 2xmediumOperating systemsTechnical2017-2019
Ans. Virtual memory is an abstraction that gives each process its own large, private address space, independent of physical RAM. Paging implements this by splitting virtual memory and physical memory into fixed-size pages and frames. A page table maps virtual pages to frames, and missing pages can be loaded from disk on demand.
Q. Implement your own sizeof operator
asked 2xmediumC cppTechnical2017-2021
Ans. Use pointer arithmetic: take the address of an object, add one to get the address just past it, cast both addresses to char pointers, then subtract them. The difference is the size in bytes because char is one byte. This uses no data structure and runs in O(1) time.
Q. Explain memory layout of a process.
asked 2xmediumOperating systemsManagerial, Technical2019-2023
Ans. A process memory layout is usually divided into text, data, heap and stack segments, plus memory-mapped regions. The text segment holds program instructions, data holds global and static variables, the heap stores dynamically allocated memory, and the stack stores function calls and local variables. The key detail is that heap and stack typically grow towards each other.
Q. Explain the producer-consumer problem
asked 2xmediumOperating systemsTechnical2020
Ans. Use a bounded blocking queue protected by a mutex, with two condition variables or semaphores for not full and not empty. Producers wait when the buffer is full, lock, enqueue an item, unlock, and signal consumers. Consumers wait when empty, lock, dequeue, unlock, and signal producers. Each produce or consume operation is O(1).
Q. Print the left view of a binary tree.
asked 2xmediumTreesOnline test, Technical2017-2021
Ans. Print the first node visible at each depth when the tree is viewed from the left. Do a level order traversal using a queue, and for each level print the first node removed from the queue. This visits every node once, so the time complexity is O(n), with O(w) space for the queue.
Q. Explain different CPU scheduling algorithms
asked 2xmediumOperating systemsTechnical2017-2021
Ans. CPU scheduling algorithms decide which ready process runs next. Common ones are First Come First Served, Shortest Job First, Priority Scheduling, Round Robin, and Multilevel Queue. The key trade-off is between fairness, response time, throughput, and starvation. Preemptive algorithms can interrupt running processes, while non-preemptive ones wait until completion or blocking.
Q. Explain internal and external fragmentation
asked 2xmediumOperating systemsTechnical2019-2021
Ans. Internal fragmentation is wasted space inside an allocated memory block, while external fragmentation is wasted free space between allocated blocks. Internal fragmentation happens when allocation units are larger than requested. External fragmentation happens when free memory is split into small non-contiguous holes, so a large request may fail despite enough total free memory.
Q. Traverse a binary tree in spiral (zigzag) order
asked 2xmediumTreesTechnical2020
Ans. Traverse the tree level by level, alternating the direction of output at each level. Use a queue for breadth first traversal and a boolean flag for direction. For each level, collect node values, reverse them when needed, then append to the answer. Time complexity is O(n), with O(w) extra space.
Q. Explain OS schedulers and scheduling algorithms.
asked 2xmediumOperating systemsTechnical2013-2016
Ans. OS schedulers decide which processes enter memory, which ready process gets the CPU, and sometimes which suspended process resumes. Long-term, medium-term, and short-term schedulers manage these choices. Common algorithms include FCFS, SJF, priority, round robin, and multilevel queues, balancing throughput, response time, waiting time, fairness, and avoiding starvation.
Q. Explain memory management concepts in operating systems.
asked 2xmediumOperating systemsTechnical2013-2016
Ans. Memory management is how an operating system allocates, tracks, protects and reclaims main memory for processes. Key concepts include virtual memory, paging, segmentation, address translation, swapping, fragmentation and protection. The most important idea is virtual memory, which gives each process its own address space while the OS maps it to physical RAM safely and efficiently.
Q. Write a program to return a stream of bytes from a function.
asked 2xmediumOOPTechnical2013-2016
Ans. Return an iterator or generator that yields one byte at a time, rather than building the whole result first. The function keeps its read position as state and produces the next byte on demand. Use a byte buffer internally if reading in chunks. Time complexity is O(n), with O(1) extra space.
Q. What is a page fault and what steps are followed to handle it
asked 2xmediumOperating systemsTechnical2017-2019
Ans. A page fault occurs when a process accesses a virtual memory page that is not currently mapped in physical RAM. The CPU traps to the operating system, which checks whether the access is valid. If valid, it finds a free frame or evicts one, loads the page from disk, updates the page table, and restarts the instruction.
Q. Explain deadlock situations and methods for deadlock detection and prevention.
asked 2xmediumOperating systemsTechnical2013-2016
Ans. A deadlock occurs when processes wait forever because each holds a resource another needs. The key conditions are mutual exclusion, hold and wait, no pre-emption, and circular wait. Detection uses a resource allocation or wait-for graph to find cycles. Prevention breaks one condition, commonly by ordering resource acquisition or avoiding hold and wait.
Q. What are acceleration structures in ray tracing and how do they improve performance?
asked 2xmediumComputer graphicsTechnical2024
Ans. Acceleration structures are spatial data structures that reduce the number of ray-object intersection tests in ray tracing. Instead of checking every object, the ray traverses a structure such as a bounding volume hierarchy, k-d tree, or grid, quickly skipping large empty or irrelevant regions. This improves performance from brute force linear testing to far fewer practical checks.
Q. How can data be accessed after a function returns? Explain why auto variables cannot be accessed.
asked 2xmediumOOPTechnical2013-2016
Ans. Data can be accessed after a function returns if it is returned by value, stored in caller-owned memory, allocated dynamically, or kept in static or global storage. Automatic variables are local stack variables; their lifetime ends when the function returns. Any pointer or reference to them becomes dangling, and using it has undefined behaviour.
Q. How would you implement ray tracing on the GPU using Vulkan ray tracing extensions?
asked 2xhardGraphics systemTechnical2024
Ans. Use Vulkan ray tracing by building BLAS for mesh geometry and a TLAS for instances, then dispatching a ray tracing pipeline with ray generation, miss, closest hit and any hit shaders. The key detail is the shader binding table, which maps hit groups to geometry and materials and is passed to vkCmdTraceRaysKHR.
Q. Swap two nibbles in a byte
asked 2xeasyBit manipulationTechnical2019
Ans. Swap the two nibbles by moving the lower 4 bits left by 4 positions and the upper 4 bits right by 4 positions, then combine them with bitwise OR. Mask with 0x0F and 0xF0 if needed to keep only the relevant bits. This takes constant time and constant space.
Q. Explain Binary Search algorithm.
asked 2xeasyBinary searchTechnical2017
Ans. Binary search repeatedly halves a sorted array or list to find a target value. Keep two indexes, low and high, check the middle element, and move to the left half if the target is smaller or the right half if it is larger. It runs in O(log n) time and O(1) space iteratively.
Q. Explain double pointers and their use cases.
asked 2xeasyPointersTechnical2019-2020
Ans. A double pointer is a pointer that stores the address of another pointer. It is commonly used when a function must modify the caller’s pointer, such as allocating memory, changing the head of a linked list, or returning multiple levels of indirection. It is also used for arrays of strings and dynamic two-dimensional structures.
Q. Count the number of set bits in a given number.
asked 2xeasyBit manipulationManagerial, Technical2020-2023
Ans. Use Brian Kernighan’s algorithm: repeatedly replace n with n & (n - 1) and increment a counter until n becomes zero. Each operation removes the lowest set bit. The data used is just an integer counter. Time complexity is O(k), where k is the number of set bits, and space is O(1).
Q. Explain function overloading and function overriding.
asked 2xeasyOOPTechnical2019-2023
Ans. Function overloading means defining multiple functions with the same name but different parameter lists in the same scope. Function overriding means a subclass provides its own implementation of a method already defined in its superclass. Overloading is resolved mostly at compile time, while overriding supports runtime polymorphism through dynamic dispatch.
Q. Explain the difference between Scheduler and Dispatcher
asked 2xeasyOperating systemsTechnical2019-2021
Ans. A scheduler decides which process or thread should run next, while a dispatcher actually gives the CPU to that selected process. The scheduler applies a policy such as priority or round robin. The dispatcher performs the practical switch, including context switching, changing to user mode, and starting execution.
Q. What is the difference between a macro and an inline function?
asked 2xeasyCTechnical2020
Ans. A macro is preprocessor text substitution, while an inline function is a real function that the compiler may expand at the call site. The key difference is safety: inline functions have types, scope, and normal argument evaluation, whereas macros can cause subtle bugs such as repeated evaluation and lack of type checking.
Q. Explain the difference between singly linked list and doubly linked list
asked 2xeasyLinked listsTechnical2017-2018
Ans. A singly linked list has nodes that point only to the next node, while a doubly linked list has nodes that point to both the next and previous nodes. The key difference is traversal and deletion: doubly linked lists can move backwards and delete a known node more easily, but they use extra memory per node.
Q. Explain the differences between singly linked list and doubly linked list
asked 2xeasyLinked listsTechnical2017-2020
Ans. A singly linked list stores a value and a pointer to the next node, while a doubly linked list stores pointers to both the next and previous nodes. Singly linked lists use less memory but only move forwards. Doubly linked lists use more memory but allow easier backward traversal and deletion when a node is known.
Q. Explain Linear Search and compare it with other search algorithms in terms of time complexity
asked 2xeasySearchingTechnical2017
Ans. Linear search checks each element one by one until it finds the target or reaches the end. Its time complexity is O(n), with O(1) best case if the first item matches. Binary search is faster at O(log n) but needs sorted data. Hash table lookup is usually O(1) on average.
Q. Why was CDMA phased out?
asked 1xmediumNetworkingTechnical2016
Ans. CDMA was phased out because LTE and later 5G offered faster data, lower latency, better spectrum use, and a single global upgrade path. Operators also wanted to refarm CDMA spectrum for newer networks, reduce maintenance costs, and move away from older voice-centric infrastructure to all-IP services such as VoLTE.
Q. Apple and Orange basket puzzle
asked 1xmediumLogical reasoningTechnical2021
Ans. Pick one fruit from the basket labelled “Apple and Orange”. Since every label is wrong, this basket cannot be mixed, so the fruit you pick tells you its true contents. If it is an apple, that basket is apples. The basket labelled “oranges” must then be mixed, and the basket labelled “apples” must be oranges.
Q. Explain structure padding in C
asked 1xmediumOOPTechnical2021
Ans. Structure padding in C is the unused space a compiler inserts between structure members, or at the end, to satisfy alignment requirements of the target machine. This makes member access faster or valid for the hardware, but it increases sizeof the structure. Member order can change padding, so binary layouts should not be assumed casually.
Q. Explain the Banker's Algorithm
asked 1xmediumOperating systemsTechnical2021
Ans. The Banker’s Algorithm is a deadlock avoidance method that grants a resource request only if the system remains in a safe state afterwards. It tracks available resources, current allocations, and each process’s maximum need. If some ordering lets all processes finish, the request is safe; otherwise it is delayed.
Q. Explain the use of pragma in C
asked 1xmediumOOPTechnical2021
Ans. A pragma in C is a compiler directive used to give implementation-specific instructions to the compiler. It is written with #pragma and can control things like structure packing, warning settings, optimisation, or linking behaviour. Pragmas are not fully portable, so code using them may behave differently with different compilers.
Q. Create a Singleton class in C++
asked 1xmediumOOPTechnical2021
Ans. Create a Singleton by making the constructor private, deleting copy and assignment, and exposing a public static function that returns the only instance. In C++, the usual approach is a function-local static object, often called a Meyers Singleton. Since C++11, its initialisation is thread-safe. Access time is constant.
Q. Delete a node in a binary tree.
asked 1xmediumTreesTechnical2016
Ans. Delete the node by replacing its value with the deepest rightmost node’s value, then remove that deepest rightmost node. Use level order traversal with a queue to find both the target node and the last node. This keeps the tree structure compact. Time complexity is O(n), and space complexity is O(n).
Q. Detect a cycle in a linked list.
asked 1xmediumLinked listsTechnical2019
Ans. Use Floyd’s tortoise and hare algorithm: keep two pointers, one moving one node at a time and the other moving two nodes at a time. If they ever meet, there is a cycle. If the fast pointer reaches null, there is no cycle. It uses constant extra space and runs in O(n) time.
Q. Puzzle: Torch and Bridge problem
asked 1xmediumLogical reasoningTechnical2019
Ans. For the classic times 1, 2, 5 and 10 minutes, the minimum is 17 minutes. Send 1 and 2 across, 1 returns. Send 5 and 10 across, 2 returns. Send 1 and 2 across again. Total is 2 + 1 + 10 + 2 + 2 = 17.
Q. Where is the page table located?
asked 1xmediumOperating systemsTechnical2021
Ans. The page table is stored in main memory, usually in kernel-managed physical memory for each process. The CPU’s memory management unit uses a page table base register to find it, and caches recent translations in the TLB, because accessing the full page table in memory on every reference would be too slow.
Q. Explain CPU scheduling algorithms
asked 1xmediumOperating systemsTechnical2019
Ans. CPU scheduling algorithms decide which ready process gets the CPU next. Common algorithms include First Come First Served, Shortest Job First, Round Robin, Priority Scheduling and Multilevel Queue. The key trade-off is between throughput, response time, waiting time and fairness, with pre-emptive algorithms allowing the OS to interrupt a running process.
Q. Remove a loop from a linked list.
asked 1xmediumLinked listsTechnical2019
Ans. Use Floyd’s slow and fast pointers to detect the loop, then find the loop start and set the last node in the loop to null. After detection, move one pointer to the head and advance both one step until they meet. Then traverse the loop to find its previous node. Time is O(n), space is O(1).
Q. Explain face detection techniques.
asked 1xmediumImage processingTechnical2017
Ans. Face detection techniques locate human faces in images or video using visual patterns. Classical methods use Haar or HOG features with classifiers such as Viola-Jones or SVMs, scanning image regions at multiple scales. Modern methods use CNN-based detectors, such as MTCNN, SSD or YOLO, which are more accurate under pose, lighting and occlusion changes.
Q. Puzzle: Apples and Oranges problem
asked 1xmediumLogical reasoningTechnical2019
Ans. Pick one fruit from the box labelled “apples and oranges”. Since every label is wrong, that box must contain only the fruit you picked. If it is an apple, that box is apples. The box labelled oranges cannot be oranges, so it is mixed, leaving the apples label for oranges. Reverse the logic if you pick an orange.
Q. Explain the Diamond Problem in OOP.
asked 1xmediumOOPTechnical2019
Ans. The Diamond Problem is an ambiguity caused by multiple inheritance when a class inherits from two classes that both inherit from the same base class. The issue is which copy or implementation of the shared base member should be used. Languages handle it with rules such as virtual inheritance, explicit qualification, or disallowing multiple inheritance.
Q. Implement your own memcpy function.
asked 1xmediumOOPTechnical2017
Ans. Implement memcpy by casting source and destination to byte pointers, saving the original destination pointer, then copying exactly n bytes from source to destination in a simple loop. Return the saved destination pointer. The key detail is that memcpy assumes the ranges do not overlap; overlapping memory requires memmove. Time is O(n), space is O(1).
Q. Print the top view of a binary tree
asked 1xmediumTreesTechnical2021
Ans. Use level order traversal with a horizontal distance for each node, taking the first node seen at every distance. Store nodes in a queue with their distance, put the first value for each distance in an ordered map, then print map values from left to right. Time is O(n log n), or O(n) with hashing plus min and max distance.
Q. Data interpretation questions using pie charts
asked 1xmediumData interpretationOnline test2019
Ans. Convert each slice into a value using the total: value equals percentage times total, or angle divided by 360 times total. Read labels carefully, noting units and time periods. For comparisons, calculate differences, ratios or percentage change as asked. Keep working precise, then round only if the options require it.
Q. Design and implement file upload functionality.
asked 1xmediumDesignTechnical2020
Ans. Use direct-to-object-storage uploads with short-lived signed URLs, while the application stores metadata and enforces authentication, size, type, and ownership checks. The key detail is separating upload bandwidth from application servers. Client requests an upload, uploads to storage, storage emits an event for virus scanning and processing, then the file is marked available.
Q. Design and draw the database schema for a project.
asked 1xmediumDb designTechnical2019
Ans. I would model a project management system with User, Project, Membership, Task, Comment and Attachment tables. User has many Memberships, Project has many Memberships and Tasks, Task belongs to Project and optionally to an assignee User, Comment belongs to Task and User. The key detail is using Membership to represent roles and permissions per project.
Q. Logical reasoning questions testing analytical aptitude
asked 1xmediumLogical reasoningOnline test2019
Ans. Break the information into clear facts, conditions, and conclusions. Identify what must be true, what may be true, and what cannot be true. Use diagrams, tables, or symbols for arrangements and relationships. Test each option against the rules, eliminate contradictions, and avoid assumptions not stated in the question.
Q. Aptitude questions involving quantitative and logical reasoning
asked 1xmediumLogical reasoningOnline test2019
Ans. Identify what is being asked, list the given information, and choose the relevant formula or logic pattern. Convert units if needed, simplify the numbers, and solve step by step. For logical reasoning, look for relationships, sequences, exclusions, or conditions. Check the final answer against the question to avoid calculation or interpretation errors.
Q. Describe a conflict you faced in a group project and how you resolved it.
asked 1xmediumConflict resolutionHR2023
Ans. Choose a real conflict with moderate stakes, such as priorities, workload, or approach, not a personal feud. Emphasise how you listened, clarified facts, kept the goal central, and helped agree next steps. Interviewers listen for maturity, ownership, respectful communication, and evidence that the outcome improved because of your actions.
Q. How do you communicate with developers and stakeholders during the testing process?
asked 1xmediumCommunicationTechnical2023
Ans. Pick a real project where clear communication improved quality or avoided delay. Emphasise regular updates, concise defect reports, evidence, risk-based priorities, and adapting detail for developers versus business stakeholders. Interviewers listen for collaboration, transparency, calm handling of conflict, and proof that you keep people informed without slowing the team down.
Q. How would you respond to different workplace scenarios?
asked 1xunknownSituational judgmentHR2016
Ans. Choose a realistic scenario that shows judgement, communication, and ownership, such as conflict, changing priorities, or a mistake. Emphasise how you assessed the situation, involved the right people, stayed calm, and achieved a positive outcome. Interviewers listen for maturity, accountability, collaboration, and decisions that protect team goals.
Showing 60 of 860 questions. Ranked by how often the same question came back across interviews.