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

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 a = 30, b = 1, c = 5, i=10;
i = b < a < c;
cout << i;
return 0;
}

정답: A
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
struct Person {
string name;
int age;
};
class First
{
Person *person;
public:
First() {person = new Person;
person->name = "John";
person->age = 30;
}
void Print(){
cout<<person->name << " "<< person->age;
}
};
int main()
{
First t[2];
for (int i=0; i<2; i++)
t[i].Print();
}

정답: C
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A
{
public:
void Print(){ cout<<"A";}
};
class B:public A
{
public:
void Print(){ cout<< "B";}
};
int main()
{
A *obj;
A ob1;
obj = &ob1;
obj->Print();
B ob2;
obj = &ob2;
obj->Print();
}

정답: B
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
int a=5;
cout << ((a < 5) ? 9.9 : 9);
}

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

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

정답: C
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
void Print(){ cout<<"A"; }
};
class B:public A {
public:
virtual void Print(){ cout<< "B"; }
};
class C:public B {
public:
void Print(){ cout<< "C"; }
};
int main()
{
A ob1;
B ob2;
C ob3;
A *obj;
obj = &ob1;
obj->Print();
obj = &ob2;
obj->Print();
obj = &ob3;
obj->Print();
}

정답: A
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main(){
int i = 1;
for(i=10; i>-1; i/=2) {
if(!i)
break;
}
cout << i;
return 0;
}

정답: B
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:
void Print(){ cout<< "B";}
};
int main()
{
A *obj;
A ob1;
obj = &ob1;
obj->Print();
B ob2;
obj = &ob2;
obj->Print();
}

정답: A
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int fun(int x);
int main() {
cout << fun(0);
return 0;
}
int fun(int x) {
if(x > 0)
return fun(x-1);
else
return 100;
}

정답: A
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, j = 1; j < 2, i < 4; i++, j++);
cout << i << " " << j; return 0;
}

정답: A
Which code, inserted at line 8, generates the output "0102020"?
#include <iostream>
using namespace std;
class Base {
static int age;
public:
Base () {};
~Base () {};
//insert code here
void Print() { cout << age;}
};
int Base::age=0;
int main () {
Base a,*b;
b = new Base();
a.Print();
a.setAge(10);
a.Print();
b->setAge();
a.Print();
b->Print();
return 0;
}

정답: A
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
월요일~토요일

서포트: 바로 연락하기