A big reason why the attrition rate of Science, Engineering, and Math is so high in universities, and what’s being done to alleviate the problem:
I completely agree with the approaches being taken.
A big reason why the attrition rate of Science, Engineering, and Math is so high in universities, and what’s being done to alleviate the problem:
I completely agree with the approaches being taken.
Indeed, I didn’t pay thousands of dollars to go to class with a glorified talking book. In addition, I also support labs since computer programmers are some of the most socially deviant people I know. Either they’re too socially awkward or they’re too pretentious for their own good. Being put in an environment where they can work together helps them in the real world where they’ll be working on teams with other programmers.
For the guys who are learning languages, simple rule of thumb I follow is to practice coding 2 hours for every hour of lecture/study. Computer programming is something you need to be a perfectionist for, since programs won’t work if you break the syntax.
We could do something neat in this thread like ask programming questions, or maybe even interview questions or something(for any who are interested in getting a job in the industry).
I’m interested in looking at any programming tests that employers give to prospects. One of the grads here showed us the test he was given when he was interviewed by Gameloft.
I’ve interviewed all over the place, everywhere from bungie to havok, so I’ve got a ton of questions. I don’t think I’ll throw up any entire tests but there’s some pretty interesting questions we could discuss. There’s a lot of general categories.
Written tests usually have:
an algorithm analysis question(thoguh not always directly, usually it’s a fairly simple problem that can easily be done n^2 and then has some slight modification to be n or n log n(if this n notation stuff looks weird to anyone, speak up because it’s super important to understand, it’s called big O notation).
Some sort of bitwise question(essentially “do you understand how bitwise | and & symbols work and how they are used”).
a debug question
a very specific algorithm design(here’s a problem and how we want you to go about it, now implement the function)
an open ended algorithm design(Here’s a problem. go.).
in person interviews usually have:
Discuss stuff you have coded(usually want to know something interesting you’ve done, how you figured out how to solve the problem, and how you implemented it)
what team projects you’ve done and what they were like
write out some code for them on the white board(they generally want you to ask lots of questions and see your thought process more than anything else)
discuss some algorithms
a logic problem of some sort.
Anyone else can chime in on what they’ve experienced in interviews but those are all pretty common in my experience.
Heres a copy/paste of a programming test I took for a job in the games industry
// Programmer’s Test
// Created: October 12, 1999
// Last Revision: July 08, 2005
// Please attempt all questions on this test. Type your answers immediately
// after the questions. If you are unable to solve a problem, typing your
// thoughts as you attempted the problem is useful. However, writing code is
// more useful.
// There are nine questions on this test. If you get stuck on one, move to the
// next one.
// Point totals for each question (or sub-question) are given in square
// brackets. There are 100 total points.
// You may not consult with anyone, reference any books, websites, etc. in
// completing this test. Do not use any compiler or utility to check your
// code.
// Cheating, or sharing the contents of the test with anyone will disqualify
// You will have three hours to complete this test.
const char *name = “Your Name Here”;
const char *date = “Today’s Date”;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (1) Consider the following important infinite sequence of numbers:
//
// 1, 1, 2, 3, 5, 8, 13, 21, 34, …
//
// where the zeroth element is 1, the first element is 1, the second element is
// 2, etc.
// (1a) [3] Write an iterative (non-recursive) function to return the Nth
// element in this sequence using this function prototype:
int isequence(int index);
// (For example, sequence(3) would return 3, as 3 is the third element in the
// list, counting from 0.)
// (1b) [3] Write a recursive function to return the Nth element in this
// sequence using this function prototype:
int sequence(int index);
// (1c) [4] Which implementation is faster? Why? What are the key
// differences? Quantify the difference in speed.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (2) [10] Write a function to remove all nodes containing even values from a
// linked list of integers. Upon exit, a new list will be returned that
// contains all the even values. The original list will contain only odd
// values. You should do this by modifying the original list. You should
// not create any new nodes.
//
// For example, if the original list contained the elements {1, 2, 3, 4, 5},
// upon exit it would contain {1, 3, 5} (or {5, 3, 1} – order doesn’t matter)
// and the function would return a pointer to the list {2, 4} (or {4, 2}).
//
// Be sure to deal with all degenerate cases.
typedef struct node {
intvalue;
node*next;
} node;
node *split_list(node **inlist)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (3) [10] Write the function described by the following comment header.
// Be sure to write the function prototype, as well.
// Determine the second largest integer in an array of ints
// If the two largest integer values in the array are identical, return that
// value.
// Formal parameters:
// count - number of elements in array
// plist - a pointer to first element in array
// Return value:
// value of second largest integer value in the array
// ERROR if data input is invalid or a second largest cannot be determined.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (4a) [8] Write a function to determine the most frequently used letter in a
// null terminated string. Ignore case. For example, in the string “ZzZ A
// man, a plan, a canal, Panama! ZzZzzZZz” the answer would be “z”. Assume
// the string is no more than one billion characters long. Please note that by
// letter, we mean alphabetic letter ‘a’ through ‘z’. Hence if the string was
// “!!!a”, the most frequent letter would be ‘a’.
//
// Very important: SPEED IS THE MOST CRITICAL FACTOR. Your program may use no
// more than one megabyte of RAM. Make sure your code won’t crash.
//
// Use the following function prototype:
char most_frequent_letter(char *buf);
//
// (4b) [2] Is your function optimized for big string or small strings?
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (5) [10] You are writing some code for a 3D shooter. You need to
// determine if someone should fire on its target. You are told that
// the attacker should fire on its target if:
//
// 1. The attacker is within FIRE_RANGE units of the target
// 2. The target is in front of the attacker
//
// Assume you can call the following functions:
typedef struct vector {
float x, y, z;
} vector;
typedef struct matrix {
vector rvec;// right unit vector
vector uvec;// up unit vector
vector fvec;// foward unit vector
} matrix;
// return dot product of vector v1 and v2
float vec_dotproduct(vector *v1, vector *v2);
// return magnitude of vector
float vec_magnitude(vector *v);
// normalize the vector v
void vec_normalize(vector *v);
// subtract v2 from v1, putting the result in out
void vec_subtract(vector *out, vector *v1, vector *v2);
// Complete this function, returning 1 if the attacker should
// fire on its target, otherwise return 0. All positions are
// in global coordinates.
int attacker_should_fire(matrix *attacker_orient, vector *attacker_pos,
vector *target_pos)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (6) [10] Consider the following code:
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned long U32;
struct Data
{
U8one;// data values
U16two;
U8three;
U32four;
const void *user;// user data
void (*callback)( Data *data );// user callback, or NULL if none
};
S16 do_something( Data input, U8 size / no. elements in input */, U32 value, const char *string )
{
// shuffle data
for ( U8 i = size - 1; i >= 0; --i ) {
input[ i ] = input[ i + 1 ];
input[ i ].callback( input + i );
}
// find the maximum value of 'two’
S16 maxValue2 = input[ 0 ].two;
for ( U8 i = 1; i < size; ++i )
if ( input[ i ].two > maxValue2 )
maxValue2 = input[ i ].two;
// find the maximum value of 'four’
U32 maxValue4 = input[ 0 ].four;
for ( U8 i = 1; i < size; ++i )
if ( input[ i ].four > maxValue4 )
maxValue4 = input[ i ].four;
// find the maximum character in the string
U32 maxCharacter = string[ 0 ];
while ( *string != 0 ) {
if ( *string > maxCharacter )
maxCharacter = *string;
}
// update the data
input[ maxCharacter ].two = maxValue2;
input[ maxCharacter ].three = value;
input[ maxCharacter ].four = maxValue4;
input[ maxCharacter ].user = string;
input[ maxCharacter ].callback( input + maxCharacter );
}
// Find as many risky code/bugs/performance issues with this code as you can.
// You should be able to find at least 5 things wrong with the code (there is
// more than five.)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (7) As part of a frequently executed AI routine, you need to build a data
// structure containing the IDs of all the monsters that are within 20 meters
// of the player. There are up to 100 monsters per level, so there may be 0 to
// 100 monsters that meet this criterion. The order of elements in this data
// structure is unimportant.
// (7a) [5] What are the advantages and disadvantages of collecting this data
// in (A) an array, and (B) a linked list with dynamically allocated
// nodes.
// (7b) [5] Which would you choose?
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (8) [15] The following code naively compresses a 32-bit image into an 8-bit
// paletted image.
//
// It makes use of the function “find_best_pixel” to find the pixel that is
// the “best” approximation to a given pixel from a list of pixels.
byte find_best_pixel(int p, int *found_pixels, int num_found, float *quality);
int found_pixels[256];
int palettize(int *pixp, int num_pixels, byte *outpix)
{
inti, j, pixval;
intnum_found = 0;
for (i=0; i<num_pixels; i++) {
intp = *pixp++;
for (j=0; j<num_found; j++) {
if (found_pixels[j] == p)
break;
}
if (j == num_found) {
if (num_found < 256) {
pixval = num_found;
found_pixels[num_found++] = p;
} else {
// All palette slots taken. Get the nearest pixel.
floatquality;
pixval = find_best_pixel(p, found_pixels, num_found, &quality);
}
} else {
pixval = j;
}
*outpix++ = pixval;
}
return num_found;
}
// The most serious problem with this function is that the first 256 unique
// pixel values will form the palette. This is likely to give poor results.
//
// Improve the function palettize, perhaps by more intelligent use of
// find_best_pixel, to generate a better palette and therefore higher quality
// output. It is OK for your function to be much slower than the naive
// palettize() above. It is not OK for it to be 1,000 times as slow on an
// image of 256x256 pixels.
//
// You do not need to write find_best_pixel().
//
// Here is a description of how find_best_pixel() works:
//
// Given a 32 bit pixel p, find the pixel in the array *found_pixels that is
// the closest approximation. *quality is a value between 0.0 and 1.0 that
// describes the nearness of the fit. For an exact match, *quality will have
// a value of 1.0. In the worst case, if you’re looking up a pixel (0,0,0,0)
// and the only pixel in the list is (255,255,255,255), you will get a
// *quality of 0.0. Unfortunately, if you call find_best_pixel with num_found
// == 0, it will crash.
//
// Note: It’s essential that you write code to implement a solution. While
// this is a heavily researched area, we’re not interested in answers like,
// “I’d use XYZ algorithm.” If you know the algorithm, you can code it. If
// you can’t code it, code something else. This is a question of coding and
// implementing a solution, not of being familiar with the research. However,
// please explain your improvements in English in the comment header.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// (9) The following function computes all primes less than num and stuffs
// them in the global array Primes. It is very slow. Note, “%” is the mod
// operator. “a % b” returns the remainder when a is divided by b. For
// example, 7 % 3 is 1.
int Num_primes, Primes[100000];
void compute_primes_slow(int num)
{
inti, j;
Num_primes = 0;
for (i=2; i<num; i++) {
for (j=2; j<i; j++) {
if (i%j == 0) {
break;
}
}
if (i == j)
Primes[Num_primes++] = i;
}
}
// (9a) [2] If it takes this function one second to determine primes less
// than 10,000, how long will it take to determine primes less than 20,000?
// (9b) [10] Write a much more efficient version of this function. A good
// solution will be at least 100 times as fast for values of num around 10,000.
// Your implementation may not consume more than five times as much memory for
// code and data (not including the array Primes[]) as this implementation,
// including global and stack space.
// (9c) [3] Explain why your code is much faster and quantify your answer in
// some useful way.
// EOF
I think I have another programmers test I can probably dig up too. I removed the company name (I think!) from the document, but yeah this was about 3 years ago. After the test, I got called in for an interview, which consisted of 3 1 1/2 hour sessions of interviews in which I was put on the spot and asked to solve some problems on a white board (first one focused on physics, second on programming, and third one on game logic where we whiteboarded the game asteriods and it’s logic)
Yeah those long itnerviews are rough, Havok had me from 9 30 in the morning till 6 at night.
edit: hah speaking of asteroids I interviewed for a flash position without knowing flash and instead of taking their normal test I got “make asteroids in 24 hours in flash”, that was actually pretty fun.
edit again: oh yeah looking at pimp’s test. linked list/node structures are SUPER common as is iterative vs recursive questions(fibbonacci’s sequence is the go to question for that as well).
A classic interview technique is to ask you some minute technical detail about something you are writing on the white board, saying no you are wrong, when in fact you are correct.
Trust yourself to be correct, but remember to be political about telling them they are wrong.
Calmly, explain it to them, show confidence, but not arrogance. I’m not sure how you can be sure of doing this without already being this person. I suppose self control is at stake here.
If you happen to get some asshole with asperger like symptoms, you’ll never win. He’ll ask you some stupid technical detail to prove you don’t know everything, because DUH, no one knows everything. Thanks asshole. Keep your remarks to yourself and say, “You’re right, I didn’t know that.” Or if by chance you answer every question correctly, this person will feel threatened by you… Lose/lose.
If you have some idea about the technical details but have little experience with the solution, talk through it, but be clear up front if your understanding of the problem is limited.
Be clear about what you know and don’t know. It’s easy to judge you this way, and it’s easy to work with someone who is honest and will say if he is over his head.
Anyways, I’m just talking about playing the game against the people. You’ve studied hard for 3 to 4+ years, or more if in graduate school, you know your stuff. If you weren’t studying hard they’d have noticed in school and given you bad grades, you’d get called on your bullshit and fired, or never even hired in the first place.
Chin up, it’s really up to whether they think you’re compatible with their team or not. I am an amiable and interesting guy so I got through lots of interviews with job offers when I graduated, took the one I wanted.
I also do not understand 5 hours tests or ‘make it in 24 hours.’ It’s either arrogance or a reflection on a work place I wouldn’t want to be in. I don’t have 24 hours a day every day to work for them, they can have me 40~50 hours a week. It’s detrimental to work anymore than that. Or if it’s, ‘Let’s weed out those who don’t really want to work here,’ I’m really not for that. Desperate or unqualified people will take the 5 hour test and desperate or unqualified people would also send you a resume if there wasn’t a 5 hour test. They’ve (probably) all gone to university and gotten their BS. What more do you want? It may be a waste of company time, but they’re going to have to weed out the desperate and/or unqualified people eventually. It would take a person with an inordinate amount of time, and not too much intelligence, to fix a fake resume and a fake transcript. Just do reference checks. Call a professor/administrator at the university they went to, to make sure they went there.
Anyways, sometimes you just have to do it, because I know some companies are too good to pass up.
Indeed. My last boss was like that, get jealous when I did something good or bitch when I did something wrong. Either way, he wouldn’t get off my dick.
As far as the test to get the job, here’s what it was (this was for a web design/software development job).
-Write a loop.
-Figure out how to change a bunch of files
-Solve something with regular expressions.
-Miscellaneous stuff about my experience with the web, social media, etc…
Job was fun for a while, but overall the environment wasn’t cool. I quit that job about a month ago.
On that note, has anyone had any success working independently, whether it be freelance or owning a business?
one of the best stupid questions I’ve heard of was one of my friends got the question “which is faster array notation or pointer arithmetic”(IE intArray[5] vs intArray + 5). They expected a correct answer and he got it wrong. Thing is they’re exactly the same or so ridiculously the same that it doesn’t matter, we looked at the assembly generated by each method and the only difference is that one way has a noop at the end(which is at worst a single cycle). If I remember correctly the extra noop was even on the one he said might be slower.
Anyone who has to worry about array notation vs pointer arithmetic should either program in assembly (and revert to stone age processors from the 1970s) or create a processor designed specifically to handle their problems, either via FPGA or an asynch.
I wouldn’t want to program whatever is being programmed if such minute performance was so important.
Yeah no kidding. I hate when the interview asks such pointless shit, like asking if something is passed back on the Stack versus some other ways. Really, is this going to affect my day to day programming? If it does, I’ll just look it up. The internet is wonderful, and helps if I need something clarified. Figuring something out is more important than knowing something in 90% of cases IMO
Even programming in assembly it’s pretty hard to beat the C++ compiler, turns out a lot of very smart people have been working on that compiler for a very long time. But yeah, I think all the timed tests and stuff are to try and keep people from being able to just google the answers, but I like tests much better that just have questions that you can’t really google(or it’ll be obvious if you don’t fully understand it). Bungies test was awesome like that, there was essentially one question that was easily googleable, the others required complex methods or math derivations where it would be super obvious if you didn’t know what you were talking about in the interview.
edit: and honestly being able to google and find what you need is a pretty important skill, every programmer I know googles all the time for work.
So for someone who knows nothing about coding but would really like to learn, where’s a good place to start?
watch this
Thanks. Will check out.
You might like Scientific computing, for instance:
Sage: http://www.sagemath.org/ A tiny bit more complicated than just an installer to get it going on Windows, but not that much, easy on Linux and OS X. VERY good support. I highly recommend this, it has soooooooo much awesome support, examples, documentation, etc. Will help with math and science classes.
Spyder: http://code.google.com/p/spyderlib/ A bit easier to set up on Windows, looks like Matlab, but still missing some main features of Matlab, eg easy debugging. Not good support, especially when compared with Sage.
Matlab: Matlab is not free and even for students may seem expensive, but it is probably the most widely used scientific and engineering software. Unfortunately a lot of these people would be perfectly happy with Sage, but they are ‘stuck’ with Matlab because its what they are used to and they are not computer scientists.
Spreadsheets, eg Microsoft Excel and Open Office: You can do a lot of things with this software which will help you in a lot of things, from quick data crunching, to balancing a budget, to cooking, to whatever makes sense. You can do simple programming to do some surprisingly complicated math functions and cool looking plots and graphics.
TI Calculator. It was my first real attempt at programming.
Also what’s more important than anything is having a problem to solve, some kind of motivation to program.
Tagging this thread. Wasn’t too into it when it was programming help, but now that you guys have crossed the interview threshold, I’m interested. Just graduated from college and it’s hard to find jobs in my shithole of a town that don’t want at least 4 years of actual work experience in IT.
Yeah, my problem with interview questions like the ones you posted is they emphasize ability to write blazing fast code to the metal, which isn’t really a handy skill. I want potential candidates to be able to write readable & maintainable code, work in a team (i.e. source control, scrum & agile development), and object oriented design. Honestly, you can weed out a lot of the clowns just by asking them to whiteboard the famous car/bicycle design question.
Also, we low-level code ninjas are a dying breed. 9/10 job postings I see are web programming/database management bs etc. That’s where the six figures is at these days.
What’s the car/bicycle design question? Doesn’t ring any bells