浙江省二级C语言0506选择题集Word格式文档下载.docx
- 文档编号:20387967
- 上传时间:2023-01-22
- 格式:DOCX
- 页数:54
- 大小:35.69KB
浙江省二级C语言0506选择题集Word格式文档下载.docx
《浙江省二级C语言0506选择题集Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《浙江省二级C语言0506选择题集Word格式文档下载.docx(54页珍藏版)》请在冰豆网上搜索。
{inti,j,t,a[10];
printf("
"
);
for(i=0;
10;
i++)
scanf((5));
for((6);
(7);
j++)
if((8)){
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
%d"
a[i]);
\n"
}
(5)A、"
%f"
a[i]B、"
%lf"
&
a[i]
%s"
aD、"
%d"
a[i]
(6)A、j=0B、j=1
C、j=iD、j=i-1
(7)A、j>
iB、j<
9-i
C、j<
10-iD、j>
i-1
(8)A、a[i-1]<
a[i]B、a[j+1]<
a[j+2]
C、a[j]<
a[j+1]D、a[i]<
a[j]
试题3(每小题3分,共12分)
输入一个字符串和一个正整数m,将该字符串中的前m个字符复制到另一个字符串中,再输出后一个字符串。
运行示例1:
Enterastring:
103+895=?
Enteraninteger:
6
Thenewstringis103+89
运行示例2:
60
Thenewstringis103+895=?
运行示例3:
0
Thenewstringis
(9)>
{chars[80],t[80],i,m;
printf("
"
gets(s);
scanf("
m);
(10);
(11);
(12)
Thenewstringis"
puts(t);
(9)A、ctype.hB、math.h
C、stdio.hD、string.h
(10)A、i<
mB、s[i]!
='
\0'
C、s[i]!
&
&
mD、s[i]!
||i<
m
(11)A、*s++=*t++B、t[i]=s[i]
C、*t++=*s++D、s[i]=t[i]
(12)A、t[i]='
;
B、;
C、*++s='
D、*++t='
试题4(每小题3分,共12分)
阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。
{ints,x1,y1,z1,x2,y2,z2;
Enter6integers:
%d%d%d%d%d%d"
x1,&
y1,&
z1,&
x2,&
y2,&
z2);
s=f(x2,y2,z2)-f(x1,y1,z1);
%d\n"
s);
f(intx,inty,intz)
{intk,n;
inttab[2][13]={
{0,31,28,31,30,31,30,31,31,30,31,30,31},
{0,31,29,31,30,31,30,31,31,30,31,30,31}
};
n=(x%4==0&
x%100!
=0||x%400==0);
for(k=1;
k<
y;
k++)
z=z+tab[n][k];
returnz;
(13)程序运行时,输入100000,输出(13)。
A、29B、28C、0D、-1
(14)程序运行时,输入001000,输出(14)。
(15)程序运行时,输入200021200031,输出(15)。
(16)程序运行时,输入198121198131,输出(16)。
试题5(每小题3分,共12分)
#include<
voidmain()
{inta=-1,b=1;
voidf1(intx,inty),f2(int*x,int*y);
voidf3(int*x,int*y),f4(intx,inty);
f1(a,b);
(%d,%d)\n"
a,b);
a=-1,b=1;
f2(&
a,&
b);
f3(&
f4(a,b);
voidf1(intx,inty)
{intt;
t=x;
x=y;
y=t;
voidf2(int*x,int*y)
t=*x;
*x=*y;
*y=t;
voidf3(int*x,int*y)
{int*t;
voidf4(intx,inty)
{int*t=malloc(sizeof(t));
*t=x;
y=*t;
(17)程序运行时,第1行输出(17)。
A、(1,-1)B、(-1,1)C、(-1,-1)D、(1,1)
(18)程序运行时,第2行输出(18)
。
(19)程序运行时,第3行输出(19)。
(20)程序运行时,第4行输出(20)。
试题6(每小题3分,共12分)
structcard{
char*face;
char*suit;
};
voidfilldeck(structcard*wdeck,char*wface[],char*wsuit[])
{inti;
for(i=0;
4;
wdeck[i].face=wface[i%2];
wdeck[i].suit=wsuit[i/2];
voiddeal(structcard*wdeck)
(%2sof%-6s)\n"
wdeck[i].face,wdeck[i].suit);
voidmain()
{structcarddeck[4];
char*face[]={"
K"
"
Q"
char*suit[]={"
Heart"
Club"
filldeck(deck,face,suit);
deal(deck);
(21)程序运行时,第1行输出(21)。
A、(KofHeart)B、(QofHeart)
C、(KofClub)D、(QofClub)
(22)程序运行时,第2行输出(22)。
(23)程序运行时,第3行输出(23)。
(24)程序运行时,第3行输出(24)。
1.A2.D3.D4.C5.D6.A7.C8.C9.D10.C11.B12.A
13.C14.D15.A16.B17.B18.A19.B20.B21.A22.B23.C24.D
输入一行字符,统计并输出其中英文字母、数字和其他字符的个数。
Entercharacters:
f(x,y)=3x+5y-10
letter=5,digit=4,other=6
{intdigit,i,letter,other;
(1)ch;
digit=letter=other=0;
while(
(2)!
\n'
)
if((3))
letter++;
(4)(ch>
0'
ch<
9'
digit++;
else
other++;
letter=%d,digit=%d,other=%d\n"
letter,digit,other);
(1)A、*B、float
C、doubleD、char
(2)A、(ch=getchar())B、ch=getchar()
C、getchar(ch)D、putchar(ch)
(3)A、(ch>
a'
z'
)&
(ch>
A'
Z'
)
B、(ch>
)||(ch>
)
C、ch>
D、ch>
(4)A、ifB、else
C、elseifD、ifelse
输入一个整数,将它逆序输出。
要求定义并调用函数reverse(longnumber),它的功能是返回number的逆序数。
例如reverse(12345)的返回值是54321。
-123
Afterreversed:
-321
{longin;
longreverse(longnumber);
scanf("
%ld"
in);
%ld\n"
(5));
longreverse(longnumber)
{intflag;
(6);
flag=number<
0?
-1:
1;
if((7))number=-number;
while(number!
=0){
res=(8);
number/=10;
returnflag*res;
(5)A、reverse()B、in
C、reverse(in)D、reverse
(6)A、res=0B、longres
C、longres=0D、res
(7)A、number>
0B、number<
0
C、number!
=0D、number==0
(8)A、number%10B、res*10+number%10
C、number/10D、res*10+number/10
输入一个3行2列的矩阵,分别输出各行元素之和.
Enteranarray:
63
1-8
312
sumofrow0is9
sumofrow1is-7
sumofrow2is15
{intj,k,sum=0;
inta[3][2];
for(j=0;
j<
3;
for(k=0;
2;
(9));
j++){
(10)
sum=(11);
sumofrow%dis%d\n"
(12),sum);
(9)A、a[j][k]B、a[k][j]
C、&
a[j][k]D、&
a[k][j]
(10)A、;
B、sum=-1;
C、sum=1;
D、sum=0;
(11)A、sum+a[j][k]B、sum+a[j][j]
C、sum+a[k][k]D、0
(12)A、kB、j
C、0D、1
{intk;
for(k=5;
k>
0;
k--){
if(k==3)
continue;
/*第6行*/
k);
(13)程序的输出是(13)。
A、54321B、5421C、54D、3
(14)将第6行中的continue改为break后,程序的输出是(14)。
(15)将第6行中的continue删除(保留分号)后,程序的输出是(15)。
(16)将第6行全部删除后,程序的输出是(16)。
{charc,s[80]="
HappyNewYear"
inti;
voidf(char*s,charc);
c=getchar();
f(s,c);
puts(s);
voidf(char*s,charc)
{intk=0,j=0;
while(s[k]!
){
if(s[k]!
=c){
s[j]=s[k];
j++;
k++;
s[j]='
(17)程序运行时,输入字母a,输出(17)。
A、HappyNewYearB、HppyNewYer
C、HayNewYearD、HappyNwYar
(18)程序运行时,输入字母e,输出(18)。
(19)程序运行时,输入字母p,输出(19)。
(20)程序运行时,输入字母b,输出(20)。
structst{
intx,y,z;
voidf(structst*t,intn);
voidmain()
structsttime;
%d%d%d%d"
time.x,&
time.y,&
time.z,&
n);
f(&
time,n);
%d:
time.x,time.y,time.z);
voidf(structst*t,intn)
t->
z=t->
z+n;
if(t->
z>
=60){
t->
y=t->
y+t->
z/60;
z%60;
}
y>
x=t->
x+t->
y/60;
y%60;
x>
=24)t->
x=t->
x%24;
(21)程序运行时,输入12125010,输出(21)。
A、12:
12:
0B、12:
50C、12:
60D、12:
13:
0
(22)程序运行时,输入12123010,输出(22)。
10C、12:
30D、12:
40
(23)程序运行时,输入22593030,输出(23)。
A、23:
0:
0B、22:
59:
60C、22:
30D、22:
(24)程序运行时,输入23590300,输出(24)。
A、0:
4:
0B、23:
300C、23:
00D、23:
1
2
3
4
5
6
7
8
9
10
11
12
D
A
B
C
13
14
15
16
17
18
19
20
21
22
23
24
21C22C
输入一个正整数,按照从高位到低位输出各位数字。
1902
thedigitsare:
1902
{intdigit,number,power,t;
&
number);
number=number<
0?
-number:
number;
power=1;
(1)
while(
(2))
{power*=10;
t/=10;
prin
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 浙江省 二级 语言 0506 选择题
![提示](https://static.bdocx.com/images/bang_tan.gif)