TCS Placement: Sample Questions 14 - 15 of 502

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 14

Edit

Write in Short

Short Answer▾

What is SAP?

Explanation

  • SAP or Series of interface points allow computers to communicate with the other layers of network protocol stack.
  • The Service Access Point identify the protocol handler which should process an incoming frame.
  • Service Access Point is a data structure identifier for a buffer area in system memory.
  • The Open Systems Interconnect (OSI) model uses a SAP to define the communication between layers (like Network, Transport, Session, and the other layers of the Seven-Layered Model) .
  • Source Service Access Point (SSAP) or a Destination Service Access Point (DSAP) refer to the boundary between the Data Link Layer and the Network Layer.

Question 15

Question

MCQ▾

What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?

Choices

Choice (4)

a.

Preprocessing error

b.

Compile-time error

c.

Runtime exception

d.

Runtime error

Answer

b.

Explanation

  • Compile time error is generated.
  • By default compiler provides zero argument constructor & copy constructor implicitly, if those are not defined explicitly.
  • However, compiler will not call default constructor (zero argument constructor) , if parameterized constructor is defined explicitly.
  • Thus creating class object without parameters will generate compile time error
  • Note: Default constructor is a constructor with no parameters (or) all parameters of the constructor are used with default arguments.
  1. #include<iostream>
  2. usingnamespacestd;
  3. classX
  4. {
  5.     private:
  6.     intx;
  7.     public:
  8.     X(intm) // Parameterized constructor
  9.     {
  10.         x =m;
  11.     }
  12. };
  13. intmain()
  14. {
  15.     Xp; // error
  16.     Xq(10); // No error
  17.     return0;
  18. }

Developed by: