CPA 試験問題 31
次のコードをコンパイルして実行しようとするとどうなりますか?
#include <iostream>
名前空間 std を使用します。
int op(int x, int y);
int main()
{
int i=2、j=2、k;
フロート f=0.3;
k = op(i, j);
cout<< k << "," << op(1, f);
0を返します。
}
int op(int x, int y)
{
x+y を返します。
}
#include <iostream>
名前空間 std を使用します。
int op(int x, int y);
int main()
{
int i=2、j=2、k;
フロート f=0.3;
k = op(i, j);
cout<< k << "," << op(1, f);
0を返します。
}
int op(int x, int y)
{
x+y を返します。
}
CPA 試験問題 32
次のコードをコンパイルして実行しようとするとどうなりますか?
#include <iostream>
名前空間 std を使用します。
クラスベース{
年齢;
公共:
クラスC {
int b;
void PrintC() { cout << b; }
};
Base () {age=5;};
void setAge(int a=20) {年齢 = a;}
void Print() { cout << age;}
};
int main () {
基数 a;
a.setAge(10);
a.Print();
0を返します。
}
#include <iostream>
名前空間 std を使用します。
クラスベース{
年齢;
公共:
クラスC {
int b;
void PrintC() { cout << b; }
};
Base () {age=5;};
void setAge(int a=20) {年齢 = a;}
void Print() { cout << age;}
};
int main () {
基数 a;
a.setAge(10);
a.Print();
0を返します。
}
CPA 試験問題 33
次のコードをコンパイルして実行しようとするとどうなりますか?
#include <iostream>
名前空間 std を使用します。
int getValue();
int main()
{
const int x = getValue();
cout<<x;
0を返します。
}
int getValue()
{
5 を返します。
}
#include <iostream>
名前空間 std を使用します。
int getValue();
int main()
{
const int x = getValue();
cout<<x;
0を返します。
}
int getValue()
{
5 を返します。
}
CPA 試験問題 34
次の操作のうち、間違っているのはどれですか?
CPA 試験問題 35
プログラムの出力は何ですか?
#include <iostream>
名前空間 std を使用します。
クラスベース{
静的整数;
公共:
ベース () {};
~Base () {};
void setAge(int a=10) {年齢 = a;}
void Print() { cout << age;}
};
int Base::age=0;
int main () {
基数 a,*b;
b = 新しいBase();
a.setAge();
b?>setAge(20);
a.Print();
b?>Print();
0を返します。
}
#include <iostream>
名前空間 std を使用します。
クラスベース{
静的整数;
公共:
ベース () {};
~Base () {};
void setAge(int a=10) {年齢 = a;}
void Print() { cout << age;}
};
int Base::age=0;
int main () {
基数 a,*b;
b = 新しいBase();
a.setAge();
b?>setAge(20);
a.Print();
b?>Print();
0を返します。
}