최신C++ Institute C++ Certified Associate Programmer - CPA무료샘플문제

문제1
What is the output of the program given below?
#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{
int i=10;
{
int i=0;
cout<<i;
}
{
int i=5;
cout << i;
}
cout<<i;
return 0;
}

정답: D
설명: (ExamPassdump 회원만 볼 수 있음)
문제2
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
struct {
int x;
char c;
union {
float f;
int i;
};
} s;
int main (int argc, const char * argv[])
{
s.x=10;
s.i=0;
cout << s.i << " " << s.x;
}

정답: B
문제3
What happens when you attempt to compile and run the following code?
#include <cstdlib>
#include <iostream>
using namespace std;
float* sum(float a,float b);
float* sum(float a,float b)
{
float *f = new float;
*f = a+b;
return f;
}
int main()
{
float a,b,*f;
a = 1.5; b = 3.4;
f = sum(a,b);
cout<<*f;
return 0;
}

정답: A
문제4
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
const int x=0;
const int *ptr;
ptr = &x;
cout<<*ptr;
return 0;
}

정답: D
문제5
What is the output of the program?
#include <iostream>
#include <string>
using namespace std;
int main () {
string s1 = "Hello", s2 = "World";
s2 = s1 + s2;
cout << s2;
return 0;
}

정답: A
문제6
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
int i = 5;
do {
i??;
cout<<i;
}
while(i >= 0);
return 0;
}

정답: D
문제7
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;
int z;
A() { x=1; y=2; z=3; }
A(int a, int b) : x(a), y(b) { z = x * y;}
void Print() {
cout << z;
}
};
int main () {
A a(2,5);
a.Print();
return 0; }

정답: D
문제8
How could you pass arguments to functions?

정답: B,C,D
문제9
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 B:public A
{
public:
virtual void Print(){ cout<< "B";}
};
int main()
{
A *obj;
A ob1;
obj = &ob1;
obj->Print();
B ob2;
obj = &ob2;
obj->Print();
}

정답: B
문제10
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.90;
cout << f << ", ";
x=f;
cout << x <<", ";
f=y;
cout << f;
return 0;
}

정답: C
문제11
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
long int x,y=10;
double d;
d = 3.99;
x=(int) d;
cout << x <<", ";
d=float (y);
cout << d;
return 0;
}

정답: B
문제12
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
void fun(int &i);
int main()
{
int i=2;
fun(i);
cout<<i;
return 0;
}
void fun(int &i)
{
i+=2;
}

정답: A
문제13
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;
}
};

정답: B
문제14
What is the output of the program?
#include <iostream>
using namespace std;
class Base {
static int age;
public:
Base () {};
~Base () {};
void setAge(int a=10) {age = a;}
void Print() { cout << age;}
};
int Base::age=0;
int main () {
Base a,*b;
b = new Base();
a.setAge();
b->setAge(20);
a.Print();
b->Print();
return 0;
}

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

정답: B
문제16
What is the output of the program given below?
#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{
int i=10;
{
int i=0;
cout<<i;
}
cout<<i;
return 0;
}

정답: A

자격증의 중요성:

ExamPassdump 경쟁율이 심한 IT시대에 인증시험을 패스함으로 IT업계 관련 직종에 종사하고자 하는 분들에게는 아주 큰 가산점이 될수 있고 자신만의 위치를 보장할수 있으며 더욱이는 한층 업된 삶을 누릴수 있을수도 있습니다.

ExamPassdump 제품의 가치:

ExamPassdump에는 IT인증시험의 최신 학습가이드가 있습니다. ExamPassdump의 IT전문가들이 자신만의 경험과 끊임없는 노력으로 최고의 학습자료를 작성해 여러분들이 시험에서 패스하도록 도와드립니다.

무료샘플 받아보기:

관심있는 인증시험과목 덤프의 무료샘플을 원하신다면 덤프구매사이트의 PDF Version Demo 버튼을 클릭하고 메일주소를 입력하시면 바로 다운받아 덤프의 일부분 문제를 체험해 보실수 있습니다.

완벽한 서비스 제공:

ExamPassdump KoreaDumps는 한국어로 온라인상담과 메일상담을 받습니다. 덤프구매후 일년동안 무료 업데이트 서비스를 제공해드리며 구매일로 부터 60일내에 시험에서 떨어지는 경우 덤프비용 전액을 환불해드려 고객님의 부담을 덜어드립니다.