無料提供中のCPA試験問題集で(2022年最新のPDF問題集)信頼度の高いテストエンジン [Q132-Q155]

Share

無料提供中のCPA試験問題集で(2022年最新のPDF問題集)信頼度の高いテストエンジン

CPAのPDFで最近更新された問題です集試験点数を伸ばそう


C++ Institute CPA 認定試験の出題範囲:

トピック出題範囲
トピック 1
  • ループとループ実行の制御
  • 関数の宣言と呼び出し
トピック 2
  • 副作用、パラメータを渡すさまざまな方法とその目的
  • コンパイルとソフトウェア開発の概要
トピック 3
  • 論理演算子、ビット演算子、算術演算子
  • オブジェクト指向アプローチとその語彙
トピック 4
  • オブジェクトの例としての文字列:メソッドとプロパティの紹介
  • マシンコードの取得:コンパイルプロセス

 

質問 132
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int op(int x, int y);
float op(int x, float y);
int main()
{
int i=1, j=2, k;
float f=0.3;
k = op(i, j);
cout<< k << "," << op(0, f);
return 0;
}
int op(int x, int y)
{
return x+y;
}
float op(int x, float y)
{ return x?y; }

  • A. It prints: 0,0
  • B. It prints: 3,?0.3
  • C. It prints: 3,1
  • D. It prints: 3,0

正解: B

 

質問 133
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int op(int x, int y);
int main()
{
float *pf;
float f=0.9;
pf=&f;
cout << op(1, *pf);
return 0;
}
int op(int x, int y)
{
return x*y;
}

  • A. It prints: ?1
  • B. It prints: 0
  • C. It prints: 1
  • D. It prints: 0.5

正解: B

 

質問 134
Which code, inserted at line 14, generates the output "3.14 10"?
#include <iostream>
using namespace std;
namespace myNamespace1
{
int x = 5;
int y = 10;
}
namespace myNamespace2
{
float x = 3.14;
float y = 1.5;
}
int main () {
//insert code here
cout << x << " " << y;
return 0;
}

  • A. using myNamespace1::y; using myNamespace2::x;
  • B. using namespace myNamespace1;
  • C. using namespace myNamespace1; using namespace myNamespace2;
  • D. using myNamespace2::y; using myNamespace1::x;

正解: A

 

質問 135
What is the output of the program?
#include <iostream>
using namespace std;
#define SQR(x)(x*x)
int main(int argc, char *argv[]) {
int x, y=2;
x = SQR(y);
cout << x << ", " <<y;
return 0;
}

  • A. It prints: 9, 2
  • B. It prints: 4, 2
  • C. It prints: 3, 3
  • D. It prints: 3, 2

正解: B

 

質問 136
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
void fun(int);
int main()
{
int a=0;
fun(a);
return 0;
}
void fun(int n)
{
if(n < 2)
{
fun(++n);
cout << n;
}
}

  • A. It prints: 0
  • B. It prints: 012
  • C. It prints: 21
  • D. None of these

正解: C

解説:
Section: Volume A

 

質問 137
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class First
{
string *s;
public:
First() { s = new string("Text");}
~First() { delete s;}
void Print(){ cout<<*s;}
};
int main()
{
First FirstObject;
FirstObject.Print(); FirstObject.~First(); }

  • A. Runtime error.
  • B. It prints: Text
  • C. Compilation error
  • D. None of these

正解: A

 

質問 138
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int x=5;
static int y;
int i=0;
void static myFunction()
{
y=x++ + ++i;
}
int main (int argc, const char * argv[])
{
x++;
myFunction();
cout<<y<<" "<<x<< " " << i;
}

  • A. Compilation fails
  • B. It prints: 7 7 1
  • C. It prints: 6 5 1
  • D. It prints: 5 5 0

正解: B

 

質問 139
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
int i = 0;
i++;
goto lab;
i++;
lab:
cout<<i;
return 0;
}

  • A. It prints: 34
  • B. It prints: 0
  • C. It prints: 3
  • D. It prints: 1

正解: D

 

質問 140
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. It prints: 0
  • B. It prints: 100
  • C. It prints: -1
  • D. It prints: 10

正解: B

解説:
Section: Volume A

 

質問 141
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main(){
int *i;
i = new int;
*i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4;
cout << *i;
return 0;
}

  • A. It prints: 0
  • B. It prints: 2
  • C. It prints: 1
  • D. It prints: 0.5

正解: B

 

質問 142
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int fun(int x) {
return 2*x;
}
int main(){
int i;
i = fun(0.5) || fun(0);
cout << i;
return 0;
}

  • A. It prints: 0
  • B. Compilation error
  • C. It prints: 1
  • D. It prints: -1

正解: A

 

質問 143
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class First
{
public:
virtual void Print(){ cout<<"from First";}
};
class Second:public First
{
public:
void Print(){ cout<< "from Second";}
};
void fun(First *obj);
int main()
{
First FirstObject;
fun(&FirstObject);
Second SecondObject;
fun(&SecondObject);
}
void fun(First *obj)
{
obj?>Print();
}

  • A. It prints: from Firstfrom Second
  • B. It prints: from Secondfrom Second
  • C. It prints: from First
  • D. It prints: from Firstfrom First

正解: A

 

質問 144
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
int i=2;
switch(i)
{
case 1:
cout<<"Hello";
break;
case 2:
cout<<"world";
break;
case 3:
printf("End");
break;
}
return 0;
}

  • A. It prints: Hello
  • B. It prints: E
  • C. It prints: End
  • D. It prints: world

正解: D

 

質問 145
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; i < 2; i++) {
for(j = i; j < i + 1; j++)
if(j == i)
continue;
else
break;
}
cout << j;
return 0;
}

  • A. It prints: 0
  • B. It prints: 3
  • C. It prints: 2
  • D. It prints: 1

正解: C

 

質問 146
What is the output of the program given below?
#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{
enum state { ok, error, warning};
enum state s1, s2, s3, s4;
s1 = ok;
s2 = warning;
s3 = error;
s4 = ok;
cout << s1<< s2<< s3<< s4;
return 0;
}

  • A. 0
  • B. 0210
  • C. compilation fails
  • D. 1

正解: B

 

質問 147
How could you pass arguments to functions?

  • A. by value
  • B. by void
  • C. by pointer
  • D. by reference

正解: A,C,D

解説:
Section: Volume A

 

質問 148
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class First
{
public:
void Print(){ cout<<"from First";}
};
class Second
{
public:
void Print(){ cout<< "from Second";}
};
int main()
{
First FirstObject;
FirstObject.Print();
Second SecondObject;
SecondObject.Print(); }

  • A. It prints: from Firstfrom Second
  • B. It prints: from Secondfrom Second
  • C. It prints: from First
  • D. It prints: from Firstfrom First

正解: A

 

質問 149
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. It will print 5
  • B. The code will not compile.
  • C. It will print garbage value
  • D. It will print 0

正解: A

解説:
Section: Volume A

 

質問 150
What will the variable "age" be in class B?
class A {
int x;
protected:
int y;
public:
int age;
A () { age=5; };
};
class B : public A {
string name;
public:
B () { name="Bob"; };
void Print() {
cout << name << age;
}
};

  • A. protected
  • B. private
  • C. public
  • D. None of these

正解: C

 

質問 151
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. It prints: 0
  • B. compilation fails
  • C. It prints: 1
  • D. It prints: 10

正解: C

解説:
Section: Volume A

 

質問 152
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=2; 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;
}

  • A. It prints: 5
  • B. It prints: 2
  • C. It prints: ?3
  • D. It prints: 6

正解: C

解説:
Section: Volume A

 

質問 153
What is the output of the program?
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s1[]= {"Hello" , "World" };
for (int i=0; i<2; i++) {
cout << s1[i];
}
return( 0 );
}

  • A. It prints: World
  • B. It prints: Hello
  • C. It prints: HelloWorld
  • D. It prints: WorldHello

正解: C

解説:
Section: Volume A
Explanation

 

質問 154
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class complex{
double re;
double im;
public:
complex() : re(1),im(0.4) {}
bool operator==(complex &t);
};
bool complex::operator == (complex &t){
if((this?>re == t.re) && (this?>im == t.im))
return true;
else
return false;
}
int main(){
complex c1,c2;
if (c1==c2)
cout << "OK";
else {
cout << "ERROR";
}
}

  • A. It prints: OK
  • B. Runtime error.
  • C. Compilation error
  • D. It prints: ERROR

正解: A

 

質問 155
......

CPA完全版問題集には無料PDF問題で合格させる:https://www.jpntest.com/shiken/CPA-mondaishu

弊社を連絡する

我々は12時間以内ですべてのお問い合わせを答えます。

オンラインサポート時間:( UTC+9 ) 9:00-24:00
月曜日から土曜日まで

サポート:現在連絡