C++ Institute C++ Certified Professional Programmer - CPP무료 덤프문제 풀어보기

What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: one two three<enter>?
# include <iostream>
# include <string>
using namespace std;
int main ()
{
string a;
cin>>a;
cout<<a<<endl;
return 0;
}
Program will output:

정답: A
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main () {
int t[] = {1,2,3,4,5,1,2,3,4,5};
vector<int> v (t,t+10);
vector<int>::iterator it;
int m1[] = {1, 3, 2};
it = find_first_of (v.begin(), v.end(), m1, m1+3);
cout << "First found at position: " << it?v.begin() << endl;
return 0;
}

정답: A
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
template<class A>
void f(A &a)
{
cout<<1<<endl;
}
void f(int &a)
{
cout<<2<<endl;
}
int main()
{
int a = 1;
f(a);
return 0;
}

정답: C
What happens when you attempt to compile and run the following code?
#include <deque>
#include <vector>
#include <iostream>
using namespace std;
int main ()
{
int t[] = {1, 2 ,3 ,4 ,5, 6 , 7, 8 , 9, 10};
vector<int>v1(t, t+10);
deque<int>d1(t, t+10);
vector<int>::iterator it1 = v1.begin();
deque<int>::iterator it2 = d1.begin();
d1.erase(it2+5);
it2 = d1.begin();
cout<<*(it2+5)<<" ";
v1.erase(it1+5);
it1 = v1.begin();
cout<<*(it1+5)<<endl;
}

정답: D
What happens when you attempt to compile and run the following code?
# include <iostream>
# include <algorithm>
#include <vector>
using namespace std;
int main () {
int t[] = {1,2,3,3,5,1,2,4,4,5};
vector<int> v (t,t+10);
vector<int>::iterator it = v.begin();
while ( (it = adjacent_find (it, v.end())) != v.end()) {
cout<<it?v.begin()<<" ";it++;
}
cout<< endl;
return 0;
}

정답: C
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main () {
int t[] = {1,2,3,2,3,5,1,2,7,3,2,1,10, 4,4,5};
vector<int> v (t,t+15);
int number = count(v.begin(), v.end(), 2);
cout<< number<<endl;
return 0;
}
Program outputs:

정답: E
What happens when you attempt to compile and run the following code?
# include <vector>
# include <iostream>
# include <algorithm>
# include <functional>
using namespace std;
class B { int val;
public:
B(int v=0):val(v){}
int getV() const {return val;}
B operator +(const B &b )const { return B(val + b.val);} };
ostream & operator <<(ostream & out, const B & v) { out<<v.getV(); return out;} template<class T>struct Out {
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) { out<<val<<" "; } };
template<typename A> struct Add : public binary_function<A, A, A> {
A operator() (const A & a, const A & b) const { return a+b; }};
int main() {
int t[]={1,2,3,4,5,6,7,8,9,10};
vector<B> v1(t, t+10);
vector<B> v2(10);
transform(v1.begin(), v1.end(), v2.begin(), bind1st(ptr_fun (Add<B>()), 1)); for_each(v2.rbegin(), v2.rend(), Out<B>(cout));cout<<endl;
return 0;
}
Program outputs:

정답: A
What happens when you attempt to compile and run the following code?
# include <vector>
# include <set>
# include <iostream>
# include <algorithm>
using namespace std;
template<class T>struct Out {
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) { out<<val<<" "; } };
template <typename T> struct Sequence {
T start; T step;
Sequence(T start, T step):start(start), step(step){}
T operator()() { T v = start; start+=step; return v; } };
bool Less(float a, float b) { return int(a)<int(b);}
int main() {
float t[]={2.28, 1.66, 1.32, 3.94, 3.64, 2.3, 2.98, 1.96, 2.62, 1.13};
vector<float> v1; v1.assign(t, t+10);
stable_sort(v1.begin(), v1.end(), Less);
for_each(v1.begin(), v1.end(), Out<float>(cout));cout<<endl;
return 0;
}
Program outputs:

정답: D

우리와 연락하기

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

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

서포트: 바로 연락하기 

English Deutsch 繁体中文 日本語