古詩詞大全網 - 經典古詩 - 求2010年3月計算機二級C語言筆試復習資料

求2010年3月計算機二級C語言筆試復習資料

壹、選擇題(每題2分,***計70分)

1.(1)下列數據結構中,屬於非線性結構的是

A)循環隊列

B)帶鏈隊列

C)二叉樹

D)帶鏈棧

A B C D

2.

(2)下列數據結構中,能夠按照“先進後出”原則存取數據的是

A)循環隊列

B)棧

C)隊列

D)二叉樹

A B C D

3.

(3)對於循環隊列,下列敘述中正確的是

A)隊頭指針是固定不變的

B)隊頭指針壹定大於隊尾指針

C)隊頭指針壹定小於隊尾指針

D)隊頭指針可以大於隊尾指針,也可以小於隊尾指針

A B C D

4.

(4)算法的空間復雜度是指

A)算法在執行過程中所需要的計算機存儲空間

B)算法所處理的數據量

C)算法程序中的語句或指令條數

D)算法在執行過程中所需要的臨時工作單元數

A B C D

5.

(5)軟件設計中劃分模塊的壹個準則是

A)低內聚低耦合

B)高內聚低耦合

C)低內聚高耦合

D)高內聚高耦合

A B C D

6.

(6)下列選項中不屬於結構化程序設計原則的是

A)可封裝

B)自頂向下

C)模塊化

D)逐步求精

A B C D

7.(7)軟件詳細設計產生的圖如下:

該圖是

A)N-S圖

B)PAD圖

C)程序流程圖

D)E-R圖

A B C D

8.

(8)數據庫管理系統是

A)操作系統的壹部分

B)在操作系統支持下的系統軟件

C)壹種編譯系統

D)壹種操作系統

A B C D

9.

(9)在E-R圖中,用來表示實體聯系的圖形是

A)橢圓形

B)矩形

C)菱形

D)三角形

A B C D

10.(10)有三個關系R,S,和T如下:

其中關系T由關系R和S通過某種操作得到,該操作為

A)選擇

B)投影

C)交

D)並

A B C D

11.(11)以下敘述中正確的是

A)程序設計的任務就是編寫程序代碼並上機調試

B)程序設計的任務就是確定所用的數據結構

C)程序設計的任務就是確定所用算法

D)以上三種說法都不完整

A B C D

12.(12)以下選項中,能用作用戶標識符的是

A)void

B)8_8

C)_0_

D)unsigned

A B C D

13.(13)閱讀以下程序

#include <stdio.h>

main()

{ int case; float printF;

printf("請輸入2個數:");

scanf("%d %f",&case,&printF);

printf("%d %f\n",case,printf);

}

該程序在編譯時產生錯誤,其出錯原因是

A)定義語句出錯,case是關鍵字,不能用作用戶自定義標識符

B)定義語句出錯,printF不能用作用戶自定義標識符

C)定義語句無錯,scanf不能作為輸入函數使用

D)定義語句無措,printf不能輸出case的值

A B C D

14.(14)表達式:(int)((double)9/2)-(9)%2的值是

A)0

B)3

C)4

D)5

A B C D

15.(15)若有定義語句: int x=10;,則表達式x-=x+x的值為

A)-20

B)-10

C)0

D)10

A B C D

16.(16)有以下程序

#include <stdio.h>

main()

{ int a=1,b=0;

printf("%d,",b=a+b);

printf("%d",a=2*b);

}

程序運行後的輸出結果是

A)0,0

B)1,0

C)3,2

D)1,2

A B C D

17.(17)設有定義: int a=1,b=2,c=3;,以下語句中執行效果與其它三個不同的是

A)if(a>b) c=a,a=b,b=c;

B)if(a>b){c=a,a=b,b=c;}

C)if(a>b) c=a;a=b;b=c;

D)if(a>b){c=a;a=b;b=c;}

A B C D

18.(18)有以下程序

#include <stdio.h>

main()

{ int c=0,k;

for(k=1;k<3;k++)

switch(k)

{ default:c+=k;

case 2:c++;break;

case 4:c+=2;break;

}

printf("%d\n",c);

}

程序運行後的輸出結果是

A)3

B)5

C)7

D)9

A B C D

19.(19)以下程序段中,與語句: k=a>b?(b>c?1:0):0;功能相同的是

A)if((a>b)&&(b>c)) k=1;

else k=0;

B)if((a>b)||(b>c)) k=1;

else k=0;

C)if(a<=b)k=0;

else if(b<=c) k=1;

D) if(a>b) k=1;

else if(b>c) k=1;

else k=0;

A B C D

20.(20)有以下程序

#include <stdio.h>

main()

{ char s[]={"012xy"};int i,n=0;

for(i=0;s[i]!=0;i++)

if(s[i]>'a'&&s[i]<='z') n++;

printf("%d\n",n);

}

程序運行後的輸出結果是

A)0

B)2

C)3

D)5

A B C D

21.

(21)有以下程序

#include <stdio.h>

main()

{ int n=2,k=0;

while(k++&&n++>2);

printf("%d %d\n",k,n);

}

程序運行後的輸出結果是

A)0 2

B)1 3

C)5 7

D)1 2

A B C D

22.

(22)有以下定義語句,編譯時會出現編譯錯誤的是

A) char a='a';

B) char a='\n';

C) char a='aa';

D) char a='\x2d';

A B C D

23.

(23)有以下程序

#include <stdio.h>

main()

{ char c1,c2;

c1='A'+'8'-'4';

c2='A'+'8'-'5';

printf("%c,%d\n",c1,c2);

}

已知字母A的ASCII碼為65,程序運行後的輸出結果是

A)E,68

B)D,69

C)E,D

D)輸出無定值

A B C D

24.

(24)有以下程序

#include <stdio.h>

void fun(int p)

{ int d=2;

p=d++;

printf("%d",p);

}

main()

{ int a=1;

fun(a);

printf("%d\n",a);

}

程序運行後的輸出結果是

A)32

B)12

C)21

D)22

A B C D

25.

(25)以下函數findmax擬實現在數組中查找最大值並作為函數值返回,

但程序中有錯導致不能實現預定功能

#define MIN -2147463647

int findmax(int x[],int n)

{ int i,max;

for(i=0;i<n;i++)

{ max=MIN;

if(max<x[i]) max=x[i];

}

return max;

}

造成錯誤的原因是

A)定義語句int i,max中max未賦值

B)賦值語句max=MIN;中,不應該給max賦MIN值

C)語句if(max<x[i]) max=x[i];中判斷條件設置錯誤

D)賦值語句max=MIN;放錯了位置

A B C D

26.

(26)有以下程序

#include <stdio.h>

main()

{ int m=1,n=2,*p=&m,*q=&n,*r;

r=p;p=q;q=r;

printf("%d,%d,%d,%d\n",m,n,*p,*q);

}

程序運行後的輸出結果是

A)1,2,1,2

B)1,2,2,1

C)2,1,2,1

D)2,1,1,2

A B C D

27.

(27)若有定義語句: int a[4][10],*p,*q[4];且0<=i<4,則錯誤的賦值是

A)p=a

B)q[i]=a[i]

C)p=a[i]

D)p=&a[2][1]

A B C D

28.

(28)有以下程序

#include <stdio.h>

#include <string.h>

main()

{ char str[][20]={"One*World","One*Dream!"},*p=str[1];

printf("%d,",strlen(p));

printf("%s\n",p);

}

程序運行後的輸出結果是

A)9,One*World

B)9,One*Dream!

C)10,One*Dream!

D)10,One*World

A B C D

29.

(29)有以下程序

#include <stdio.h>

main()

{ int a[]={2,3,5,4},i;

for(i=0;i<4;i++)

switch(i%2)

{ case 0:

switch(a[i]%2)

{ case 0:a[i]++;break;

case 1:a[i]--;

} break;

case 1:a[i]=0;

}

for(i=0;i<4;i++)

printf("%d ",a[i]);

printf("\n");

}

程序運行後的輸出結果是

A)3 3 4 4

B)2 0 5 0

C)3 0 4 0

D)0 3 0 4

A B C D

30.

(30)有以下程序

#include <stdio.h>

#include <string.h>

main()

{ char a[10]="abcd";

printf("%d,%d\n",strlen(a),sizeof(a));

}

程序運行後的輸出結果是

A)7,4

B)4,10

C)8,8

D)10,10

A B C D

31.

(31)下面是有關C語言字符數組的描述,其中錯誤的是

A)不可以用賦值語句給字符數組名賦字符串

B)可以用輸入語句把字符串整體輸入給字符數組

C)字符數組中的內容不壹定是字符串

D)字符數組只能存放字符串

A B C D

32.

(32)下列函數的功能是

fun(char *a,char *b)

{ while((*b=*a)!='\0'){a++;b++;} }

A)將a所指字符串賦給b所指空間

B)使指針b指向a所指字符串

C)將a所指字符串和b所指字符串進行比較

D)檢查a和b所指字符串中是否有'\0'

A B C D

33.

(33)設有以下函數:

void fun(int n,char *s){……}

則下面對函數指針的定義和賦值均正確的是

A)void (*pf)(); pf=fun;

B)void *pf(); pf=fun;

C)void *pf(); *pf=fun;

D)void (*pf)(int,char);pf=&fun;

A B C D

34.(34)有以下程序

#include <stdio.h>

int f(int n);

main()

{ int a=3,s;

s=f(a);s=s+f(a);printf("%d\n",s);

}

int f(int n)

{ static int a=1;

n+=a++;

return n;

}

程序運行後的輸出結果是

A)7

B)8

C)9

D)10

A B C D

35.

(35)有以下程序

#include <stdio.h>

#define f(x) x*x*x

main()

{ int a=3,s,t;

s=f(a+1);t=f((a+1));

printf("%d,%d\n",s,t);

}

程序運行後的輸出結果是

A)10,64

B)10,10

C)64,10

D)64,64

A B C D

36.

(36)下面結構體的定義語句中,錯誤的是

A)struct ord {int x;int y;int z;};struct ord a;

B)struct ord {int x;int y;int z;} struct ord a;

C)struct ord {int x;int y;int z;} n;

D)struct {int x;int y;int z;} a;

A B C D

37.(37)設有定義: char *c;以下選項中能夠使字符型指針C正確指向壹個字符串的是

A) char str[]="string";c=str;

B) scanf("%s",c);

C) c=getchar();

D) *c="string";

A B C D

38.

(38)有以下程序

#include <stdio.h>

#include <string.h>

struct A

{ int a;char b[10];double c;};

struct A f(struct A t);

main()

{ struct A a={1001,"ZhangDa",1098.0};

a=f(a); printf("%d,%s,%6.1f\n",a.a,a.b,a.c);

}

struct A f(struct A t)

{ t.a=1002;strcpy(t.b,"ChangRong");t.c=1202.0;return t;}

程序運行後的輸出結果是

A)1001,ZhangDa,1098.0

B)1002,ZhangDa,1202.0

C)1001,ChangRong,1098.0

D)1002,ChangRong,1202.0

A B C D

39.

(39)有以下程序

int r=8;

printf("%d\n",r>>1);

輸出結果是

A)16

B)8

C)4

D)2

A B C D

40.

(40)下列關於C語言文件的敘述中正確的是

A)文件由壹系列數據壹次排列組成,只能構成二進制文件

B)文件由結構序列組成,可以構成二進制文件或文本文件

C)文件由數據序列組成,可以構成二進制文件或文本文件

D)文件由字符序列組成,只能是文本文件

A B C D

二、填空題(每空2分,***計30分)

1.(1)某二叉樹有5個度為2的結點以及3個度為1的結點,則該二叉樹中***有1個結點。

輸入答案,中間不含空格:

2.

(2)程序流程圖中菱形框表示的是2

輸入答案,中間不含空格:

3.

(3)軟件開發過程主要分為需求分析、設計、編碼與測試四個階段。其中3階段

產生”軟件需求規格說明書“。

輸入答案,中間不含空格:

4.

(4)在數據庫技術中,實體集之間的聯系可以是壹對壹或壹對多或多對多的,那麽”學生“

和"可選課程"的聯系為4

輸入答案,中間不含空格:

5.

(5)人員基本信息壹般包括:身份證號,姓名,性別,年齡等。其中可以作為主關鍵字的

是5

輸入答案,中間不含空格:

6.

(6)若有定義語句:int a=5;,則表達式a++的值是6。

輸入答案,中間不含空格:

7.

(7)若有語句double x=17;int y;,當執行y=(int)(x/5)%2;之後y的值是7

輸入答案,中間不含空格:

8.

(8)以下程序運行後的輸出結果是8

#include <stdio.h>

main()

{ int x=20;

printf("%d ",0<x<20);

printf("%d\n",0<x&&x<20);

}

輸入答案,中間不含空格:

9.

(9)以下程序運行後的輸出結果是9

#include <stdio.h>

main()

{ int a=1,b=7;

do{

b=b/2;a+=b;

} while (b>1);

printf("%d\n",a);

}

輸入答案,中間不含空格:

10.

(10)有壹下程序

#include <stdio.h>

main()

{ int f,f1,f2,i;

f1=0;f2=1;

printf("%d %d ",f1,f2);

for(i=3;i<=5;i++)

{ f=f1+f2; printf("%d",f);

f1=f2; f2=f;

}

printf("\n");

}

程序運行後的輸出結果是10

輸入答案,中間不含空格:

11.

(11)有以下程序

#include <stdio.h>

int a=5;

void fun(int b)

{ int a=10;

a+=b; printf("%d",a);

}

main()

{ int c=20;

fun(c); a+=c; printf("%d\n",a);

}

程序運行後的輸出結果是11

輸入答案,中間不含空格:

12.

(12)設有定義

struct person

{ int ID;char name[12];} p;

請將scanf("%d",12);語句補充完整,使其能夠為結構體變量p的

成員ID正確讀入數據。

輸入答案,中間不含空格:

13.

(13)有以下程序

#include <stdio.h>

main()

{ char a[20]="How are you?",b[20];

scanf("%s",b); printf("%s %s\n",a,b);

}

程序運行時從鍵盤輸入: How are you?<回車>

則輸出結果為13

輸入答案,中間不含空格:

14.

(14)有以下程序

#include <stdio.h>

typedef struct

{ int num;double s;} REC;

void fun1(REC x){ x.num=23;x.s=88.5; }

main()

{ REC a={16,90.0};

fun1(a);

printf("%d\n",a.num);

}

輸入答案,中間不含空格:

15.

(15)有以下程序

#include <stdio.h>

fun(int x)

{ if(x/2>0) fun(x/2);

printf("%d ",x);

}

main()

{ fun(6);printf("\n");}

程序運行後的輸出結果是15

輸入答案,中間不含空格: