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

5/9

Page

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

Which operator is used for accessing a member of namespace?

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 extra
{
    int i;
}
void i()
{
    using namespace extra;
    int i;
    i = 9;
    cout << i;
}
int main()
{
    enum  letter { i, j};
    class i { letter j; };
    ::i();
    return 0;
}

Select an option to see the answer and solution.

To which does the function pointer point to?

Select an option to see the answer and solution.

What will happen when the handler is not found for an exception?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int func(int m = 10, int n)
{
    int c;
    c = m + n;
    return c;
}
int main()
{
    cout << func(5);
    return 0;
}

Select an option to see the answer and solution.

Which of the following permits function overloading on c++?

Select an option to see the answer and solution.

What happens to a function defined inside a class without any complex operations (like looping, a large number of lines, etc)?

Select an option to see the answer and solution.

Which of the following feature is used in function overloading and function with default argument?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int mult (int x, int y)
{
    int result;
    result = 0;
    while (y != 0) 
    {
        result = result + x;
        y = y - 1;
    }
    return(result);
}
int main ()
{
    int x = 5, y = 5;
    cout  << mult(x, y) ;
   return(0);
}

Select an option to see the answer and solution.

An inline function is expanded during . . . . . . . .

Select an option to see the answer and solution.

What is the mandatory part to present in function pointers?

Select an option to see the answer and solution.

Where does the return statement returns the execution of the program?

Select an option to see the answer and solution.

What is the other name of the macro?

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
#include <stdarg.h>
using namespace std;
int flue(char c,...);
int main()
{
    int x, y;
    x = flue('A', 1, 2, 3);
    y = flue('1', 1.0,1, '1', 1.0f, 1l);
    cout << x << y;
    return 0;
}
int flue(char c,...)
{
    return c;
}

Select an option to see the answer and solution.

What is the general syntax for accessing the namespace variable?

Select an option to see the answer and solution.

What will you use if you are not intended to get a return value?

Select an option to see the answer and solution.

From which function the execution of a C++ program starts?

Select an option to see the answer and solution.

Which value will it take when both user and default values are given?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int Add(int X, int Y, int Z)
{
    return X + Y;
}
double Add(double X, double Y, double Z)
{
    return X + Y;
}
int main()
{
   cout << Add(5, 6);
   cout << Add(5.5, 6.6);
   return 0;
}

Select an option to see the answer and solution.