Vidyalelo
C++ Programming · all questions

Functions and Procedures in C++
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

176

Questions

2/9

Page

Pick an option on a question to see the right answer and solution.

Which of the following is a valid function declaration in C++?

Select an option to see the answer and solution.

What is the purpose of function overloading in C++?

Select an option to see the answer and solution.

What does the 'inline' keyword do in C++ function declaration?

Select an option to see the answer and solution.

What is the output of the following code: int max(int a, int b) { return (a > b) ? a : b; } int main() { cout << max(5, 5); } in C++?

Select an option to see the answer and solution.

In C++, how are function arguments passed by default?

Select an option to see the answer and solution.

What is the purpose of the 'static' keyword in a function declaration in C++?

Select an option to see the answer and solution.

What is the syntax for defining a recursive function in C++?

Select an option to see the answer and solution.

What will be the output of the following code: int add(int x, int y) { return x + y; } int main() { cout << add(2); } in C++?

Select an option to see the answer and solution.

What is the purpose of the 'extern' keyword in a function declaration in C++?

Select an option to see the answer and solution.

What is the correct way to pass an array to a function in C++?

Select an option to see the answer and solution.

What is the purpose of the 'static' keyword in a C++ function?

Select an option to see the answer and solution.

What does the 'void' keyword represent in the function declaration in C++?

Select an option to see the answer and solution.

Which of the following is true about inline functions in C++?

Select an option to see the answer and solution.

What is the output of the following code: int add(int a, int b) { return a + b; } int sum = add(3, 5); cout << sum; in C++?

Select an option to see the answer and solution.

In C++, what is the significance of the function return type 'auto'?

Select an option to see the answer and solution.

What is the purpose of the 'friend' keyword in a C++ function declaration?

Select an option to see the answer and solution.

What is the syntax for declaring a function that takes a variable number of arguments in C++?

Select an option to see the answer and solution.

What is the output of the following code: int x = 5; cout << "Before: " << x; changeValue(x); cout << "After: " << x; in C++?

Select an option to see the answer and solution.

What is the correct syntax for defining a function template in C++?

Select an option to see the answer and solution.

What is the purpose of the 'const' keyword in a function parameter list in C++?

Select an option to see the answer and solution.