设为首页 加入收藏

TOP

计算机等级考试二级C语言模拟试卷(六)(四)
2023-07-23 13:31:33 】 浏览:275
Tags:计算机
       D)9

(28)有以下程序

#include<stdio.h>

#define N 4

void  fun(int a[][N],int b[])

{

       int i;

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

              b[i]=a[i][i]-a[i][N-1-i];

}

void main()

{

    int x[N][N]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};

    int y[N],i;

    fun(x,y);

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

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

   printf("\n");

}

程序运行后的输出结果是

A)-12,-3,0,0,                              B)-3,-1,1,3,

C)0,1,2,3,                                     D)-3,-3,-3,-3 

(29)有以下函数

int fun(char *x,char *y)

{  int n=0;

    while ((*x=*y)&&*x!='\0') {x++;y++;n++;}

    return n:

)

函数的功能是

A)查找x和y所指字符串中是否有'\0'

B)统计x和y所指字符串中前面连续相同的字符个数

C)将y所指字符串赋给X所指存储空间

D)统计x和y所指字符串中相同的字符个数

(30)若有定义语句:char *s1="OK",*s2="ok";,以下选项中,能够输出"OK"的语句是

A)if(strcmp(s1,s2)=0)  puts(s1);          B)if(strcmp(s1,s2)!=0) puts(s2);

C)if(strcmp(s1,s2)=1)  puts(s1);          D)if(strcmp(s1,s2)!=0) puts(s1);

(31)以下程序的主函数中调用了在其前面定义的fun函数

main()

{  double a[15],k;

    k=fun(a);

}

则以下选项中错误的fun函数首部是

A)double fun(double a[15])                    B)double fun(double *A)

C)double fun(double a[])                        D)double fun(double A)

(32)有以下程序

#include <stdio.h>

#include <string.h>

int main()

{

    char a[5][10]={"china","beijing","you","tiananmen","welcome"};

    int i,j;  char t[10];

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

      for(j=i+1;j<5;j++)

         if (strcmp(a[i],a[j])>0)

               { strcpy(t,a[i]); strcpy(a[i],a[j]); strcpy(a[j],t); }

    puts(a[3]);

    return 0;

}

程序运行后的输出结果是

A)Beijing               B)china                  C)welcome               D)tiananmen

(33)有以下程序

#include <stdio.h>

in

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/7/7
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇OpenGL ES EGL eglMakeCurrent 下一篇OpenGL ES EGL eglDestroySurface

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目