2014計算機二級考試C語言預測題

字號:

為大家收集整理了《2014計算機二級考試C語言預測題》供大家參考,希望對大家有所幫助?。?!
    單項選擇題
    1、有以下程序:
    #include
    #define S(x)(x)"x"2
    main(  )
    { int k=5,j=2;
    Drintf("%printf,",S(k+j));printf("%printf\n",S((k—j)));
    }
    程序運行后的輸出結(jié)果是(  )。
    A.98,18
    B.39,11
    C.39,18
    D.98,11
    2、以下關于long、int和short類型數(shù)據(jù)占用內(nèi)存大小的敘述中正確的是(  )。
    A.均占4個字節(jié)
    B.根據(jù)數(shù)據(jù)的大小來決定所占內(nèi)存的字節(jié)數(shù)
    C.由用戶自己定義
    D.由C語言編譯系統(tǒng)決定
    3、有以下函數(shù)
    #include
    struct stu
    {int mun; char name[10]; int age;};
    void fun(struct stu *p)
    { printf(“%s\n”,p->name);}
    main()
    { struct stu x[3]={{01,”zhang”,20},{02,”wang”,19},{03,”zhao”,18}};
    fun(x+2);
    }
    程序運行輸出結(jié)果是(  )。
    A.zhang
    B.zhao
    C.wang
    D.19
    4、已知大寫字母A的ASCIl碼值是65,小寫字母a的ASCIl碼值是97,則用8進制表示的字符常量'\101'是
    5、結(jié)構化程序設計的基本原則不包括 (  )
    A.多態(tài)性
    B.自頂向下
    C.模塊化
    D.逐步求精
    6、 以下描述中正確的是(  )。
    A.由于do-while循環(huán)中循環(huán)體語句只能是一條可執(zhí)行語句,所以循環(huán)體內(nèi)不能使用復合語句
    B.do-while循環(huán)由do開始,用while結(jié)束,在while(表達式.后面不能寫分號
    C.在do-while循環(huán)體中,是先執(zhí)行一次循環(huán),再進行判斷
    D.do-while循環(huán)中,根據(jù)情況可以省略while
    7、 下列鏈表中,其邏輯結(jié)構屬于非線性結(jié)構的是(  )0、
    A.雙向鏈表
    B.帶鏈的棧
    C.二叉鏈表
    D.循環(huán)鏈表
    填空題
    8、int x=6, y=7;
    printf(“%d,”,x++); printf(“%d\n”,++y);
    程序的輸出結(jié)果是__________。
    9、以下程序運行后的輸出結(jié)果是 【11】 。
    #include
    void fun(int x)
    {if(x/5>o)fun(x/5);
    prinff("%dt",x);
    )
    main()
    {fun(11);printf("\n");}
    簡答題
    10、
    請編寫函數(shù)proc().該函數(shù)的功能是:實現(xiàn)B=A+A7,即把矩陣A加上A的轉(zhuǎn)置,存放在矩陣B中。計算結(jié)果在main ()函數(shù)中輸出。 ’
    例如,輸入下面矩陣:
    1 1 1
    4 4 4
    7 7 7
    其轉(zhuǎn)置矩陣為:
    1 4 7
    1 4 7
    1 4 7
    則程序輸出:
    2 5 8
    5 8 11
    8 11 14
    注意:部分源程序給出如下。
    請勿改動main()函數(shù)和其他函數(shù)中的任何內(nèi)容,僅在函數(shù)proc()的花括號中填入所編寫的若干語句。 .
    試題程序:
    #include
    #include
    #include
    void proc(int a[3][3],int b[3][3])
    {
    }
    void main()
    { int arr[3][3]={{1,1,1),{4,4,4},{7,7,7}},
    t[3][3];
    int i,j。
    system("CLS");
    proc(arr,t);
    for(i=0;i<3;i++)
    {
    for(j=0;j<3;j++)
    printf("%7d",t[i][j]);
    printf("\n"):
    }
    }