3i Infotech Papers: Sample Questions 710 - 711 of 1245

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

Question number: 710

» Basic CS » Networks

Essay Question▾

Describe in Detail

What is the minimum and maximum length of the header in the TCP segment and IP datagram?

Explanation

  • The header should have a minimum length of 20 bytes and can have a maximum length of 60 bytes.

Header of TCP segment

  • TCP provides reliable data delivery with the help of sequencing and checksums.

  • 32 Bit number is used for byte level numbering of TCP segments.

  • Data Offset field- 4 Bit field shows the number of 32 Bit words in the header

  • The minimum size header is 5 words.

Header of IP diagram

  • Packet format of data recognized by IP is called IP datagram.

  • Consists of two components: the header and data, which need to be transmitted.

  • The size of the Header Length or the IHL field is 4 bits- specifies the length of header, which can range from 20 to 60 bytes.

  • IP datagram has a fixed header size except for the IP Options field- which can be 20–60 bytes.

Question number: 711

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is the output of the following program?

  1. # include <stdio.h>
  2. int aaa () { printf ( “hi” ); }
  3. int bbb () { printf ( “hello” ); }
  4. int ccc () { printf ( “bye” ); }
  5. main ()
  6. {
  7.     int ( * ptr[3]) ();
  8.     ptr[0] = aaa;
  9.     ptr[1] = bbb;
  10.     ptr[2] = ccc;
  11.     ptr[2] ();
  12. }

Explanation

In the program

Table shows the program

Table shows the program

int aaa () {printf (“hi”); }

Define the integer function aaa ()

int bbb () {printf (“hello”); }

Define the integer function bbb ()

int ccc () {printf (“bye”); }

Define the integer function ccc ()

int (* ptr [3] ) ();

int (* ptr [3] ) () says that ptr is an array of pointers to functions that takes no arguments and returns the type int.

ptr [0] = aaa;

First function pointer in the array is initialized with the address of the function aaa.

ptr [1] = bbb;

Second function pointer in the array is initialized with the address of the function bbb.

ptr [2] = ccc;

Third function pointer in the array is initialized with the address of the function ccc.

ptr [2] ();

The call to the function ptr [2] () is same as calling ccc ()

So, it results in printing “bye”.