填空
第一章? 概述
?[1]
匯編語言屬于面向(????? )語言,高級語言屬于(????? )語言。
[2]
用高級語言編寫的程序稱為(? )程序,它可以通過解釋程序翻譯一句執行一句的方式執行,也可以通過編譯程序一次翻譯產生(?? )程序,然后執行。
[3]
轉義字符是由( )符號開始的( )字符或若干個字符組成的。
[4]
C語言詞類主要分為(?? )、變量、運算符、函數調用、表達式和(??? )等6類。
[5]
C語言的語句主要分為數據定義語句、(??? )語句、函數調用語句、(??? )語句、流程控制語句、復合語句、空語句、其它語句等8類。
[6]
C程序是由函數構成的。其中有并且只能有( ?)個主函數。C語言程序的執行總是由(?? )函數開始,并且在main函數中結束。
[7]
C語言程序的注釋可以出現在程序的任何地方,它總是以(?? ) 符號作為開始標記,以(?? )符號作為結束標記。
[8]
各類計算機語言的發展歷程大致為:先有(?? )語言,再有匯編語言,最后出現中級語言和(? )語言。
[9]
C語言中用(??? )或(?? )運行程序。
[10]
匯編語言必須通過(?? )程序把其中的符號還原成對應的(??? ),才能運行。
[11]
C語言的字符集就是(???? )字符集。
‘
A
’
的ASCII 值是(? )。
[12]
可以利用轉義字符形成任意一個1個字節的代碼。用(? )后跟1到3個八進制數表示一個字符的ASCII碼值;用(?? )后跟1到2個十六進制數表示一個字符的ASCII碼值。
[13]
對于一些不能用普通字符表示的(?? ),也常需要用(?? )字符來表達。
[14]
C語言中規定標識符只能由字母、數字、下劃線組成,且第一個字符必須是(?? )或(??? )。
[15]
C語言符號集包括(?????? )、(???? )和一些有特殊含義的標點符號。
[16]
一個C程序有且僅有一個(??????? )函數,且程序執行總是從(???? )開始。
[17]
一個C源程序有(?? )main()函數和(??? )個其它函數。
[18]
結構化設計中的三種基本結構是(??????? )、(?????? )和循環結構。
[19]
C程序的執行是從(??????????????????????? )開始執行的。C程序中定義的變量,代表內存中的一個(???????? )。
[20]
C語言源程序文件的后綴是(?? ),經過編繹后生成文件的后綴是(????? ),經過連接后生成文件的后綴是.exe。
[21]
C語言源程序的語句分隔符是(?? )。'\n'表示(? )。
[22]
C程序開發的四個步驟是(???? )、 (???? )鏈接和執行。
第二章? 基本數據類型和運算
?[1]
在內存中存儲"A"要占用(? )個字節,存儲'A'要占用(? )個字節。
?
[2]
C語言中的邏輯值
“
真
”
是用(? )表示的,邏輯值
“
假
”
是用(? )表示的。
[3]
符號常量的定義方法是(?????????? ),C語言中的標識符分為關鍵字、用戶標識符和(????????????? )三類。
[4]
說明變量時,若省略存儲類型符,系統默認其為(????? )存儲類別,該存儲類別的類型符為(???? )。
[5]
無符號基本整型的數據類型符為(??????????? ),雙精度實型數據類型符為(????? )。
?
?[6]
定義變量的完整語句格式是: (?????????? )?? (????????? )? 變量名1=初值1,變量名2=初值2,...;。
[7]
設有下列運算符:<<、+、++、&&、<=,其中優先級最高的是(? ),優先級最低的是(? )。
[8]
通常一個字節是(?? )個二進制位,假設二進制數A是00001101,若想通過異或運算A^B使A的高4位取反,低4位不變,則二進制數B應是(??????? )。
[9]
設a=3,b=2,c=1,則a>b的值為(? ),a>b>c的值為(? )。
?
?[10]
若已知a=10,b=20,則表達式a<b的值為(? ),!a<b的值為(? )。
[11]
設x和y均為int型變量,且x=1,y=2,則printf(
“
%
3.1f
”
,(1.0+x/y));的結果為(?? ),printf("%d",x%y);的結果為(?? )。
[12]
設整型變量x,y,z均為5:
?
①
? 執行
“
x-=y-z
”
后x=(? ),
?
②
? 執行
“
x%=y+z
”
后x=(? ),
[13]
能表述
“
20<X<30的C語言表達式是(??????? )。能表述
“
x>30或x<
20
”
的c語言表達式是(?????????????? )。
?
?[14]??????????? a
請寫出數學式的--------的C語言表達式(??????? )。表達式3.5+1/2的計算結果是(?? )。
??????????
?
???b
×
c
[15]
C語言中運算結果可以當成邏輯值使用的表達式有:算術表達式、(?? )表達式、(?? )表達式、賦值表達式、條件表達式和逗號表達式。
[16]
“
=
”
是(?? )符號,不是等號。在C語言中等于號用
“
(?? )
”
表示。
[17]
c=b*=a+2相當于(???????? )和(??? )這樣兩個表達式。
[18]
在程序或語句中使用表達式時,要按照語法和表達式的位置來確定表達式的準確類型。例如,
“
10?A:C
”
中的
“
10
”
的類型就是(?? )型的,10/4的結果是(???? )。
[19]
表達式10/3的結果是(???? ),10.0/3的結果是(?? ???)。
[20]
表達式10%3的結果是(????? ),3%10的結果是(?????? )。
[21]
已知a=13,b=6,表達式a&&b的值為(???? ),a||b的結果是(???? )。
[22]
已知int a,i=5; a=i++;執行后i和a的值為(??? )。
int a,i=5; a=(a=i+1,a+2,a+3) ,執行后i和a的值為(??? )
[23]
定義int x,y;執行y=(x=1,++x,x+2);語句后,x的值是(??? ),y的值是(??? )。
?
?[24]
設int x=9,y=8;表達式x==y+1的結果是(??? ),表達式x=y+1的結果是(??? )。
[25]
設int x=10,y,z;執行y=z=x;x=y==z后,變量x的結果是(??? ), 變量z的結果是(??? )。
[26]
設int a=1,b=2,c,d,e;執行c=(-a++)+(++b);d=(b--)+(++a)-a;e=(a/(++b))-(b/(--a));后,變量a、e的結果分別是(?? )、(?? )。
?
?[27]
設int a=1,b=2,c=3,d;執行d=!(a+b+c)后,d的結果是(???? ),執行d=!a+!b+!c后,d的結果是(???? )。
[28]
設int a=2,b=3,c,d,e,f;執行c=(a++>=--b);d=(a==++b);e=(a--!=b);f=(++a>b--);后,變量c、f的結果分別是(??? )、(??? )。
[29]
設int x;當x的值分別為1、2時,表達式(x&&1==1)?1:0的值分別是(?? )、(??? )、。
[30]
int a=12;執行a+=a-=a*a;語句后,a的值是(???? ),執行a/=5; 語句后,a的值是(???? )。
[31]
若x為double型,則執行x=3.2,++x;語句后,該表達式的值是(????? ),x的值是(????? )。
[32]
執行下列語句后,a、b的值分別是(??? )、(??? )。
???? int x=10,y=9; int a,b,c; a=(--x==y++)?--x:++y;b=x++;c=y;
[33]
unsigned int b=65535;
printf("%d",b);的輸出結果是(???? ),printf("%u",b);的輸出結果是(???? )。
[34]
int a=-1; printf("%x",a);的輸出結果是(?????? ),printf("%d",a);的輸出結果是(?????? )。
[35]
以下程序的執行結果是(???? )。
? #include <stdio.h>
? main()
? { int a,b,d=241;
??? a=d/100%9;
??? b=(-1)&&(-1);
??? printf("%d,%d\n",a,b);
? }
[36]
以下程序的執行結果是(????? )。
? #include <stdio.h>
? main()
? { int i,j,x,y;
??? i=5;j=7;
??? x=++i;y=j++;
??? printf("%d,%d,%d,%d\n",i,j,x,y);
? }
[37]
以下程序的執行結果是(???? )。
? #include <stdio.h>
? main()
? { float f=13.8;
??? int n;
??? n=((int)f)%3;
??? printf("n=%d\n",n);
? }
[38]
以下程序的執行結果是(???? )。
? #include<stdio.h>
? main()
? { int x=35;
??? printf("%d\n",(x&15)&&(x|15));
???? }
[39]
以下程序的執行結果是(?????? )。
? #include <stdio.h>
? main()
? { int n=2;
??? n+=n-= n*n;
??? printf("n=%d\n",n);
? }
[40]
以下程序的執行結果是(???????????????? )。
?? #include <stdio.h>
?? main()
?? { int a,b,x;
????? x=(a=3,b=a--);
???? printf("x=%d,a=%d,b=%d\n",x,a,b);
??? }
[41]
以下程序的執行結果是(?????? )。
?? #include <stdio.h>
??? main()
?? { float f1,f2,f3,f4;
???? int m1,m2;
???? f1=f2=f3=f4=2;
???? m1=m2=1;
???? printf("%d\n",(m1=f1>=f2)&&(m2=f3<f4));
?? }
[42]
以下程序的執行結果是(??????? )。
?? #include <stdio.h>
?? main()
?? { int i=16,j,x=6,y,z;
???? j=i+++1;
???? printf("1:%d\n",j);
???? x*=i=j;
???? printf("2:%d\n",x);
???? x=1,y=2,z=3;
???? x+=y+=z;
???? printf("3:%d\n",z+=x>y?x++:y++);
???? x=0x02ff;y=0xff00;
???? printf("4:%d\n",(x&y)>>4|0x
005f
);
???? x=y=z=-1;
???? ++x||++y&& ++z;
???? printf("5:%d,%d,%d\n",x,y,z);
?? }
[43]
以下程序的執行結果是(?????????? )。
?? #include <stdio.h>
?? main()
?? { int x=5,y=2;
???? printf("1:%d\n",!(y==x/2));
???? printf("2:%d\n",y!=x%3);
???? printf("3:%d\n",x>0&&y<0);
???? printf("4:%d\n",x!=y||x>=y);
?? }
第三章? 順序、選擇和循環結構的程序設計
[1]
float a=3.54;
printf("%
2.3f
",a);的輸出結果是(????? )
[2]
若有定義語句
“
int a=25,b=14,c=19;
”
,以下語句的執行結果是(??????????????? )。
? if(a++<=25&&b--<=2&&c++) printf("***a=%d,b=%d,c=%d\n",a,b,c);
? else???????????????????? printf("###a=%d,b=%d,c=%d\n",a,b,c);
[3]
以下兩條if語句可合并成一條if語句為(???????????????????????????? )。
? if(a<=b)? x=1;
?? else???? y=2;
? if(a<=b) printf("**** y=%d\n",y);
?? else?? printf("#### x=%d\n",x);
[4]
設i,j,k均為int型變量,則執行完下面的for循環后,k的值為(? )。
? for(i=0,j=10;i<=j;i++,j--)??? k=i+j;
[5]
下列程序的功能是輸入一個正整數,判斷是否是素數,若為素數輸出1,否則輸出0,請為程序填空。
? main()
? { int i,x,y=1;
??? scanf("%d",&x);
??? for (i=2;i<=x/2;i++)
???????? if(??????? ) {y=0;break;}
??? printf("%d\n",y);
? }
[6]
以下程序的執行結果是(???????????????????????????? )。
? #include <stdio.h>
? main()
? { short i=-1;
??? printf("dec:%d,oct:%o,hex:%x,unsigned:%u\n",i,i,i,i);
? }
?
?[7]
以下程序的執行結果是(????????????????????????????? )。
? #include <stdio.h>
? main()
? { short i=1;
??? printf("dec:%d,oct:%o,hex:%x,unsigned:%u\n",i,i,i,i);
? }
?
?[8]
以下程序的執行結果是(????????????????????????????? )。
? #include <stdio.h>
? main()
? { char c='A';
??? printf("dec:%d,oct:%o,hex:%x,ASCII:%c\n",c,c,c,c);
? }
以下程序的執行結果是(??????????? ?????????????)。
? #include <stdio.h>
? main()
? { float f=3.1415927;
??? printf("%f,%
5.4f
,%
3.3f
",f,f,f);
? }
[10]
以下程序的執行結果是(????????????????????? )。
? #include <stdio.h>
? main()
? { float f=3.5;
??? printf("%f,%g",f,f);
? }
[11]
以下程序的執行結果是(???????????? ???????????)。
? #include <stdio.h>
? main()
? { float f=31.41532;
??? printf("%f,%
2.3f
",f,f);
? }
[12]
以下程序的執行結果是(???????????????? )。??
#include <stdio.h>
? main()
? { char c='A'+10;
??? printf("c=%c\n",c);
? }
[13]
以下程序輸入1 2 3<CR>后的執行結果是(??????????????? ?????)。
? #include <stdio.h>
? main()
? { int a,c;
??? char b;
??? scanf("%d%c%d",&a,&b,&c);
??? printf("a=%d,b=%c,c=%d\n",a,b,c);
? }
[14]
以下程序輸入123456<CR>后的執行結果是(???????????????? )。
? #include <stdio.h>
? main()
? { int a,b;
??? scanf("%2d%3d",&a,&b);
?
??printf("a=%d,b=%d\n",a,b);
? }
[15]
以下程序輸入ABC<CR>后的執行結果是(?????? )。
? #include <stdio.h>
? main()
? { char c;
??? scanf("%
3c
",&c);
??? printf("c=%c\n",c);
? }
[16]
以下程序輸入100<CR>后的執行結果是(????????? )。
? #include <stdio.h>
? main()
? { int n;
??? scanf("%o",&n);
??? printf("n=%d\n",n);
? }
?
?[17]
以下程序輸入x=1.23,y=50<CR>后的執行結果是(???????????????????? )。
? #include <stdio.h>
? main()
? { float x,y;
??? scanf("x=%f,y=%f",&x,&y);
??? printf("x=%
7.2f
,y=%
7.2f
\n",x,y);
? }
[18]
以下程序的執行結果是(????? )。
? #include <stdio.h>
? main()
? {? int a,b,c;
???? a=2;b=3;c=1;
???? if (a>b)
???????? if (a>c)
?????????? printf("%d\n",a);
????????? else
??????????? printf("%d\n",b);
???? printf("end\n");
? }
[19]
以下程序的執行結果是(???????? )。
? #include <stdio.h>
? main()
? {? int a,b,c,d,x;
???? a=c=0;
???? b=1;
???? d=20;
???? if(a)d=d-10;
???? else? if(! b)
?????????? if (! c)x=15;
?????????? else x=25;
???? printf("d=%d\n",d);
? }
[20]
以下程序在輸入5,2之后的執行結果是(????????????? )。
? #include <stdio.h>
? main()
? { int s,t,a,b;
??? scanf("%d,%d",&a,&b);
?
?? s=1;
??? t=1;
??? if(a>0) s=s+1;
??? if(a>b)t= s + t;
??? else if(a==b) t=5;
??? else t=2*s;
??? printf("s=%d,t=%d\n",s,t);
? }
[21]
以下程序的執行結果是(??????????? )。
? #include <stdio.h>
? main()
? { int x=1,y=0;
??? switch(x)
??? { case 1:
???????? switch(y)
????????? {case 0:printf("first\n");break;
?????????? case 1:printf("second\n");break; }
??? case 2:printf("third\n");
??? }
? }
[22]
執行以下程序,輸入-10的結果是(????? ),輸入5的結果是(????? ),輸入10的結果是(????? ),輸入30的結果是(????? )。
? #include <stdio.h>
? main()
? { int x,c,m;
??? float y;
??? scanf("%d",&x);
??? if (x<0) c=-1;
??? else c= x/10;
??? switch (c)
??? {case-1:y=0;break;
???? case 0:y=x;break;
???? case 1:y=10;break;
???? case 2:
???? case 3:y=-0.5*x+20;break;
???? default:y=-2;???????????? }
??? if (y!=-2) printf("y=%g\n",y);
??????? else printf("error\n");
???? }
[23]
以下程序的執行結果是(?????? )。
? #include <stdio.h>
? main()
? { int a=2,b=7,c=5;
??? switch(a>0)
??? { case 1:switch(b<0)
????????? { case 1:printf("@");break;
??????????? case 2:printf("!");break;??? }
????? case 0:switch(c==5)
????????? {case 0:printf("*");break;
?????????? case 1:printf("#");break;
?????????? default:printf("$");break;?? }
????? default:printf("&");
??? }
?? printf("\n");
? }
[24]
下列程序運行后的輸出結果是(?????????? )。
? #include <stdio.h>
? main()
? { int s=0,k;
??? for(k=7;k>=0;k--)
??? { switch(k)
????? { case 1:
??????? case 4:
??? case 7: s++; break;
??????? case 2:
??????? case 3:
??????? case 6: break;
??????? case 0:
??????? case 5: s+=2; break;
????? }
??? }
????? printf("s=%d\n",s);
? }
[25]
下列程序運行后的輸出結果是(?????????? )。
? #include <stdio.h>
? main()
? { int i,j;
??? for(i=4;i>=1;i--)
??? {? printf("*");
?????? for (j=1;j<=4-i;j++)printf("*");
?????? printf("\n");????????????????? }
? }
[26]
下列程序運行后的輸出結果是(?????????? )。
????? #include <stdio.h>
????? main()
????? { int i,j,k;
??????? for (i=1;i<=6;i++)
???????? { for(j=1;j<=20-2 *i;j++) printf(" ");
?????????? for (k=1;k<=i;k++) printf("%4d",i);
?????????? printf("\n");
???????? }
?????? }
[27]
下列程序運行后的輸出結果是(??????? )。
????? #include <stdio.h>
????? main()
????? { int i,j,k;
??????? for (i=1;i<=6;i++)
?
?????? { for(j=1;j<=20-3*i;j++)printf(" ");
????????? for(k=1;k<=i;k++) printf("%3d",k);
????????? for(k=i-1;k>0;k--) printf("%3d",k);
????????? printf("\n");
???????? }
?????? }
[28]
下列程序運行后的輸出結果是(?????????? )。
????? #include <stdio.h>
????? main()
????? { int i,j,k;
??????? for (i=1;i<=4;i++)
??????? { for(j=1;j<=20-3*i;j++)printf(" ");
????????? for (k=1;k<=2*i-1;k++) printf("%3s","*");
????????? printf("\n");???????? }
??????? for(i=3;i>0;i--)
??????? { for(j=1;j<=20-3*i;j++)printf(" ");
????????? for(k=1;k<=2*i-1;k++) printf("%3s","*");
????????? printf("\n");???????? }
?????? }
[29]
下列程序運行后的輸出結果是(???????????? )。
????? #include <stdio.h>
????? main()
????? { int i,j,sum,m,n=4;
??????? sum=0;
??????? for(i=1;i<=n;i++)
??????? { m=1;
????????? for(j=1;j<=i;j++) m=m*j;
????????? sum=sum+m;??????????? }
??????? printf("sum=%d\n",sum);
???
??}
[30]
若有以下定義,寫出以下程序段中輸出語句執行后的輸出結果。
int i=-200,j=2500;
printf("%d? %d",i,j); 輸出結果是(??????? )。
printf("i=%d,j=%d,i,j);輸出結果是(??????? )。
[31]
以下程序段的輸出結果是(??????????????????????????????????? )。
int x=0177;
printf("x=%3d,x=%6d\n",x,x);
[32]
以下程序段的輸出結果是(????? ??????????????????????????????)。
int x=0177;
printf("x=%-3d,x=%-6d,x=$%-06d,x=$%06d,x=%%06d\n",x,x,x,x,x);
[33]
a=b或a<c? 用C語言表達式表示為(?????????????? ),? |x|>4用C語言表達式表示為(?????????????? )。
?
?[34]
寫出下列程序的輸出結果(???????????????? )
main()
{int a=100;
if(a>100)?
printf("%d\n",a>100);
else??? printf("%d\n",a<=100);
}
[35]
當a=1,b=2,c=3時,以下if語句執行后,a的值為(???? )。
if(a>c)
?? b=a;a=c;c=b;
[36]
若變量已正確定義,以下語句段的輸出結果是(?????? )。
x=0;y=2;z=3;
switch(x)
{case?? 0:? switch(y==2)
{case??? 1:?? printf("*");break;
???????????????? case??? 2:?? printf("%");break;
}
case??? 1: switch(z)
{ case??? 1:?? printf("$");
????????????????? case??? 2:?? printf("*");break;
default: printf("#");
}
}
[37]
當以下程序段運行后,i的值是(??? ),j的值是(???? )。
int a,b,c,d,i,j,k;
a=10;b=c=d=5;i=j=k=0;
for( ; a>b);++b)
? i++;
while(a>++c)?
? j++;
do
{k++;}while(a>d++);
[38]
以下程序輸出結果是(??? )。
main()
{int x=2;
while (x--);
printf("%d\n",x);
}
[39]
以下程序段輸出結果是(??? )。
int i=0,sum=1;
do
{sum+=i++;
}while(i<5);
printf("%d\n",sum);
[40]
有以下程序段:
s=1.0;
for(k=1;k<=n;k++)
s=s+1.0/(k*(k+1));
printf("%d\n",s);
請填空,使下面的程序段的功能完全與之相同。
s=0.0;
(??????????????????? );
k=0;
do
{ s=s+d;
k=1;
d=1.0/(k*(k+1));
}while(???????????????? );
printf("%f\n",s);
?
?[41]
以下程序的功能是:從鍵盤上輸入若干學生的成績,統計并輸出最高成績和最低成績,當輸入負數時結束輸入,請填空。
main()
{float x,amax,amin;
scanf("%f",&x);
amax=x;
amin=x;
while(???????? )
{if(x>amax)
? amax=x;
if(????????? )
? amin=x;
scanf("%f",&x);
}
printf("\namax=%f\namin=%f\n",amax,amin);
}
[42]
若輸入字符A,在while語句執行后ch的值是(????? )。
While(ch=getchar()= ='A')
[43]
若有以下說明和輸入語句,要求給c1,c2輸入字符A和B,給a1,a2輸入7.29和101.298,從鍵盤正確輸入數據的形式是(?????????????????????????????????????? )。
char c1,c2;
float a1,a2;
scanf("%f%f",&a1,&a2);
scanf("%c%c",&c1,&c2);
第四章? 數組
?[1]
執行
“
static int b[5],a[][3]={1,2,3,4,5,6}
”
后,b[4]=(? ),a[1][2]=(? )。
[2]
設有定義語句
“
static int a[3][4]={{1},{2},{3}}
”
,則a[1][1]值為(? ),a[2][1]的值為(? )。
[3]
若在程序中用到
“
putchar()
”
函數時,應在程序開頭寫上包含命令(??????????? ),若在程序中用到
“
strlen()
”
函數時,應在程序開頭寫上包含命令(??????????? )。
?
?[4]
下面程序的功能是輸出數組s中最大元素的下標,請填空。
????? main()
????? { int k,p;
??????? int s[]={1,-9,7,2,-10,3};
??????? for(p=0,k=p;p<6;p++) if (s[p]>s[k])(???? )
??????? printf("%d\n",k);
????? }
?
?[5]
下面程序的功能是將一個字符串str的內容顛倒過來,請填空。
????? #include"string.h"
????? main()
????? { int i,j,(?? );
??????? char str[]={"1234567"};
??????? for(i=0,j=strlen(str),(?????? );i<j;i++,j--)
????
???????{ k=str[i];str[i]=str[j];str[j]=k;}
????? }
[6]
以下程序可把輸入的十進制長整型數以十六進制數的形式輸出,請填空。
????? main()
????? { char b[17]={"0123456789ABCDEF"};
??????? int c[64],d,i=0,base=16;
??????? long n;
??????? printf("Enter a number:\n");
??????? scanf("%1d",&n);
??
?????do{c[i]=(??????? );i++;n=n/base;}while (n!=0);
??????? printf("Transmite new base:\n");
??????? for (--i;i>=0;--i){ d=c[i];printf("%c",b[?????? ];}
????? }
[7]
以下程序執行時輸入Language Programming<CR>的結果是(?????????? )。
????? #include <stdio.h>
????? main()
?
???? { char str[30];
??????? scanf("%s",str);
??????? printf("str=%s\n",str);
????? }
[8]
以下程序執行時輸入Language Programming<CR>的結果是(?????????????? )。
????? #include <stdio.h>
????? main()
????? { char str[30];
??????? gets(str);
??????? printf("str=%s\n",str);
????? }
[9]
以下程序執行的結果是(??????????? )。
????? #include <stdio.h>
????? main()
????? { int a[]={1,2,3,4},i,j,s=0;
??????? j=1;
??????? for(i=3;i>=0;i--) { s=s+a[i]*j;j=j*10;}
??????? printf("s=%d\n",s);
????? }
[10]
以下程序執行的結果是(????????????? )。
????? #include <stdio.h>
????? main()
????? {? char str[]={"
1a
2b
3c
"};
???????? int i;
???????? for(i=0;str[i]!='\0';i++)
?????????? if(str[i]>='0'&&str[i]<='9') printf("%c",str[i]);
???????? printf("\n");
????? }
?
?[11]
以下程序執行的結果是(???????????? )。
????? #include <stdio.h>
????? main()
????? { int a[3][3]={1,2,3,4,5,6,7,8,9},i,s=0;
??????? for(i=0;i<=2;i++) s=s+a[i][i];
??????? printf("s=%d\n",s);
????? }
[12]
以下程序執行的結果是(????????????? )。
????? #include <stdio.h>
????? main()
????? { int a[3][3]={1,2,3,4,5,6,7,8,9},i,s=1;
?
?????? for(i=0;i<=2;i++) s=s*a[i][i];
??????? printf("s=%d\n",s);
????? }
[13]
以下程序執行的結果是(???????????? )。
????? #include <stdio.h>
????? main()
????? {? int a[]={0,2,5,8,12,15,23,35,60,65};
???????? int x=15,i,n=10,m;
???????? i=n/2+1;
???????? m=n/2;
???
?????while(m!=0)
???????? { if(x<a[i]){i=i-m/2-1; m=m/2; }
??????????? else if(x>a[i]) { i=i+m/2+1; m=m/2;}
?????????????? else break;
????????? }
???????? printf("place=%d",i+1);
????? }
?
?[14]
以下程序執行的結果是(????????????? )。
????? #include <stdio.h>
????? main()
????? { int i,j,row=0,col=0,m;
??????? static int a[3][3]={1,-2,0,4,-5,6,2,4};
??????? m=a[0][0];
??????? for(i=0;i<3;i++)
?????????? for(j=0;j<3;j++)
??????????? if(a[i][j]<m)
???????????? {m=a[i][j];
????????????? row=i;
????????????? col=j;??????? }
??
?????printf("(%d,%d)=%d\n",row,col,m);
????? }
[15]
以下程序執行的結果是(????????????????????? )。
????? #include <stdio.h>
????? main()
????? {? int a[4][5]={1,2,4,-4,5,-9,3,6,-3,2,7,8,4};
???????? int i,j,n;
???????? n=9;
???????? i=n/5;
???????? j=n-i* 5-1;
???????? printf("第%d個元素(%d,%d)值是%d\n",n,i,j,a[i][j]);
???
???}
[16]
以下程序執行的結果是(??????????????? )。
????? #include <stdio.h>
????? main()
????? { int a[4][5]={1,2,4,-4,5,-9,3};
??????? int b,i,j,i1,j1,n;
??????? n=-9;
??????? b=0;
??????? for(i=0;i<4;i++)
??????? { for(j=0;j<5;j++) if(a[i][j]==n){i1=i;j1=j; b=1;break;}
????????? if(b) break;
??????? }
??????? printf("%d是第%d個元素\n",n,i1 * 5+j1+1);
?????? }
[17]
以下程序執行的結果是(?????????????? )。
????? #include <stdio.h>
????? main()
????? {? static char s1[50]={"some string * "};
???????? static char s2[]={"test"};
???????
?printf("%d,",strlen(s2));
???????? strcat(s1,s2);
???????? printf("%s\n",s1);
?????? }
[18]
以下程序將
“
Hello
”
逆序顯示出來。請在程序中的空白處填入一條語句或一個表達式。
????? #include <stdio.h>
????? main()
????? { pt("Hello"); }
????? pt(char * string)
????? {?? char *str= (???
①
????? ) ;
????????? if(*str== (??
②
??? ) ) return;
????????? while( *str)str++;
?????????? (????
③
????? ) ;
????????? printf("%c", *str);
????????? *str='\0';
????????? pt( (?
④
????? ) );
?????? }
[19]
若有以下定義:double w[10];則w數組元素下標的上限是(?????????? ),下限是(???????? )。
[20]
以下程序輸出結果是(?????????? )。
main()
{int arr[10],i,k=0;
for (i=0;i<10;i++)
arr[i]=i;
for(i=0;i<4;i++)
k+=arr[i]+i;
printf("%d\n",k);
}
[21]
以下程序輸出結果是(?????? )。
main()
{int i,j,row,col,m;
int arr[3][3]={{100,200,300},{28,782,-30},{-850,2,6}};
m=arr[0][0];
for(i=0;i<3;i++)
? for(j=0;j<3;j++)
if(arr[i][j]<m)
???? {m=arr[i][j];
????? row=i;
????? col=j;
}
printf("%d,%d,%d\n",m,row,col);
}
[22]
以下findmax返回數組s中最大元素的下標,數組中元素的個數有t傳入,請填空。
findmax(int s[],int t)
{int k,p;
for(p=0,k=p;p<t;p++)
? if(s[p]>s[k])?
??????
??(??????????????? );
return (??????????? );
}
?
?[23]
以下程序統計從終端輸入的字符中每個大寫字母的個數,num[0]中統計字母A的個數,其他依次類推。用#號結束輸入,請填空。
#include "stdio.h"
#include "ctype.h"
main()
{
int num[26]={0},i ;
char c;
while(???????????????????????? )
?? if(isupper( c ))
(?????????? ???????????)
? for(i=0;i<26;i++)
? if(num[i])
printf("%c:%d\n",i+'a',num[i]);
}