现在的位置: 首页 > 综合 > 正文

GameLoft Interview Question

2013年12月07日 ⁄ 综合 ⁄ 共 2868字 ⁄ 字号 评论关闭

1、 求下列代码执行以后expr的值

a)        int a = 8,b = 4;

int expr =a++%++b*2

 

b)       int expr = 20 / 8 * 8;

 

c)        int expr = 4 << 2 + 1;

 

d)       int expr = -4321>>>30;

 

e)        int expr = 123 ^ 321 ^ 123;

 

f)        int a = 255;

int expr =(byte)a + (((byte)a) & 0xff);

 

g)       int expr = “123454321”.charAt(4)+ 2;

 

 

h)       Integer a =  new Integer(1234);

Integer b =  new Integer(1234);

boolean expr = a== b;

 

i)         String func(String s){

returns.length() > 0 ? func(s.substring(1)) + s.charAt(0) : “”;

}

Striing expr =func(“Gameloft”);

 

 

2、 知识题

a)        什么是垃圾回收?什么时候触发垃圾回收?如何降低垃圾回收的触发频率?它能保证程序有足够的可用内存吗?

 

 

b)       请写出short的取值范围。

 

 

c)        什么是混淆(obfuscate)?有什么好处?有哪些工具可以混淆jar文件?

 

d)       什么是状态机?游戏开发中有那些地方能用到状态机?

 

e)        请根据你的知识,对以下计算机名词进行尽量简单的描述:

                       i.             J2ME

 

                     ii.             Python

 

                   iii.             Ant

 

                    iv.             Javac

 

                      v.             Subversion

 

                    vi.             OpenGL

 

 

f)        请列出你心目中一名优秀员工所应该具备的品质,并按重要程度排序

 

 

 

3、 分析以下程序:

constSCREEN_WIDTH = 176;

const TEXTWORD_SPACE= 3;

 

public staticvoid DrawString(String strText,int posX,int posY,int flagX){

        int width = GetTextWidth(strText);

        int x,int y = posy;

        if(flagX > 0){

               x = 0;

        }

        else if(flagX == 0){

               x = (SCREEN_WIDTH – width) / 2;

        }

        else{

               x= SCREEN_WIDTH – width;

        }

        x += posX;

       

        byte charTemp;

        for(int i = 0;i <=strText.length();i++){

               charTemp = strText.charAt(i);

               if(charTemp < ‘!’ | charTemp> ‘z’){

                      x += TEXTWORD_SPACE;

                      continue;

               }

               x += DrawCharacter(charTemp,x,y);

        }

}

问题:

1)       请尽量找出程序中的错误,直接标注在上面。

2)       请解释参数flagX的作用

 

 

3)       请推测函数DrawCharater的返回值有什么意义?

 

 

4、 应用题

a)        写一个函数判断两个圆是否相交,并尽量优化运行速度。

boolIsOverlapped(int x1,int y1,int r1,int x2,int y2,int r2)

 

 

b)       写一个函数去掉一个字符串中单词间多余的空格,使得相邻两个单词间有且只有一个空格。例如当输入字符串是“Hello!_ _Game_programming_ _world!”时,调用该函数后字符串变为“Hello!_Game_programming_world!”。

 

 

c)        假定屏幕的像素宽度为screenWidth,写一个函数计算一个字符串需要分成几行显示。

要求:

1、每行应尽可能多地显示字符,但不能有字符部分或完全显示在屏幕外。超过部分的字符换下一行显示。

       2、每个字符的像素宽度不一样,每个字符的像素宽度不一样。用intGetCharWidth(char c)获得每个字符的像素宽度。

 

 

5、 把以下段落翻译成中文

a)        An integral approach to codedocumentation is to write the code so that it documents itself.In otherwords,the code should be naturally readable in such a way as to make it easy tounderstand .This is accomplished by proper naming conventions and
statementformatting.

 

 

b)       Collections are the datastructures that are most easily altered for performance-tuning purposes. Usingthe correct or most appropriate collection class can improve performance withlittle change to code. For example, if a large ordered collection
has elementsfrequently deleted or inserted throughout it, it usually can provide better performanceif based on a linked list rather than an array. On the other hand, astatic(unchanging) collection that needs to be accessed by index performs betterwith an underlying
implementation that is an array.

抱歉!评论已关闭.