71. What will be the output of the following C++ code?
#include <iostream>
int const s=9;
int main()
{
std::cout << s;
return 0;
}
#include <iostream>
int const s=9;
int main()
{
std::cout << s;
return 0;
}
72. Which concept is used to implement late binding?
73. What will be the output of the following C++ code?
#include <iostream>
int main(int argc, char const *argv[])
{
cout<<"Hello World";
return 0;
}
#include <iostream>
int main(int argc, char const *argv[])
{
cout<<"Hello World";
return 0;
}
74. Which of the following cannot be used with the virtual keyword?
75. What happens if the following program is executed in C and C++?
#include <stdio.h>
int main(void)
{
int new = 5;
printf("%d", new);
}
#include <stdio.h>
int main(void)
{
int new = 5;
printf("%d", new);
}
76. Which of the following is an exit-controlled loop?
77. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class Test
{
static int x;
public:
Test() { x++; }
static int getX() {return x;}
};
int Test::x = 0;
int main()
{
cout << Test::getX() << " ";
Test t[5];
cout << Test::getX();
}
#include <iostream>
using namespace std;
class Test
{
static int x;
public:
Test() { x++; }
static int getX() {return x;}
};
int Test::x = 0;
int main()
{
cout << Test::getX() << " ";
Test t[5];
cout << Test::getX();
}
78. What happens if the following program is executed in C and C++?
#include<stdio.h>
int main()
{
foo();
}
int foo()
{
printf("Hello");
return 0;
}
#include<stdio.h>
int main()
{
foo();
}
int foo()
{
printf("Hello");
return 0;
}
79. Which of the following is C++ equivalent for scanf()?
80. What will be the output of the following C++ code?
#include<iostream>
using namespace std;
int x = 1;
int main()
{
int x = 2;
{
int x = 3;
cout << ::x << endl;
}
return 0;
}
#include<iostream>
using namespace std;
int x = 1;
int main()
{
int x = 2;
{
int x = 3;
cout << ::x << endl;
}
return 0;
}
Read More Section(Introduction to C plus plus)
Each Section contains maximum 100 MCQs question on Introduction to C plus plus. To get more questions visit other sections.