Advanced C++ Programming Interview Questions and Answers - 2

Question: 6

What is template?

Templates allow to create generic functions that admit any data type as parameters and return value without having to overload the function with all the possible data types. Until certain point they fulfill the functionality of a macro. Its prototype is any of the two following ones:

template  function_declaration;

template function_declaration;

The only difference between both prototypes is the use of keyword class or typename, its use is indistinct since both expression have exactly the same meaning and behave exactly the same way.

Question: 7

What are the divisions in integral type?

The divisions in Integral type are int and char. Integral is the integer data type. It cannot hold fractional values. Char is character data type that can hold both the character data and the integer data.

Question: 8

What are the operators used only by the preprocessor?

The operators # and ## are used only by the preprocessor.

Question: 9

How can the special character be represented?

Special characters are represented using escape sequences. Escape sequences are represented using characters prefixed with a backslash.

Question: 10

What is storage class and how many storage specifiers are there?

Storage class is another qualifier (like long or unsigned) that can be added to a variable declaration. There are four storage specifiers, they are auto, static, extern and register.

Related Questions