C++ Certified Associate Programmer (CPA) - CPPL Actual Exam Questions
Last updated on May 02, 2026
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int op(int x, int y); int main() { float *pf; float f=0.9; pf=&f; cout << op(1, *pf); return 0; } int op(int x, int y) { return x*y; }
It prints: 0
It prints: 0.5
It prints: 1
It prints: ?1
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class A { public: virtual void Print(){ cout<<"A";} }; class
It prints: AB
public A { public: void Print(){ cout<< "B";} }; int main() { A *obj; A ob1; obj = &ob1; obj?>Print(); B ob2; obj = &ob2; obj?>Print(); }
It prints: AA
It prints: BA
It prints: BB
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main() { int x,y=10; float f; f = 5.20; x=(int) f; cout << x <<", "; f=float (y); cout << f; return 0; }
It prints: 5, 10
It prints: 5.2, 10
It prints: 5.20, 10.0
It prints: 5.2, 10.00
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class First { public: First() { cout << "Constructor";} ~First() { cout << "Destructor";} void Print(){ cout<<"from First";} }; int main() { First FirstObject; FirstObject.Print(); }
It prints: Constructorfrom First
It prints: Constructorfrom FirstDestructor
It prints: Constructorfrom FirstDestructorDestructor
Compilation error at line 16
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
What will be the output of the program? #include <iostream> using namespace std; int main() { const int y = 5; const x = ?10; cout<<x<<" "<<y; return 0; }
?10 5
5 ?10
Compilation error
None of these
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
Finish Practice?
Are you sure you want to finish? This will end your practice session.