某游戏公司的面试题

注意:所有题目答案请提供答题思路,否则视为未回答。

1. 现有1000个苹果,10个盒子,问各个盒子内应该分别放入多少个苹果,才能使得用户要买任意1至1000之间的一个苹果数,都可以给他(卖的时候是整个盒子卖,不能拆盒子的包装)。

2. 请仔细阅读下面的资料:
 材料一:CArray
template< class TYPE, class ARG_TYPE > class CArray : public CObject
Parameters:
TYPE
Template parameter specifying the type of objects stored in the array.
TYPE is a  parameter that is returned by CArray.
ARG_TYPE
Template parameter specifying the argument type used to access objects stored in the  array.

Often a reference to TYPE. ARG_TYPE is a parameter that is passed to CArray.

Remarks:
The CArray class supports arrays that are are similar to C arrays, but can dynamically  shrink and grow as necessary.

Array indexes always start at position 0. You can decide whether to fix the upper bound or allow the array to expand when you add elements past the current bound. Memory is allocated contiguously to the upper bound, even if some elements are null.
 
int CArray::Add (ARG_TYPE newElement);
 
Return Value:
The index of the added element.
Parameters:
ARG_TYPE
Template parameter specifying the type of arguments referencing elements in this array.
newElement
The element to be added to this array.
 
TYPE& CArray::operator [] (int nIndex);
Parameters:
TYPE
Template parameter specifying the type of elements in this array.
nIndex
Index of the element to be accessed.
Remarks:
Returns the array reference of element at the specified index.
 
1) 材料二:CList
template<class TYPE, class ARG_TYPE>class CList : public CObject
Parameters:
TYPE
Type of object stored in the list.
ARG_TYPE
Type used to reference objects stored in the list. Can be a reference.
Remarks:
The CList class supports ordered lists of nonunique objects accessible sequentially or by value.
CList lists behave like doubly-linked lists.
 
void CList::AddTail(ARG_TYPE newElement);
Parameters:
ARG_TYPE
Template parameter specifying the type of the list element (can be a reference).
newElement
The element to be added to this list.
Remarks:
Adds a new element or list of elements to the tail of this list. The list can be empty before the operation.

2) 材料三: realloc
realloc
Reallocate memory blocks.
void *realloc(void *memblock, size_t size);
Return Value:
The return value points to a storage space that is guaranteed to be suitably aligned for storage of any type of object. To get a pointer to a type other than void, use a type cast on the return value.
Remarks:
The size argument gives the new size of the block, in bytes. The contents of the block are unchanged up to the shorter of the new and old sizes, although the new block can be in a different location. Because the new block can be in a new memory location, the pointer returned by realloc is not guaranteed to be the pointer passed through the memblock argument.
 
3) 请指出下面这段代码可能会出现的问题
CList<VARIANT*, VARIANT*> g_ValueList;
CArray<VARIANT, const VARIANT&> g_ValuePool;
void AddNewValue (const VARIANT& newValue)
{
g_ValueList.AddTail(&g_ValuePool[g_ValuePool.Add(newValue)]);
}

3. 有一无符号整型数组,大小为10, 初始的数值随机,但在[0, 99]之间。请用C语言写一个过滤程序,令数组内的数据互不相等。
说明:
    1.若数组内有相等的数据,可令某一数值加1或减1作出偏移,直至不等为止。
    2.数组内的数据只能在[0, 99]之间。
    3.保持数组内的数据位置不变,即对应下标不变。

4. 按要求编写以下函数。
功能:将给定缓冲区中的#字符移到字符串尾部
函数名称:ChangeToTail
入口参数:pSZ指向缓冲区的指针, nSize缓冲区长度
出口:pSZ所指缓冲区中的#字符被移到缓冲区尾部
返回值:在出口缓冲区中第一个#的位置,若缓冲区中无#字符则返回-1
说明:如传入#W#W#W#WW#, 10 则传出时应转换为WWWWW#####并且返回值为5
int  ChangeToTail(BYTE* pSZ, UINT nSize)
{
// Todo:请在此加入您的代码
}

5. 阅读以下程序,纠正其中的错误。(40分钟)
//------------------------------------------------------------------
class CCelsius
{
public:
 CCelsius()   { m_nC = 0; }
  ~CCelsius()   {}

 short ToFahrenheit()   { return m_nC * 9 / 5 + 32; }
 void  SetC(short nCelsius) { m_nC = nCelsius; }
 short GetC()    { return m_nC; }

protected:
 short m_nC;
};

class CFahrenheit
{
public:
 CFahrenheit()   { m_nF = 0; }
  ~CFahrenheit()  {}

 short ToCelsius()     { return (m_nF - 32) * 5 / 9; }
 void  SetF(short nFahrenheit) { m_nF = nFahrenheit; }
 short GetF()      { return m_nF; }

protected:
 short m_nF;
};

class CTemperature : public CCelsius , public CFahrenheit
{
public:
 CTemperature();
 ~CTemperature();

 BOOL CreateLevel(UINT nSize);
 void ReleaseLevel();
 UINT GetLevel(int nCelsius);

protected:
 UINT    m_nSize;
 short*  m_pLevel;
};

//------------------------------------------------------------------

CTemperature::CTemperature()
{
 m_nSize  = 0;
 m_pLevel = NULL;
}

CTemperature::~CTemperature()
{
 ReleaseLevel();
}

BOOL CTemperature::CreateLevel(UINT nSize)
{
 ASSERT(m_pLevel == NULL);
 if (m_pLevel)
return FALSE;

 m_pLevel = new short[nSize];
 if (m_pLevel == NULL)
return FALSE;

 for (UINT i = 0; i < nSize; i++)
m_pLevel[i] = 100 * i * i;

 m_nSize = nSize;
 return TRUE;
}

void CTemperature::ReleaseLevel()
{
 if (m_pLevel)
 {
delete [] m_pLevel;
m_nSize  = 0;
m_pLevel = NULL;
 }
}

UINT CTemperature::GetLevel(int nT)
{
 ASSERT(m_pLevel);

 for (UINT nLevel = 0; nLevel < m_nSize; nLevel++)
 {
if (m_pLevel[nLevel] > nT)
break;
 }
 return nLevel;
}

void OutC(CCelsius* pC)
{
if (pC)
printf("摄氏%d度等于华氏%d度/n", pC->GetC(), pC->ToFahrenheit());
}

void OutF(CFahrenheit* pF)
{
if (pF)
printf("华氏%d度等于摄氏%d度/n", pF->GetF(), pF->ToCelsius());
}

void OutL(CTemperature* pT)
{
 if (pT)
 {
printf("摄氏%d度的等级为:%d/n", pT->GetC(), pT->GetLevel(pT->GetC()));
printf("华氏%d度的等级为:%d/n", pT->GetF(), pT->GetLevel(pT->GetF()));
 }
}

void main()
{
 CTemperature* pTemperature = new CTemperature;
 if (pTemperature == NULL)
return;
 CCelsius* pCelsius = (CCelsius*)pTemperature;
 pCelsius->SetC(100);
 OutC(pCelsius);
 CFahrenheit* pFahrenheit = (CFahrenheit*)pCelsius;
 pFahrenheit->SetF(400);
 OutF(pFahrenheit);
 pTemperature->CreateLevel(3);
 OutL(pTemperature);
 CTemperature* pTempOther = new CTemperature;
 if (pTempOther == NULL)
  return;
 *pTempOther = *pTemperature;
 delete pFahrenheit;
 OutL(pTempOther);
 delete pTempOther;
}

6. C++程序设计
1) 写出以下程序的运行结果:
#include <iostream>
class Base
{
public:
 Base()
 {
  cout << "Base()" << endl;
 }
 Base(const Base &theBase)
 {
  cout << "Base(const Base &theBase)" << endl;
 }
 ~Base()
 {
  cout << "~Base()" << endl;
 }
 void Open()
 {
  OnOpen();
 }
private:
 virtual void OnOpen() = 0;
};

class Derived : public Base
{
public:
 Derived()
 {
  cout << "Derived()" << endl;
 }
 Derived(const Derived &theDerived)
 {
  cout << "Derived(const Derived &theDerived)" << endl;
 }
 ~Derived()
 {
  cout << "~Derived()" << endl;
 }
private:
 virtual void OnOpen()
 {
  //这里可能抛出异常
 }
};
Base *CreateInstance()
{
 return new Derived();
}

int main()
{
 Base *pBase = ::CreateInstance();
 if (pBase)
 {
  pBase->Open();
  delete pBase;
 }
 return 0;
}

2) 在1)中,类Base和类Derived的实现有没有问题?如果有,如何修改?

 


3) 说明1)中类Base的Open函数和OnOpen函数的设计目的和意义。

 


4) 使用STL技术修改main()函数中的代码,使之成为异常安全的。

### 武汉微派游戏测试面试题 武汉微派是一家知名的游戏公司,其招聘的游戏测试岗位通常会考察应聘者的技术能力、逻辑思维以及对游戏行业的理解。以下是常见的几类面试题目及其解析: #### 技术知识部分 1. **自动化测试工具的选择及使用** 面试官可能会问到你在之前的工作经验中是否接触过自动化测试工具,并要求举例说明你是如何选择合适的工具来满足特定项目的需要。 2. **Bug管理流程** 描述从发现bug到最后修复验证整个过程中的关键步骤和注意事项,包括但不限于提交详尽的报告(重现步骤)、分类优先级等操作规范。 3. **性能测试方法论** 解释为什么要做性能测试,有哪些指标可以衡量应用的表现效果;分享一些常用的做法如压力测试、负载测试的具体实施手段。 #### 业务理解方面 4. **对公司产品的了解程度** 提前研究目标公司的主营产品线,在面试时能够清晰地阐述出你对他们所推出的某款手游或其他娱乐软件的认识。 5. **用户反馈的重要性** 讨论如何收集并分析玩家的意见建议用于改进产品质量和服务体验,同时也要意识到保护个人隐私数据安全的问题。 6. **团队协作精神** 游戏产业往往涉及到跨部门间的密切合作,比如策划、美术、程序等部门之间相互沟通协调才能完成一款作品的研发工作,所以这方面的软实力也是必不可少的考量因素之一。 #### 实战演练环节 7. **现场模拟找茬儿游戏关卡设计漏洞** 给定一定时间限制内快速浏览一段新上线版本的内容截图或视频演示片段,然后指出其中存在的明显错误点所在位置或者潜在风险隐患之处。 8. **解答关于某个技术难题的实际案例** 假设有一个典型场景描述给你听,请按照自己掌握的知识体系给出合理的解决方案,并解释这么做的理由依据是什么? --- 为了帮助您更好地准备这类考试,这里提供几个思考方向供参考:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值