3i Infotech Placement: Sample Questions 610 - 611 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 610

Question MCQ▾

To send a data packet using datagram, connection will be established

Choices

Choice (4)

a.

connection is not established before data transmission.

b.

before data transmission.

c.

no connection is required.

d.

All of the above

Edit

Answer

c.

Explanation

  • To send a data packet using datagram no connection is required.
  • User datagram protocol allows an application to send data packet with a low overhead in some important standards.
  • Datagram sends and receives data packets like TCP without any connection
  • Datagram is routed and send individually with no guarantee of delivery.
  • To send and receive datagrams an appropriate socket is required - for example an instance of the java. net. DatagramSocket class.

Question 611

Describe in Detail Essay▾

What is the output of the following program?

  1. #define DIM (array, type) sizeof (array)/sizeof (type)
  2. main ()
  3. {
  4. int arr[10];
  5. printf (“The dimension of the array is %d”, DIM (arr, int) );
  6. }
Edit

Explanation

The dimension of the array is 10

In the program

Table Shows the Program
int arr [10] ;
  • The size of integer array of 10 elements is 10 ⚹ sizeof (int) .
#define DIM (array, type) sizeof (array) /sizeof (type)
  • The macro expands to size of (arr) /size of (int) ⩾ 10 ⚹ size of (int) /size of (int) ⩾ 10
printf ( “The dimension of the array is % d” , DIM (arr, int) ) ;
  • Printf prints The dimension of the array as 10.