Unity Need cram help for job application testing please !!!!

This topic is 4680 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello I am so excited, i just got short listed for a job interview so they must have liked at least something about my game demo that the GameDev.net community helped me so much with. ;p The position is for a Junior Programmer and I have to do a '3 hour software test' as part of the next stage. They gave me no clue other that that.... So I have about 40hrs - 2 sleeps to prepare and I am not sure how I should spend my time. I'm thinking I will be digging out my c++ books and just brushing up on that. Possibly also looking a little at the DirectX API which I am kind of familiar with. Is anyone here in a position to be able to offer me some advice on this??

Share on other sites
Hey,

Nothing that is obvious aside from:

Get enough sleep.

[and other general study stuff] - Also depending on how competent they are, you should possibly be prepared for silly questions about doing multiplication using only shifting and addition and that sort of stuff.

Hope it helps.

CJM

Share on other sites
Check out the tests at the bottom of this site

http://www.codesampler.com/miscsrc.htm

Good Luck

Share on other sites
Hey thanks a lot guys !

Those tests look like just the sort of thing i need to look into ;p

"multiplication using only shifting and addition"......can anyone explain how to do this ?

Share on other sites
Quote:
 Original post by bobbinusHey thanks a lot guys !Those tests look like just the sort of thing i need to look into ;p"multiplication using only shifting and addition"......can anyone explain how to do this ?

If you know long multiplication (which I would assume you do) then "multiplication using only shifting and addition" is basically just that in binary.

We all know that multiplying by 10 in decimal just involves shifting all the figures to the left then putting a zero at the end. It's similar in binary when multiplying by %10 (2 in decimal), i.e. shift left then put a zero at the end.

e.g.

%1101 * %0110=

(%00001101 * %0[bit 0])+
(%00011010 * %1[bit 1])+
(%00110100 * %1[bit 2])+
(%01101000 * %0[bit 3]) =

(%00011010 * %1)+
(%00110100 * %1) =
%1001110

In code, you would shift the multiplier to the right each time and if a 1 came out add the multiplicand to the result. Then shift the multiplicand left. Do this in a loop for all bits in the multiplier.

As to your original question, there's many different formats your test could take, from writing a function to do a particular job to a few smaller tests such as IQ tests, questions on c++, debug a small function etc. I don't think there's anything you can really prepare for.

In fact, they probably don't want you to prepare which is why they won't tell you what form the test will be. They will probably want to see how youthink about problems and how you go about solving them.

Good luck anyway.

Share on other sites
Quote:
 Original post by bobbinusHey thanks a lot guys !Those tests look like just the sort of thing i need to look into ;p"multiplication using only shifting and addition"......can anyone explain how to do this ?

Left-Shifting doubles the value of a number, so multiplication by a power of 2 can be easily achieved.

Multiplying by a number close to a power of 2 can be achieved by combining left-shifting with addition/subtraction:

a = (a << 3)-a;//multiply a by 8 then subtract a, giving a final value of a*7.

I've also been asked how to count the number of set-bits in an integer in O(n) where n is the number of set bits (Rare asked me this)

That can be done like this:
unsigned int bitCount(unsigned int data){    unsigned int count=0;    while(data)    {        data &= data-1;        ++count;    }    return count;}

They key to understanding this is that subtracting 1 from a number unsets the least significant set bit and sets all less significant bits:

e.g. 10001000 - 1 == 10000111;

so x &= x-1; simply unsets the least significant set bit.

Share on other sites
Quote:
 Original post by bobbinus"multiplication using only shifting and addition"......can anyone explain how to do this ?

Like so:

result = 640 * y //starting example equasion which we wish to evaluate using only addition & shifting
result = (512 + 128) * y //step 1: distribute the constant into a sum of powers of two.
result = (512 * y) + (128 * y) //step 2: distribute the other operand
result = (2^9 * y) + (2^7 * y) //step 3: convert into power-of-two representation (equasion uses ^ as in power (e.g. BASIC ^) not binary xor (e.g. C++ ^))
result = (y << 9) + (y << 7); //step 4: convert each power-of-two representation into shifts, ala this equivilancy: (2^n * y) == (y << n)

This is an ancient "optimization" back from the days of C compilers without optimizers. Any recent compiler should in fact automatically do this conversion for you as needed, meaning the difference is only cosmetic.

Share on other sites
Hehe. I like this question (from the Codemasters test, linked above):
Quote:
 What does mysteryFunction3D() compute?struct vector_3d_typ {// a 3-D vector along with normalization factorfloat x,y,z,w; } vector_3d,*vector_3d_ptr;float mysteryFunction3D_1(vector_3d_ptr u,vector_3d_ptr v){return( (u->x * v->x) + (u->y * v->y) + (u->z * v->z));}

Since it's under the "3D" section of the test I assume they're looking for an answer of "the (unnormalized) dot product", but in actual fact the answer is "nothing"!. They forgot to typedef their struct, so vector_3d_ptr is a global variable of type vector_3d_typ *, not a type and subsequently mysteryFunction3D_1 fails to compile. [lol]

Enigma

Share on other sites
Go learn the format of the floating point- how many bits are used for the mantissa and the exponent. People love asking about that.

Actually, make sure you know the typical sizes of all the data types.

The floodfill algorithm is popular, I've had to write that one like 3 times. Hint: Don't use recursion. Depending on how big the area is to be floodfilled, either keep a big queue for "next cells to look at", or have a flag for every pixel/cell that means "checked".

In fact, I remember one question that just asked "what is a better way to solve this problem, iteration or recursion?" The answer is almost always iteration.

Also, the quicksort algorithm seems to show up a lot. Luckily I don't think anyone has asked me to write quicksort from memory, which is good because it's a damn confusing algorithm. More likely, they'll show you a broken version of quicksort and ask you to fix it.

And these days, everybody seems to throw in a question about 3d math. Here's an example of one that I got: "Given a triangle defined by points A,B,C (<Ax,Ay,Az>, <Bx,By,Bz>,<Cx,Cy,Cz>) using clockwise winding, determine whether point P (<Px,Py,Pz>) is in front of the triangle, behind it, or coplanar."

Share on other sites
A test I was asked to complete had these sort of questions:

1. Some round about word problem that required binary partitioning. [a range of numbers, and you could tell if the answer was 'above' or 'below' a given guess, so you divide the range in two, successively until you find the solution]

2. Write a pathfinding function for a basic map type.

3. Add two abritrarily long strings, and return the result as a string.

4. Define an object class which has to do such-and-such things. [how to design for collision detection elegantly]

and one other I don't remember.

• 9
• 9
• 13
• 41
• 15
• Similar Content

• By Aryndon
Project Redemption is an semi-fantasy RPG with a linear story and an elaborate combat system.
We are building in Unity and are currently looking animators and artists.
What we are looking for
-Someone who is okay with split revenue/profits when finished
-Collaborate with others in the team. Do you have an idea/thought on what should be included? Tell us!
If you are interested. Please message me and I will get back to you as soon as possible! Or add me on Discord AJ#6664
• By Aggrojag
Hello!
I'm working on a game that is a narrative driven dark comedy with some small aspects of platforming and puzzle solving. The project is rather small as well. It touches on topics such as suicide, mental illness, family, corruption, free-will, and redemption.
This project is exercise in polish, this means some experimentation will be needed along with some reworking of assets as they're provided.
This will be a revshare model.
First, I'm looking for a 2D sprite artist, not pixelated, that can compliment the style of the attached images, and be similar to the temporary character.
We are looking to bring on a SFX designer at this time. Full list of required SFX will be available upon request, as well as a build with all elements related to sound implemented in some form (many SFXs pulled from the web for now). Will likely require some field recording, and some pretty strange SFX for when things get weird. I imagine a good portion of these will be quite fun to create.
Lastly, I'm looking for a male voice actor, English should be your primary language. There will be at minimum two characters that will need to be brought to life through vocals. The first voice is similar to Marvin from Hitchhiker's Guide to the Galaxy. A reference for the second voice would be a mix of Ren (Ren & Stimpy), and Android 21 (DragonBallFighterZ). Due to formatting, I'm not including YouTube links in the post, sorry.

WIP Scene with our custom shaders attached (platforms are lazily placed, as this was an asset test):

A scene with dynamic lighting and temp character:

If you made it to the bottom, thank you, and I look forward to hearing from you.

• Ok, firstly, Hi.

This is my first post on this forum. I am an Indie Dev making my first game so bear with me when I say dumb stuff, I'm on a huge learning curve.

My first question is about inventory systems for unity. I am trying to make a survival type game with crafting. I have purchased Inventory manager pro by devdog from the unity asset store and it seems like a pretty powerful assett but for an intermediate coder its a little tough to use.  I'm beginning to wonder if it was the right purchase.
So my question is.... does anyone have any experience of inventory plugins / systems for unity and can anyone reccomend a system to me?
It needs to have the following: Loot system, crafting system, character sheet, blueprint system,  character stats system. Ideally with as little coding as possible.

Thanks

• I've got a bug with my brick breaker style game. The bricks move down one line at a time ever 1.5 seconds. What appears to be happening is occasionally the ball will be just about to hit the brick when the brick moves down a line, and now the ball is behind it. I'm not sure how to fix this. I have two ideas but I'm not sure of implementation. 1 solution would be to check where they were and where they are going to be before rendering the frame. Then if they crossed paths, then register the brick as hit. Solution 2 would be change how the bricks move. I could maybe slide them down line by line, instead of a jump down. I'm not sure of this will fix the issue or not. Any ideas?
• By Pixeye
I wrote an extension for unity inspector that allows to group/fold variables.
Available on github  , cheers!