stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
function Flashcards | StudBud
Explore
/
function
function
12 terms
·
StudBud Administration
·
34 plays
Imported from external platform
Flashcards
12 cards
F
Practice quiz
P
Host live
L
Questions
12
Answers
1
What is the final output of the following code?
none
both
10
50
2
What is the return type of a function that does not return any value?
null
void
int
float
3
What is the output of the following code?
5
3
8
0
4
What is the purpose of the return statement in a function?
To return a value from the function to the caller
To call another function
To terminate the program
To define the function
5
What happens when you pass an argument by value?
The original variable is modified
The variable is passed as a reference
A new copy of the variable is created
Compilation error
6
What is a function in C++?
A keyword used for loops
A data type used for mathematical operations
A block of code that performs a specific task
A variable that stores data
7
Which of the following correctly passes an argument by reference?
None
void func(int &x);
Both b and c
void func(int x);
8
Which of the following is the correct syntax for a function in C++?
functionName(returnType) {}
functionName {}
returnType functionName() {}
functionName() {}
9
Which of the following is true about function overloading in C++?
Functions can have the same name and same parameters
Functions can have the same name but different parameters
Functions cannot have the same name
Functions can have the same name but different return types
10
What is the scope of a variable declared inside a function?
local
Global
none
both
11
What is a recursive function?
A function that has no parameters
A function that calls itself
A function that calls another function
A function that returns a value
12
Which of the following is true about pass-by-reference in C++?
It is not supported in C++
A copy of the argument is passed to the function
The original argument is passed to the function
The function cannot modify the original argument