2013年完美世界校园招聘笔试题
生活随笔
收集整理的這篇文章主要介紹了
2013年完美世界校园招聘笔试题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、設有矩陣A1(30*35)、A2(35*15)、A3(15*5)、A4(5*10),M=A1*A2*A3*A4,下列組合計算M所需數乘次數最少的是:
A、(A1(A2(A3A4))) ? ?B、(A1((A2A3)A4)) ? ?C、((A1A2)(A3A4)) ? ?D、((A1(A2A3))A4)? ?E、(((A1A2)A3)A4)
2、在32位機器上,有如下代碼:
char array[] = "abcdefg"; printf("%d\n",sizeof(array)); // 8char *p = "abcdefg"; printf("%d\n",sizeof(p)); // 4void func(char p[10]) {printf("%d\n",sizeof(p)); // 4 }void func(char (&p)[10]) {printf("%d\n",sizeof(p)); // 10 }int main(void) {printf("%d\n",sizeof(char[2])); // 2printf("%d\n",sizeof(char&)); // 1return 0; }其輸出結果依次為:
A、8 ? 4 ? 4 ?10 ?2 ?1
B、4 ? 4 ? 4 ?10 ?4 ?1
C、8 ? 4 ? 4 ?10 ?2 ?4
D、8 ? 4 ? 4 ?4 ?2 ?1
E、8 ? 4 ? 4 ?10 ?4 ?4
F、以上答案都不對
3、
CONTAINER::iterator iter , tempIt; for(iter = cont.begin() ; iter != cont.end() ; ) {tempIt = iter;++iter;cont.erase(tempIt); } 假設cont是一個CONTAINER的示例,里面包含數個元素,那么當CONTAINER為:
1、vector<int>
2、list<int>
3、map<int , int>
4、deque<int>
會導致上面的代碼片段崩潰的CONTAINER類型是:
A、1,4 ? ? B、2,3 ? ?C、1,3 ? ? ?D、2,4
正確答案選擇A(第1個、第4個都是線性的類型存儲,所以會存在崩潰)
4、以下代碼
class classA { public:classA(){clear();}virtual ~classA(){}void clear(){memset(this , 0 , sizeof(*this));}virtual void func(){printf("func\n");} }; class classB : public classA { };int main(void) {classA oa;classB ob;classA * pa0 = &oa;classA * pa1 = &ob;classB * pb = &ob;oa.func(); // 1ob.func(); // 2pa0->func(); // 3pa1->func(); // 4pb->func(); // 5return 0; } A、func ? ? ? ? ? ? ?func ? ? ? ?執行出錯 ? ? ?執行出錯 ? ? ? ?func ?
B、執行出錯 ? ? ? ? func ? ? ? ?執行出錯 ? ? ?執行出錯 ? ? ? ?func?
C、執行出錯 ? ? ?執行出錯 ? ? ?執行出錯 ? ? ?執行出錯 ? ? ?執行出錯
D、func ? ? ? ? ? ? ?func ? ? ? ? ?func ? ? ? ? ? ?func ? ? ? ? ?func
E、func ? ? ? ? ? ? ?func ? ? ? ?執行出錯 ? ? ? ? ?func ? ? ? ? ?func
F、以上選項都不對
5、在32位系統中
class CBase { public:void func(){Print();}virtual void Print(){cout<<"CBase::Print"<<endl;} }; class CDerived : public CBase { public:virtual void Print(){cout<<"CDerived::Print"<<endl;} };int main(void) {CDerived c;CBase *p = &c;return 0; } 請問:
sizeof(*p)的值是多少? (實際上求的就是一個成員變量的大小+一個虛表指針VPTR的大小)
A、1 ? ?B、4 ? ? C、8 ? ?D、12
p->Print(); 和 c.func();的輸出分別是?
A、CBase::Print ? ? CBase::Print ? ? B、CBase::Print ? ? CDerived::Print
C、CDerived::Print ?CBase::Print ? ?D、CDerived::Print ?CDerived::Print
6、
struct Thing {int valueA;const int valueB; }; Thing t; t的成員變量valueA 和 valueB 的值分別為:
A、0 ?0 ? ? B、垃圾值 ?0 ? ? C、無法運行 ? ? D、垃圾值 ?垃圾值
常成員變量valueB必須在構造函數中進行初始化
7、for(int x = 0 , y = 0; !x && y <= 5 ; y++)語句執行循環的次數是:
A、0 ? ? ? ?B、5 ? ? ? ?C、6 ? ? ? ?D、無數次
8、在Windows 32位操作系統中,假設字節對齊為4,對于一個空的類A,sizeof(A)的值為()
A、0 ? ? ? ? B、1 ? ? ? ? C、2 ? ? ? ? D、4
9、以下對函數指針的定義,哪些是正確的:
A、typedef ?int ?(*fun_ptr)(int , int); ? ? ? B、typedef ?int ?*(fun_ptr)(int , int);?
C、typedef ?int ?(fun_ptr*)(int , int); ? ? ? D、typedef ?*int ?(fun_ptr)(int , int);?
10、在32位系統中,下面結構體
struct st {char ch , *ptr;union{short a , b;unsigned int c : 2 , d : 1;};bool f;struct st *next; }; 的大小是:
A、14字節 ? ? ? B、16字節 ? ? ? C、20字節 ? ? ? D、24字節
11、32位小端字節序的機器上,如下代碼:
char array[12] = {0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08}; short *pshort = (short *)array; int *pint = (int *)array; int64 *pint64 = (int64 *)array; printf("0x%x , 0x%x , 0x%x , 0x%x", *pshort , *(pshort+2) , *pint64 , *(pint+2)); 輸出結果為:
A、0x201 , 0x403 , 0x807060504030201 , 0x0 ? ?B、0x201 , 0x605 , 0x807060504030201 , 0x0 ??
C、0x201 , 0x605 , 0x4030201 , 0x8070605 ?? ? ?D、0x102 , 0x506 , 0x102030405060708 , 0x0 ?
E、0x102 , 0x304 , 0x1020304 , 0x5060708 ? ? ? ? ?F、0x201 , 0x605 , 0x4030201 , 0x6050403
12、有關引用,下列說法錯誤的是:
A、引用定義時必須初始化
B、類的非靜態引用成員變量不需要在構造函數中初始化
C、數組可以有引用,但沒有引用數組
D、public派生對象可以初始化基類類型的引用
E、整型數據的常引用可以直接用數值初始化
F、以上選項都不是
13、Windows PE文件裝載到的地址為:
A、0x0030000 ? ?B、0x0040000 ? ?C、任意地址 ? D、0x10000000 ? ?
14、以下哪些對象可用于Windows進程間通信:
A、事件 ? ?B、臨界區 ? ?C、互斥量 ? ?D、共享內存
A、(A1(A2(A3A4))) ? ?B、(A1((A2A3)A4)) ? ?C、((A1A2)(A3A4)) ? ?D、((A1(A2A3))A4)? ?E、(((A1A2)A3)A4)
2、在32位機器上,有如下代碼:
char array[] = "abcdefg"; printf("%d\n",sizeof(array)); // 8char *p = "abcdefg"; printf("%d\n",sizeof(p)); // 4void func(char p[10]) {printf("%d\n",sizeof(p)); // 4 }void func(char (&p)[10]) {printf("%d\n",sizeof(p)); // 10 }int main(void) {printf("%d\n",sizeof(char[2])); // 2printf("%d\n",sizeof(char&)); // 1return 0; }其輸出結果依次為:
A、8 ? 4 ? 4 ?10 ?2 ?1
B、4 ? 4 ? 4 ?10 ?4 ?1
C、8 ? 4 ? 4 ?10 ?2 ?4
D、8 ? 4 ? 4 ?4 ?2 ?1
E、8 ? 4 ? 4 ?10 ?4 ?4
F、以上答案都不對
3、
CONTAINER::iterator iter , tempIt; for(iter = cont.begin() ; iter != cont.end() ; ) {tempIt = iter;++iter;cont.erase(tempIt); } 假設cont是一個CONTAINER的示例,里面包含數個元素,那么當CONTAINER為:
1、vector<int>
2、list<int>
3、map<int , int>
4、deque<int>
會導致上面的代碼片段崩潰的CONTAINER類型是:
A、1,4 ? ? B、2,3 ? ?C、1,3 ? ? ?D、2,4
正確答案選擇A(第1個、第4個都是線性的類型存儲,所以會存在崩潰)
4、以下代碼
class classA { public:classA(){clear();}virtual ~classA(){}void clear(){memset(this , 0 , sizeof(*this));}virtual void func(){printf("func\n");} }; class classB : public classA { };int main(void) {classA oa;classB ob;classA * pa0 = &oa;classA * pa1 = &ob;classB * pb = &ob;oa.func(); // 1ob.func(); // 2pa0->func(); // 3pa1->func(); // 4pb->func(); // 5return 0; } A、func ? ? ? ? ? ? ?func ? ? ? ?執行出錯 ? ? ?執行出錯 ? ? ? ?func ?
B、執行出錯 ? ? ? ? func ? ? ? ?執行出錯 ? ? ?執行出錯 ? ? ? ?func?
C、執行出錯 ? ? ?執行出錯 ? ? ?執行出錯 ? ? ?執行出錯 ? ? ?執行出錯
D、func ? ? ? ? ? ? ?func ? ? ? ? ?func ? ? ? ? ? ?func ? ? ? ? ?func
E、func ? ? ? ? ? ? ?func ? ? ? ?執行出錯 ? ? ? ? ?func ? ? ? ? ?func
F、以上選項都不對
5、在32位系統中
class CBase { public:void func(){Print();}virtual void Print(){cout<<"CBase::Print"<<endl;} }; class CDerived : public CBase { public:virtual void Print(){cout<<"CDerived::Print"<<endl;} };int main(void) {CDerived c;CBase *p = &c;return 0; } 請問:
sizeof(*p)的值是多少? (實際上求的就是一個成員變量的大小+一個虛表指針VPTR的大小)
A、1 ? ?B、4 ? ? C、8 ? ?D、12
p->Print(); 和 c.func();的輸出分別是?
A、CBase::Print ? ? CBase::Print ? ? B、CBase::Print ? ? CDerived::Print
C、CDerived::Print ?CBase::Print ? ?D、CDerived::Print ?CDerived::Print
6、
struct Thing {int valueA;const int valueB; }; Thing t; t的成員變量valueA 和 valueB 的值分別為:
A、0 ?0 ? ? B、垃圾值 ?0 ? ? C、無法運行 ? ? D、垃圾值 ?垃圾值
常成員變量valueB必須在構造函數中進行初始化
7、for(int x = 0 , y = 0; !x && y <= 5 ; y++)語句執行循環的次數是:
A、0 ? ? ? ?B、5 ? ? ? ?C、6 ? ? ? ?D、無數次
8、在Windows 32位操作系統中,假設字節對齊為4,對于一個空的類A,sizeof(A)的值為()
A、0 ? ? ? ? B、1 ? ? ? ? C、2 ? ? ? ? D、4
9、以下對函數指針的定義,哪些是正確的:
A、typedef ?int ?(*fun_ptr)(int , int); ? ? ? B、typedef ?int ?*(fun_ptr)(int , int);?
C、typedef ?int ?(fun_ptr*)(int , int); ? ? ? D、typedef ?*int ?(fun_ptr)(int , int);?
10、在32位系統中,下面結構體
struct st {char ch , *ptr;union{short a , b;unsigned int c : 2 , d : 1;};bool f;struct st *next; }; 的大小是:
A、14字節 ? ? ? B、16字節 ? ? ? C、20字節 ? ? ? D、24字節
11、32位小端字節序的機器上,如下代碼:
char array[12] = {0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08}; short *pshort = (short *)array; int *pint = (int *)array; int64 *pint64 = (int64 *)array; printf("0x%x , 0x%x , 0x%x , 0x%x", *pshort , *(pshort+2) , *pint64 , *(pint+2)); 輸出結果為:
A、0x201 , 0x403 , 0x807060504030201 , 0x0 ? ?B、0x201 , 0x605 , 0x807060504030201 , 0x0 ??
C、0x201 , 0x605 , 0x4030201 , 0x8070605 ?? ? ?D、0x102 , 0x506 , 0x102030405060708 , 0x0 ?
E、0x102 , 0x304 , 0x1020304 , 0x5060708 ? ? ? ? ?F、0x201 , 0x605 , 0x4030201 , 0x6050403
12、有關引用,下列說法錯誤的是:
A、引用定義時必須初始化
B、類的非靜態引用成員變量不需要在構造函數中初始化
C、數組可以有引用,但沒有引用數組
D、public派生對象可以初始化基類類型的引用
E、整型數據的常引用可以直接用數值初始化
F、以上選項都不是
13、Windows PE文件裝載到的地址為:
A、0x0030000 ? ?B、0x0040000 ? ?C、任意地址 ? D、0x10000000 ? ?
14、以下哪些對象可用于Windows進程間通信:
A、事件 ? ?B、臨界區 ? ?C、互斥量 ? ?D、共享內存
總結
以上是生活随笔為你收集整理的2013年完美世界校园招聘笔试题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2013年海康威视校园招聘笔试题
- 下一篇: 2013百度校园招聘-机器学习和数据挖掘