• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. 有心情的試一試,考查C++/C程序員的基本編程技能

        時(shí)間:2020-10-22 16:41:20 筆試題目 我要投稿

        有心情的試一試,考查C++/C程序員的基本編程技能

        本試題僅用于考查C++/C程序員的基本編程技能。
        內(nèi)容限于C++/C常用語法,不涉及數(shù)據(jù)結(jié)構(gòu)、算法以及深?yuàn)W的語法。
        考試成績(jī)能反映出考生的編程質(zhì)量以及對(duì)C++/C的理解程度,
        但不能反映考生的智力和軟件開發(fā)能力。
        筆試時(shí)間90分鐘。請(qǐng)考生認(rèn)真答題,切勿輕視。
        一、請(qǐng)?zhí)顚態(tài)OOL , float, 指針變量 與"零值"比較的 if 語句。
        (10分)
        提示:這里"零值"可以是0, 0.0 , FALSE或者"空指針"。
        例如 int 變量 n 與"零值"比較的 if 語句為:
        if ( n == 0 )
        if ( n != 0 )
        以此類推。
        請(qǐng)寫出 BOOL flag 與"零值"比較的 if 語句:
        請(qǐng)寫出 float x 與"零值"比較的 if 語句:
        請(qǐng)寫出 char *p 與"零值"比較的 if 語句:
        二、以下為Windows NT下的.32位C++程序,請(qǐng)計(jì)算sizeof的值(10分)
        char str[] = "Hello" ;
        char *p = str ;int
        n = 10;
        請(qǐng)計(jì)算
        sizeof (str ) =
        sizeof ( p ) =
        sizeof ( n ) =
        void Func ( char str[100])
        {請(qǐng)計(jì)算 sizeof( str ) = }
        void *p = malloc( 100 );
        請(qǐng)計(jì)算sizeof ( p ) =
        三、簡(jiǎn)答題(25分)
        1、頭文件中的 ifndef/define/endif 干什么用?
        2、#include %26lt;filename.h%26gt; 和

        有心情的試一試,考查C++/C程序員的基本編程技能

         


        #include "filename.h" 有什么區(qū)別?
        3、const 有什么用途?(請(qǐng)至少說明兩種)
        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%26lt;N; i++)
        {if (condition)
        DoSomething();
        else
        DoOtherthing();}
        優(yōu)點(diǎn):缺點(diǎn):
        // 第二個(gè)if (condition)
        {for (i=0; i%26lt;N; i++)
        DoSomething();}
        else{
        for (i=0; i%26lt;N; i++) DoOtherthing();}
        優(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)問運(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)問運(yùn)行Test函數(shù)會(huì)有什么樣的結(jié)果?答:
        Void GetMemory2(char **p, int num)
        {
        *p = (char *)malloc(num);
        }
        void Test(void)
        {
        char *str = NULL;
        GetMemory(%26str, 100);
        strcpy(str, "hello");
        printf(str);
        }
        請(qǐng)問運(yùn)行Test函數(shù)會(huì)有什么樣的結(jié)果?答:
        void Test(void)
        {
        char *str = (char *) malloc(100);
        strcpy(str, "hello");
        free(str);
        if(str != NULL)
        {
        strcpy(str, "world");
        printf(str);
        }
        }
        請(qǐng)問運(yùn)行Test函數(shù)會(huì)有什么樣的結(jié)果?答:
        五、編寫strcpy函數(shù)(10分)
        已知strcpy函數(shù)的原型是
        char *strcpy(char *strDest, const char *strSrc);
        其中strDest是目的字符串,strSrc是源字符串。
        (1)不調(diào)用C++/C的字符串庫(kù)函數(shù),請(qǐng)編寫函數(shù) strcpy
        (2)strcpy能把strSrc的內(nèi)容復(fù)制到strDest,為什么還要char * 類型的返回值?

         


        六、編寫類String的構(gòu)造函數(shù)、析構(gòu)函數(shù)和賦值函數(shù)(25分)
        已知類String的原型為:
        class String
        {
        public:
        String(const char *str = NULL); // 普通構(gòu)造函數(shù)
        String(const String %26other); // 拷貝構(gòu)造函數(shù)
        ~ String(void); // 析構(gòu)函數(shù)
        String %26 operate =(const String %26other); // 賦值函數(shù)

         


        private:
        char *m_data; // 用于保存字符串
        };
        請(qǐng)編寫String的上述4個(gè)函數(shù)。

        【有心情的試一試,考查C++/C程序員的基本編程技能】相關(guān)文章:

        有心情的試一試,考查C++/C程序員的基本編程技能11-13

        考查C++/C程序員的基本編程技能11-25

        C++語言的基本符號(hào)08-20

        C++程序的基本框架08-17

        一個(gè)C/C++編程面試題11-22

        C++語言的基本語法規(guī)則08-20

        關(guān)于C++編程中對(duì)象生命周期管理的論文06-15

        凌陽科技C++程序員筆試題10-25

        華為c/c++筆試題11-22

        C,C++的幾個(gè)面試題小集11-24

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 亚洲人成电影手机在线播放 | 亚洲日韩欧美一区 | 精品国精品自拍自在线 | 中文乱码字幕国产一区 | 最新亚洲精品视频在线 | 日韩精品亚洲国产一区蜜芽 |