What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;class Test {float i,j;};class Add {public:int x,y;Add (int a=3, int b=3) { x=a; y=b; }int result() { return x+y;}};int main () {Test test;Add * padd;padd = &test;cout << padd?>result();return 0;}
Answer(s): C
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;class BaseC{int *ptr;public:BaseC() { ptr = new int(10);}BaseC(int i) { ptr = new int(i); }~BaseC() { delete ptr; }void Print() { cout << *ptr; }};int main(){BaseC *o = new BaseC(5);o?>Print();}
Answer(s): A
What will happen when you attempt to compile and run the following code?#include <iostream>using namespace std;int main(){const char *s;char str[] = "Hello ";s = str;while(*s) {cout << *++s;*s++;}return 0;}
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 :void print() {cout << "B ";}};int main() {B sc[2];A *bc = (A*)sc;for (int i=0; i<2;i++)(bc++)->print();return 0;}
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
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-21-02 content, but please register or login to continue.