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

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

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

                     

模拟试卷(四)

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

1.以下各选项中,均是c语言保留字的组是(   )。
 (1)integer、floa、double         (2)If、else、switch
 (3)struct、union、enum           (4)auto、static、external

2.执行下述程序的输出结果是(   )。
 #include <stdio.h>
 main()
  {
     int a,b,c=246;
     a=c/100%9;
     b=(-1)&&(-1);
     printf("%d,%d/n",a,b);
   }
   (1)2,1    (2)3,2   (3)4,3    (4)2,-1
3.与语句
  y=(x>0?1:x<0?-1:0);
  的功能相同的if语句是(   )。
  (1)if (x>0) y=1;              (2)if (x)
     else if (x0) y=-1;              if (x>0) y=1;
     else y=0;                       else if (x<0) y=-1;
                                     else y=0;
  (3)y=-1;                       (4)y=0;
     if (x)                         if (x>=0)
       if (x>0) y=1;                  if (x>0) y=1;
     else if (x==0) y=0;            else y=-1;
     else y=-1;

4.两次运行下述程序,如果从键盘上分别输入6和4,则输出结果是(   )。
  #include <stdio.h>
  main()
   {
     int x;
     xcanf("%d",&x);
     if (x++>5)
        printf("%d/n",x);
     else
        printf("%d/n",x--);
    }
   (1)7和5      (2)6和3       (3)7和4      (4)6和4

5.执行下述程序的输出结果是(    )。
  #include <stdio.h>
  main()
  {
    int x=3;
    do
    {
       printf("%d/n",x-=2);
    }  while (!(--x));
   }
   (1)1     (2)1       (3)3      (4)死循环
                -2         0

6.执行下述程序的输出结果是(   )。
  #include <stdio.h>
  main()
  {
    int x=10,y=10,i;
    for (i=0;x>8;y++i)
      printf("%d %d",x--,y);
    printf("/n");
   }
   (1)10 1 9 2      (2)9 8 7 6     (3)10 9 9 0     (4)10 10 9 1

7.运行以下程序后,如果从键盘上输入
   China#
   则输出结果为(   )。 
   #include <stdio.h>
   main()
   {
     int v1=0,v2=0;
     char ch;
     while ((ch=getchar())!='#')
     {
       switch (ch)
       {
         case 'a':
         case 'h':
         default :v1++;
         case 'o':v2++;
        }
      }
      printf("%d,%d/n",v1,v2);
     }
    (1)2,0     (2)5,0    (3)5,5     (4)2,5

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

9.以下带初始赋值的二维数组说明语句中语法正确的是(   )。
   (1)int a[2][]={{1,0,1},{5,2,3}};
   (2)int a[][3]={{1,2,3},{4,5,6}};
   {3}int a[2][4]={{1,2,3},{4,5},{6}}
   (4)int a[][3]={{1,0.1},{},{1,1}};

10.若有以下的定义
   int a[]={1,2,3,4,5,6,7,8,9,10},*p=a;
  则值为3的表达式是(    )。
   (1)p+=2,*(p++)    (2)p+=2,*++p
   (3)p+=3,*p++      (4)p+=2,++*p

11.下面程序的运行结果是(   )。
   #include <stdio.h>
   main()
   {
     char a[]="programming",*p;
     p=a;
     while (*p!='i')
     {
       printf{"%c",*p-32);
       p++;
      }
      printf("E/n");
    }
   (1)PROG    (2)programmE   (3)PROGRAMME    (4)PROGRAMM

12.设有如下定义
   int (*ptr) ();
   则以下叙述中正确的是(    )。
   (1)ptr是指向一维数组的指针变量
   (2)ptr是指向int型数据的指针变量
   (3)ptr是指向函数的指针,该函数返回一个int型数据
   (4)ptr是一个函数名,该函数的返回值是指向int型数据的指针

13.设有下述函数定义
   int stlen (char *s)
   {
      int n=0;
      while (*s++)
        n++;
      return (n);
    }
   若调用此函数时,字符指针s所指向的字符串是"I love this game.",则函数的返回值是(    )。
   (1)17   (2)16     (3)18    (4)0

14.执行下述程序的输出结果是(    )。
   #include <stdio.h>
   func(int x)
   {
     static int a=3;
     a+=x;
     return (a);
    }
    main()
    {
      int k=2,m=1,n;
      n=func(k);
      n+=func(m);
      printf("%d/n",n);
    }
    (1)8     (2)9   (3)11    (4)14

15.执行下述程序的输出结果是(    )。
  #include <stdio.h>
  sub1(char a,char b)
  {
     char c;
     c=a;
     a=b;
     b=c;
   }
   sub2(char *a,char b)
   {
     char c;
     c=*a;
     *a=b;
     b=c;
    }
    sub3(char *a,char *b)
    {
      char c;
      c=*a;
      *a=*b;
      *b=c;
     }
      main()
      {
        char a,b;
        a='A';b='B';
        sub3(&a,&b);
        putchar (a);
        putchar (b);
        a='A'; b='B';
        sub2(&a,b);
        putchar(a);
        putchar(b);
        a='A';b='B';
        sub1(a,b);
        putchar(a);
        putchar(b);
        printf("/n");
       }
    (1)BABBAB    (2)ABBBBA    (3)BABABA     (4)BAABBA

16.以下程序运行后,输出结果是(    )。
   #include <stdio.h>
   func(int a,int b)
   {
      static int m=0,i=2;
      i+=m+1;
      m=i+a+b;
      return (m);
    }
    main()
    {
      int k=4,m=1,p;
      p=func(k,m);
      printf("%d,",p);
      p=func(k,m);
      printf("%d/n",p);
     }
     (1)8,15      (2)8,16     (3)8,17     (4)8,8

17.以下所写结构体类型定义和变量说明中,语法上有错误的是(    )。
   (1)struct item
      {
        int num;
        struct item *next;
       };
       struct item  *head;
    (2)struct item
       {
         int num;
         struct item *next;
        } *head;
     (3)#defime ITEM struct item
        ITEM
        {
          int num;
          ITEM *next;
         };
         ITEM *head;
     (4)struct item
        {
          int num;
          struct item *next;
         };
         item *head;

18.执行下述程序的输出结果是(   )。
    #include <stdio.h>
    main()
    {
      union
      {
        char c[4];
        int i[2];
       } u;
       int m;
       u.i[0]=ox4142;
       u.i[1]=ox6162;
       for (m=0;m<4;m++)
         printf("%c",u.c[m]);
       printf("/n");
      }
     (1)abAB   (2)baBA    (3)ABab    (4)BAba

19.设a是一个一维数组变量,其说明如下:
  int a[5];
  若已知fp是指向某个已打开的磁盘文件的文件指针,则下面函数调用语句中不正确的是(    )。
  (1)fread (a[0],sizeof(int),5,fp);
  (2)fread (&a[0],5*sizeof(int),1,fp);
  (3)fread (a,sizeof(int),5,fp);
  (4)fread(a,5*sizeof(int),1,fp);

20.指向如下程序后,输出结果为(    )。
   #include <stdio.h>
   #define N 4+1
   #define RE 5*M+M*N
   main()
   {
     printf("%d/n",RE/2);
    }
   (1)150    (2)100    (3)41    (4)以上结果均不正确

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


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

学知识原创教程下载

本类最近更新
阅读排行

其他相关信息