3i Infotech Papers: Sample Questions 199 - 200 of 1245

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

Question number: 199

» Basic CS » Networks

Essay Question▾

Describe in Detail

What is point to point protocol?

Explanation

Point to point configration

Point to Point Configration

Define point to point configration

  • Point to point (P2P) protocol is a data-link layer communication protocol to establish direct connection between two nodes.

  • Communication protocol connect computers to remote networking services including internet service providers.

  • P2P protocols tunnel Internet Protocol or other network Layer 3 data between two directly connected nodes over a physical connection, or over a direct link.

  • Widely used for the heavier and faster connections necessary for broadband communications.

Advantages of P2P:

  • Defines format of the frame to be exchanged between the devices.

  • Defines link control protocol.

  • Defines mechanism of network layer data encapsulation in data link frame.

  • Provides error detection.

  • Allows IP address to be assigned at the connection time i. e. dynamically- a temporary IP address can however be assigned to each host.

  • Also defines how two devices can authenticate each other.

Question number: 200

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

Predict the output or error (s) for the following:

  1. char *someFun1()
  2. char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; }int main()
  3. puts(someFun1()); puts(someFun2()); }

Explanation

  • In the program both the functions suffer from the problem of dangling pointers

Table showing the program

Table showing the program

char * someFun1 ()

{char temp [] = “string”; return temp; }

  • In someFun1 () temp is a character array

  • The space for it is allocated in heap and is initialized with character string “string”.

  • This is created dynamically as the function is called, so is also deleted dynamically on exiting the function

  • So the string data is not available in the calling function main () leading to printing of garbage values.

char * someFun2 () {char temp [] = {’s’, ‘t’, ‘r’, ‘i’, ‘n’, ‘g’}; return temp; }

  • The function someFun2 () also suffers from the same problem but the problem can be easily identified in this case.