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

8/9

Page

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

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
#define MAX 10
int main()
{
    int num;
    num = ++MAX;
    cout << num;
    return 0;
}

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void square (int *x)
{
    *x = (*x + 1) * (*x);
}
int main ( )
{
	int num = 10;
        square(&num);
        cout << num; 
        return 0;
    }
a) 100

Select an option to see the answer and solution.

What will initialize the list of arguments in stdarg.h header file?

Select an option to see the answer and solution.

What is the meaning of the following declaration?
int(*ptr[5])();

Select an option to see the answer and solution.

How many types of macros are there in c++?

Select an option to see the answer and solution.

Which is the correct syntax of declaring a namespace?

Options are not available for this question.

Select an option to see the answer and solution.

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;
}

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What is the default calling convention for a compiler in c++?

Select an option to see the answer and solution.

which of the following is used to implement the c++ interfaces?

Select an option to see the answer and solution.

To where does the program control transfers when the exception is arisen?

Select an option to see the answer and solution.

How many ways of passing a parameter are there in c++?

Select an option to see the answer and solution.

Which is used to keep the call by reference value as intact?

Select an option to see the answer and solution.

Overloaded functions are . . . . . . . .

Select an option to see the answer and solution.

What we can't place followed by the non-default arguments?

Select an option to see the answer and solution.

What are the advantages of passing arguments by reference?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
namespace space
{
    int x = 10;
}
namespace space
{
    int y = 15;
}
int main(int argc, char * argv[])
{
    space::x = space::y =5;
    cout << space::x << space::y;
}

Select an option to see the answer and solution.

Which symbol is used to declare the preprocessor directives?

Select an option to see the answer and solution.

If the user did not supply the value, what value will it take?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void func(int a, bool flag = true)
{
    if (flag == true ) 
    {
        cout << "Flag is true. a = " << a;
    }
    else 
    {
        cout << "Flag is false. a = " << a;
    }
}
int main()
{
    func(200, false);
    return 0;
}

Select an option to see the answer and solution.