[Week 1] Sample Game Programming Interview Question

  • (2 Pages)
  • +
  • 1
  • 2

21 Replies - 23931 Views - Last Post: 04 January 2012 - 03:13 PM

#1 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 999
  • View blog
  • Posts: 4,175
  • Joined: 14-February 08

[Week 1] Sample Game Programming Interview Question

Post icon  Posted 03 February 2011 - 05:46 PM

*
POPULAR

Sample Interview Question 1

I am going to be posting a weekly sample interview question for you guys to try out :) if you don't know the answer then you should look it up, this stuff is essential and will serve you well in the future.

Please put your answer between spoiler tags (like code tags but with the word spoiler instead) so people can read the thread without getting the answers straight away. OK then...

Question 1

Look at this class declaration can you calculate how much memory an instance of this class would take up?
You may have to make some assumptions, please list them too. What improvements could you make so that this class could take up less memory?

class GameObject
{
public:
    GameObject();
    ~GameObject();

    virtual Mesh &GetMesh();
    float GetAnimationTime() const;

private:
    uint       m_health;
    Vector3    m_position;
    Vector3    m_velocity;
    bool       m_bVisible;
    Quaternion m_orientation;
    bool       m_bAlive;
    float      m_creationTime;
    bool       m_bAnimated;
}



Is This A Good Question/Topic? 9
  • +

Replies To: [Week 1] Sample Game Programming Interview Question

#2 TMKCodes  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 48
  • View blog
  • Posts: 440
  • Joined: 21-March 09

Re: [Week 1] Sample Game Programming Interview Question

Posted 03 February 2011 - 06:30 PM

Don't know how much the function pointers take space, but i tried calculating the variables. Anyway this will be really useful.
Spoiler

This post has been edited by TMKCodes: 03 February 2011 - 06:34 PM

Was This Post Helpful? 0
  • +
  • -

#3 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: [Week 1] Sample Game Programming Interview Question

Posted 03 February 2011 - 06:40 PM

I don't know if my post got deleted or if I didn't actually post it :blush:

I think you should throw in a long, but I'm kind of a jerk hehe :devil2:
Was This Post Helpful? 0
  • +
  • -

#4 (Cryptic)  Icon User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 69
  • Joined: 13-January 11

Re: [Week 1] Sample Game Programming Interview Question

Posted 07 February 2011 - 09:16 AM

Ok I dont know how to edit my post above, so I'm going to have to multi post (my bad).

My question to your Interview question is, how do you actually improve it? And if you cannot improve it, it doesn't lead to a conversation or topic regarding anything. What I'm trying to get at is, how from the question do we insinuate that the question you are asking us is related to, what ever it is, it is related to. (I'm sure i'm not making sense... ).

So lets say I was asked this question, and I don't know the answer. I might have a though process which you would like to hear, but no communicative way to express that since I wouldn't know it if is even relevant. And thus, rendering my answer and thought process, mute. Now I know this is wrong, but, it is how some people would deal with it (for example myself). And even, if I did know that it was related to "usage of limited memory allocation". Again I wouldn't know how to bring that across, because the question is and was "What improvements could you make".

On the other hand (as I was typing out the above I though of this):

Spoiler

This post has been edited by (Cryptic): 07 February 2011 - 09:25 AM

Was This Post Helpful? 1
  • +
  • -

#5 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: [Week 1] Sample Game Programming Interview Question

Posted 07 February 2011 - 09:48 AM

In response to (Cryptic), here are some possible ways the memory usage could be reduced:

Spoiler

This post has been edited by atraub: 08 February 2011 - 07:59 AM

Was This Post Helpful? 1
  • +
  • -

#6 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: [Week 1] Sample Game Programming Interview Question

Posted 07 February 2011 - 09:52 AM

*
POPULAR

I hope that stayscrisp doesn't mind me mentioning the following spoiler, but I doubt anyone will come up with this idea that should score big marks and I spotted immediately:

Spoiler

This post has been edited by ButchDean: 07 February 2011 - 09:53 AM

Was This Post Helpful? 5
  • +
  • -

#7 (Cryptic)  Icon User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 69
  • Joined: 13-January 11

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 06:54 AM

Wow. This shows a huge gap between amateurs and either professional/skilled programmer. Does that reflect what would be the ideal answer? And is that expected?

How about:

Spoiler

Was This Post Helpful? 1
  • +
  • -

#8 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 07:19 AM

Spoiler

This post has been edited by atraub: 08 February 2011 - 08:02 AM

Was This Post Helpful? 1
  • +
  • -

#9 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 07:33 AM

View Post(Cryptic), on 08 February 2011 - 01:54 PM, said:

Wow. This shows a huge gap between amateurs and either professional/skilled programmer. Does that reflect what would be the ideal answer? And is that expected?

How about:

Spoiler

Don't use unions because memory is shared between the member variables of that union. It's not the same thing. :)

This post has been edited by ButchDean: 08 February 2011 - 07:33 AM

Was This Post Helpful? 0
  • +
  • -

#10 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 07:39 AM

View Post(Cryptic), on 08 February 2011 - 01:54 PM, said:

Wow. This shows a huge gap between amateurs and either professional/skilled programmer. Does that reflect what would be the ideal answer? And is that expected?

Sorry, forgot to answer this bit. :)

In programming tests there are three ways that you can answer a question:

1. Give the (or a) right answer.
2. Give the (or a) wrong answer.
3. Give an insightful answer.

The ones in category (3) generally get the job, because it shows an in-depth understanding beyond the 'Average Joe' who can memorize stuff. :)
Was This Post Helpful? 3
  • +
  • -

#11 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 07:40 AM

View PostButchDean, on 08 February 2011 - 09:39 AM, said:

In programming tests there are three ways that you can answer a question:

1. Give the (or a) right answer.
2. Give the (or a) wrong answer.
3. Give an insightful answer.

The ones in category (3) generally get the job, because it shows an in-depth understanding beyond the 'Average Joe' who can memorize stuff. :)


yes
Was This Post Helpful? 0
  • +
  • -

#12 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 999
  • View blog
  • Posts: 4,175
  • Joined: 14-February 08

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 07:41 AM

Spoiler

Was This Post Helpful? 0
  • +
  • -

#13 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 07:44 AM

View Poststayscrisp, on 08 February 2011 - 02:41 PM, said:

Spoiler

Excellent! :D
Was This Post Helpful? 0
  • +
  • -

#14 (Cryptic)  Icon User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 69
  • Joined: 13-January 11

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 08:39 AM

View Postatraub, on 08 February 2011 - 07:19 AM, said:

Spoiler


I like tinyInt!

stayscrisp, so there is only 1 right answer? Also would this question be for Experienced ? Senior ? Junior? Or you would not care, and just ask the candidate?
Was This Post Helpful? 0
  • +
  • -

#15 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: [Week 1] Sample Game Programming Interview Question

Posted 08 February 2011 - 08:40 AM

yeah, originally I did go with UTinyInt lol, I called an audible.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2