设为首页|收藏学知识 |改版意见收集|智能DIY搜索|加入我们|网站地图
当前在线人数:8770
文化共享 好教程 易学习 新资讯
计算软件水平考试

高级语言程序设计模拟试卷(六)

2007-04-29 源自: 网友评论 共有( )条评论! 内容报错
本文章地址:http://kao.xuezhishi.net/ITtest/level/2007-04-29/23290.html [将本信息与朋友分享!]

                     

模拟试卷(六)

一、单项选择题(在本题的每一小题的备选答案中只有一个答案是正确的,请把你认为正确的答案的题号,填入题干的括号内。多选不给分。每题1分,共20分)

1.执行语句
  printf("%d/n",12&012);
 的输出结果是(   )。
  (1)12   (2)8   (3)6   (4)012

2.若设n是个整型变量且已有值,则与给定条件表达式
  (!n)?n+10:n-10
  等价的条件表达式是(    )。
   (1)(n!=0)?n+10:n-10      (2)(n!=1)?n+10:n-10
   (3)(n==0)?n+10:n-10      (4)(n==1)?n+10:n-10

3.设有程序  
   #include <stdio.h>
   main()
   {
      int x=3,y=0,z=0;
      if (x=y+z)
       printf("****/n")
      else
       printf("####/n");
    }
   则以下叙述正确的是(   )。 
   (1)程序有语法错误,不能通过编译
   (2)程序可执行,输出结果是****
   (3)程序可以通过编译,但是不能通过连接,因而不能运行
   (4)程序可执行,输出结果是####

4.设x和y均为int型变量,则执行下面for语句后,y的值为(   )。
   for (y=1,x=1;y=50;y++)
   {
      if (x>=10)
        break;
      if (x%2==1)
      {
        x+=5;
        continue;
       }
        x=-3;
     }
   (1)2   (2)4   (3)6   (4)8

5.执行下述程序的输出结果是(   )。
  #include <stdio.h>
  main()
  {
    int i,j,m=0,n=0
    for (i=0;i<2;i++)
      for (j=0;j<2;j++)
        if (j>=i) m=1;n++;
    printf("%d/n",n);
   }
  (1)4   (2)2   (3)1  (4)o
6.执行下述程序的输出结果是(    )
  #include <stdio.h>
  main( )
  {
    int k=0,m=0;
    int i,j;
    for (i=0;i<2;i++)
    {
      for (j=0;j<3;j++)
        k++;
      k-=j;
    }
    m=i+j;
    printf("k=%d,m+%d/n",k,m);
   }
   (1)k=1,m=3  (2)k=1,m=5  (3)k=0,m=3  (4)k=0,m=5

7.运行下述程序后,如果从键盘上输入
  65 14
  则输出结果是(   )。
  #include <stdio.h>
  main()
  {
    int m,n;
    printf("Enter m,n:");
    scanf("%d%d",&m,&n);
    while (m!=n)
    {
      while (m>n)
       m-=n;
      while (n>m)
       n-=m;
     }
     printf("m=%d/n",m);
   }
   (1)m=1    (2)m=2   (3)m=3   (4)m=0

8.下述对于c语言字符数组的描述中错误的是(   )。
  (1)字符数组可以存放字符串
  (2)字符数组中的字符串可以整体输入、输出
  (3)可以在赋值语句中通过赋值运算符“=”对字符数组整体赋值
  (4)不可以用关系运算符对字符数组中的字符串进行比较

9.下述程序段所实现的功能是(   )。
  int a[]={4,0,2,3,1},i,j,t;
  for (i=1;i<5;i++)
   {
     t=a[i];
     j=i-1;
     while (j>=0&&t>a[j])
     {
       a[j+1]=a[j];
       j--;
      }
      a[j+1]=t;
     }
   (1)对数组a进行插入排序(按升序)
   (2)对数组a进行插入排序(按降序)
   (3)对数组a进行选择排序(按升序)
   (4)对数组a进行选择排序(按降序)

10.若有以下定义
  char s[20]="programming",*ps=s;
  则不能正确地表示其值等于字符'o'的表达式是(   )。
  (1)ps+2   (2)s[2]  (3)ps[2]   (4)ps+=2,*ps

11.阅读程序
   #include <stdio.h>
   int func(int b[],int n)
   {
     int i,r;
     r=1;
     for (i=0;i<=n;i++)
         r=r*b[i];
        return (r);
    }
    main()
    {
      int x,a[]={2,3,4,5,6,7,8,9};
      x=func(a,3);
      printf("%d/n",x);
     }
   执行下述程序的输出结果是(    )。
   (1)720  (2)120   (3)24    (4)6

12.执行下述程序的输出结果是(    )。
   #include <stdio.h>
   main()
   {
     char *t="23142";
     int a=0,b=0,c=0,d=0,i;
     for (i=0;t[i];i++)
         switch (t[i])
          {
            default :d++;
            case '1':a++;
            csse '2':b++;
            case '3':c=+;
           }
        printf("%d,%d,%d,%d/n",a,b,c,d);
     }
   (1)1,2,1,1     (2)2,4,5,1    (3)2,5,7,1     (4)1,1,1,1

13.以下程序当运行时,如果从键盘上输入
   ABCD
  则输出结果是(   )。
  #include <stdio.h>
  #include <string.h>
  func(char str[])
  {
     int num=0;
     while (*(str+num)!='/0')
       num++;
     return (num);
  }
  main()
  {
     char str[10],*p=str;
     gets(p);
     printf("%d/n",func(p));
   }
   (1)8  (2)7   (3)6   (4)5

14.设有如下函数定义
   int func(char *s)
   {
     char *p=s;
     while (*p1='/0')
        p++;
     return 9p-s);
    }
   如果在主程序中用下面的语句调用上述函数,则输出结果是(   )。
   printf("%d/n",func("Good-bye!"));
   (1)4   (2)8   (3)9   (4)0

15.执行下述程序的输出结果是(   )。
   #include <stdio.h>
   void fib(int n,int *s)
   {
     int f1,f2;
     if (n==0)
     *s=0;
    else if (n==1)
     *s=1;
    else 
    {
      fib(n-1,&f1);
      fib(n-2,&f2);
      *s=f1+f2;
     }
    }
    main()
    {
      int x;
      fib(6,&x);
      printf("%d/n",x);
     }
   (1)21    (2)17   (3)8    (4)5

16.若有以下对函数func的调用语句,则函数func不正确的函数首部是(   )。
   #include <stdio.h>
   main()
   {
     ······
          int a[50],n;
     ······
         func(n,&a[9]);
     ······
      }
   (1)void func(int m,intx[])        (2)void func(int s,int h[41])
   (3)void func(int p,int *s)        (4)void func(int n,int a)

17.执行下述程序的输出结果是(  )。
  #include <stdio.h>
    struct stu
    {
      int num;
      char name[10];
      int age;
     };
     void func(struct stu *p)
     {
       printf("%s/n",(*p).name);
     }
     main()
     {
        struct stu students[3]={
                                  {9801,"Zhang",20},
                                  {9802,"Wang",19},
                                  {9803,"Zhao",18}
                                };
        func(students+2);
       }
     (1)Zhang    (2)Zhao   (3)Wang    (4)18

18.执行下述程序段后的输出结果是(   )。
  enum days
    {
      MON=1,TUE,WED,THU,FRI,SAT,SUN
     };
     enum days today,dayaftertomorrow;
     today=SAT;
     dayaftertomorrow=(enum days)(((int)today+2)%7;
     printf("%d/n",(int)dayaftertomorrow);
    (1)1    (2)0    (3)MON    (4)编译时出错

19.以下不能将文件位置指针重新移到文件开头位置的函数是(   )。
  (1)rewind(fp);
    (2)fseek(fp,0L,SEEK_SET);
    (3)fseek(fp,-(long)ftell(fp),SEEK_CUR);
    (4)fseek(fp,0L,SEEK_END);

20.执行以下程序的输出结果是(   )。
  #include <stdio.h>
    #define PR(a) printf("a=%4.2f",a)
    #define PINTF(a) PR(a);putchar('/n');
    main()
    {
      float y=1.5;
      PRINT(y);
     }
    (1)1.5=1.50    (2)a=1.50   (3)y=1.50   (4)1.50

http://kao.xuezhishi.net/ITtest/level/2007-04-29/23290.html
分页:[1] 2 3 4
评论 点击查看
 


加入QQ群:35714363 一起成长
我要加入更多群 我有意见要反映
考试教室

学知识原创教程下载

本类最近更新
阅读排行

其他相关信息