C++ Lab Viva-Practical Exams Questions and Answers - 1

Question: 1

What are the advantages of inheritance?

It permits code reusability.

Reusability saves time in program development.

It encourages the reuse of proven and debugged high quality software, thus reducing problem after a system becomes functional.

Question: 2

Explain storage qualifiers in C++?

Const – This variable means that if the memory is initialized once, it should not be altered by a program.

Volatile – This variable means that the value in the memory location can be altered even though nothing in the program code modifies the contents.

Mutable – This variable means that a particular member of a structure or class can be altered even if a particular structure variable, class, or class member function is constant.

Question: 3

What is RTTI?

Run Time Type Identification (RTTI) lets you find the dynamic type of an object when you have only a pointer or a reference to the base type.

RTTI is the official way in standard C++ to discover the type of an object and to convert the type of a pointer or reference.

The need came from practical experience with C++.

Question: 4

What are logical operators?

Logical operators combine the results of one or more conditions or variables having numerical values.

The various logical operators are && (AND), || (OR),! (NOT)

Question: 5

What is an operator and an operand?

Operator specifies an operation to be performed that yields a value. An operand is an entity on which an operator acts.

For example:

RESULT=NUM1+NUM2

NUM1 and NUM2 are operands. An operand is an entity on which the operator works. + is the additional operator, that performs the addition of the numbers. The result (value) generated is stored in the variable RESULT by virtue of “=” (Assignment) operator.

Related Questions