C-Plus-Plus Questions

0 votes, 0 avg
28

C-Plus-Plus Questions

1 / 15

1. What should be printed on screen?

int main() 
{
int x = 5;

if(x++ == 5)
cout<<"Five"<

2 / 15

2. Exceptions are Caught at ?

3 / 15

3. Under which pillar of OOPS does base class and derived class relationship come?

4 / 15

4. Choose the correct option which is mandatory in a function.

5 / 15

5. What will be the output of the following C++ code?

#include 
using namespace std;
void square (int *x, int *y)
{
	*x = (*x) * --(*y);
}
int main ( )
{
	int number = 30;
	square(&number, &number);
	cout << number;
	return 0;
}

6 / 15

6. Which of the following statement is correct about Virtual Inheritance?

7 / 15

7. What is the use of is_same() function in C++?

8 / 15

8. What is do-while loop also known as?

9 / 15

9. Which of the following can be used to create an abstract class in the C++ programming language?

10 / 15

10. Which option is false for the following code?

class A
{
 private : int sum(int x, int y)
 { 
  return x+y; 
 }
 public: A()
 {  
 }
 A(int x, int y)
 { 
  cout<

11 / 15

11. What will be the output of the following C++ code?

        #include 

        using namespace std;

        double & WeeklyHours()

        {

            double h = 46.50;

            double &hours = h;

            return hours;

        }

        int main()

        {

            double hours = WeeklyHours();

            cout << "Weekly Hours: " << hours;

            return 0;

        }

12 / 15

12. What is virtual inheritance in C++?

13 / 15

13. Which of the following is correct about this pointer in C++?

14 / 15

14. What will be the output of the following C++ code?

 #include 
    using namespace std;
    #define PI 3.14159
    int main ()
    {
        float r = 2;
        float circle;
        circle = 2 * PI * r;
        cout << circle;
        return 0;
    }

15 / 15

15. What is the correct definition of an array?

Your score is

The average score is 16%

0%