填空题以下程序输出的最后一个值是 【11】 int ff(int n) static int f=1; f=f*n; return f; main() int i; for(i=1;i<=5;i++) printf("%d/n",ff(i));
填空题假定变量x为int类型,请以最简单的形式写出与逻辑表达式!x等价的C语言关系表达式{{U}} {{U}} {{/U}} {{/U}}。
填空题下列给定程序中,函数proc()的作用是:将字符串tt中的大写字母都改为对应的小写字母,其他字符不变。
例如,若输入“I, am, A, Student”,则输出“i, am, a, student”。
请修改程序中的错误,使它能得到正确结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
//****found****
char proc(char str[])
{
int i;
for(i=0;str[i];i++)
{
//****found****
if((str[i]>="a")
return(str);
void main()
{
char str[81];
system("CLS");
printf("/nPlease enter a string:");
gets(str);
printf("/nThe result string is:/n%s",
proc(str));
}
填空题下列程序中,字符串中各单词之间有一个空格,则程序的输出结果是 【8】 。 #include main() char strl[]="How do you do", *p1=strl; strcpy(strl+strlen(strl)/2,"es she"); printf("%s/n",p1);
填空题某微型机的运算速度为2MIPS,则该微型机每秒执行{{U}} 【5】 {{/U}}条指令。
填空题下列给定程序中,函数proc()的功能是:先将字符串s中的字符按顺序存放到t中,然后把s中的字符按正序连接到t的后面。例如,当s中的字符串为WXYZ时,则t中的字符串应为WXYZWXYZ。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void proc(char*s,char*t)
{
int i,s1;
s1=strlen(s);
for(i=0;i<s1;i++)
//****found****
t[i]=s[s1];
for(i=0;i<s1;i++)
t[s1+i]=s[i];
t[2*s1]="/0";
}
void main()
{
char s[100],t[100];
system("CLS");
printf("/nPlease enter string s:");
scanf("%s",s);
proc(s,t);
printf("The result is:%s/n",t);
}
填空题在给定程序中,函数fun的功能是:对形参s所指字符串中下标为奇数的字符按ASCII码大小递增排序,并将排序后下标为奇数的字符取出,存入形参p所指字符数组中,形成一个新串。 例如,形参s所指的字符串为BADCDBFGEDC;执行后p所指字符串数组中的字符串应为ABCDG。 请在程序的下画线处填入正确的内容并把下画线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的BLANK1.C中。不得增行或删行,也不得更改程序的结构。 文件BLANK1.C内容如下: #include<stdio.h> void fun(char *s,char *p) int i,j,n,x,t; n=0; for(i=0;s[i]!='/0';i++)n++; for(i=1;i<n-2;i=i+2) /**********found**********/ (1) ; /**********found**********/ for(j= (2) +2;j<n;j=j+2) if(s[t]>s[j])t=j; if(t!=i) x=s[i];s[i]=s[t];s[t]=x; for(i=1,j=0;i<n;i=i+2,j++)p[j]=s[i]; /**********found**********/ p[j]= (3) ; void main( ) char s[80]="BADCDBFGEDC",p[50]; printf("/nThe original string is:%s/n",s); fun(s,p); printf("/nThe result is:%s/n",p);
填空题下列给定程序中函数fun的功能是:把从主函数中输入的3个数,最大的数放在a中,中间的数放在b中,最小的数放在C中。 例如,若输入的数为:55 12 34,输出的结果应当是.a=55.0,b=34.0,c=12.0。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构! 试题程序: #include<stdio.h> void fun(float*a,float*b,float*c) /*********found*********/ float*k; if(*a<*b) k=*a: *a=*b: *b=k; /*********found*********/ if(*a>*c) k=*c: *c=*a: *a=k; if(*b<*c) k=*b; *b=*c; *c=k; void main() float a,b,c; printf("Input a b c:"); scanf("%f%f%f",&a,&b,&c); printf("a=%4.1f,b=%4.1f,c=%4.1f/n/n",a,b,c); fun(&a,&b,&c); printf("a=%4.1f,b=%4.1f,c=%4.1f/n/n",a,b,c);
填空题下列给定程序是建立一个带头结点的单向链表,并用随机函数为各结点数据域赋值。函数proc()的作用是求出单向链表结点(不包括头结点)数据域中的最大值,并且作为函数值返回。请修改程序中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<stdlib.h>
typedef struct aa
{ int data;
struct aa*next;
}NODE;
//****found****
proc(NODE*h)
{int max=-1;
NODE*p;
p=h->next;
while(p)
{ if(p->data>max)
max=p->data;
//****found****
p=h->next;
}
return max;
void outresult(int s,FILE*pf)
{ fprintf(pf,"/nThe max in link:%d/n",s);}
NODE*creatlink(int n,int m)
{ NODE*h,*p,*s;
int i;
srand((unsigned)time(NULL));
h=p=(NODE*)malloe(sizeof(NODE));
h->data=9999;
for(i=1;i<=n;i++)
{ s=(NODE*)malloc(sizeof(NODE));
s->data=rand()%m;s->next=p->
next;
p->next=s;p=p->next;
}
p->next=NULL;
return h;
}
void outlink(NODE*h,FILE*pf)
{ NODE*p;
p=h->next;
fprintf(pf,"/n The LIST:/n/n HEAD");
while(p)
{ fprintf(pf,"->%d",p->data);
p=p->next;}
fprintf(pf,"/n");
}
void main()
{ NODE*head;int m;
system("CLS");
head=creatlink(12,100);
outlink(head,stdout);
m=proc(head);
printf("/nThe RESULT:/n");outresult
(m,stdout);
}
填空题以下程序运行后的输出结果是{{U}} {{/U}}。 fun(iht x) if(x/2>0) fun(x/2); printf("%d",x); main() fun(6);
填空题下列程序的运行结果为 【15】 。 main () int i=lO,*p,*func(); p= printf("%d ",*p); p=func (p); printf ( "%d/n", *p) int *func(px); int *px; int temp=20; px= return (px);
填空题下列给定程序中,函数fun的功能是:找出形参s所指字符串中出现频率最高的字母(不区分大小写),并统计出其出现的次数。
例如,形参s所指的字符串为:abcAbsmaxless,程序执行后的输出结果为:
leffer"a":3times
leffer"s":3times
请在程序的下划线处填入正确的内容,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#include<string.h>
#include<ctype.h>
void fun(char*s)
{int k[26]={0},n,i,max=0;char ch;
while(*s)
{if(isalpha(*s))
{
/********found********/
ch=tolower(______);
n=ch-"a";
/********found********/
k[n]+=______;
}
s++;
/********found********/
if(max<k[n])max=______;
}
printf("/nAfter count:/n");
for(i=0;i<26;i++)
if(k[i]==max)
printf("/nletter"%c":%d times/n",i+"a",k[i]);
}
main()
{char s[81];
printf("/nEnter a string:/n/n");
gets(s);fun(s);}
填空题以下程序运行后的输出结果是{{U}} {{/U}}。 #include<stdio.h> main() int a=200,b=010; printf("%d%d//n",a,b);
填空题对如下图所示的二叉树进行中序遍历的结果为______。
填空题如果一个工人可管理多个设施,而一个设施只被一个工人管理,则实体“工人”与实体“设备”之间存在 【5】 联系。
填空题以下程序运行时,若从键盘输入:10 20 30 <回车>,输出的结果是 【6】 。 #include<stdio.h> main() int i=0,j=0,k=0; scanf("% d%* d%d", &i,&j,&k); prinff("%d%d%d/n",i,j,k);
填空题以下程序运行后的输出结果是{{U}} 【18】 {{/U}}。
fun(int x)
{ if(x/2>0)fun(x/2);
printf("%d ",x);
}
main()
{ fun(6); }
填空题以下程序的功能是输出如下形式的方阵: 13 14 15 16 9 10 11 12 5 6 7 8 1 2 3 4 请填空。 main() int i,j,x; for(j=4;j (10) ;j--) for(i=1;i<=4;i++) x=(j-1)*4+ (11) ; printf("M",x); printf("/n");
填空题人员基本信息一般包括:身份证号,姓名,性别,年龄等。其中可以作为主关键字是 ______。
填空题在面向对象方法中_________描述的是具有相似属性与操作的一组对象。
