题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-06-03 04:24:14

[单项选择]以下程序(函数fun只对下标为偶数的元素进行操作)运行后的输出结果是
#include<stdio.h>
void fun(int *a, int n)
 int i, j, k, t;
 for(i=0; i<n-1; i+=2)
  k=i;
  for(j=i; j<n; j+=2) if(a[j]>a[k]) k=j;
 t=a[i]; a[i]=a[k]; a[k]=t;
 

main( )
int aa[10]=1, 2, 3, 4, 5, 6, 7, i;
fun(aa, 7);
for(i=0; i<7; i++) printf("%d, ", aa[i]);
printf("/n");

A. 7,2,5,4,3,6,1
B. 1,6,3,4,5,2,7
C. 7,6,5,4,3,2,1
D. 1,7,3,5,6,2,1

更多"以下程序(函数fun只对下标为偶数的元素进行操作)运行后的输出结果是 "的相关试题:

[单项选择]以下程序(函数fun只对下标为偶数的元素进行操作)运行后的输出结果是()
#include<stdio.h>
void fun(int *a, int n)
 int i, j, k, t;
 for(i=0; i<n-1; i+=2)
  k=i;
  for(j=i; j<n; j+=2) if(a[j]>a[k]) k=j;
 t=a[i]; a[i]=a[k]; a[k]=t;
 

main( )
int aa[10]=1, 2, 3, 4, 5, 6, 7, i;
fun(aa, 7);
for(i=0; i<7; i++) printf("%d, ", aa[i]);
printf("/n");

A. 7,2,5,4,3,6,1
B. 1,6,3,4,5,2,7
C. 7,6,5,4,3,2,1
D. 1,7,3,5,6,2,1
[单项选择]若程序执行时输入的数据是“2473”,则下述程序的输出结果是( )。
#include<stdio.h>
void main( )
int cx,
while((cx=getchar( ))!='/n')
switch(cx-'2')
case 0:
case 1:putchar(cx+4);
case 2:putchar(cx+4);
break;
case3: putchar(cx+3);
default: putchar(cx+2);



A. 668977
B. 668966
C. 6677877
D. 6688766
[单项选择]阅读下列程序,当运行函数时,输入abc de fg z10,则输出为
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int fun (char *str)
int i,j=0;
for(i=0;str[i]!='/0';i++)
if(str[i]!='') str[j++]=str[i];
str[j]='/0';

main( )

char str[81];
int n;
printf("Input a string:");
gets(str);
puts(str);
fun(str);
printf("%s/n",str);

A. abc
B. z10
C. abc de fg z10
D. abc de fg z10
[单项选择]阅读下列程序,当运行函数时,输入asd af aa z67,则输出为
#include <stdio.h>
#include <ctype.h>
#inelude <string.h>
int fun(char *str)
int i,j=0;
for(i=0;str[i]!='/0';i++)
if(str[i]!='')str[j++]=str[i];
str[j]='/0';

main( )

char str[81];
int n;
printf("Input a string:");
gets(str);
puts(str);
fun(str);
printf("%s/n",str);

A. asdafaaz67
B. asd af aa z67
C. asd
D. z67
[单项选择]

有以下程序:  
#include<stdi0.h>  
main( ) {
FILE *fp;
int i=20,j=50,k,n; 
  fp=fopen("d1.dat","W");
  fprintf(fp,"%d/n",i);
fprintf(fp,"%d/n",j); 
  fclose(fp); 
  fp=fopen("d1.dat","r",);  
  fscanf(fp,"%d%d",&k,&n);
printf("%d%d/n",k,n); 
  fclose(fp);  
}  
 程序运行后的输出结果是()


A. 20 30
B. 20 50
C. 30 50
D. 30 20
[单项选择]下列程序中函数son( )的功能是对数组a中的数据进行由大到小的排序。
#include<stdio.h>
void sort(int a[],int n)
int i,j,t;
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(a[i]<a[j])
t=a[i];a[i]=a[j];a[j]=t;


main( )
int a[10]=1,2,3,4,5,6,7,8,9,10,i;
sort(&a[1],7);
for(i=0;i<10;i++)printf("%d,",a[i]);

程序运行后的输出结果是( )。
A. 1,2,3,4,5,6,7,8,9,10,
B. 10,9,8,7,6,5,4,3,2,1,
C. 1,8,7,6,5,4,3,2,9,10,
D. 1,2,10,9,8,7,6,5,4,3,
[填空题]若输入I have a test.#,则以下程序的运行结果为 【10】
#include<stdio.h>
main( )
FILE*fp;
char str[100],filename[10];
int i=0;
if ((fp=fopen("test","w"))==NULL)
printf("can not open the file!/n");
exit(0);

getchar( );
gets(str);
while(str[i]!=’#’)
if (str[i]>=’a’ && str[i]<=’z’)
str[i]=str[i]-32;
fputc(str[i],fp);
i++;

fclose(fp);
fp=fopen("test","r");
fgets(str,strlen(str)+1,fp);
printf("%s/n",str);
fclose(fp);

[填空题]以下程序运行后输出结果是 【11】 。 #include void fun(int x) { if(x/5>0) fun(x/5);  printf("/%dn",x);  } main( ) { fun(11); printf("/n"); }
[单项选择]执行以下程序后,test.txt文件的内容是(若文件能正常打开)()。
#include<stdio.h>
main( )

FILE*fp;
char*s1="Fortran",*s2="Basic";
if((fp=fopen("test.txt","wb"))==NULL)

printf("Can't open test.txt file/n");exit(1);
fwrite(s1,7,1,fp);/*把从地址s1开始的7个字符写到fp所指文件中*/
fseek(fp,0L,SEEK_SET);/*文件位置指针移到文件开头*/
fwrite(s2,5,1,fp);
fclose(fp);

A. Basican
B. BasicFortran
C. Basic
D. FortranBasic
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
int fun( )
 static int x=1;
 x+=1; return x;

main( )
 int i,s=1;
 for(i=1; i<=5;i++) s+=fun( );
 printf("%d/n", s);

A. 11 B) 21 C) 6 D) 120
[单项选择]以下程序运行后的输出结果是
#include
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
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
void fun(int x)
 if(x/2>1) fun(x/2);
 printf("%d", x);

main( )
 fun(7); printf("/n");

A. 1 3 7 B) 7 3 1 C) 7 3 D) 3 7
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
int fun( )
static int x=1;
x*=2; return x;

main( )
int i, s=1;
for(i=1; i<=2; i++) s=fun( );
printf("%d/n", s);

A. 0
B. 1
C. 4
D. 8
[填空题]以下程序运行后的输出结果是【 】。   void fun(int x,int y)   { x=x+y;y=x-y;x=x-y;   printf("%d,%d,",x,y);}   main( )   { int x=2,y=3;    fun(x,y);    printf("%d,%d/n",x,y);   }
[简答题]以下程序运行后的输出结果是
#include <stdio.h>
void fun(int a[], int n)
int i,t;
for(i=0;i<n/2;i++) t=a[i];a[i]=a[n-1-i];a[n-1-i]=t;

main( )
int k[10]=1,2,3,4,5,6,7,8,9,10,i;
fun(k,5);
for(i=2;i<8;i++) printf("%d",k);
printf("/n");

[填空题]以下程序运行后的输出结果是【 】   int a=5;   fun(int b)   { static int a=10;    a+=b++;    printf("%d ",a);   }   main( )   { int c=20;    fun(c);    a+=c++;    printf("%d/n",a);   }

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码