What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;int x=5;static int y=0;void myFunction(int a){y=++a;}int main (int argc, const char * argv[]){int i=0;myFunction(i);cout<<y<<" "<<x;}
Answer(s): C
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"; }};class C:public B {public:void Print(){ cout<< "C"; }};int main(){A ob1;B ob2;C ob3;A *obj;obj = &ob1;obj?>Print();obj = &ob2;obj?>Print();obj = &ob3;obj?>Print();}
Answer(s): B
What happens when you attempt to compile and run the following code?#include <iostream>#include <string>using namespace std;class A {public:int x;};class B : public A {public:B() { x=1;}B(int x) {this?>x = x;}};int main () {B c1;B c2(10);cout << c1.x;cout << c2.x;return 0;}
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;void fun(char*);int main(){char t[4]={'0', '1', '2', '3'};fun(&t[2]);return 0;}void fun(char *a){cout << *a;}
Answer(s): A
Post your Comments and Discuss C++ Institute CPA-21-02 exam with other Community members:
Subash commented on October 21, 2024 I am planning to take this exam. Are these 257 questions enough to clear it? Also, does each section have a passing percentage, or is it based on the overall ? INDIA upvote