当前位置:网站首页>100 basic multiple choice questions of C language (with answers) 04

100 basic multiple choice questions of C language (with answers) 04

2022-07-05 02:17:00 Su_ mer

  1. Of the following options , Only when the x The absolute value of is 1 to 6 When in range , Expression value
    by “ really ” Yes.
    A)(x>=-6)&&(x<=-1)||(x>=1)&&(x<=6)
    B)(x>=1)&&(x<=6)&&(x>=-6)&&(x<=-1)
    C)(x>=-6)||(x<=-1)||(x>=1)||(x<=6)
    D)(x>=1)&&(x<=6)||(x>=-1)&&(x<=-6)
    answer :A
  2. In the following program segments , The output information cannot correctly reflect the variable size relationship
    A)if (x>y) printf(" x>y “);
    if (x<y) printf(” x<y “);
    else printf(” x=y “);
    B)if(x>=y)
    if(x>y) printf(“x>y”);
    else printf(“x=y”);
    else printf(“x<y”);
    C)if (x>y) printf(” x>y “);
    if (y>x) printf(” x<y “);
    if (x==y) printf(” x=y “);
    D)if (x>y) printf(” x>y “);
    else if (y<x) printf(” x<y “);
    else printf(” x=y ");
    answer :A
  3. There are the following procedures
    #include <stdio.h>
    main()
    { int x,y=0,z=0,t;
    do
    { scanf("%d",&x);
    t=x>0;
    switch (t)
    { case 0: break;
    case 1: y+=x; continue;
    }
    z+=x;
    }
    while(x);
    printf("%d,%d\n",y,z);
    }
    Program run time input :-1 1 -2 2 0< enter >, The output is
    A) 1,0
    B) 3,-3
    C)1,1
    D)3,0
    answer :B
  4. There are the following procedures
    #include <stdio.h>
    main()
    { int x,a=1,b=1;
    while(1)
    { scanf("%d",&x);
    if(x>0) { a*=x; break; }
    if(x<0) { b*=x; continue; }
    printf("%d,%d\n",a,b);
    } }
    Program run time input :-1 -2 0 1 2 < enter >, The output is
    A) 2,2
    B) 1,2
    C)-1,1
    D)-2,1
    answer :B
  5. There are the following definitions and input statements
    char c1,c2;
    scanf("%3c%3c", &c1, &c2);
    If required, give c1 Enter letters M, to c2 Enter letters N, Then in the following input form
    The right is ( notes : On behalf of the space , Input starts from the first column )
    answer :A
  6. There are the following procedures
    #include <stdio.h>
    main()
    { int i,j;
    for( i=3; i>0; i-- ) { for( j=1; j<=i; j++ )
    putchar( '’);
    for( j=1; j<=3-i; j++ )
    putchar(’#’);
    putchar(’\n’);
    } }
    The output after execution is
    A)
    ***
    **#
    *##
    answer :A
  7. If there is a definition :int a=0,b=1,c=1;
    About logical expressions a++ || b++ && c++ The execution of each part of the is smooth
    order , The following statement is correct
    A) Execute first a++, Re execution b++, Finally, execute c++
    B) Execute first b++, Re execution c++, Finally, execute a++
    C) Execute first c++, Re execution b++, Finally, execute a++
    D) Execute first b++, Re execution a++, Finally, execute c++
    answer :A
  8. There are the following procedures
    #include <stdio.h>
    main( )
    { char s=“01234”;
    while(
    (++s) !=’\0’)
    { switch(*s-‘0’)
    { case 0:
    case 1: putchar(*s+1); break;
    case 2: putchar(*s+1); break;
    case 3: putchar(*s+1);
    default: putchar(*s+1); break;
    } } }
    The output of the program after execution is
    A) 2345
    B) 23445
    C)12345
    D)22345
    answer :B
  9. There are the following procedures
    #include <stdio.h>
    main( )
    { int a=-2, b=2;
    for(; ++a && --b;)
    printf("%d,%d,", a,b);
    }
    The output of the program after execution is
    A) -1,1,0,0,
    B)-1,1,0,1,
    C) -1,1,
    D)0,1,
    answer :C
  10. There are the following procedures
    #include <stdio.h>
    main()
    { int a=6, i;
    for (i=1; i<=3; i++)
    { if (a>=5) break;
    if (a%2) { a+=2; continue; }
    a= (a-3, a+4);
    }
    printf("%d,%d", i,a);
    }
    The output of the program after execution is
    A)1,6
    B)0,6
    C)8,6
    D)4,2
    answer :A
  11. In the following character constants , What is still the original English letter after output is
    A) ‘\t’
    B) ‘\s’
    C)’\n’
    D)’\r’
    answer :B
  12. There are the following procedures
    #include <stdio.h>
    main( )
    { char *a=“12345678”;
    char b[ ]=“happynewyear”;
    int i=4;
    printf("%c%c%s%s",*a, b[0], b+5, a+6);
    }
    The output of the program after execution is
    A) 1happynewyear78
    B)1hn78
    C) 1hnewyear78
    D)1hn7
    answer :C
  13. about if( expression ) sentence , The following statement is correct
    A)“ expression ” Any legal value can be used
    B) stay “ expression ” Variables of double precision type cannot appear in
    C) stay “ expression ” String constants cannot appear in
    D)“ expression ” The value of must be a logical value or an operation of a logical variable
    answer :A
  14. There are the following procedures
    #include <stdio.h>
    main()
    {
    int a, b;
    a = 0, b = 1;
    if (a++ && b++)
    printf(">");
    else
    printf("<");
    }
    The output of the program after running is
    A)<a=1,b=1
    B)<a=0,b=2
    C)>a=1,b=2
    D)>a=0,b=1
    answer :A
  15. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i, data;
    scanf("%d", &data);
    for (i=0; i<8; i++)
    {
    if (i <= data) continue;
    printf("%d,", i);
    } }
    Program runtime , Input from keyboard :5< enter >, Then the program output is
    A) 0,1,2,3,4,
    B) 6,7,
    C)5,6,7,
    D)6,7,8,
    answer :B
  16. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i, data;
    scanf("%d", &data);
    for (i=0; i<8; i++)
    {
    if (i >= data) break;
    printf("%d,", i);
    } }
    Program runtime , Input from keyboard :5< enter >, Then the program output is
    A)0,1,2,3,4,
    B)5,6,7,
    C)5,6,7,8,
    D)6,7,
    answer :A
  17. There are the following procedures
    #include <stdio.h>
    main()
    {
    char a, b;
    int i;
    a = ‘3’;
    b = ‘A’;
    for (i=0; i<6; i++)
    {
    if (i % 2) putchar(a + i);
    else putchar(b + i);
    } }
    The output of the program after running is
    A) B4D6F8
    B)AB56EF
    C) A4C6E8
    D)A5C7E9
    answer :C
  18. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i;
    for (i=0; i<5; i++)
    putchar(‘9’ - i % 2);
    }
    The output of the program after running is
    A)98989
    B)98765
    C)‘9’‘8’‘7’‘6’‘5’
    D)‘98989’
    answer :A
  19. As shown in the figure, a plane circle , The center of the circle is (2,1), The radius is 1:
    Of the following options , Judge the plane point (x,y) The expression that is true when it is in a circle is
    A)(x-2)(x-2)+(y-1)(y-1)<1
    B)abs(x-2)<1&&abs(y-1)<1
    C)x>1&&x<3&&y>0&&y<2
    D)(x-2)2+(y-1)2<1
    answer :A
  20. To take advantage of if-else Sentence judgment year Leap year or not , If it's a leap year, return to 1,
    If it is not a leap year, it returns 0.
    Among the following options, the program segment that cannot complete correct judgment is
    A)if(year%400= =0) return 1;
    else if(year%100!=0)
    if(year%4= =0) return 1;
    else return 0;
    B)if(year%400!=0)
    if(year%100= =0) return 0;
    else if(year%4= =0) return 1;
    else return 0;
    else return 1;
    C)if(year%100= =0)
    if(year%400= =0) return 1;
    else return 0;
    else if(year%4= =0) return 1;
    else return 0;
    D)if(year%4!=0) return 0;
    else if(year%400= =0) return 1;
    else if(year%100= =0) return 0;
    else return 1;
    answer :A
  21. Here's about switch The correct statement is
    A) char Type constants cannot be case Use
    B) all case The labels of should be continuous
    C) Every case There can be no after the statement label break sentence
    D)default Must be placed in all case Last
    answer :C
  22. There are the following procedures
    #include<stdio.h>
    #include<math.h>
    main()
    {
    int s; float n,t,pai;
    t=1,pai=0,n=1.0,s=1;
    while(fabs(t)>1.0e-6)
    {
    pai+=t;
    n+=2; s=-s;t=s/n;
    }
    printf(“total=%f\n”,pai);
    }
    What the program calculates is
    A)1-1/3+1/5-1/7+1/9-…
    B)1+1/3+1/5+1/7+1/9-…
    C)1+1/2+1/3+1/4+1/5-…
    D)1-1/2!+1/3!-1/5!+1/7!-…
    answer :A
  23. With definition :int sum=100,i;
    Of the following options , Can achieve sum -=1+2+3…+10 The program segment is
    A) for(i=0;i<=10;)
    sum=sum-i++;
    B) i=0;
    do
    {
    sum=sum-++i;
    }while(i<=10);
    C) i=0;
    while(i<>10)
    sum=sum - ++i;
    D) i=1;
    for( ;i<10;i++)
    sum=sum-i++;
    answer :A
  24. There are the following procedures
    #include<stdio.h>
    main()
    {
    int i;
    for(i=1;i<=10;i++)
    {
    if(i%3= =0)
    { printf("%d “,i);
    continue;
    }
    if(i%5= =0)
    {
    printf(”%d “,i);i++;
    }
    if(i%7= =0)
    {
    printf(”%d ",i);i++;
    break;
    } } }
    The result of the program running is
    A) 4 6 8
    B) 3 5 7
    C)3 6 9
    D)3 3 3
    answer :B
  25. What is wrong in the following statement is
    A)C The result of language logic operation is 0 And any non 0 value
    B)C Any legal expression in the language can be used as the object of logical operation
    C)C The value of language relation operation is only 0 and 1 Two possible
    D)C Used in language 0 To express logic “ false ”, Non zero represents logic “ really ”
    answer :A
  26. C The logical expression of language will produce “ A short circuit ” The phenomenon . if
    There is the following logical expression :
    x++ && y++
    What is correct in the following statement is
    A) if x The value of is 0, be y++ The operation is “ A short circuit ”,y The value remains the same
    B) if x The value of is 1, be y++ The operation is “ A short circuit ”,y The value remains the same
    C) if y The value of is 0, be && Arithmetic quilt “ A short circuit ”,y The value remains the same
    D) if y or x The value of is 0, Then the expression value is 0,x++ and y++ None of them
    answer :A
  27. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i,x,k=0,m;
    for(i=0;i<5; i++)
    {
    scanf("%d",&x);
    x/=10;
    switch(x)
    {
    case 0: case 1: case 2: k++;m=1;
    default : k++; m=2;
    case 3: k++; m=3;
    case 4: k++; m=4;
    } }
    printf("%d,%d",k,m);
    } Program run time input :35 20 52 40 106< enter >, The output is
    A) 5,2
    B) 13,4
    C)15,2
    D)5,4
    answer :B
  28. There are the following procedures
    #include <stdio.h>
    main()
    { int f=-2,k=4,a=0;
    while(f)
    { do
    { if(k%2) a++;
    else break;
    } while(–k);
    f++;
    }
    printf("%d,%d,%d",f,k,a);
    }
    The result of the program running is
    A) 0,0,2
    B) 0,4,0
    C)2,4,0
    D)0,4,2
    answer :B
  29. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i,f=1,s=0;
    for(i=1; i<100; i++)
    {
    s=s+fi;
    f=-f;
    i++;
    }
    printf(“s=%d\n”,s);
    }
    The function of the program is
    A) Calculation 1-3+5-7+…-99 Value
    B) Calculation 1-2+3-4+…-99 Value
    C) Calculation 1
    234*…99 Value
    D) Calculation 1
    357*…*99 Value
    answer :A
  30. In the following expression , Its value is not equal to the value 3 Yes.
    A)0 +‘3’
    B)‘D’-‘A’
    C)‘3’-‘0’
    D)‘d’- ‘a’
    answer :A
  31. There are the following procedures
    #include <stdio.h>
    main()
    {
    int a=0,b=0,c=0;
    if (++a || ++b && ++c)
    printf("%d,%d,%d\n", a, b, c);
    }
    The output of the program after execution is
    A) 0,1,1
    B)1,1,1
    C) 1,0,0
    D)1,1,0
    answer :C
  32. There are the following procedures
    #include <stdio.h>
    main( )
    { int a=123456, b;
    while(a)
    { b = a%10;
    a /= 10;
    switch(b)
    { default: printf("%d", b++);
    case 1:
    case 2: printf("%d", b++); break;
    case 3: printf("%d", b++); break;
    case 4: printf("%d", b++);
    }
    }
    }
    The output of the program after execution is
    A) 12345667
    B) 67564321
    C)76654321
    D)654321
    answer :B
  33. There are the following procedures
    #include <stdio.h>
    main( )
    { int a=-2, b=2;
    for(; a++ , b—; )
    printf("%d,%d,", a, b);
    }
    The output of the program after execution is
    A)-1,1,0,0,
    B)-1,1,0,1,
    C)-1,1,
    D)-1,1,-1,0,
    answer :A
  34. There are the following procedures
    #include <stdio.h>
    main()
    { int a = 6, i;
    for (i=1; i<=3; i++)
    { if (a<5) break;
    if (a%2) { a += 2; continue; }
    a = a + 4;
    }
    printf("%d,%d", i, a);
    }
    The output of the program after execution is
    A) 4,6
    B)3,18
    C) 4,18
    D)4,2
    answer :C
  35. About character constants ’\141’, The following statement is correct
    A) character \ The number after 141 It's octal.
    B) character \ The number after 141 It's decimal
    C) character \ The number after 141 It's hexadecimal
    D) character \ The number after 141 Because I didn't write 0 or 0x, Therefore, it is impossible to determine what is going on
    system
    answer :A
  36. There are the following procedures
    #include <stdio.h>
    main( ) {
    char b[] = “happynewyear”;
    printf("%s%s", “12345678”+4, b+8);
    }
    The output of the program after execution is
    A) 12345682year
    B)52345678year
    C) 5678year
    D)5678wyear
    answer :C
  37. about if( expression ) , The following statement is correct
    A)“ expression ” The value of can be 1
    B) stay “ expression ” Variables must appear in
    C) stay “ expression ” Non logical values cannot appear in
    D)“ expression ” The value of must be a logical value
    answer :A
  38. There are the following procedures
    #include <stdio.h>
    main()
    {
    int a = 0, b = 1;
    if (a++ && b++)
    printf(“T”);
    else
    printf(“F”);
    a = b++;
    printf(“a=%d,b=%d\n”, a, b);
    }
    The output of the program after running is
    A) Fa=1,b=1
    B) Fa=1,b=2
    C)Ta=0,b=2
    D)Ta=0,b=1
    answer :B
  39. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i, data;
    scanf("%d", &data);
    for (i=0; i<5; i++)
    {
    if ((i < data && i % 2) || (i > data && i % 3 == 0)) conti
    nue;
    printf("%d,", i);
    } }
    Program runtime , Input from keyboard :13< enter > after , The output of the program is
    A)0,2,4,
    B)1,3,5,
    C)0,1,2,3,4,5,
    D)0,1,2,3,
    answer :A
  40. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i;
    char data;
    scanf("%c", &data);
    printf("%d\n", data);
    for (i=2; i<10; i++)
    {
    if (data % i) continue;
    printf("%d,", i);
    } }
    Program runtime , Input from keyboard : B< enter > after , The first act of program output
    66, Then the second line is
    A) 6,
    B)2,3,4,5,6,7,8,9,
    C)10,
    D) 2,3,6,
    answer :D
  41. There are the following procedures
    #include <stdio.h>
    main()
    {
    char a = ‘0’, b = ‘A’;
    int i;
    for (i=1; i<6; i++)
    {
    if (i % 2 == 0) putchar(a + i);
    else putchar(b + i);
    } }
    The output of the program after running is
    A) 2B4DF
    B) B2D4F
    C)B4CD7
    D)A2A3B
    answer :B
  42. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i;
    for (i=0; i<3; i++)
    putchar(‘K’ - i);
    }
    The output of the program after running is
    A) KLM
    B) KJI
    C)LMN
    D)012
    answer :B
  43. After the code snippet in the following options is executed , Variable y The value of the 1 Yes.
    A)int x=10,y=0; if(x=y) y=1;
    B)int x=5,y=0; if(x) y=1;
    C)int x=5,y=0; if(5) y=1;
    D)int x=5,y=10; if(x=y) y=1;
    answer :A
  44. Of the following options , And the expression flag ? a*=2 : a/=3 The equivalent is
    A)flag!=0 ? a+=a : a/=3
    B)flag= =0 ? a*=2 : a/=3
    C)flag!=1 ? a*=2 : a/=3
    D)flag= =1 ? a*=2 : a/=3
    answer :A
  45. There are the following procedures
    #include <stdio.h>
    main()
    {
    int a=1,b=2,c=3;
    char flag;
    flag = b>=2 && c<=3;
    switch(a)
    {
    case 1: switch(flag)
    {
    case 0: printf(""); break;
    case 1: printf("%%"); break;
    }
    case 0: switch
    {
    case 1: printf("$ $ “); break;
    case 2: printf(”& & “); break;
    default : printf(”##");
    } }
    printf("\n");
    }
    The output of the program after running is
    A) %&&
    B)
    $$
    C) %##
    D)**##
    answer :C
  46. For circular statements :for(i=0;i<=10;i++) { ; } Description of the following options
    What's wrong is
    A) Omit i=0, Can cause infinite loops
    B) Omit i<=10, Can cause infinite loops
    C) Omit i++, Can cause infinite loops
    D) parentheses ( ) All three expressions in the are omitted , Can cause infinite loops
    answer :A
  47. There are the following sections
    char c1,c2;
    for(c1=‘0’,c2=‘9’; c1<c2; c1++,c2–)
    printf("%c%c",c1,c2);
    The execution result of the program segment is
    A)0918273645
    B)0123456789
    C)0123498765
    D)9876543210
    answer :A
  48. There are the following procedures
    #include <stdio.h>
    main()
    {
    char i,j,n;
    for(i=‘1’;i<=‘9’;i++)
    {
    if(i<‘3’) continue;
    for(j=‘0’;j<=‘9’;j++)
    {
    if(j<‘2’||j>=‘4’) continue;
    n=(i-‘0’)*10+j-‘0’;
    printf("%d “,n);
    }
    if(i==‘4’) break;
    }
    printf(”\n");
    }
    The output of the program after running is
    A) 30 31 40 41
    B) 32 33 42 43
    C)34 35 44 45
    D)35 36 45 46
    answer :B
  49. The following can be correctly described “k It is greater than 0 An even number of ” The expression of
    A)(k>0) && (k%2!=1)
    B)(k>0) && (k%2=0)
    C)(k>0) || !(k%2)
    D)(k>0) || (k%2= =0)
    answer :A
  50. With definition :int m=1,n=2;
    The following if In the sentence , The error message generated during compilation is
    A)if(m>n) m–
    else n–;
    B)if(m=n){ m++; n++; }
    C)if(m<0 && n<0) { }
    D)if(m>0) ;
    else m++;
    answer :A
  51. There are the following procedures
    #include <stdio.h>
    main()
    { int i,f=1,s=0;
    for(i=1; i<100;i++)
    { s=s+fi;
    f=-f;
    }printf(“s=%d\n”,s);
    }
    The function of the program is
    A) Calculation 1-3+5-7+…-99 Value
    B) Calculation 1-2+3-4+…+99 Value
    C) Calculation 1
    234*…99 Value
    D) Calculation 1
    357*…*99 Value
    answer :B
  52. Set variables n Correctly defined and assigned , The following natural numbers cannot be realized 1 To n tired
    The program segment for adding and summing is
    A)int sum=1,i=0;
    while(i<=n)
    { i++; sum+=i; }
    B)int sum=0,i=1;
    while(i<=n)
    { sum+=i; i++; }
    C)int sum=0,i=0;
    while(i<n)
    { i++; sum+=i; }
    D)int sum=1,i=1;
    while(i<n)
    { i++; sum+=i; }
    answer :A
  53. There are the following procedures
    #include <stdio.h>
    main( ) { int i=0,j=0,x=0;
    while(i<2)
    { x++;
    for( ; j<=3; j++)
    { if(j%2) continue;
    x++;
    }
    x++; i++;
    }
    printf(“x=%d\n”,x);
    }
    The output of the program after running is
    A) x=5
    B)x=4
    C) x=6
    D)x=8
    answer :C
  54. There are the following procedures
    #include <stdio.h>
    main( ) { char x,a=‘A’,b=‘B’,c=‘C’,d=‘D’;
    x=(a<b) ? a : b;
    x=(x>c) ? c : x;
    x=(d>x) ? x : d;
    printf("%c\n",x);
    }
    The output of the program after running is
    A)A
    B)B
    C)C
    D)D
    answer :A
  55. There are the following procedures
    #include <stdio.h>
    void main()
    {
    int i, m = 0, n = 0, k = 0;
    for(i = 9; i <= 11; i++)
    switch(i / 10)
    { case 0: m++; n++; break;
    case 10: n++; break;
    default: k++; n++;
    }
    printf("%d %d %d\n", m, n, k);
    }
    The output of the program after running is
    A) 3 5 4
    B) 1 3 2
    C)1 5 4
    D)4 5 1
    answer :B
  56. set up a、b and c All are int Type variable , And a=3,b=4,c=5, The following
    The value in the expression is 0 Yes.
    A)!((a<b)&&!c||1)
    B)a&&b
    C)a<=b
    D)a||b+c&&b-c
    answer :A
  57. There are the following procedures
    #include <stdio.h>
    void main()
    { int y=10;
    for(; y>0; y–)
    if(y%3 == 0)
    { printf("%d", --y); }
    printf("\n");
    }
    The output of the program after running is
    A) 741
    B) 852
    C)963
    D)875421
    answer :B
  58. What is wrong in the following statement is
    A)while The loop body of the statement will be executed at least once
    B)break Statements can only be in the loop body and switch In the body of a sentence
    C) perform continue Statement will skip the remaining unexecuted statements in the body of this loop
    D) stay C There are three kinds of circular statements in language that can form a circular structure :while、do–
    while and for
    answer :A
  59. There are the following procedures
    #include <stdio.h>
    void main()
    { char s = “\ta\018bc”;
    for (; s != ‘\0’; s++)
    printf("
    ");
    printf("\n");
    }
    The output of the program after running is
    A)
    ****
    B)*********
    C) ******
    D)*******
    answer :C
  60. Of the following options , When char Type variable c When the middle is a capital letter , Expression is true
    Yes.
    A)(c>=‘A’) && (c<=‘Z’)
    B)‘A’ >= c >= ‘Z’
    C)(c>=‘A’) OR (c<=‘Z’)
    D)(‘A’<=c) AND (‘Z’>=c)
    answer :A
  61. There are the following procedures
    #include <stdio.h>
    main()
    { int a=0,b=0,c=0;
    if (a++ || b++ && ++c)
    printf("%d,%d,%d\n", a, b, c);
    else
    printf("%d,%d,%d\n", a, c, b);
    }
    The output of the program after execution is
    A) 1,1,1
    B) 1,0,1
    C)1,0,0
    D)1,1,0
    answer :B
  62. There are the following procedures
    #include <stdio.h>
    main( )
    { int a=123456, b;
    while(a)
    { b = a%10;
    a /= 10;
    switch(b)
    { default: printf("%d", b++);
    case 1: continue;
    case 2: printf("%d", b++); continue;
    case 3: printf("%d", b++);
    case 4: printf("%d", b++); continue;
    }
    }
    }
    The output of the program after execution is
    A) 234456
    B) 654342
    C)1234456
    D)6543421
    answer :B
  63. There are the following procedures
    #include <stdio.h>
    main( )
    { int a=-1, b=2;
    for(; a++ && b–
    printf("%d,%d,", a,b);
    printf("%d,%d", a,b);
    }
    The output of the program after execution is
    A) 0,1,1,0
    B) 0,1,1,1
    C)0,1,1,0,1,0
    D)0,1,1,1,1,1
    answer :B
  64. There are the following procedures
    #include <stdio.h>
    main()
    { int a=7, i;
    for (i=1; i<=3; i++)
    { if (a>13) break;
    if (a%2) { a+=3; continue; }
    a= a+4;
    }
    printf("%d,%d", i,a);
    }
    The output of the program after execution is
    A) 3,18
    B) 3,14
    C)4,18
    D)2,10
    answer :B
  65. The following correct character constants are
    A)’\xAB’
    B)’\0AB’
    C)‘AB’
    D)“AB”
    answer :A
  66. There are the following procedures
    #include <stdio.h>
    main( )
    { char b[ ]=“happynewyear”, k;
    for (k=0; b[k]; k++)
    printf("%c", b[k]- ‘a’+‘A’);
    }
    The output of the program after execution is
    A)HAPPYNEWYEAR
    B)Happynewyear
    C)hAppynewyeAr
    D)HaPPYNEWYEaR
    answer :A
  67. If there is a definition :int a=3,b=2;, Then in the following expression , Options with a value of true
    yes
    A)!(b/a)
    B)!(a/b)
    C)!b||!a
    D)!a && !b
    answer :A
  68. If required : When the mathematical formula 3<x<7 When established , bring y=1, And set x、y by
    int Type variable , Then the following options that can achieve this requirement are
    A)if(x>3)
    if(x<7) y=1;
    B)if(x>3||x<7) y=1;
    C)if(x<3) ;
    else if(x<7) y=1;
    D)if(!(x<=3)) y=y;
    else if(7>x) y=1;
    answer :A
  69. There are the following procedures
    #include <stdio.h>
    main( ) {
    char c,d;
    c=getchar();
    d=getchar();
    switch(c-‘0’)
    {
    case 1: switch(d%‘0’)
    {
    case 1: printf("");
    case 2: printf("@");
    }
    case 2: switch(d%‘0’)
    {
    case 1: printf("#");
    case 2: printf("&");
    } } }
    If you enter... At run time :21< enter >, The output of the program is
    A)#&
    B)&
    C)@#&
    D)
    @#&
    answer :A
  70. There are the following procedures
    #include <stdio.h>
    main( ) {
    int i,a,b,c;
    a=b=c=0;
    for(i=0;i<3;i++)
    {
    switch(i%3)
    {
    case 0:a++;
    break;
    case 1:b++;
    break;
    case 2:c++;
    break;
    }
    if(i%3==0)
    break;
    }
    printf("%d %d %d\n",a,b,c);
    }
    The output of the program after execution is
    A) 2 0 1
    B)1 1 1
    C) 1 0 0
    D)2 1 0
    answer :C
  71. There are the following procedures
    #include <stdio.h>
    main( ) {
    int i,j,a,b;
    a=b=j=0;
    while(j<3)
    {
    j++;
    if(j==1)continue;
    for(i=0;i<3;i++)
    {
    if(i>1) break;
    a=a*10+i;
    if(i<1) b=a;
    } }
    printf("%d %d\n",a,b);
    }
    The output of the program after execution is
    A) 10 0
    B)101 101
    C) 101 10
    D)10 101
    answer :C
  72. There are the following procedures
    #include <stdio.h>
    main( ) {
    char c,i;
    for(i=0;i<3;i++)
    {
    c=getchar();
    printf("%c,",(c-‘A’+5)%26+‘a’);
    }
    printf("\n");
    }
    If you enter :APE< enter >, The output is
    A) F,U,J,
    B) f,u,j,
    C)E,T,I,
    D)E,t,I,
    answer :B
  73. about if( expression ) sentence , The following statement is correct
    A)“ expression ” It can be an arithmetic expression
    B) stay “ expression ” Functions that return integers cannot be called in
    C) stay “ expression ” Cannot contain function calls
    D)“ expression ” The value of can only be an integer value
    answer :A
  74. There are the following procedures
    #include <stdio.h>
    main()
    {
    int a = 0, b = 4;
    if (a++)
    {
    if (b++) printf(“T”);
    }
    else
    printf(“F”);
    printf(":a=%d,b=%d\n", a, b);
    }
    The output of the program after running is
    A) T:a=1,b=5
    B)F:a=0,b=4
    C) F:a=1,b=4
    D)T:a=0,b=5
    answer :C
  75. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i, data;
    scanf("%d", &data);
    for (i=2; i<6; i++)
    {
    if (data % i)
    printf("%d-", i);
    else
    continue;
    } }
    Program runtime , Input from keyboard :10< enter > after , The output of the program is
    A)3-4-
    B)2-3-4-5-
    C)0-1-
    D)2-5-
    answer :A
  76. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i, data;
    scanf("%d", &data);
    for (i=0; i<10; i++)
    {
    if (i > data)
    break;
    else
    printf("%d,", i);
    } }
    Program runtime , Input from keyboard :10< enter > after , The output of the program is
    A) 0,
    B) 0,1,2,3,4,5,6,7,8,9,
    C)1,3,5,7,9,
    D)0,2,4,6,8,
    answer :B
  77. There are the following procedures
    #include <stdio.h>
    main()
    {
    if (’\0’ == 0) printf("<1>OK");
    if (‘0’ == 0) printf("<2>OK");
    if (‘z’ > ‘A’) printf("<3>OK");
    }
    The output of the program after running is
    A)<1>OK<3>OK
    B)<1>OK
    C)<2>OK
    D)<2>OK<3>OK
    answer :A
  78. There are the following procedures
    #include <stdio.h>
    main()
    {
    int i;
    for (i=0; i<3; i++)
    putchar(‘A’ + i*2);
    }
    The output of the program after running is
    A) A012
    B)ABC
    C) ACE
    D)AA
    answer :C
  79. There are the following procedures
    #include <stdio.h>
    main()
    {
    int a=1,b=1,c=1;
    if (a-- || b-- && --c)
    printf("%d,%d,%d\n", a, b, c);
    else
    printf("%d,%d,%d\n", a, c, b);
    }
    The output of the program after execution is
    A) 0,1,0
    B) 0,1,1
    C)0,0,1
    D)0,0,0
    answer :B
  80. There are the following procedures
    #include <stdio.h>
    main( ) {
    int a=123456, b;
    while(a)
    { b = a%10;
    a /= 10;
    switch(b)
    {
    default: printf("%d", b++);
    case 1: break;
    case 2: printf("%d", b++); break;
    case 3: printf("%d", b++);
    case 4: printf("%d", b++);
    case 5: printf("%d", b++);
    } } }
    The output of the program after execution is
    A) 65432
    B) 65453452
    C)654321
    D)654534521
    answer :B
  81. There are the following procedures
    #include <stdio.h>
    main( ) {
    int a=1, b=-2;
    for (; a-- && b++;)
    printf("%d,%d,", a,b);
    printf("%d,%d", a,b);
    }
    The output of the program after execution is
    A)0,-1,-1,-1
    B)0,-1,-1,0
    C)0,-1,-1,0,-1,0
    D)0,-1,-1,-1,-1,-1
    answer :A
  82. There are the following procedures
    #include <stdio.h>
    main()
    {
    int a=7, i;
    for (i=1; i<=3; i++)
    {
    if (a>14) break;
    if (a%2) { a+=3; continue; }
    a = a+4;
    printf("%d,%d,", i,a);
    }
    printf("%d,%d", i,a);
    }
    The output of the program after execution is
    A) 1,14,2,18,3,18
    B) 2,14,3,18,4,18
    C)2,14,3,18,4,22
    D)1,14,2,18,3,18,4,18
    answer :B
  83. The following correct character constants are
    A)’\012’
    B)’\089’
    C)’\0XAB’
    D)’\0xab’
    answer :A
  84. There are the following procedures
    #include <stdio.h>
    main( ) {
    char b[ ]=“happychristmas”, k;
    for (k=0; b[k]; k++)
    {
    if (b[k] < ‘m’)
    b[k] = b[k]- ‘a’+‘A’;
    printf("%c", b[k]);
    } }
    The output of the program after execution is
    A) hAppychristmAs
    B)happychristmas
    C) HAppyCHrIstmAs
    D)HAPPYCHRISTMAS
    answer :C
  85. There are the following procedures
    #include <stdio.h>
    main()
    {
    int s = 0, i;
    for (i = 1; i < 5; i++)
    {
    switch (i)
    {
    case 0:
    case 3: s += 2;
    case 1:
    case 2: s += 3;
    default: s += 5;
    } }
    printf("%d\n", s);
    }
    The output of the program after running is
    A) 10
    B)13
    C) 31
    D)20
    answer :C
  86. There are the following procedures
    #include <stdio.h>
    main()
    {
    int w=4,x=3,y=2,z=1;
    printf("%d\n", (w < x ? w : z < y ? z : x));
    }
    The output of the program after running is
    A)1
    B)2
    C)3
    D)4
    answer :A
  87. There are the following procedures
    #include <stdio.h>
    main()
    {
    int x,i;
    for (i = 1; i <= 100; i++)
    { x = i;
    if (++x % 2 == 0)
    if (++x % 3 == 0)
    if (++x % 7 ==0)
    printf("%d “, x);
    }
    printf(”\n");
    }
    The output of the program after running is
    A) 42 84
    B) 28 70
    C)26 68
    D)39 81
    answer :B
  88. What is true in the following statement is
    A) stay switch In the sentence , Not necessarily break sentence
    B)break Statements can only be used for switch sentence
    C)break The statement must be the same as switch Statement case Pairs using
    D) stay switch Statement must use default
    answer :A
  89. There are the following procedures
    #include <stdio.h>
    char fun(char ch)
    {
    if (ch>=‘A’ && ch<=‘Z’) ch = ch - ‘A’ +‘a’;
    return ch;
    }
    main()
    {
    char s[] = “ABC+abc=defDEF”, *p=s;
    while (*p)
    {
    *p = fun(*p);
    p++;
    }
    }
    The output of the program after running is
    A) abc+ABC=DEFdef
    B) abc+abc=defdef
    C)abcABCDEFdef
    D)abcabcdefdef
    answer :B
  90. To judge char Type variable c Are the lowercase letters stored in , The following is correct
    The expression of
    A)(c>=‘a’) && (c<=‘z’)
    B)‘a’<=c<=‘z’
    C)(c>=‘a’) || (c<=‘z’)
    D)(‘a’<=c) AND (‘z’>=c)
    answer :A
  91. With definition :int a=0,b=1;, Then execute the following expression , Cannot change
    The amount a and b The value of all increases 1 Yes.
    A) a++ || ++b
    B)a++ || b++
    C)++a && ++b
    D) a++ && b++
    answer :D
  92. There are the following procedures
    #include <stdio.h>
    main ( ) {
    int s,m=10;
    scanf("%d", &s);
    if (s<30) m–;
    if (s<40) m–;
    else
    if(s<50) m–;
    else m++;
    printf ( “m=%d\n”,m);
    }
    Program run time input :25< enter >, The output is
    A)m=7
    B)m=8
    C)m=9
    D)m=10
    answer :B
  93. There are the following procedures
    #include <stdio.h>
    main ( ) {
    int m=10247,a=0,b=0,c=0;
    do {
    switch(m%10)
    {
    case 0: m/=10; a++;
    case 1: case 3: case 5: case 7: case 9: m/=10; b++;
    case 2: case 4: case 6: case 8: m/=10; c++;
    }
    }while(m!=0);
    printf ("%d,%d,%d\n",a,b,c);
    }
    The output of the program after running is
    A) 1,2,2
    B) 1,2,3
    C)1,3,5
    D)1,3,4
    answer :B
  94. There are the following procedures
    #include <stdio.h>
    main ( ) {
    int m=128,n=256,k=100;
    while(n/k>m/k)
    {
    n %= k;
    m %= k;
    k /= 10;
    }
    printf (“n=%d\n”,n);
    }
    The output of the program after running is
    A)n=0
    B)n=6
    C)n=56
    D)n=256
    answer :B
  95. The following legal character constants are
    A)’\x6D’
    B)’\0x41’
    C)’\X51’
    D)’\068’
    answer :A
  96. There are the following procedures
    #include <stdio.h>
    #include <ctype.h>
    main ( ) {
    char ch;
    do
    {
    ch = getchar();
    if (islower(ch)) ch-=32;
    else continue;
    printf ("%c",ch);
    } while(ch!=’!’);
    }
    Program run time input :1aB2cD!< enter >, The output is
    A) ac
    B)bd
    C) AC
    D)1B2D
    answer :C
  97. If there is a description statement : int *ptr[10]; The following statement is correct
    A)ptr Is a person with 10 A one-dimensional array of pointer elements
    B)ptr Is a pointer to an integer variable
    C)ptr Is a point with 10 Pointer to a one-dimensional array of integer elements
    D)ptr It's a point 10 A function pointer to an integer variable
    answer :A
  98. There are the following procedures
    #include <stdio.h>
    main()
    {
    printf("%d\n", NULL );
    }
    The output of the program after running is
    A)1
    B) Variable undefined , Output uncertainty
    C)-1
    D)0
    answer :D
  99. Function call statements :
    fun( ( exp1, exp2 ), ( exp1, exp2, exp3) ); The number of arguments contained is
    A)1
    B)4
    C)5
    D)2
    answer :D
  100. If there are defined statements :int a[10]={0,1,2,3,4,5,6,7,8,9},p=a;, Select below
    Wrong reference in item a The of array elements is ( among 0≤i<10)
    A)
    ((a+i))
    B)a[ p-a ]
    C)p[i]
    D)
    ( &a[i] )
    answer :A
原网站

版权声明
本文为[Su_ mer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140935437757.html