歷年全國(guó)計(jì)算機(jī)等級(jí)考試二級(jí)C語言筆試填空真題及答案

字號(hào):

二、填空題(每空2分,共30分)
    請(qǐng)將每一個(gè)空的正確答案寫在答題卡【1】至【15】序號(hào)的橫線上,答在試卷上不得分。
    (1)假設(shè)一個(gè)長(zhǎng)度為50的數(shù)組(數(shù)組元素的下標(biāo)從0到49)作為棧的存儲(chǔ)空間,棧底指針bottom指向棧底元素,棧頂指針top指向棧頂元素,如果bottom=49,top=30(數(shù)組下標(biāo)),則棧中具有【1】個(gè)元素。
    (2)軟件測(cè)試可分為白盒測(cè)試和黑盒測(cè)試?;韭窂綔y(cè)試屬于 【2】測(cè)試。
    (3)符合結(jié)構(gòu)化原則的三種基本控制結(jié)構(gòu)是:選擇結(jié)構(gòu)、循環(huán)結(jié)構(gòu)和【3】。
    (4)數(shù)據(jù)庫(kù)系統(tǒng)的核心是 【4】
    (5)在E-R圖中,圖形包括矩形框、菱形框、橢圓框。其中表示實(shí)體聯(lián)系的是【5】框。
    (6)表達(dá)式(int)((double)(5/2)+2.5)的值是【6】
    (7)若變量x、y已定義為int類型且x的值為99,y的值為9,請(qǐng)將輸出語句printf(【7】,x/y);補(bǔ)充完整,使其輸出的計(jì)算結(jié)果形式為:x/y=11
    (8)有以下程序
    #include
    main( )
    {
    char c1,c2;
    scanf(“&c”,&c1);
    while(c1<65||c1>90)
    scanf(“&c”,&c1);
    c2=c1+32;
    printf(“&c, &c\n”,c1,c2);
    }
    程序運(yùn)行輸入65回車后,能否輸出結(jié)果、結(jié)束運(yùn)行(請(qǐng)回答能或不能)【8】。
    (9)以下程序運(yùn)行后的輸出結(jié)果是【9】
    #include
    main( )
    {int k=1,s=0;
    do{
    if{((k&2)!=0)continue;
    s+=k;k++;
    }while(k)10);
    printf(“s=&d/n”,s);
    }
    (10)下列程序運(yùn)行時(shí),若輸入labced12df<回車>輸出結(jié)果為【10】
    #include
    main( )
    {char
    a =0,ch;
    while((ch=getchar())!=’\n’)
    {if(a&2!=0&&(ch>’a’&&ch<=’z’)) ch=ch-‘a(chǎn)’+’A’;
    a++;putchar(ch);
    }
    printf(“\n”);
    }
    (11)有以下程序,程序執(zhí)行后,輸出結(jié)果是【11】
    #include
    void fun (int *a)
    {a[0=a[1];]}
    main()
    {int a[10]={10,9,8,7,6,5,4,3,2,1},i;
    for(i=2;i>=0;i--) fun{&a};
    for(i=0;i<10;i++) printf(“&d”,a);
    printf(“\n”);
    }
    (12)請(qǐng)將以下程序中的函數(shù)聲明語句補(bǔ)充完整
    #include
    int【12】
    ;
    main( )
    {int x,y,(*p)();
    p=max;
    printf(“&d\n”,&x,&y);
    }
    Int max(int a,int b)
    {return (a>b/a:b);}
    (13)以下程序用來判斷指定文件是否能正常打開,請(qǐng)?zhí)羁?BR>    #include
    main( )
    {FILE *fp;
    if (((fp=fopen(“test.txt”,”r”))==【13】))
    printf(“未能打開文件!\n”);
    else
    printf(“文件打開成功!\n”);
    (14)下列程序的運(yùn)行結(jié)果為【14】
    #include
    #include
    struct A
    {int a;char b[10];double
    c;};
    void
    f (struct
    A
    *t);
    main()
    {struct A a=(1001,”ZhangDa”,1098,0);
    f(&a);printf(“&d,&s,&6,if\n”,a.a,a.b,a.c);
    }
    void f(struct
    A
    *t)
    {strcpy(t->b,”ChangRong”);
    }
    (15)以下程序把三個(gè)NODETYPE型的變量鏈接成一個(gè)簡(jiǎn)單的鏈表,并在while循環(huán)中輸出鏈表結(jié)點(diǎn)數(shù)據(jù)域中的數(shù)據(jù),請(qǐng)?zhí)羁?BR>    #include
    struct node
    {int data; struct node *next;};
    typedef struct node NODETYPE;
    main()
    {NODETYPE a,b,c,*h,*p;
    a.
    data=10;b.data=20;c.data=30;h=&a;
    b.
    next=&b;b.next=&c;c.next=’\0’;
    p=h;
    while(p){printf(“&d”,p->data);【15】;}
    }
    填空題:
    (1)19(2)白盒(3)順序結(jié)構(gòu)(4)數(shù)據(jù)庫(kù)管理系統(tǒng)(DBMS)(5)菱形
    (6)4(7)"x/y=%d"(8)能(9)s=0(10)1AbCeDf2dF
    (11)7777654321(12)max(int a,int b)(13)NULL
    (14)1001,ChangRong,1098.0(15)p=p—>next