Functions

6.What is the return type of a function that doesn't return any value?
  • A. void
  • B. int
  • C. char
  • D. None

void

void

7.Which of the following best describes function overloading in C++?
  • A. Multiple functions with the same name and different return types.
  • B. Functions with the same name and different parameter lists.
  • C. Functions with the same name and the same parameter lists.
  • D. Functions that return multiple values.

Functions with the same name and different parameter lists.

Functions with the same name and different parameter lists.

8.Which of the following is correct regarding a function with a reference parameter in C++?
  • A. A reference parameter is passed by value.
  • B. A reference parameter cannot modify the original argument
  • C. A reference parameter is passed by reference, meaning the original argument can be modified.
  • D. A reference parameter must always be an int.

A reference parameter is passed by reference, meaning the original argument can be modified.

A reference parameter is passed by reference, meaning the original argument can be modified.

9. What is the scope of a local variable inside a function in C++?
  • A. It is accessible throughout the entire program.
  • B. It is accessible only within the function where it is declared.
  • C. It is accessible in any other function that is called later.
  • D. It is only accessible in the main function.

It is accessible only within the function where it is declared.

It is accessible only within the function where it is declared.

10. What is the purpose of the inline keyword in C++?
  • A. To define a function that doesn't return a value.
  • B. To define a function that is called without passing arguments.
  • C. To suggest to the compiler to insert the function code directly at the place where the function is called.
  • D. To define a function with default arguments.

To suggest to the compiler to insert the function code directly at the place where the function is called.

To suggest to the compiler to insert the function code directly at the place where the function is called.