一、单项选择题(共 20 题,每题 1.5 分,共计 30 分;每题有且仅有一个正确选项)
| 1. | 1MB等于( )。 |
|---|
| 2. | 在 PC机中,PENTIUM(奔腾)、酷睿、赛扬等是指( )。 |
|---|
| 3. | 操作系统的作用是( )。 |
|---|
| 4. | 在计算机内部用来传送、存贮、加工处理的数据或指令都是以( )形式进行的。 |
|---|
| 5. | 下列说法正确的是( )。 |
|---|
| 6. | 二进制数 00100100 和 00010100 的和是( )。 |
|---|
| 7. | 与二进制小数 0.1 相等的十六进制数是( )。 |
|---|
| 8. | 所谓的“中断”是指( )。 |
|---|
| 9. | 计算机病毐是( )。 |
|---|
| 10. | FTP 可以用于( )。 |
|---|
| 11. | 下面哪种软件不属于即时通信软件( )。 |
|---|
| 12. | 6 个顶点的连通图的最小生成树,其边数为( )。 |
|---|
| 13. | 链表不具备的特点是( )。 |
|---|
| 14. | 线性表若采用链表存储结构,要求内存中可用存储单元地址( )。 |
|---|
| 15. | 今有一空栈 S,对下列待进栈的数据元素序列 a,b,c,d,e,f依次进行进栈, 进栈,出栈,进栈,进 栈,出栈的操作,则此操作完成后,栈 S的栈顶元素为( )。 |
|---|
| 16. | 前序遍历序列与中序遍历序列相同的二叉树为( )。 |
|---|
| 17. | 如果根的高度为 1,具有 61 个结点的完全二叉树的高度为( )。 |
|---|
| 18. | 下列选项中不属于视频文件格式的是( )。 |
|---|
| 19. | 设某算法的计算时间表示为递推关系式 T(n)=T(n-1)+n(n为正整数) 及 T(0)=1,则 该算法的时间复杂度为( )。 |
|---|
| 20. | 在 NOI系列赛事中参赛选手必须使用由承办单位统一提供的设备。 下列物品中不允许选 手自带的 是( )。 |
|---|
二、问题求解(共 2 题,每题 5 分,共计 10 分;每题全部答对得 5 分,没有部分分)
| 1. | 重新排列 1234 使得每一个数字都不在原来的位置上,一共有 种排法。 |
|---|
| 2. | —棵结点数为 2015 的二叉树最多有 个叶子结点。 |
|---|
三、阅读程序写结果(共4题,每题8分,共计32分)
| 1. |
#include <iostream>
using namespace std;
int main() {
int a,b,c;
a=1; b=2; c=3;
if (a > c){
if(a > c)
cout << a << " " ;
else cout << b << " ";
}
cout << c << endl;
return 0;
}
|
|---|---|
| 输出: |
| 2. |
#include <iostream>
using namespace std;
struct point {
int x;
int y;
};
int main() {
struct EX {
int a;
int b;
point c;
} e;
e.a=1;
e.b=2;
e.c.x = e.a + e.b;
e.c.y = e.a * e.b;
cout << e.c.x << "," << e.c.y << endl;
return 0;
}
|
|---|---|
| 输出: |
| 3. |
#include <iostream>
using namespace std;
int main() {
string str;
int i;
int count;
count = 0;
getline(cin,str);
for (i = 0; i < str.length(); i++) {
if(str[i] >= 'a' && str[i] <= 'z')
count++;
}
cout << "It has " << count << " lowercases" << endl;
return 0;
}
|
|---|---|
| 输入:NOI2016 will be held in Mian Yang. | |
| 输出: |
| 4. |
#include <iostream>
using namespace std;
void fun(char *a, char *b) {
a = b;
(*a)++;
}
int main() {
char cl, c2, *p1, *p2;
cl = 'A'; c2 = 'a'; p1 = &cl; p2 = &c2;
fun(p1, p2);
cout << cl << c2 << endl;
return 0;
}
|
|---|---|
| 输出: |
四、完善程序(共2题,每题14分,共计28分)
| 1. |
(打印月历)
输入月份 m(1 ≤ m ≤ 12),按一定格式打印 2015 年第 m月的月历。 例如,2015 年 1 月的月历打印效果如下(第一列为周日):
|
|---|
#include <iostream>
using namespace std;
const int dayNum[] = {-l,31,28,31,30,31,30,31,31,30,31,30,31};
int m, offset, i;
int main() {
cin >> m;
cout << " S\tM\tT\tW\tT\tF\tS " << endl; // '\t'为 TAB 制表符
;
for(i = 1; i < m; i++)
offset = ;
for(i = 0; i < offset; i++)
cout << '\t';
for(i = 1; i <= ;i++){
cout << ;
if(i == dayNum[m] || == 0)
cout << endl;
else
cout << '\t';
}
return 0;
}
|
| 2. | (中位数) 给定 n(n为奇数且小于 1000)个整数,整数的范围在 0〜m(0 < m < 231)之间, 请使用二分法求这 n个整数的中位数。所谓中位数,是指将这 n个数排序之后, 排在正中间的数。 |
|---|
#include <iostream>
using namespace std;
const int MAXN = 1000;
int n, i, lbound, rbound, mid, m, count;
int x[MAXN];
int main(){
cin >> n >> m;
for (i = 0; i < n; ++i)
cin >> x[i];
lbound=0;
rbound=m;
while () {
mid = (lbound + rbound)/2;
;
for(i = 0; i < n; i++)
if ()
;
if(count > n / 2) lbound = mid + 1;
else
;
}
cout << rbound << endl;
return 0;
}
|