C++ Institute CPA Associate Programmer Practice Exam
Sign in to Google to save your progress. Learn more
Write down the full name *
Write down the your phone number *
Write down the your phone E mail addres *
QUESTION NO: 101                                                                                                                                                             What happens when you attempt to compile and run the following code?#include <iostream>using namespace std; class A{public:void Print(){ cout<<"A";}};class B:public A{public:virtual void Print(){ cout<< "B";}};int main(){A *obj;A ob1;  obj = &ob1;obj?>Print();B ob2;obj = &ob2;obj?>Print();} *
1 point
QUESTION NO: 102                                                                  What happens when you attempt to compile and run the following code?#include <iostream>using namespace std; int main(){const int x=0;const int *ptr;ptr = &x;cout<<*ptr;return 0;}   *
1 point
QUESTION NO: 103                                                                                   What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;int main(){int i = 1;for(i=10; i>-1; i/=2) {if(!i)break;}cout << i;return 0;} *
1 point
QUESTION NO: 104                                                                                   What happens when you attempt to compile and run the following code?#include <iostream>#include <string>using namespace std;class A {public:int x;A() { x=0;}};class B {public:int x;B() { x=1;}};class C :public A, public B {public:int x;C(int x) {this?>x = x;   A. :x = x + 1;}void Print() { cout << x << A::x << B::x; }};int main () {C c2(1);   c2.Print();return 0;} *
1 point
QUESTION NO: 105                                                                                                                                              What happens when you attempt to compile and run the following code?#include <iostream>using namespace std; namespace myNamespace1{int x = 5;int y = 10;}namespace myNamespace2{float x = 3.14;float y = 1.5;}int main () {{using namespace myNamespace1;cout << x << " ";   }{using namespace myNamespace2;cout << y;}return 0; *
1 point
QUESTION NO: 106                                                                                                                                            What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;int main() {float i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4 / 2;cout << i; return 0;} *
1 point
QUESTION NO: 107                                                                                                                                                     What is the output of the program?#include <iostream>#include <string>using namespace std; class First{string name;public:First() {name = "Alan";}void Print(){cout << name;}};int main(){First ob1,*ob2;ob2 = new First();  ob1.Print();ob2?>Print(); *
1 point
QUESTION NO: 108                                                                                 What will the variable "age" be in class B?class A {int x;protected:int y;public:int age;};class B : protected A {string name;public:void Print() {cout << name << age;}  }; *
1 point
QUESTION NO: 109                                                                                                                                                    What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;int main(){const int x=20;const int *ptr;ptr = &x;*ptr = 10;cout<<*ptr;return 0;} *
1 point
QUESTION NO: 110                                                                                                                                          What is the output of the program given below?#include <iostream>using namespace std; int main (int argc, const char * argv[]){int i=10;{int i=0;cout<<i;}{int i=5;cout << i;}cout<<i;return 0;} *
1 point
Next
Clear form
Never submit passwords through Google Forms.
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy