C++ Programs Asked in Interview for Freshers - 1

Question: 1

What are functions?

Functions are the building blocks of C++ programs. Functions are also the executable segments in a program.

The starting point for the execution of a program is main ().

Question: 2

What are the advantageous of Functions?

Functions are advantageous as they –

Reduce the size of the program.

Induce reusability of code.

Reusability of code (function fact is executed more than once).

A function can be shared by other programs by compiling it separately and loading them together.

Question: 3

What is calling a function?

A function can be called or invoked from another function by using its name. The function name may include a set of actual parameters, enclosed in parenthesis separated by comma.

Question: 4

What are the two methods used in Functions?

In C++, functions that have arguments can be invoked by

Call by value and

Call by reference.

Question: 5

What is an inline function?

An inline looks like a normal function in the source file but inserts the function’s code directly into the calling program.

Inline functions execute faster but require more memory space.

Related Questions