TCS Papers: Sample Questions 404 - 405 of 502

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

Question number: 404

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

Which of the following statements should be used to obtain a remainder after dividing 7.14 by 3.1?


  • fmod (x, y) - Calculates x modulo y, the remainder of x/y.

  • This function is the same as the modulus operator but also performs floating-point divisions.

  • Example:

  1. #include <stdio.h>
  2. #include <math.h>
  3. int main ()
  4. {
  5.     printf ("fmod of 7.14/3.1 is %lf "fmod (7.14,3.1) );
  6.     return 0;
  7. }
  • Output:

Fmod of 7.14/3.1 is 0.940000

Question number: 405

» Basic CS » Networks

Essay Question▾

Describe in Detail

What is stop-and –wait protocol?


  • In Stop and wait protocol, sender sends one frame, waits until it receives confirmation from the receiver (okay to go ahead), and then sends the next frame.

  • In this method of flow control, the sender sends a single frame to receiver & waits for an acknowledgment.

  • The next frame is sent only when acknowledgment of previous frame is received- process continues as long as the sender has data to send.

  • To end transmission sender transmits end of transmission (EOT) frame.

  • The main advantage of stop & wait protocol is accuracy and order- there is no chance of frame being lost or arriving out of order.

  • The method is however inefficient- transmission process is slow as a single frame travels from source to destination and single acknowledgment travels from destination to source- one by one in serial order. Each frame sent and received uses the entire time needed to traverse the link.

Stop and wait protocol

Stop and Wait Protocol

Given the image is define the stop and wait protocol