Functions / Methods MCQs

Topic-wise practice questions for Programming (C++ / Java / Python). Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q11easy
What is the difference between a "Parameter" and an "Argument"?
Q12hard
Trace this recursive function: f(n) = f(n-1) + f(n-2). Given

f(0)=0, f(1)=1, what is f(4)?
Q13easy
What is the "Call Stack"?
Q14hard
You are writing a recursive function to calculate a factorial. What is the most important component to prevent the program from crashing?
Q15medium
You have a function saveData() that is called 1 million times. You notice that the "overhead" of calling the function is slowing down the program. Which optimization might help?
Q16hard
What is wrong with this C++ function?

int* getPointer() {
    int val = 10;
    return &val;
}
Q17easy
What happens to a function's local variables when the function finishes executing?
Q18easy
What is a "Pure Function" in the context of functional programming?
Q19medium
A developer wants to pass a massive 1GB object to a function in C++. Which method should they use to avoid slowing down the program?
Q20easy
Function **Overloading** is an example of which type of polymorphism?