青岛理工大学
  1. 以下程序执行后输出的结果是(   )。#include "stdio.h"main() {  int i=1,s=0;  do {   if(i%3){i+=2;continue;}    s+=i;  i++;  }  while(i<8);  printf("%d\n",s); }

  2. A:12 B:9 C:21 D:16
    答案:9
  3. 若运行时给变量x输入12,则以下程序的运行结果是( )。#include "stdio.h"main(){ int x,y; scanf("%d",&x);y=x>12?x+10:x-12;printf("%d\n",y); }

  4. A:0 B:22 C:12 D:10
    答案:0
  5. 在C语言中,要求运算数必须是整型的运算符是(   )

  6. A:/ B:< C:! D:%
    答案:%
  7. 以下选项中可用作C程序合法实数的是(   )。

  8. A:

    E9

    B:

    9.12E

    C:

    .1e3

    D:3.0e0.2
    答案:.1e3
  9. 若要求定义具有10个int型元素的一维数组a,则以下定义语句中错误的是()。

  10. A:

    int n=10,a[n];

    B:

    #define n 5            
    int a[
    2*5];

    C:

    int a[5+5];

    D:

    #define N 10            
    int a[N];


    答案:int n=10,a[n];
  11. 以下程序的运行结果是(   )。#include "stdio.h"void fun(int x, int y, int z){   y=x+5;   z=x*y;   x=z-y;}main( ){ int x=10,y=20,z=30;   fun(z,y,x);   printf("%d,%d,%d",x,y,z);}

  12. A:

    10,20,30

    B:

    565,35,600

    C:

    15200185

    D:

    30,20,10  


    答案:10,20,30
  13. 以下程序的运行结果是(    )。#include "stdio.h"main() {     int p[7]={11,13,14,15,16,17,18},i=0,k=0;     while(i<7&&p[i]%2)    {k=k+p[i]; i++;}     printf("%d  ",k); }

  14. A:

    56

    B:

    45

    C:

    24

    D:

    58


    答案:24
  15. 下列不正确的转义字符是(   )。

  16. A:

    '067'

    B:

    ‘\\’

    C:

    '\t'

    D:

    '\x8a'


    答案:'067'
  17. 若有代数式3ae/(bc),则不正确的C语言表达式是 (    )。

  18. A:

    a/b/c*e*3

    B:

    3*a*e/b/c

    C:

    a*e/c/b*3

    D:

    3*a*e/b*c


    答案:3*a*e/b*c
  19. 以下程序段中的变量已正确定义        for(i=0; i<4; i++, i++)            for(k=1; k<3; k++)                printf("*");程序段输出的结果是(  )。

  20. A:

    ********

    B:

    ****

    C:

    **

    D:

    *

  21. 要判断char类型变量m是否为数字字符,可以使用下列表达式(  )。

  22. A:0<=m && m<=9  B:'0’<=m || m<='9’ C:'0’<=m && m<='9’ D:

    '0'<=m & m<='9’

  23. 若执行下面的程序时从键盘上给a,b分别赋值4和5,则输出结果是(    )。#include 'stdio.h'main(){ int a,b,s; scanf('%d%d',&a,&b); s=a; if(a
    A:5 B:4 C:16 D:25
  24. 以下C语言用户标识符中,不合法的是(   )。

  25. A:

    AaBc

    B:

    a_b

    C:

    _1

    D:

    a--b

  26. 以下选项中,当x为大于1的奇数时,值为0的表达式为(   )。

  27. A:

    x%2==1

    B:

    x%2!=0

    C:

    x%2==0

    D:

    x/2

  28. 语句while(x%3) a++; 中的表达式x%3等价于( )。

  29. A:x%3!=0 B:x%3==1 C:x%3==2 D:x%3==0
  30. 下列程序的输出结果是(    )。#include "stdio.h" main() {  int a=15,x=20; if(x==a)  printf("%d ", x); else  printf("%d ", x); }

  31. A:20 B:1 C:15 D:0
  32. 以下程序执行后的输出结果是( )。#include "stdio.h"main( ){int k=2,s=0;switch(k) { case 1: s+=10; break; case 2: s+=20; break; default: s+=3;}printf("%d\n",s);}

  33. A:10 B:23 C:30 D:20
  34. 以下程序执行后的输出结果是(  )。#include "stdio.h"main()      { int m,i;        for(i=1;i<=50;i++)        { m=i;          if(m%2==0)            if(m%3==0)              if(m%7==0)                 printf("%d ",m);        }       }

  35. A:41 B:42 C:28 D:27
  36. "AA"在内存中占据的字节数是(   )。

  37. A:2 B:4 C:3 D:1
  38. 以下程序执行时输入Language Programming的结果是(    )。#include "stdio.h"#include "string.h"main(){ char str[30];  gets(str);  printf("%s",str);}

  39. A:Language B:Language, Programming C:Language Programming D:Programming
  40. 有定义语句:char s[10];,若要从终端给 s 输入5个字符,错误的输入语句是(  )。

  41. A:

    gets(&s[0]);

    B:

    gets(s);

    C:

    scanf("%s", s);

    D:

    scanf("%s", s[0]);

  42. 以下程序运行后的输出结果是(  )。#include "stdio.h"main(){int a[8]={11,12,13,14,15,16,17,18},i=1,s=0; while(i<7){ if(a[i]%3) s+=a[i];  i++;} printf("%d ",s); }

  43. A:60 B:45 C:71 D:27
  44. 表示数学关系a≥b>c的C语言表达式形式为(    )。

  45. A:

    (a>=b)&&(b>c)

    B:

    (a>=b)&(b>c)

    C:

    (a>=b)AND(b>c)

    D:

    (a>=b>c)

  46. 以下程序的输出结果是(    )。#include "stdio.h"main( ){     int i,j,k;    for(i=1;i<3;i++)       for(j=1;j<3;j++)      { if (i!=j)            { k=i*10+j;           printf("%d  ",k);         }        }}

  47. A:21 22 31 32 B:12 21 C:11  22 D:11 12 21 22
  48. 下列变量定义中合法的是(   )。

  49. A:

    double  b=1+5e2.5;

    B:float  2_and=1e-3; C:short  _a=12; D:

    long   do=0x12L;

  50. 以下叙述中不正确的是(   )。

  51. A:在一个函数内的复合语句中定义的变量在本函数范围内有效 B:函数中的形式参数是局部变量 C:在一个函数内定义的变量只在本函数范围内有效 D:在不同的函数中可以使用相同名字的变量
  52. 以下程序的执行结果是(   )。#include "stdio.h"main(){   int  a=10, y=10;   do    {       a+=4; y+=a;      printf("a=%d,y=%d ",a,y);      if(y>20) break;  }     while(a==14);}

  53. A:a=14,y=34 B:a=18,y=28 C:a=14,y=24 D:a=18,y=42
  54. 以下程序运行后的输出结果是(  )。#include "stdio.h"main(){ char a;  for(a=0; a<15; a+=5)  { putchar(a+'A');}}

  55. A:

    A0

    B:

    A5

    C:

    A10

    D:

    AFK

  56. 设x和y均为int型变量,则执行下列循环后,y值为( )。for(y=1,x=1;y<=50;y++){ if(x>=10) break;  x+=3;}

  57. A:6 B:8 C:2 D:4
  58. 以下程序的运行结果是(    )。#include  "stdio.h"int a, b;void fun( ){ a=10; b=20; }main( ){ int a=5, b=7;  fun( );  printf("%d  %d", a,b);}

  59. A:

    5  7

    B:

    10  20

    C:

    7  5

    D:

    20  10

  60. 设a、b和c都是int型变量,且a=3,b=4,c=5,则下面的表达式中,值为0的表达式是(  )。

  61. A:

    'a'&&'b'

    B:

    a<=b

    C:a||b+c&&b-c D:

    !((a<b)&&!c||1)

  62. 以下程序的输出结果是( )。#include "stdio.h"main() { int p,a=5; if(p=a!=0) printf("%d\n",p); else printf("%d\n",p+2); }

  63. A:1 B:3 C:5 D:2
  64. 下面程序的功能是:输入一些整数,编程计算并输出其中所有正数的和,输入负数时不累加,继续输入下一个数。输入零时,表示输入数据结束。要求最后统计出累加的项数。在[【1】处填写适当的表达式,使程序完整并符合题目要求。  #include "stdio.h"main(){   int i=0,n,sum=0;   printf("Input a number:");   scanf("%d",&n);   while(【1】)    {if(n>0)        {sum=sum+n;i++;}      printf("Input a number:");       scanf("%d",&n);     }    printf("sum=%d,count=%d\n",sum,i);}

  65. A:

    n<0

    B:

    n!=0

    C:

    1

    D:

    n==0

  66. 循环语句for(i=0,j=0;(j!=4)||(i<3);i++); 的循环次数是(       )

  67. A:

    2

    B:

    3次

    C:

    4次

    D:

    无限次

  68. 以下程序运行后的输出结果是( )。#include "stdio.h"main(){ char a='H';a=(a>='A' && a<='Z')? (a+'a'-'A'): a;printf(" %c\n", a);}

  69. A:a B:h C:H D:A
  70. 设ch是char型变量,其值为a,且有下面的表达式:ch=(ch>='a'&&ch<='z')?(ch-32):ch上面表达式的值是(  )。

  71. A:Z B:a C:z D:A
  72. 以下错误的定义语句是(  )。

  73. A:

    int x[4][3]={{1,2,3},{1,2,3},{1,2,3}{1,2,3}};

    B:

    int x[][3]={{0},{1},{1,2,3}};

    C:

    int x[][3]={1,2,3,4};

    D:

    int x[3][3]= {{1,2,3},{1,2,3},{1,2,3}{1,2,3}};

  74. 以下程序的输出结果是(    )。#include "stdio.h"main( ){ int  a[3][3]={{1,2},{3,4},{5,6}},i,j,s=0;   for(i=1;i<3;i++)  for(j=0;j<=i;j++) s+=a[i][j];   printf("%d\n",s);}

  75. A:

    18

    B:

    21

    C:

    20

    D:

    19

  76. 下面程序运行的结果是(   )。 #include "stdio.h"main(){char ch[7]={ "89cd51"};  int  i,s=0;  for(i=0;ch[i]>='0'&&ch[i]<='9';i++)   s=10*s+ch[i]-'0';   printf("%d ",s);  }

  77. A:

    8951

    B:

    89cd51

    C:

    85

    D:

    89

  78. 给出以下定义:char str1[ ]="1234567";char str2[ ]={'1','2','3','4','5','6','7'};则正确的叙述为(   )。

  79. A:

    数组str1和数组str2等价

    B:数组str1的长度小于数组str2的长度 C:数组str1的长度大于数组str2的长度 D:

    数组str1和数组str2的长度相同

温馨提示支付 ¥5.00 元后可查看付费内容,请先翻页预览!
点赞(3) dxwkbang
返回
顶部