#cspjc2022y1. 2022csp-j初赛程序阅读1
2022csp-j初赛程序阅读1
2022csp-j初赛程序阅读1
判断题 1.5 分,选择题 3 分
1.第一题
#include <iostream>
using namespace std;
int main()
{
unsigned short x, y; //7行
cin >> x >> y;
x = (x | x << 2) & 0x33;
x = (x | x << 1) & 0x55;
y = (y | y << 2) & 0x33;
y = (y | y << 1) & 0x55;
unsigned short z = x | y << 1; //13行
cout << z << endl;
return 0;
}
假设输入的 x、y 均是不超过 15 的自然数,完成下面的判断题和单选题:
判断题
1.删去第 7 行与第 13 行的 unsigned,程序行为不变。( ) {{ select(1) }}
- √
- ×
2.将第 7 行与第 13 行的 short 均改为 char,程序行为不变。( ) {{ select(2) }}
- √
- ×
3.程序总是输出一个整数“0”。( ) {{ select(3) }}
- √
- ×
4.当输入为“2 2”时,输出为“10”。( ) {{ select(4) }}
- √
- ×
5.当输入为“2 2”时,输出为“59”。( ) {{ select(5) }}
- √
- ×
选择题
6.当输入为“13 8”时,输出为( )。 {{ select(6) }}
- “0”
- “209”
- “197”
- “226”