游戏软件开发工程师笔试题
第二部分 专业试题(60分钟)
请勿在笔试题目上答题,答案请写在草稿纸上。谢谢
一、 不定项选择题:
1. 设数组a[5, 10]的元素以行为主序存放,每个元素占用4个存储单元,则数组元素
a[i, j](0≤i≤4,0≤j≤9)的相对地址(对于a[0, 0])计算公式为
A. 10i + j B. 11i +j C. 10j + i D. 11j + i
2. 在一个32位机器上,采用4字节对齐方式,下面C++中结构sizeof(student)为_______
struct student {
int m_id:5;
char m_name[10];
bool m_sex;
int m_age;
};
A. 16 B.18 C. 20 D. 24
3. 下面哪种排序法对123456798在空间和时间上最优
A. 快速排序 B.冒泡排序
C. 插入排序 D.堆排序
4. C++在运行switch判断时(switch: ()),如下不能作为switch类型的是______
A. float B.int C. char D. unsigned char
5. 构造、拷贝构造和赋值运算符的概念
struct C
{
C()
{
cout <<"construct: C()" << endl;
i = 0;
}
C(const C &c) {
cout <<"construct: C(const C &c)" << endl;
}
C(int i) {
cout <<"construct: C(int i)" << endl;
this->i = i;
}
~C() {
}
C& operator = (const C&c) {
cout <<"operator = (const C &c)" << endl;
i = c.i;
return *this;
}
int i;
};
void test()
{
C *c;
c = new C(100);
C c2 = *c;
C c3;
c3 = c2;
}
四行输出的结果依次顺序为:
a. construct: C() b.construct: C(const C &c)
c. construct: C(int i) d.operator = (const C &c)
则输出的正确顺序为________
A. c b a d; B.a c b d C. c a b d D. d b a c
6. 请选择下列程序的输出结果________
class A
{
public:
void PrintOne(){cout<<”A”};
virtual void PrintSecond(){cout<<” A”};
};
class B: public A
{
public:
virtual void PrintOne(){cout<<” B”};
virtual void PrintSecond(){cout<<”B”};
};
void main()
{
A* a= new B;
B* b=new B;
a.PrintOne(); a.PrintSecond();
b.PrintOne(); b.PrintSe