Customers Passed C++Institute CPA Exam
Average Score In Real CPA Exam
Questions came from our CPA dumps.
Welcome to PassExamHub's comprehensive study guide for the C++ Certified Associate Programmer exam. Our CPA dumps is designed to equip you with the knowledge and resources you need to confidently prepare for and succeed in the CPA certification exam.
PassExamHub's CPA dumps PDF is carefully crafted to provide you with a comprehensive and effective learning experience. Our study material includes:
In-depth Content: Our study guide covers all the key concepts, topics, and skills you need to master for the CPA exam. Each topic is explained in a clear and concise manner, making it easy to understand even the most complex concepts.
Online Test Engine: Test your knowledge and build your confidence with a wide range of practice questions that simulate the actual exam format. Our test engine cover every exam objective and provide detailed explanations for both correct and incorrect answers.
Exam Strategies: Get valuable insights into exam-taking strategies, time management, and how to approach different types of questions.
Real-world Scenarios: Gain practical insights into applying your knowledge in real-world scenarios, ensuring you're well-prepared to tackle challenges in your professional career.
Expertise: Our CPA exam questions answers are developed by experienced C++Institute certified professionals who have a deep understanding of the exam objectives and industry best practices.
Comprehensive Coverage: We leave no stone unturned in covering every topic and skill that could appear on the CPA exam, ensuring you're fully prepared.
Engaging Learning: Our content is presented in a user-friendly and engaging format, making your study sessions enjoyable and effective.
Proven Success: Countless students have used our study materials to achieve their CPA certifications and advance their careers.
Start Your Journey Today!
Embark on your journey to C++ Certified Associate Programmer success with PassExamHub. Our study material is your trusted companion in preparing for the CPA exam and unlocking exciting career opportunities.
What happens when you attempt to compile and run the following code?#include <iostream> using namespace std; int main() { int i=5; switch(i) { case 1: cout<<"Hello"; break; case 2: cout<<"world"; break; case 3: break; default: cout<<"End"; } return 0; }
A. It prints: Hello
B. It prints: world
C. It prints: End
D. It prints: Helloworld
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(2); cout << i; return 0; }
A. It prints: 0
B. It prints: 1
C. It prints: -1
D. Compilation error
What happens when you attempt to compile and run the following code?#include <iostream> #include <string> using namespace std; int main() { string s1[]= {"H" , "t" }; string s; for (int i=0; i<2; i++) { s = s1[i]; s.insert(1,"o"); cout << s; } return( 0 ); }
A. It prints: Hoto
B. It prints: Ho
C. It prints: to
D. It prints: Ht
What is the output of the program?#include <iostream> #include <string> using namespace std; class First { string name; public: First() { name = "Alan"; } void setName(string n) {this?>name = n;} void setName() {this?>name = "John";} void Print(){ cout << name; } }; int main() { First ob1,*ob2; ob2 = new First(); First *t; t = &ob1; t?>setName(); t?>Print(); t = ob2; t?>setName("Steve"); ob2?>Print(); }
A. It prints: JohnSteve
B. It prints: AlanAlan
C. It prints: AlanSteve
D. It prints: Johnlan
What happens when you attempt to compile and run the following code?#include <iostream> #include <string> using namespace std; class A { protected: int y; public: int x, z; A() : x(1), y(2), z(0) {} A(int a, int b) : x(a), y(b) { z = x * y;} void Print() { cout << z; } }; class B : public A { public: int y; B() : A() {} B(int a, int b) : A(a,b) {} void Print() { cout << z; } }; int main () { A b(2,5); b.Print(); return 0; }
A. It prints: 10
B. It prints: 2
C. It prints: 5
D. It prints: 1
What happens when you attempt to compile and run the following code?#include <iostream> #include <string> using namespace std; class SampleClass { string *s; public: SampleClass() { s = new string("Text");} SampleClass(string s) { this?>s = new string(s);} ~SampleClass() { delete s;} void Print(){ cout<<*s;} }; int main() { SampleClass *obj; obj = new SampleClass("Test"); obj?>Print(); }
A. It prints: Text
B. It prints: Test
C. It prints: TextTest
D. Garbage value.
What happens when you attempt to compile and run the following code?#include <iostream> using namespace std; int main (int argc, const char * argv[]) { int tab[5]={1,2,3}; for (int i=0; i<5; i++) cout <<tab[i]; return 0; }
A. compilation fails
B. It prints: 12300
C. It prints: 12345
D. It prints: 00000
What happens when you attempt to compile and run the following code?#include <iostream> using namespace std; class First { public: void Print(){ cout<<"from First";} }; class Second:public First { public: void Print(){ cout<< "from Second";} };void fun(First *obj); int main() { First FirstObject; fun(&FirstObject); Second SecondObject; fun(&SecondObject); } void fun(First *obj) { obj?>Print(); }
A. It prints: from First
B. It prints: from Firstfrom First
C. It prints: from Firstfrom Second
D. It prints: from Secondfrom Second
What will be the output of the program?#include <iostream> #include <string> using namespace std; int fun(int); int main() { float k=3; k = fun(k); cout<<k; return 0; } int fun(int i) { i++; return i; }
A. 3
B. 5
C. 4
D. 5
Which code, inserted at line 19, generates the output "23"?#include <iostream> #include <string> using namespace std; class A { int x; protected: int y; public: int z; A() { x=1; y=2; z=3; } }; class B : public A { string z; public: int y; void set() { y = 4; z = "John"; } void Print() { //insert code here } }; int main () { B b; b.set(); b.Print(); return 0; }
A. cout << y << z
B. cout << y << A::z;
C. cout << A::y << A::z;
D. cout << B::y << B::z;
What happens when you attempt to compile and run the following code?#include <iostream> using namespace std; int main() { int i = 0; do { i++; if (i==3) break; cout<<i; } while(i < 5); return 0; }
A. It prints: 12
B. It prints: 1
C. It prints: 0
D. No output
What happens when you attempt to compile and run the following code?#include <iostream> using namespace std; int main() { int i, j; for(i = 0; i < 2; i++) { for(j = i; j < i + 1; j++) if(j == i) continue; else break; } cout << j; return 0; }
A. It prints: 0
B. It prints: 3
C. It prints: 2
D. It prints: 1
What happens when you attempt to compile and run the following code?#include <iostream> #include <string> using namespace std; class A { int x; protected: int y; public: int z; A() { x=1; y=2; z=3; } }; class B : public A { public: void set() { y = 4; z = 2;} void Print() { cout << y << z; } }; int main () { B b; b.set(); b.Print(); return 0; }
A. It prints: 42
B. It prints: 44
C. It prints: 22
D. It prints: 2
Which code, inserted at line 18, generates the output "AB"#include <iostream> using namespace std; class A { public: void Print(){ cout<< "A";} void Print2(){ cout<< "a";} }; class B:public A { public: void Print(){ cout<< "B";} void Print2(){ cout<< "b";} }; int main() { B ob2; //insert code here ob2.Print(); }
A. ob2?>A::Print();
B. ob2.B::Print();
C. ob2?>B::Print();
D. ob2.A::Print();
What is the output of the program given below?#include <iostream> using namespace std; int main (int argc, const char * argv[]) { enum state { ok, error, warning}; enum state s1, s2, s3, s4; s1 = ok; s2 = warning; s3 = error; s4 = ok;cout << s1<< s2<< s3<< s4; return 0; }
A. 1234
B. compilation fails
C. 0210
D. 1322
What happens when you attempt to compile and run the following code?#include <iostream> #include <string> using namespace std; class A { public: int age; A () { age=5; }; }; class B : private A { string name; public: B () { name="Bob"; }; void Print() {cout << name << age; } }; int main () { B b,*ob; ob = &b; ob?>age = 10; ob?>Print(); return 0; }
A. It prints: Bob55
B. It prints: Bob1
C. It prints: 10
D. Compilation error
What is the output of the program?#include <iostream> #include <string> using namespace std; int main() { char str[] = "Hello\0\World\0"; cout << str; return 0; }
A. It prints: Hello
B. It prints: World
C. It prints: HW
D. It prints: World\0World
What is the output of the program if character “1” is supplied as input?#include <iostream> using namespace std; int main () { int c; cin >> c; try { switch (c) { case 1: throw 20; case 2: throw 5.2f; case 3: throw 'a'; } } catch (int e) { cout << "int exception. Exception Nr. " << e; } catch (float e) { cout << "float exception. Exception Nr. " << e; } catch (...) { cout << "An exception occurred."; } return 0; }
A. It prints: float exception. Exception Nr. 5.2
B. It prints: int exception. Exception Nr. 20
C. It prints: An exception occurred
D. Compilation Error
What happens when you attempt to compile and run the following code?#include <iostream> #include <string> using namespace std; const int size = 3; class A { public: string name; A() { name = "Bob";} A(string s) { name = s;} A(A &a) { name = a.name;} }; class B : public A { public: int *tab; B() { tab = new int[size]; for (int i=0; i<size; i++) tab[i]=1;} B(string s) : A(s) { tab = new int[size]; for (int i=0; i<size; i++) tab[i]=1;} ~B() { delete tab; } void Print() { for (int i=0; i<size; i++) cout << tab[i]; cout << name; } }; int main () { B b1("Alan"); B b2; b1.tab[0]=0; b1.Print(); b2.Print(); return 0; }
A. It prints: Alan
B. It prints: 111
C. It prints: 011Alan111Bob
D. It prints: 0
What happens when you attempt to compile and run the following code?#include <iostream> #include <string> using namespace std; class A { int x; protected: int y; public: int z; }; class B : private A { string name; public: void set() { x = 1; } void Print() {cout << x; } }; int main () { B b; b.set(); b.Print(); return 0; }
A. It prints: 123
B. It prints: 1
C. It prints: ?123
D. Compilation error
What happens when you attempt to compile and run the following code?#include <iostream> using namespace std; class First { public: void Print(){ cout<<"from First";} }; class Second { public: void Print(){ cout<< "from Second";} }; int main() { Second t[2];for (int i=0; i<2; i++) t[i].Print(); }
A. It prints: from First
B. It prints: from Firstfrom First
C. It prints: from Secondfrom Second
D. It prints: from Second
What will variable "y" be in class B?class A { int x; protected: int y; public: int age; }; class B : public A { string name; public: void Print() { cout << name << age; } };
A. public
B. private
C. protected
D. None of these