최신 CPA 무료덤프 - C++ Institute C++ Certified Associate Programmer

What is the output of the program?
#include <iostream> #include <string>
using namespace std;
union t { char c; int i; };
class First { union t u; public: First() {
u.c = 'A';
}
void Print(){
cout << u.c;
}
};
int main()
{
First *t = new First();
t->Print();
}

정답: C
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
int f(int i, int b);
int main()
{
int i=0;
i++;
for (i=0; i<=2; i++)
{
cout<<f(0,i);
}
return 0;
}
int f(int a, int b)
{
return a+b;
}

정답: C
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
#define FUN(arg) if(arg) cout<<"Test";
int main()
{
int i=1;
FUN(i<3);
return 0;
}

정답: B
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class Base
{
string s;
public:
Base() { s="Sample text";}
Base(string s) { this->s=s; }
void Print() { cout << s; }
};
int main()
{
Base *o = new Base();
o->Print();
}

정답: D
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
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
char *s = "ABCDEF";
cout << s+2;
return 0;
}

정답: C
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class A {
public:
int x;
A() { x=0;}
A(int x) { this->x=x;}
};
class B : private A {
public:
using A::x;
B() { x=1;}
B(int x) {this->x = x;}
};
int main () {
B c1;
B c2(?5);
cout << c1.x;
cout << c2.x;
return 0;
}

정답: A
What will happen when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int getValue();
int main()
{
const int x = getValue();
cout<<x;
return 0;
}
int getValue()
{
return 5;
}

정답: A
What happens when you attempt to compile and run the following code?
#include <iostream> #include <string>
using namespace std;
class A {
public:
A() { cout << "A no parameters";}
A(string s) { cout << "A string parameter";}
A(A &a) { cout << "A object A parameter";}
};
class B : public A {
public:
B() { cout << "B no parameters";}
B(string s) { cout << "B string parameter";}
B(int s) { cout << "B int parameter";}
};
int main () {
A a2("Test");
B b1(10);
B b2(b1);
return 0;
}

정답: B
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
float x=3.5,y=1.6;
int i,j=2;
i = x + j + y;
cout << i;
return 0;
}

정답: B
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.print();
return 0;
}

정답: C
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
int i = 5;
cout<<"Hello World" << ++i;
return 0;
}

정답: D
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;
double i=2;
c1 = i; c1.print(); return 0; }

정답: B
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();
}

정답: A
Which of the following operations is INCORRECT?

정답: C
What will the variable "y" be in class B?
class A {
int x;
protected:
int y;
public:
int age;
};
class B : private A {
string name;
public:
void Print() {
cout << name << age;
}
};

정답: D

우리와 연락하기

문의할 점이 있으시면 메일을 보내오세요. 12시간이내에 답장드리도록 하고 있습니다.

근무시간: ( UTC+9 ) 9:00-24:00
월요일~토요일

서포트: 바로 연락하기