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

1/9

Page

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

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

Select an option to see the answer and solution.

What is the purpose of a function prototype in C++?

Select an option to see the answer and solution.

Which keyword is used to define a function in C++ that does not return any value?

Select an option to see the answer and solution.

What is the correct way to call a function named "add" that takes two parameters in C++?

Select an option to see the answer and solution.

What does the 'return' statement do in a function in C++?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of the following is true about function overloading in C++?

Select an option to see the answer and solution.

What is the purpose of default arguments in C++ functions?

Select an option to see the answer and solution.

What is the correct syntax for declaring a function prototype in C++?

Select an option to see the answer and solution.

What is the purpose of passing arguments by reference in C++ functions?

Select an option to see the answer and solution.

What is the output of the following code: int square(int x) { return x * x; } int main() { cout << square(3) + square(2); } in C++?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What is the purpose of a function header in C++?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of the following is true about function recursion in C++?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of the following is true about function parameters in C++?

Select an option to see the answer and solution.

What is the correct way to declare a function in C++ that takes no parameters and returns an integer?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What is the output of the following code: int multiply(int x, int y) { return x * y; } int main() { cout << multiply(3, 4); } in C++?

Select an option to see the answer and solution.