#GOBJ306H. GESP 3级客观题|模拟算法与程序推演|课后作业

GESP 3级客观题|模拟算法与程序推演|课后作业

GESP 3级客观题|模拟算法与程序推演|课后作业

考试频率:高频。本卷共 6 题。

  1. C++程序执行后,输入 chen a dai 输出应该为: chen 。( )
string str;
cin >> str;
cout << str;

{{ select(1) }}

  1. 下面C++代码执行后的输出是( )。
int main()
{
    cout << (3|16) << endl;

    cout << endl;
    return 0;
}

{{ select(2) }}

  • 3
  • 16
  • 19
  • 48
  1. 下列代码中,输出结果是( )
#include<iostream>
using namespace std;
int main()
{
    double a=0.9;
    double b=1.0;
    if(((b-a)==0.1))
    {
        cout<<"Equal"<<endl;
    }
    else
    {
        cout<<"Not equal"<<endl;
    }
}

{{ select(3) }}

  • Equal
  • Not equal
  • 程序不能正确执行
  • 没有输出
  1. 执行下面C++代码输出是( )。
int temp= 0;
for (int i = 1; i < 7; i++){
	for (int j = 1; j < 5; j++){
		if (i / j == 2){
			temp++;
		}
	}
}
cout << temp << endl; 

{{ select(4) }}

  • 10
  • 8
  • 4
  • 3
  1. 执行下面C++代码后输出的是( )。
string str = ("chen");
cout << str[5] << endl;

{{ select(5) }}

  • 输出未知的数
  • 输出'n'
  • 输出'\0'
  • 输出空格
  1. C++的数据类型转换让人很难琢磨透,下列代码输出的值是( )。
int a = 3;
int b = 2;
cout << a / b * 1.0 << endl; 

{{ select(6) }}

  • 1.5
  • 1
  • 2
  • 1.50
蜀ICP备2025119001号-1