InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What Is An Elf? |
|
Answer» EXECUTABLE and LINKING Format is a common standard FILE format for executables, object code, shared libraries, and CORE dumps. Executable and Linking Format is a common standard file format for executables, object code, shared libraries, and core dumps. |
|
| 2. |
What Are The Different Segments Of A Program? |
|
Answer» Memory Segments: Code segment This PHRASE used to refer to a portion of memory or of an object file that contains executable computer instructions. It is generally readonly segment. Data segment: This is one of the sections of a program in an object file or in memory, which contains the global variables that are INITIALIZED by the programmer. It has a fixed size, since all of the data in this section is set by the programmer before the program is loaded. However, it is not readonly, since the values of the variables can be altered at runtime. .bss: This segment of memory is part of data segment that contains uninitialized data (static variables). These are initialized to 0 and later assigned values during runtime. Stack segment: This segment of memory is a special stack which stores information about the active subroutines of a TASK. It contains the return address to be branched to after a subroutine has finished execution. It contains local variables of the subroutines and the parameters that are passed to those sub routines. HEAP segment: The segment of memory which is used for dynamic memory allocation is known as heap. It is the RESPONSIBILITY of the programmer to deallocate it after its use. Or alternatively it will be garbage collected by the OS. Memory Segments: Code segment This phrase used to refer to a portion of memory or of an object file that contains executable computer instructions. It is generally readonly segment. Data segment: This is one of the sections of a program in an object file or in memory, which contains the global variables that are initialized by the programmer. It has a fixed size, since all of the data in this section is set by the programmer before the program is loaded. However, it is not readonly, since the values of the variables can be altered at runtime. .bss: This segment of memory is part of data segment that contains uninitialized data (static variables). These are initialized to 0 and later assigned values during runtime. Stack segment: This segment of memory is a special stack which stores information about the active subroutines of a task. It contains the return address to be branched to after a subroutine has finished execution. It contains local variables of the subroutines and the parameters that are passed to those sub routines. Heap segment: The segment of memory which is used for dynamic memory allocation is known as heap. It is the responsibility of the programmer to deallocate it after its use. Or alternatively it will be garbage collected by the OS. |
|
| 3. |
What Is Present In .bss? |
|
Answer» The BSS SECTION CONTAINS uninitialized data, and is allocated at runtime. Until it is WRITTEN to, it remains zeroed. The bss section contains uninitialized data, and is allocated at runtime. Until it is written to, it remains zeroed. |
|
| 4. |
What Are The Different Inter Process Communications? |
|
Answer» SEMAPHORE, MUTEX, MESSAGE passing, shared memory, SOCKET connections. semaphore, mutex, message passing, shared memory, socket connections. |
|
| 5. |
What Are The Different Types Of Semaphores And Where They Are Used? |
|
Answer» BINARY semaphore and counting semaphore. Binary semaphore is same as mutex. Binary semaphore tries to PROTECT only one resource. For ex: we have 4 printers then the counting semaphore value will be INIT to 4. When it reaches 0, the task waiting on the semaphore is SUSPENDED. Binary semaphore and counting semaphore. Binary semaphore is same as mutex. Binary semaphore tries to protect only one resource. For ex: we have 4 printers then the counting semaphore value will be init to 4. When it reaches 0, the task waiting on the semaphore is suspended. |
|
| 6. |
Write A Small Piece Of Code Protecting A Shared Memory Variable With A Semaphore? |
|
Answer» INT global_i; VOID increment_shared_memory { global_i++; SIGNAL(semaphore); } int global_i; void increment_shared_memory { wait(semaphore); global_i++; signal(semaphore); } |
|
| 7. |
Why Do We Require Semaphore? |
|
Answer» For PROCESS synchronization, it is a mechanism to invoke the sleeping process to become ready for EXECUTION. Its mechanism where a process can wait for resources to be available.typical example is producer consumer process. The producer process creates resources and signals the semaphore saying RESOURCE is available. Consumer process waiting on the semaphore GETS the SIGNAL that resource is available. For process synchronization, it is a mechanism to invoke the sleeping process to become ready for execution. Its mechanism where a process can wait for resources to be available.typical example is producer consumer process. The producer process creates resources and signals the semaphore saying resource is available. Consumer process waiting on the semaphore gets the signal that resource is available. |
|
| 8. |
Write A Code To Check Whether A Stack Grows Upwards Or Downwards? |
|
Answer» void checkStack() { INT i=2; int j=3; if(&i > &j) printf("stack grown DOWNWARDS"); ELSE printf("stack grows upwards"); } define 2 local variables one after other and try to PRINT the address void checkStack() { int i=2; int j=3; if(&i > &j) printf("stack grown downwards"); else printf("stack grows upwards"); } define 2 local variables one after other and try to print the address |
|
| 9. |
What Is Paging, Segmentation Y Do We Need It? |
|
Answer» Paging: Paging is a technique where in the OS makes available the data required as quickly as possible. It STORES some PAGES from the aux device to main memory and when a prog NEEDS a page that is not on the main memory it fetches it from aux memory and replaces it in main memory. It uses specialised algorithms to choose which page to replace from in main memory. CACHING: It deals with a concept where the data is temperorarily stored in a high speed memory for FASTER access. This data is duplicated in cache and the original data is stored in some aux memory. This concepts brings the average access time lower. Segmentation: Segmentation is a memory management scheme. This is the technique used for memory protection. Any accesses outside premitted area would result in segmentation fault. Virtual Memory: This technique enables noncontiguous memory to be accessed as if it were contiguous. Same as paging. Paging: Paging is a technique where in the OS makes available the data required as quickly as possible. It stores some pages from the aux device to main memory and when a prog needs a page that is not on the main memory it fetches it from aux memory and replaces it in main memory. It uses specialised algorithms to choose which page to replace from in main memory. Caching: It deals with a concept where the data is temperorarily stored in a high speed memory for faster access. This data is duplicated in cache and the original data is stored in some aux memory. This concepts brings the average access time lower. Segmentation: Segmentation is a memory management scheme. This is the technique used for memory protection. Any accesses outside premitted area would result in segmentation fault. Virtual Memory: This technique enables noncontiguous memory to be accessed as if it were contiguous. Same as paging. |
|
| 10. |
What Is A Flat Memory Model And A Shared Memory Model? |
| Answer» | |
| 11. |
How Will U Create A Process In Unix Or Our Os Ose? |
|
Answer» We can USE thr FORK system call to create a PROCESS in UNIX and in OSE the system call create_process is USED. We can use thr fork system call to create a process in UNIX and in OSE the system call create_process is used. |
|
| 12. |
Windows Also Has Multiple Processes Has Process Priorities Switches Between Multiple Process, How Rtos Is Different From That? |
|
Answer» RTOS has PREDICTABLE TIMING CONSTRAINTS. RTOS has predictable timing constraints. |
|
| 13. |
What Is Stack Overflow And Heap Overflow? |
| Answer» | |
| 14. |
What Is A Core Dump? |
|
Answer» A CORE dump is the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally includes the program COUNTER and stack pointer, memory management information, and other processor and operating system flags and information a fatal error usually triggers the core dump, often buffer overflows, where a programmer allocates too LITTLE memory for incoming or computed DATA, or access to null pointers, a common coding error when an unassigned memory reference variable is accessed. A core dump is the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally includes the program counter and stack pointer, memory management information, and other processor and operating system flags and information a fatal error usually triggers the core dump, often buffer overflows, where a programmer allocates too little memory for incoming or computed data, or access to null pointers, a common coding error when an unassigned memory reference variable is accessed. |
|
| 15. |
Is Unix A Multitasking Or Multiprocessing Operating System? Whats The Difference Between The Two? |
|
Answer» UNIX is a multitasking operating system, multiprocessing means it can run on multiple processors, the multiproceesing os coordinates with multiple processors RUNNING in PARALLEL. unix is a multitasking operating system, multiprocessing means it can run on multiple processors, the multiproceesing os coordinates with multiple processors running in parallel. |
|
| 16. |
How Is Rtos Different From Other Os? |
|
Answer» A RTOS OFFERS services that ALLOW tasks to be performed within predictable TIMING CONSTRAINTS. A RTOS offers services that allow tasks to be performed within predictable timing constraints. |
|
| 17. |
What Is A Non Reentrant Code? |
|
Answer» Re entrant code is code which does not rely on being executed WITHOUT INTERRUPTION before completion. Reentrant code can be used by multiple, simultaneous tasks. Reentrant code generally does not access GLOBAL data. Variables within a reentrant function are allocated on the stack, so each INSTANCE of the function has its own PRIVATE data. Nonreentrant code, to be used safely by multiple processes, should have access controlled via some synchronization method such as a semaphore. Re entrant code is code which does not rely on being executed without interruption before completion. Reentrant code can be used by multiple, simultaneous tasks. Reentrant code generally does not access global data. Variables within a reentrant function are allocated on the stack, so each instance of the function has its own private data. Nonreentrant code, to be used safely by multiple processes, should have access controlled via some synchronization method such as a semaphore. |
|