I got a test in C from Cryptic Studios and it's timed so I can't look at it and then go brush up. Anyone know what kind of stuff would be on it? I would consider myself proficient with C, but I would like to know what kind of stuff would be on it.
Printable View
I got a test in C from Cryptic Studios and it's timed so I can't look at it and then go brush up. Anyone know what kind of stuff would be on it? I would consider myself proficient with C, but I would like to know what kind of stuff would be on it.
I've never applied for a programming job, so I can't help you with what might be on the test. But good luck on getting the job. Game development should be fun.
C or C++? I know you said C, but they're a MMO game studio, not a low-level driver company :)
I took a C++ test when interviewing at Sybase. Very similar to the kinds of stuff you have in university (so, not too difficult). Know your OO, and know your memory management. File i/o is useful to know without having to look it up.
This was years ago, so all I can remember was they had this one question that asked, "what does this class do?" and it was some weird recursive linked list thing.
I think mostly, they just want to see that you can code, and that you're not a total waste of their time. It really helps to narrow things down and prevent the interviewers from wasting time on duds.
I kid you not. When I do phone screens, I always ask a really dumb coding question (most of the time, it's "reverse a string"), and you'd be amazed at how many candidates are all talk.
I can't speak for cryptic studios, but they're not out to trick you with trick questions. Most candidates are too daft to answer easy, straight-forward questions, so there's almost no need for it at the starting stages. :) good luck!
Oh good. Yes, I'm certain that they said C, not C++.
My specialty is low level stuff like memory management. I should refresh myself on i/o streams, I never used them much so I always looked up parameters for those functions.
Ah I see. Then i/o streams and the likes are probably very important, because I'll probably put you into the network layer somewhere hehe. Marshalling/unmarshalling, etc.
But really, don't worry about it. Do you know what position you're going for? Like, what department?
General programmer for a gaming company. I hope that they don't ask about networking, I have no knowledge of that at all. *gets scared* Well I'm off to do it and I've got my trusty C in a Nutshell book.
Good luck mate, let us know how you get on :)
:morecrying: I didn't do good, I couldn't figure out how to do one of the questions.
Can you tell me how to do this so that I don't go nuts:
Code:Given a string of 10 characters and a number, insert multiplies and
additions to make the characters equal the number
ie
1232537859, 995 -> 123*2+35*7+8*58
christ,
they expected you to come up with code to do that?
in a timed exam?
my first thought,
target = 995;
test = 1232537859;
if test is too high,
split in half and multiply two halves
12325*37859
if still too high, try addition instead
12325+37859
if still too high, split largest half, and multiply
12325*378*59
if still too high, pick largest multiple (12325*378) and try addition
etc, etc.
testing value, if too high picking the largest section and altering the operator
once all altered and still too high, split largest number and go again
if you get too low, backtrack one step and split smallest section instead
I don't know,
there's bound to be a way to do that nice & concisely
but it's certainly not obvious, and I wouldn't want to be timed to try to figure out a way of achieving it
That's kind of how I wanted to do it too, but backtracking was impossible without recursion and I didn't think the rest of it would work recursively. The other problem was a puzzle solver, I didn't get to it, but I knew how to do it.
I thought that question was a little too hard, I spent four hours on it. :morecrying:
Anyone else think they know how to do it?
the only other way I can think of right now, is the brute force approach
start with all addition
1+2+3+2+5+3+7+8+5+9
change one addition at a time into a multiple
1*2+3+2+5+3+7+8+5+9
1+2*3+2+5+3+7+8+5+9
......
1*2*3*2*5*3*7*8*5*9
then, combine first 2 digits and go again
12+3+2+5+3+7+8+5+9
......
12*3*2*5*3*7*8*5*9
then next two
1+23+2+5+3+7+8+5+9
......
1*23*2*5*3*7*8*5*9
then combining 2 sets of 2 digits
then 3 sets of two
yadda yadda
then combining one set of three digits
etc. etc.
slowly working your way up
it'd take forever to complete
but you'd hit every possible combination
I tried to do a brute force approach at first, but I couldn't figure out how to code it. :P I tried it with for loops, then recursively, then with while loops :?
I had to write a string solver too, but I just realized that I forgot to do preserve order precedence :P
Four hours? How long was this test?!? Definitely not what I would have thought. Sorry if I led you into thinking it would be easy. That's pretty insane for a test, but I would expect most everyone to mess up on that level. If you did alright for the others, you stand a chance (and you probably should have gone right to the next question if you knew how to do it - no need to spend 4 hours on one when you can do the next in half an hour).
For this one, I'd probably just go brute force and move on, and update it if I had the time.
The brute force solution space is not that huge... You have 10 characters, and the 9 spaces between them can either be a +, a * or nothing (i.e. they're connected as part of the same number). That means the full solution space has a size of 3^9 = 19683. Come to think of it, that's pretty tiny, if you don't think of it in terms of something that has to execute within the ticks of a game. That way, for brute force, you can separate the problem into "solution generator" and "solution tester" (which evaluates the expression). That second part is arguably harder to implement on the fly.
You can also do some MAJOR pruning by cutting off any search where the result exceeds the number requested, which is also pretty easy to build into your algorithm. It really is the "evaluation" part that you have to be careful of.
All that being said, my writing about it in a laid back environment doesn't compare to the high-stress environment you were in, and if they gave you 6 hours or so for the test, then I assume you were already pretty fried when you got to it. Let us know if they call you back!
3^9? Not quiet, it's a little bit more complicated than that. 3^9 tells you how many combinations of +'s, *'s, and nothings there are, but order also matters so for each of those 19,683 combinations, you have to do a permutation of all nine values. P(9, 9) = 9! = 36,2880 so, in fact, there are 7,142,567,040 solutions. That isn't easy, even for a computer. I couldn't figure out how to do the permutations anyway. :tonguewiggle:
Order? But all the numerals are in fixed positions...
The operations order, the number's positions are fixed like you said. There were nine operators.
True, but a + b * c isn't the same as a * b + c. There are lots of repeats as in the example above, but it's still a permutation.
123+2+5+3*7+8+59 = 998
I failed.
I tried working backwards...until I had a lower number to work with, and then forwards... see below if you can make sense of it
1 2 3 2 5 3 7 8 5 9 995
995-9 = 986
986/5 = 197.2
995-(5+9)=981
981/8 = 122.6
995-(8+5+9)=973
973/7 = 139
1 2 3 2 5 3 139
123+2+5+3*7+8+59 = 998
Lord almighty, that's a hard one. I was recently interviewed for a .NET programmer (something I know little off) and there was a 1/2 hour exam with questions on programming ("What is polymorphism?") SQL ("What is a subquery?") and web design ("What is CSS and what is it used for?"). Was pretty easy but I got some questions wrong.
Then in the interview they asked a series of "problem solving" questions, one of which was "How would you write a system that had a web interface and could sychronously communicate between two servers". That lost me, but I made up something.
Anyhow I got the job, so :D. Think of it this way: if they're cruel enough to set that as a question, would you like to work for them?
If you want help on this subject message me and Ill give you my mates msn.
He kinda knows everything about it.
:D
It's covered by the 3^9
Here, let's pick a simpler example with just 3 characters. Exhaustively, the possibilities are:
1) abc
2) a+bc
3) a*bc
4) ab+c
5) ab*c
6) a+b+c
7) a*b+c
8) a+b*c
9) a*b*c
... = 3^2 = 9 possbilities.
Your permutation argument would stipulate that in this case, there are 18 possibilities, which is not true.