Showing posts with label OS Exam Questions. Show all posts
Showing posts with label OS Exam Questions. Show all posts

Monday, December 28, 2020

Operating systems multiple choice questions for exams - Set 22

Operating systems exams - multiple choice questions (MCQ) and answers, Objective type questions, OS exam questions, MCQ in system programming, semaphores, marshaling, monitors, race condition


Operating Systems MCQ questions and answers – Set 22

 

1. A race condition is when:

a) Multiple processes are all trying to finish first

b) A process runs too slow

c) The correctness of the code depends upon the timing of the execution

d) None of the above

Answer: (c) The correctness of the code depends upon the timing of the execution       

A race condition is a semantic error. It is a flaw that occurs in the timing or the ordering of events that leads to erroneous program behavior.

A race condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the second thread reads the same value from the variable. Then the first thread and second thread perform their operations on the value, and they race to see which thread can write the value last to the shared variable. The value of the thread that writes its value last is preserved, because the thread is writing over the value that the previous thread wrote. [Refer here for more]

 

2. Semaphores, Condition Variables, and Monitors support which of the following set of distinct operations?

a) Parallelization and event notification

b) Synchronization and event notification

c) Synchronization and parallelization

d) None of the above

Answer: (b) Synchronization and event notification  

The operations of semaphores, condition variables and monitors include synchronization and event notification.

The main aim of using a semaphore is process synchronization and access control for a common resource in a concurrent environment. The operations of semaphores are wait and signal.

Condition variables provide a mechanism to wait for events. Condition variables support three operations: Wait, Signal and Broadcast.

Monitors provide a structured concurrent programming primitive, which is used by processes to ensure exclusive access to resources, and for synchronizing and communicating among users.

 

3. The main advantage of multilevel page tables is that they

a) Use page table memory efficiently

b) Reduce the complexity of the paging system

c) Speed up page table references

d) None of the above

Answer: (a) Use page table memory efficiently

With many processes in a system, the page tables can potentially take up a large chunk of physical memory. One solution to the large memory requirements of page tables is to use multilevel paging. In this scheme, a virtual address is divided into three or more sections, with all but the last section being page numbers in different page tables, and the last one being the offset. We look up the first page table to find the second table, then look up the second table to find the frame in which the page is stored.

This scheme uses the page table memory efficiently. [Refer here for more]

4. Remote procedure calls rely on marshaling parameters. Marshaling means ______.

a) transforming the parameters into a form suitable for network transmission.

b) sending the parameters over the network to a remote server.

c) having the remote server extract the parameters from the network message.

d) having the remote server place the parameters on the stack to make a procedure call.

Answer: (a) transforming the parameters into a form suitable for network transmission           

Marshaling is placing all the parameters into a stream of bytes in an agreed upon format so that they can be transmitted. Unmarshaling is the opposite process.

Marshaling is the process of gathering data and transforming it into a standard format before it is transmitted over a network so that the data can transcend network boundaries.

 

5. Which of the following protocols is most suitable to the statement “a message may be lost between the sending process and the receiving process and as a result the receiving process may never receive that message.”

a) UDP protocol

b) TCP protocol

c) IP protocol

d) Both UDP  and TCP

Answer: (a) UDP protocol 

The UDP protocol does not do anything to resend lost messages, but TCP will resend until an ACK is received.

The service provided by UDP is an unreliable service that provides no guarantees for delivery and no protection from duplication (e.g. if this arises due to software errors within a router). The simplicity of UDP reduces the overhead from using the protocol and the services may be adequate in many cases.

 

*********

Related links:


OS Interview questions with answers

solved Interview questions in operating systems

GATE questions in system programming and operating systems

MCQ Interview questions in OS

Operating systems interview questions for competitive exams

objective type OS questions for IIT JEE entrance exam

Define marshaling

Friday, November 6, 2020

Operating systems multiple choice questions for exams - Set 21

Operating systems exams - multiple choice questions (MCQ) and answers, Objective type questions, OS exam questions, MCQ in system programming


Operating Systems MCQ questions and answers – Set 21

1. Translator for low level programming language were termed as

a) Compiler

b) Linker

c) Assembler

d) Loader

Answer: (c) Assembler

An assembler is a type of computer program that interprets source code written in assembly language into machine language, code and instructions that can be executed by a computer.

An assembler performs the following;

  • Translate assembly language mnemonics into machine language.
  • Translate symbolic names for addresses into numeric addresses.

 

2. The translator which perform macro expansion is called a

a) Macro processor

b) Macro pre-processor

c) Micro pre-processor

d) Assembler

Answer: (b) Macro pre-processor

An assembly language macro is a template whose format represents a pattern of 0 or more assembly language statements that might be common to multiple programs. For this purpose, a macro language is used to provide syntax for defining macros. Where a sequence of assembly language statements can be represented by a macro, a macro call is inserted into the assembly program source code where the assembly code would otherwise go.

A macro facility is used to interpret macro definitions and expand each macro call as it occurs with the requisite pattern of assembly language statements, providing expanded source code ready for the assembler. Hence, the macro facility is a preprocessor, which interprets all macro calls into assembly code prior to passing the expanded code on to the assembler. A macro facility is an add-on piece of system software, a convenience for the programmer, to facilitate production of multiple lines of commonly occurring code via single macro calls embedded in the programmer's assembly program.

[For more information and examples, please refer here]

 

3. Interval between the time of submission and completion of the job is called

a) Response time

b) Throughput

c) Turnaround time

d) Waiting time

Answer: (c) Turnaround time      

The interval from the time of submission of a process to the time of completion is the turnaround time. Turnaround time is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O.

For example, let us assume that job A arrives at time 0 (submission time) and takes 6 time units to finish. Then the turnaround time of A is 6.

 

4. The scheduling in which CPU is allocated to the process with least CPU burst time is called

a) Priority scheduling

b) Shortest Job First scheduling

c) Round Robin scheduling

d) First Come First Serve scheduling

Answer: (b) Shortest Job First (SJF) scheduling           

The idea behind the SJF algorithm is to pick the smallest fastest little job that needs to be done, get it out of the way first, and then pick the next smallest fastest job to do next. Technically this algorithm picks a process based on the next shortest CPU burst, not the overall process time.

This scheduling algorithm associates with each process the length of its next CPU burst. SJF is optimal – gives minimum average waiting time for a given set of processes. Here, the difficulty is to find the length of the next CPU request.

 

5. What does a time-sharing system need that a multi-programming system does not?

a) Trap mechanism

b) Kernel mode execution privileges

c) Shorter time slices

d) Interval Timer

Answer: (d) Interval Timer           

Time-sharing or multitasking is a logical extension of multiprogramming. The main difference between Multi programmed Batch Systems and Time-Sharing Systems is that in case of Multi programmed batch systems, objective is to maximize processor use, whereas in Time-Sharing Systems objective is to minimize response time.

Time sharing system

Time sharing is a technique that enables multiple users simultaneously accesses the system through terminals, with the OS interleaving the execution of each user program in a short burst or quantum of computation. Processor's time which is shared among multiple users simultaneously is termed as time-sharing.

The time sharing operating system assures that all the tasks get to access the CPU one by one and for a fixed small interval of time. This interval is known as the time quantum.

 

*********

Related links:


OS Interview questions with answers

solved Interview questions in operating systems

GATE questions in system programming and operating systems

MCQ Interview questions in OS

Operating systems interview questions for competitive exams

objective type OS questions for IIT JEE entrance exam

 

 

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery