久久综合丝袜日本网手机版,日韩欧美中文字幕在线三区,亚洲精品国产品国语在线,极品在线观看视频婷婷

      • 阿里云 面試 流程

        時(shí)間:2022-06-29 00:25:35 面試 我要投稿
        • 相關(guān)推薦

        阿里云 面試 流程

        電話問(wèn)題1:構(gòu)造和析構(gòu)函數(shù)中的虛函數(shù)調(diào)用;

        阿里云 面試 流程

        答案:虛函數(shù)可以在構(gòu)造函數(shù)和析構(gòu)函數(shù)中調(diào)用,但虛函數(shù)此時(shí)是靜態(tài)綁定;而非動(dòng)態(tài)綁定。

        電話問(wèn)題2:C++中的異?刹豢梢允且;

        答案:異常可以是引用,并且效率高。

        電話問(wèn)題3:TCP狀態(tài)中的close_wait是什么狀態(tài);

        答案:close_wait狀態(tài)是被動(dòng)關(guān)閉方的一個(gè)狀態(tài),此時(shí)是半關(guān)閉狀態(tài),被關(guān)閉方收到了Fin包,并且發(fā)送了fin包的ack,等待上層應(yīng)用結(jié)束連接。

        電話問(wèn)題4:排序算法的時(shí)間復(fù)雜度;

        答案:最好是nLogn,其他的上網(wǎng)搜索。

        面試問(wèn)題1.atoi函數(shù)編寫;

        答案:

        自己寫的atoi函數(shù)----(注意:自己定義的atoi函數(shù)和庫(kù)的atoi函數(shù)一樣的時(shí)候,拋出異常時(shí)會(huì)引起異常退出,個(gè)人認(rèn)為是異常沒(méi)有不知道被那個(gè)函數(shù)拋出,所以coredump)

        #include

        #include

        #include

        #include

        #include

        #include

        #include

        #include

        using namespace std;

        const unsigned int SIGN_BIT = 0x1 << 31;

        bool isDigit(const char ch)

        {

        if (ch <= '9' && ch >= '0')

        {

        return true;

        }

        return false;

        }

        int atoi_i(const char *str)

        {

        assert(str != NULL);

        while (' ' == *str){ str++; }

        int result = 0;

        bool signFlag = false;

        if ('+' == *str)

        {

        if (false == isDigit(*++str)) throw "input format error!";

        }

        else if ('-' == *str)

        {

        if (false == isDigit(*++str)) throw "input format error!";

        signFlag = true;

        }

        else if (*str > '9' || *str < '0')

        {

        throw "input format error!";

        }

        do

        {

        result = result * 10 + *str++ - '0';

        if ((result & SIGN_BIT) != 0)

        {

        throw "overflow error!";

        }

        }

        while (isDigit(*str));

        if (true == signFlag)

        {

        result = -result;

        }

        return result;

        }

        int main(int argc, char *argv[])

        {

        char input[1024];

        while (1)

        {

        try

        {

        cout << "Input Array:";

        cin >> input;

        printf("exchange:%d/n", atoi_i(input));

        }

        catch (const char *p)

        {

        cout <<"Error Info:" << p << endl;

        }

        catch ( ... )

        {

        cout << "test" << endl;

        }

        }

        return 0;

        }

        本文來(lái)自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/zhangxinrun/archive/2010/12/01/6048695.aspx

        面試問(wèn)題2.sizeof和空類;

        答案:

        class CBase

        {

        int a;

        char *p;

        };

        那么運(yùn)行cout<<"sizeof(CBase)="<<sizeof(cbase)<<endl;之后輸出什么?< p="">

        這個(gè)應(yīng)該很簡(jiǎn)單,兩個(gè)成員變量所占的大小——8。

        第一步:空類

        class CBase

        {

        };

        運(yùn)行cout<<"sizeof(CBase)="<<sizeof(cbase)<<endl;< p="">

        sizeof(CBase)=1;

        深度探索c++對(duì)象模型中是這樣說(shuō)的: 那是被編譯器插進(jìn)去的一個(gè)char ,使得這個(gè)class的不同實(shí)體(object)在內(nèi)存中配置獨(dú)一無(wú)二的地址。 也就是說(shuō)這個(gè)char是用來(lái)標(biāo)識(shí)類的不同對(duì)象的。

        第二步:

        還是最初的那個(gè)類,運(yùn)行結(jié)果:sizeof(CBase)=8

        第三步:添個(gè)虛函數(shù)

        class CBase

        {

        public:

        CBase(void);

        virtual ~CBase(void);

        private:

        int a;

        char *p;

        };

        再運(yùn)行:sizeof(CBase)=12

        C++ 類中有虛函數(shù)的時(shí)候有一個(gè)指向虛函數(shù)的指針(vptr),在32位系統(tǒng)分配指針大小為4字節(jié)”。那么繼承類呢?

        第四步:

        基類就是上面的了不寫了

        class CChild :

        public CBase

        {

        public:

        CChild(void);

        ~CChild(void);

        private:

        int b;

        };

        運(yùn)行:cout<<"sizeof(CChild)="<<sizeof(cchild)<<endl;< p="">

        輸出:sizeof(CChild)=16;

        可見(jiàn)子類的大小是本身成員變量的大小加上子類的大小。

        面試問(wèn)題3.(1)對(duì)象只允許在堆上創(chuàng)建,(2)對(duì)象只允許在棧上創(chuàng)建;

        答案:

        class HeapOnly

        {

        public:

        HeapOnly()

        {

        cout<<"constructor. "<<endl;< p="">

        }

        void destroy()

        {

        this;

        }

        private:

        ~HeapOnly(){}

        };

        int main()

        {

        HeapOnly *p = new HeapOnly;

        p->destroy();

        HeapOnly h;

        h.Output();

        return 0;

        }

        #include

        using namespace std;

        class StackOnly

        {

        public:

        StackOnly()

        {

        cout<<"constructor." <<endl;< p="">

        }

        ~StackOnly()

        {

        cout<<"destructor." <<endl;< p="">

        }

        private:

        void *operator new (size_t);

        };

        int main()

        {

        StackOnly s; //okay

        StackOnly *p = new StackOnly; //wrong

        return 0;

        }

        本文來(lái)自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/zhangxinrun/archive/2010/12/03/6052551.aspx

        面試問(wèn)題4.在一個(gè)不知道升序還是降序的數(shù)據(jù)組中查找一個(gè)給定的數(shù),

        個(gè)人想法:1.根據(jù)數(shù)組的首尾比較,判斷數(shù)組的序列形式;2.折半查找算法。

        答案:

        #include

        #include

        using namespace std;

        static bool flag = true;

        bool intCompare(int value1, int value2)

        {

        return (value1 > value2) == flag;

        }

        int binary_search_i(int a[], int value, int start, int end)

        {

        if (start > end) return -1;

        int pos = (start + end)/ 2;

        if (value == a[pos])

        {

        return pos;

        }

        else if (intCompare(value, a[pos]))

        {

        return binary_search_i(a, value, pos + 1, end);

        }

        else

        {

        return binary_search_i(a, value, start, pos - 1);

        }

        }

        int binary_search(int a[], int value, int n)

        {

        assert((a != NULL) && (n > 0));

        if ((n == 1) || (a[0] == a[n - 1]))

        {

        if (a[0] == value)

        {

        return 0;

        }

        else

        {

        return -1;

        }

        }

        if (a[0] < a[n - 1])

        {

        flag = true;

        }

        else

        {

        flag = false;

        }

        int temp = binary_search_i(a, value, 0, n - 1);

        while ((temp > 0) && (a[temp] == a[temp - 1]))

        {

        --temp;

        }

        return temp;

        }

        int main()

        {

        //int a[] = {1, 3, 5, 7, 7, 7, 7, 7, 7, 7, 9, 10, 11};

        int a[] = {11, 10, 9, 7, 7, 7, 7, 7, 5, 3, 1};

        int arrayNum = sizeof(a) / sizeof(int);

        for(int i = 0; i < arrayNum; ++i)

        {

        printf("a[%d]=%d/t", i, a[i]);

        }

        printf("/n");

        int value = 0;

        while(1)

        {

        printf("Input search value:");

        scanf("%d", &value);

        printf("Pos in array:%d/n", binary_search(a, value, arrayNum));

        }

        return 0;

        }

        面試問(wèn)題5.那些算法是穩(wěn)定排序,那些算法是不穩(wěn)定排序。

        答案:上網(wǎng)上搜索一下。


        [阿里云 面試 流程]相關(guān)文章:

        1.阿里云 面試 流程

        2.互聯(lián)網(wǎng)公司面試問(wèn)題

        【阿里云 面試 流程】相關(guān)文章:

        面試流程07-11

        阿里巴巴面試經(jīng)驗(yàn)07-13

        國(guó)企面試流程07-02

        正確的面試流程07-02

        華為面試流程07-11

        模擬面試流程11-07

        求面試流程07-09

        華為的面試流程07-13

        空姐面試的流程10-31

        阿里云服務(wù)器的網(wǎng)站的操作方法07-13