C++ Interview Question and Answers
31. |
What is file scope? |
|
- A variable declared all blocks and functions (precisely main ()) has the scope of a file.
-
The scope of a file scope variable is the entire program. The life time of a file scope variable is the life time of a program.
|
|
|
32. |
How many types of variable scopes are there? What are they? |
|
Scope refers to the accessibility of a variable. There are four types of scopes in C++. They are:- Local scope
- File scope
- Function scope
- Class scope
|
`
|
|
33. |
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
|
|
|
34. |
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.
|
|
|
35. |
What is the use of parameters passing in function? |
|
- The call statement communicates with the function through arguments or parameters.
-
Parameters are the channels through which data flows from call statement to function and vice versa.
|
|
|