Which statement should be added in the following program to make work it correctly?using namespace std;int main (int argc, const char * argv[]){ cout<<"Hello";}
Answer(s): C
What is the output of the program? #include <iostream> using namespace std; int main() { int tab[4]={10,20,30,40}; tab[1]=10; int *p; p=&tab[0]; cout<<*p; return 0; }
Answer(s): A
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int fun(int x) { return 2*x; } int main(){ int i; i = fun(1) & fun(0); cout << i; return 0; }
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class A { public: virtual void Print()=0; }; class B:public A { public: virtual void Print() { cout<< "B"; } }; class C:public A { public: virtual void Print() { cout<< "C"; } }; int main() { B ob2; C ob3; A *obj; obj = &ob2; obj?>Print(); obj = &ob3; obj?>Print(); }
Post your Comments and Discuss C++ Institute CPA exam with other Community members:
Our website is free, but we have to fight against bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the CPA content, but please register or login to continue.