TCS Papers: Sample Questions 186 - 187 of 502

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

Question number: 186

» Languages » C & C Plus Plus



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?


Choice (4) Response


Runtime error


Compile-time error


Runtime exception


Preprocessing error




  • 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. using namespace std;
  3. class X
  4. {
  5.     private:
  6.     int x;
  7.     public:
  8.     X(int m// Parameterized constructor
  9.     {
  10.         x = m;
  11.     }
  12. };
  13. int main()
  14. {
  15.     X p// error
  16.     X q(10); // No error
  17.     return 0;
  18. }

Question number: 187

» Basic CS » Networks

Essay Question▾

Describe in Detail

Define Character Stuffing?


  • Byte stuffing (or character stuffing) adds a special byte to the data section of the frame when there is a character with the same pattern as the flag. The data section is stuffed with an extra byte- usually called the escape character (ESC), which has a predefined bit pattern. Whenever the receiver encounters the ESC character, it removes it from the data section and treats the next character as data, not a delimiting flag.

  • In the second method, each frame starts with the ASCII character sequence DLE STX and ends with the sequence DLE ETX. (where DLE is Data Link Escape, STX is Start of Text and ETX is End of Text. ). This method overcomes the drawback of increasing character count. If the destination loses synchronization, it can look for DLE STX and DLE ETX characters.

  • If however, binary data is being transmitted then there exists a possibility of the characters DLE STX and DLE ETX occurring in the data. As this will interfere with framing, a technique called character stuffing is used.

  • The sender’s data link layer inserts an ASCII DLE character just before the DLE character in the data. The receiver’s data link layer removes this DLE before this data is given to the network layer.

  • Character stuffing is closely associated with 8-bit characters and this is a major hurdle in transmitting arbitrary sized characters.

Image of the character stuffing

Image of the Character Stuffing

Given the image is define the character stuffing