亚洲喷奶水中文字幕电影,日本aⅴ高清一区二区三区,欧美亚洲日本国产,欧美日韩亚洲中文字幕

<legend id="flx4p"><abbr id="flx4p"><thead id="flx4p"></thead></abbr></legend>

<mark id="flx4p"><thead id="flx4p"></thead></mark>

      我要投稿 投訴建議

      中興通訊C++/C筆試題

      時(shí)間:2022-09-26 13:37:14 筆試題目 我要投稿
      • 相關(guān)推薦

      中興通訊C++/C筆試題

        C語(yǔ)言是在70年代初問(wèn)世的。一九七八年由美國(guó)電話電報(bào)公司(AT&T)貝爾實(shí)驗(yàn)室正式發(fā)表了C語(yǔ)言。現(xiàn)在很多公司把C++/C列入招聘考核的范圍。本文是關(guān)于中興通訊C++/C筆試題,歡迎閱讀學(xué)習(xí)。

      中興通訊C++/C筆試題

        一、請(qǐng)?zhí)顚?xiě)B(tài)OOL , float, 指針變量 與“零值”比較的 if 語(yǔ)句。(10分)

        提示:這里“零值”可以是0, 0.0 , FALSE或者“空指針”。例如 int 變量 n 與“零值”比較的 if 語(yǔ)句為:

        if ( n == 0 )

        if ( n != 0 )

        以此類(lèi)推。

        請(qǐng)寫(xiě)出 BOOL flag 與“零值”比較的 if 語(yǔ)句:

        if(flag)

        if(!flag)

        請(qǐng)寫(xiě)出 float x 與“零值”比較的 if 語(yǔ)句:

        if(x>=-0.00001)

        if(x<=0.00001)

        請(qǐng)寫(xiě)出 char *p 與“零值”比較的 if 語(yǔ)句:

        if(p=null)

        if(p!=null)

        二、以下為Windows NT下的32位C++程序,請(qǐng)計(jì)算sizeof的值(10分)

        char str[] = “Hello” ;

        char *p = str ;

        int n = 10;

        請(qǐng)計(jì)算

        sizeof (str ) = 6

        sizeof ( p ) = 4

        sizeof ( n ) =4

        void Func ( char str[100])

        {

        請(qǐng)計(jì)算

        sizeof( str ) = 4

        }

        void *p = malloc( 100 );

        請(qǐng)計(jì)算

        sizeof ( p ) =4

        三、簡(jiǎn)答題(25分)

        1、頭文件中的 ifndef/define/endif 干什么用? 防止重復(fù)定義

        2、#include 和 #include “filename.h” 有什么區(qū)別? 查找范圍不同,后者先查找工作路徑,再查找VC標(biāo)準(zhǔn)路徑;前者只查工作路徑。

        3、const 有什么用途?(請(qǐng)至少說(shuō)明兩種) 定義變量常量,函數(shù)常量

        4、在C++ 程序中調(diào)用被 C編譯器編譯后的函數(shù),為什么要加 extern “C”聲明?二者的編譯器不同

        5、請(qǐng)簡(jiǎn)述以下兩個(gè)for循環(huán)的優(yōu)缺點(diǎn)

        // 第一個(gè)

        for (i=0; i

        {

        if (condition)

        DoSomething();

        else

        DoOtherthing();

        }

        // 第二個(gè)

        if (condition)

        {

        for (i=0; i

        DoSomething();

        }

        else

        {

        for (i=0; i

        DoOtherthing();

        }

        先循環(huán)再判斷,先判斷再循環(huán)

        第一個(gè)優(yōu)點(diǎn):每個(gè)循環(huán)都先判斷,再執(zhí)行

        第一個(gè)缺點(diǎn):

        第二個(gè)優(yōu)點(diǎn):條件判斷,只發(fā)生其中一個(gè)行為

        第二個(gè)缺點(diǎn):

        優(yōu)點(diǎn):

        缺點(diǎn):

        四、有關(guān)內(nèi)存的思考題(20分)

        void GetMemory(char *p)

        {

        p = (char *)malloc(100);

        }

        void Test(void)

        {

        char *str = NULL;

        GetMemory(str);

        strcpy(str, "hello world");

        printf(str);

        }

        請(qǐng)問(wèn)運(yùn)行Test函數(shù)會(huì)有什么樣的結(jié)果?

        答:程序崩潰了,

        char *GetMemory(void)

        {

        char p[] = "hello world";

        return p;

        }

        void Test(void)

        {

        char *str = NULL;

        str = GetMemory();

        printf(str);

        }

        請(qǐng)問(wèn)運(yùn)行Test函數(shù)會(huì)有什么樣的結(jié)果?

        答:亂碼,

        Void GetMemory2(char **p, int num)

        {

        *p = (char *)malloc(num);

        }

        void Test(void)

        {

        char *str = NULL;

        GetMemory(&str, 100);

        strcpy(str, "hello");

        printf(str);

        }

        請(qǐng)問(wèn)運(yùn)行Test函數(shù)會(huì)有什么樣的結(jié)果?

        答: 可以運(yùn)行

        void Test(void)

        {

        char *str = (char *) malloc(100);

        strcpy(str, “hello”);

        free(str);

        if(str != NULL)

        {

        strcpy(str, “world”);

        printf(str);

        }

        }

        請(qǐng)問(wèn)運(yùn)行Test函數(shù)會(huì)有什么樣的結(jié)果?

        答:word

        五、編寫(xiě)strcpy函數(shù)(10分)

        已知strcpy函數(shù)的原型是

        char *strcpy(char *strDest, const char *strSrc);

        其中strDest是目的字符串,strSrc是源字符串。

        (1)不調(diào)用C++/C的字符串庫(kù)函數(shù),請(qǐng)編寫(xiě)函數(shù) strcpy

        (2)strcpy能把strSrc的內(nèi)容復(fù)制到strDest,為什么還要char * 類(lèi)型的返回值?

        六、編寫(xiě)類(lèi)String的構(gòu)造函數(shù)、析構(gòu)函數(shù)和賦值函數(shù)(25分)

        已知類(lèi)String的原型為:

        class String

        {

        public:

        String(const char *str = NULL); // 普通構(gòu)造函數(shù)

        String(const String &other); // 拷貝構(gòu)造函數(shù)

        ~ String(void); // 析構(gòu)函數(shù)

        String & operate =(const String &other); // 賦值函數(shù)

        private:

        char *m_data; // 用于保存字符串

        };

        請(qǐng)編寫(xiě)String的上述4個(gè)函數(shù)。

      【中興通訊C++/C筆試題】相關(guān)文章:

      c++個(gè)人實(shí)習(xí)心得體會(huì)范文01-11

      中興辭職報(bào)告09-26

      c語(yǔ)言心得04-24

      c語(yǔ)言編程心得06-19

      學(xué)習(xí)c#心得01-17

      C語(yǔ)言實(shí)習(xí)總結(jié)07-10

      c語(yǔ)言實(shí)踐報(bào)告01-17

      心理c證培訓(xùn)心得12-15

      心理c證的培訓(xùn)心得03-22

      c語(yǔ)言工作總結(jié)03-31