Functions interview questions
20 questions. Tap “Show answer” to check yourself.
-
____ are the building blocks C++ programs.
- Switch
- For
- If-else
- Functions
Show answer
D. Functions
-
How many types of scopes in C++?
- 2
- 3
- 4
- 5
Show answer
C. 4
-
Which function executes faster but requires more memory space?
- Inline function
- Regular function
- Void function
- Normal function
Show answer
A. Inline function
-
A variable declared above all blocks and functions has the ___
- Class scope
- Function scope
- Local scope
- Scope of a file
Show answer
D. Scope of a file
-
The starting point for the execution of a program is ___
- Class
- Public
- Void ()
- Main()
Show answer
D. Main()
-
The return type of the function prototype float power (float,.int) is ___
- Int
- Float
- Double
- Char
Show answer
B. Float
-
The lifetime of a ___ variable is the life time of a program.
- Global scope
- Local scope
- File scope
- Function scope
-
In call by value method, the flow of data is always from the ___ statement to the function definition.
- Call
- Return
- Function
- Go to
Show answer
A. Call
-
A block of code begins and ends with ___
- {}
- []
- ()
- {]
Show answer
A. {}
-
The scope of any variable used in the entire program is ___
- Class
- Function
- File
- Local
Show answer
C. File
-
The lifetime of a ___ variable, is the life time of the function block.
- Function scope
- File scope
- Local scope
- Global scope
Show answer
A. Function scope
-
A function can be invoked from another function using its ___
- Value
- Return
- Name
- Variables
Show answer
C. Name
- Advertisement
-
The ___ reveals the hidden scope of a variable.
- ++
- *
- %
- Scope operator
Show answer
D. Scope operator
-
In ___ a local variable is defined within a block.
- Class scope
- Local scope
- Function scope
- File scope
Show answer
B. Local scope
-
The calling function parameters are called as ___
- Actual parameters
- Dummy parameters
- Duplicate parameters
- Formal parameters
Show answer
A. Actual parameters
-
The functions that return no value is declared as ___
- Null
- Void
- Static
- Public
Show answer
B. Void
-
In ___ method any change in the formal parameters is not reflected back to the actual parameter.
- Call by value
- Call by reference
- Call
- Return
Show answer
B. Call by reference
-
The main purpose of function prototype is to help the ____ to check the data requirement of the function.
- Object
- Linker
- Interpreter
- Compiler
Show answer
D. Compiler
-
An ___ looks like a normal function in the source file but inserts the function’s code directly into the calling program.
- Inline
- Online
- Mainline
- Line
Show answer
A. Inline
-
Inline keyword is just a request to the ___
- Object
- Linker
- Interpreter
- Compiler
Show answer
D. Compiler