3i Infotech Papers: Sample Questions 1157 - 1159 of 1245

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

Question number: 1157

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

Will the inline function be compiled as the inline function always? Justify.

Explanation

  • An inline function (marked with inline keyword) is a request and not a command.

  • Hence it won’t always be compiled as an inline function.

  • Explanation:

  • Inline-expansion could fail if the inline function contains loops, the address of an inline function is used, or an inline function is called in a complex expression.

  • The rules for inlining are compiler dependent.

Inline function

Inline Function

Given the image is define the inline function and default arguments

Question number: 1158

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

How do you declare the following:

Explanation

  • An array of three pointers to chars.

    • char * p [3];

    • An array of three char pointers.

    • char * p [3];

    • A pointer to array of three chars.

    • char (*ptr) [3];

    • A pointer to function which receives an int pointer and returns a float pointer.

    • float * (*ptr) (int *);

    • A pointer to a function which receives nothing and returns nothing.

  • void (*ptr) ();

Question number: 1159

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What are virtual classes?

Explanation

Understanding of virtual class.

Understanding of Virtual Class.

Understanding of virtual class.

  • A virtual class is inner class whose functions and member variables can be overridden and redefined by subclasses of the outer class.

  • Analogous to virtual functions.

  • Run time type of a virtual class depends on the run time type of an object of the outer class.

  • A run-time instance-type of the outer class object not only decides polymorphic type of its own object, but also the whole family tree of virtual class members.