TCS Papers: Sample Questions 402 - 403 of 502

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

Question number: 402

» Basic CS » Networks

Essay Question▾

Describe in Detail

What is protocol Data Unit?

Explanation

  • A protocol data unit is information delivered as a unit among peer entities of networks containing control information, address information, or data.

  • PDU represents a unit of data specified in the protocol of a given layer, which consists of protocol control information and user data.

  • PDU is related to the initial four layers of the OSI model. In Layer 1, PDU is a bit, in Layer 2 it is a frame, in Layer 3 it is a packet and in Layer 4 it is a segment. In Layer 5 and above, PDU is referred to as data.

  • Contains four fields:

    • Destination service access point (DSAP)

    • Source service access point (SSAP)

    • Control field

    • Information field

  • DSAP, SSAP are addresses used by the LLC to identify the protocol stacks on the receiving and sending machines that are generating and using the data.

  • The control field specifies whether the PDU frame is an information frame (I - frame), a supervisory frame (S - frame), or an unnumbered frame (U - frame).

Image of the protocol data unit

Image of the Protocol Data Unit

Given the image is define the protocol data unit (PDU)

Question number: 403

» Languages » C & C Plus Plus

MCQ▾

Question

Which of the following function/type of function cannot be overloaded?

Choices

Choice (4) Response

a.

Member function

b.

Virtual function

c.

Static function

d.

None of the above

Answer

b.

Explanation

  • Virtual function cannot be overloaded

  • A virtual function is a member function expected to be redefined in derived classes.

  • When referencing a derived class object using pointer or a reference to the base class, virtual function for that object can be called to execute the derived class’s version of the function.

  • Virtual functions ensure that the correct function is called for an object, regardless of the type of reference (or pointer) used for function call.

  • Functions are declared with a virtual keyword in base class.

  • The resolving of function call is done at Run-time.

  • Example:

  1. #include<iostream>
  2. using namespace std;
  3. class base
  4. {
  5.     public:
  6.     virtual void print ()
  7.     {
  8.         cout<< "Print base class" <<endl;
  9.     }
  10.     void show ()
  11.     {
  12.         cout<< "Show base class" <<endl;
  13.     }
  14. };
  15. class derived:public base
  16. {
  17.     public:
  18.     void print ()
  19.     {
  20.         cout<< "Print derived class" <<endl;
  21.     }
  22.     void show ()
  23.     {
  24.         cout<< "Show derived class" <<endl;
  25.     }
  26. };
  27. int main()
  28. {
  29.     base *bptr;
  30.     derived d;
  31.     bptr = &d;
  32.     //virtual function, binded at runtime
  33.     bptr->print();
  34.     // Non-virtual function, binded at compile time
  35.     bptr->show();
  36. }
  • Output:

Print derived class

Show base class