What will the variable "age" be in class B?class A {int x;protected:int y;public:int age;A () { age=5; };};class B : public A {string name;public:B () { name="Bob"; };void Print() {cout << name << age;}};
Answer(s): A
What happens when you attempt to compile and run the following code?#include <iostream>#include <string>using namespace std;class complex{double re, im;public:complex() : re(1),im(0.4) {}complex operator?(complex &t);void Print() { cout << re << " " << im; }};complex complex::operator? (complex &t){complex temp;temp.re = this?>re ? t.re;temp.im = this?>im ? t.im;return temp;}int main(){complex c1,c2,c3;c3 = c1 ? c2;c3.Print();}
Answer(s): C
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;class complex{double re;double im;public:complex() : re(0),im(0) {}complex(double x) { re=x,im=x;};complex(double x,double y) { re=x,im=y;}void print() { cout << re << " " << im;}};int main(){complex c1;c1 = 3.0;c1.print();return 0;}
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;void fun(int);int main(){int a=0;fun(a);return 0;}void fun(int n){if(n < 2){fun(++n);cout << n;}}
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;int s(int n);int main(){int a;a = 3;cout << s(a);return 0;}int s(int n){if(n == 0) return 1;return s(n?1)*n;}
Answer(s): B
Post your Comments and Discuss C++ Institute CPA-21-02 exam dumps with other Community members:
CREATE TABLE new_table CLONE old_table;
CREATE DATABASE new_db CLONE old_db;
CREATE SCHEMA new_schema CLONE old_schema;
CREATE FILE FORMAT new_format CLONE old_format;
SECURITYADMIN
SYSADMIN
ACCOUNTADMIN
PUBLIC
__name__
'__main__'
ClassB.__bases__
ClassB
"<class 'Object'>"
'Object'
__module__
ClassA
'ClassA'
DynamoDB
S3
Cognito
RDS
EFS
/sbin/init
/etc/inittab
/etc/rc.d
/etc/init.d
/lib/init.so
/etc/rc.d/rcinit
/proc/sys/kernel/init
/boot/init
/bin/init
Amazon S3 Intelligent-Tiering
S3 Lifecycle
S3 Glacier Flexible Retrieval
Amazon Athena
Amazon EFS
EC2 instance store
ElastiCache for Redis
S3 Glacier Deep Archive
AWS Lake Formation
Amazon EMR Spark jobs
Amazon Kinesis Data Streams
Amazon DynamoDB
Defender for Endpoint
Defender for Identity
Defender for Cloud Apps
Defender for Office 365