Basic CS (3i Infotech Papers): Sample Questions 1 - 2 of 243

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 1

» Basic CS » Networks

MCQ▾

Question

Piggy backing is a technique for

Choices

Choice (4) Response

a.

Flow control

b.

Acknowledgement

c.

Sequence

d.

Retransmission

Answer

b.

Explanation

In two way communication when the data frame is received, receiver waits and does not send the acknowledgement back to the sender immediately. The receiver waits until its network layer passes in the next data packet. The delayed acknowledgement is then attached to this outgoing data frame. This technique of temporarily delaying the acknowledgement so that it can go with next outgoing data frame is known as piggybacking. The major advantage of piggybacking is better use of available channel bandwidth.

Question number: 2

» Basic CS » Operating System

Essay Question▾

Describe in Detail

How is the wait/signal operations for monitor different from those for semaphores?

Explanation

Monitor:

  • A programming language construct which monitors a particular location for access.

  • The program waits for access to happen and then if the value is satisfactory it processed to execute other operations.

  • The observed value is written by other thread

  • Implemented in a programing language

  • If a process provides monitor signal but no task is waiting on the condition variable than the signal is lost.

  • One process waits while the process writing the monitored location provides signal

A monitor has:

  • Shared data

  • A set of atomic operation on the data

  • A set of condition variables.

Advantages:

  • Reduces probability of error.

  • Provides low level synchronization operations.

  • Biases programmer to think about the system in a certain way.

Semaphore:

  • A data structure, which provide mutual exclusion to critical sections.

  • Supports 2 operation wait and signal.

  • The semaphore does not allow another process to enter the critical location until no other process is using it.

  • The waiting process continually reads the memory location (shared semaphore) and the process exiting the critical section provides the signal by writing the semaphore.

  • Associated with a queue of waiting processes.

Two types of semaphore:

  • Counting semaphore

    • Take non-negative integer values

  • Binary semaphore:

    • Take the value 0 & 1 only.

Difference between semaphore and monitor:

Table shows the difference between semaphore and monitor

Table shows the difference between semaphore and monitor

Semaphore

Monitor

Code for semaphores is distributed as wait and signal function calls.

The code that is used to achieve mutual exclusion is in a single place and is more structured.

Very easy to make mistakes when implementing

A very little chance to make mistakes when implementing

Do not use condition variable.

Use condition variables