3i Infotech Papers: Sample Questions 515 - 517 of 1245

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

Question number: 515

» Basic CS » Networks

Short Answer Question▾

Write in Short

What is Gateway to Gateway protocol?

Explanation

  • An obsolete protocol for routing datagrams between internet gateways.

  • Designed as internet protocol datagram service to the transmission control protocol.

  • Defined as internet layer protocol.

  • A minimum hop algorithm measuring distance in router hops- implementing distributed shortest-path methodology.

  • Message has a field header that identifies the message type and the format of the remaining field.

Question number: 516

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

  1. char * foo ()
  2. {
  3.     char result[100];
  4.     strcpy (result, “anything is good” );
  5.     return (result);
  6. }
  7. int main ()
  8. {
  9.     char * j;
  10.     j = foo ();
  11.     printf ( “%s”, j);
  12. }

Explanation

  • In the program using strcpy () function

  • The C library function char * strcpy (char * dest, const char * src) copies the string pointed to, by “src” to “dest”.

Table showing the program

Table showing the program

char result [100];

  • Define the character result array

strcpy (result, “anything is good”);

  • Using strcpy () function

return (result);

  • Return the result

char * j;

  • Define the character pointer j

j = foo ();

  • Pointer j calls the foo () function

  • And output is stored in j

printf (“%s”, j);

  • Printf prints the string

Question number: 517

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

What is the output of the following program?

  1. #include<stdio.h>
  2. void main ()
  3. {
  4.     char *p = "ayqm";
  5.     printf ("%c",*(p++));
  6. }

Explanation

In the program

Table shows the program

Table shows the program

char * p = “ayqm”;

  • p is char pointer that stores the address of string “ayqm”

  • Means p has the address of ‘a’.

printf (“%c”, * (++p) );

  • Outputs ‘a’.

  • Now * (p++) is post-increment that means it prints the value than increment the address by 1.

  • so * (p++) prints the value ‘a’.