TCS Papers: Sample Questions 343 - 344 of 502

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

Question number: 343

» Languages » C & C Plus Plus

MCQ▾

Question

A constructor that accepts ________ parameters is called the default constructor.

Choices

Choice (4) Response

a.

One

b.

No

c.

Two

d.

Three

Answer

b.

Explanation

  • The correct answer is NO.

  • Default constructor is called when object is allocated memory but is not provided any values from the constructor call (that is constructor call is without any arguments).

  • Example:

  1. #include <iostream>
  2. using namespace std;
  3. class Def
  4. {
  5.     public:
  6.     int a;
  7.     int b;
  8.     Def()
  9.     {
  10.         a=b=0;
  11.     }
  12. };
  13. int main()
  14. {
  15.     Def X;
  16.     cout << "Default constructs a,b value: "<<X.a <<" , "<< X.b << " ";
  17.     return 0;
  18. }
  • Output:

    Default constructer puts in a, b value: 0,0

  • In the above example a default constructor has the default value of “0” for both the parameters.

Question number: 344

» Basic CS » Networks

Essay Question▾

Describe in Detail

What are the responsibilities of Network Layer?

Explanation

Network Layer is responsible for the source-to-destination delivery of packet possibly across multiple networks (links). It provides following functions:

  • Logical Addressing

    • It translates logical network address into physical address.

    • Concerned with circuit, message, or packet switching.

  • Routing

    • Routers and gateways operate in the network layer.

    • Network Layer routes the packets to final destination.

  • Provides connection services including network layer flow-control, network layer error-control, and packet sequence control.

  • Breaks larger packets into small packets.