C++ Multiple Choice Questions

Our C++ questions and answers focuses on all areas of C++ programming language covering 100+ topics in C++

C++ Functions MCQ | Set 1

C++ Functions | Set 1

1. Where does the execution of the program starts?

a) user-defined function
b) main function
c) void function
d) else function

2. What are mandatory parts in the function declaration?

a) return type, function name
b) return type, function name, parameters
c) parameters, function name
d) parameters, variables

3. which of the following is used to terminate the function declaration?

a) :
b) )
c) ;
d) ]

4. How many can max number of arguments present in function in the c99 compiler?

a) 99
b) 90
c) 102
d) 127

5. Which is more effective while calling the functions?

a) call by value
b) call by reference
c) call by pointer
d) call by object

6. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void car{
    cout << "Audi R8";
int main() {

    return 0;

a) Audi R8
b) Audi R8Audi R8
c) compile time error
d) runtime error

7. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void fun(int x, int y){
    x = 20;
    y = 10;
int main() {

    int x = 10;
    fun (x, x);
    cout << x;
    return 0;

a) 10
b) 20
c) compile time error
d) 30

8. What is the scope of the variable declared in the user defined function?

a) whole program
b) only inside the {} block
c) the main function
d) header section

9. How many minimum number of functions should be present in a C++ program for its execution?

a) 0
b) 1
c) 2
d) 3

10. Which of the following is the default return value of functions in C++?

a) int
b) char
c) float
d) void

- Related Topics