Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › How to prepare for programming job test?
New Posts  All Forums:Forum Nav:

# How to prepare for programming job test? - Page 2

Quote:
Originally Posted by poroboszcz;13026485
And I'm still not sure if that would be the most computationally efficient solution since the function has to iterate through all the points on the screen.

You could start at the right-center of the circle (straight to the right of the center) at the pixel you've calculated to be correct. And then use those coords to rotate around the center, coloring each pixel along the way.

x * sin (theta) + y * cos (theta). x and y are the coords you found for the first pixel. Just increase theta in small increments between 0 and 2*Pi, and you as long as your increments are small enough you should find every unique X,Y coord along the way. This keeps you from wasting calculations on pixels that aren't part of the circle.
Quote:
Originally Posted by Plex;13024729
They are basic questions. I'm not "getting down" on anyone's skills, mind you. If anyone is going to derail the thread into that, it's your post right there.

My concern for the OP is that there are three levels of programmer jobs. Entry level, mid-level, and senior. This exam seems like it's targeted toward an entry level position applicant, but I could be mistaken. It's one thing to be a programmer who is in the middle of learning, figuring out his/her mistakes and improving. It's another to come here and be like "hey here's some questions, how can I not fail this test again?" Like I said, I hope that the OP is able to grasp what he needs to before this test, and I hope that he passes. I'm the last person to "get down" on anyone's skills. I certainly wouldn't talk like a moron (e.g. n00bs, skillz, etc.) either. I go out of my way to help beginners on here all of the time.

I agree with this. The questions are fairly simple and are similar to ones that I have seen or given in entry-level programmer interviews.
 Foldatron (17 items) Mat (10 items) Work iMac (9 items)
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000
PowerCase
750W PC P&C Silencer CoolerMaster 690
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard
Mouse
Mac wireless mouse
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display
Monitor
27" Apple thunderbolt display
 Foldatron (17 items) Mat (10 items) Work iMac (9 items)
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000
PowerCase
750W PC P&C Silencer CoolerMaster 690
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard
Mouse
Mac wireless mouse
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display
Monitor
27" Apple thunderbolt display
Quote:
Originally Posted by lordikon;13035557
You could start at the right-center of the circle (straight to the right of the center) at the pixel you've calculated to be correct. And then use those coords to rotate around the center, coloring each pixel along the way.

x * sin (theta) + y * cos (theta). x and y are the coords you found for the first pixel. Just increase theta in small increments between 0 and 2*Pi, and you as long as your increments are small enough you should find every unique X,Y coord along the way. This keeps you from wasting calculations on pixels that aren't part of the circle.

I agree with this. The questions are fairly simple and are similar to ones that I have seen or given in entry-level programmer interviews.

It's a student internship, so pretty much the most entry-level there can be, but I found this test more difficult than other ones I've done which were more of a multiple small questions rather than few bigger problems. I don't exactly understand why am I being bashed for it as this forum seem to mostly be populated by basic questions which can easily be answered by google/documentation. And my question doesn't even qualify as one of these as I'm not asking about solutions, but rather how to get comfortable with solving these kinds of problems on my own.
 buka (17 items)
 buka (17 items)
Quote:
Originally Posted by poroboszcz;13023329
There's a job that I'd really like to get and I have already had an interview for it which went really well. There has also been a programming test which I failed.

Apparently no one else managed to pass it as the company has re-advertised the position, and thanks to my good interview performance I am allowed to take the test again, and will be assessed based on the average score of both tests, so I need to perform decently.

I have done and passed a number of similar tests in the past however this one is a bit different and has probably been created by programming nerds rather than people from HR department. It consists of three open questions where you need to write a code solving particular problem using any programming language (C, C#, Java) or pseudo-code.

The three questions I remember from last time were something like these:

Can you recommend any kind of resources, books and/or exercises that would help me to prepare for this kind of test. I'd really like to get the job, but, even though I have some programming experience, these are not the kind of problems I deal with on regular basis, especially in higher level languages where most of this kind of stuff is done for you. Thanks.

I'm not even through my first programming course yet, and I can do 1 and 3. The second one... not so much =P. Point is, you should either know how to do it if you intend to program. Studying, you can't. Just know available functions?
 Mine (19 items)
CPUMotherboardGraphicsRAM
Intel Core i7-6700K 4.0GHz Quad-Core Asus Z170 PRO GAMING ATX LGA1151 EVGA GeForce GTX 1070 8GB SC Gaming ACX 3.0 G.Skill Ripjaws V Series 16GB (2 x 8GB) DDR4-3200
Hard DriveHard DriveHard DriveHard Drive
PNY CS1311 480GB SSD Barracuda 500 WD 1000 WD 1000
CoolingOSMonitorMonitor
Thermalright TRUE Spirit 140 POWER 73.6 CFM Windows 10 Acer S277HK 27" 4K Acer 23" 1080p
MonitorKeyboardPowerCase
Acer 23" 1080p Razer Black Widow Ultimate EVGA SuperNOVA G2 550W 80+ Gold Corsair 330R Titanium Edition ATX
Mouse
Logitech G303 Daedalus Apex
 Mine (19 items)
CPUMotherboardGraphicsRAM
Intel Core i7-6700K 4.0GHz Quad-Core Asus Z170 PRO GAMING ATX LGA1151 EVGA GeForce GTX 1070 8GB SC Gaming ACX 3.0 G.Skill Ripjaws V Series 16GB (2 x 8GB) DDR4-3200
Hard DriveHard DriveHard DriveHard Drive
PNY CS1311 480GB SSD Barracuda 500 WD 1000 WD 1000
CoolingOSMonitorMonitor
Thermalright TRUE Spirit 140 POWER 73.6 CFM Windows 10 Acer S277HK 27" 4K Acer 23" 1080p
MonitorKeyboardPowerCase
Acer 23" 1080p Razer Black Widow Ultimate EVGA SuperNOVA G2 550W 80+ Gold Corsair 330R Titanium Edition ATX
Mouse
Logitech G303 Daedalus Apex
Quote:
Originally Posted by poroboszcz;13037902
I don't exactly understand why am I being bashed for it as this forum seem to mostly be populated by basic questions which can easily be answered by google/documentation.

Not bashing you at all. On the contrary, I was just concerned that you would pass the exam and land the job, only to be completely in over your head. No one means any offense to it, and I know it's difficult to understand the tone of the statements on the Internet, but I was asking about the difficulty because I do actually care and want to help. This is the first time that you mentioned it was actually a student internship. I feel a lot better about it then, and I think this is perfect for you if programming is what you want to do.
 Intellect v2 (9 items)
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC...
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5
Mouse
MIONIX NAOS 7000
 Intellect v2 (9 items)
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC...
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5
Mouse
MIONIX NAOS 7000
Write code to remove duplicates from an unsorted linked list.
How would you solve this problem if a temporary buffer is not allowed?

--

Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate the number of ways of representing n cents.

 Main Rig (10 items)
CPUMotherboardGraphicsRAM
Intel Core 2 Extreme QX6700 "Engineering Sample" MSI P6N SLI Platinum XFX Radeon 5870 Corsair XMS2 6GB DDR2
Hard DriveCoolingOSMonitor
Seagate 320GB Noctua NH-C12P SE14 Windows 7 64-bit Ultimate with SP1 Dell 2408WFP x Dell 2407WFP - 24"
PowerCase
OCZ ModXStream Pro 700W Modular High Performanc... NZXT Source 210 Mid Tower Case
 Main Rig (10 items)
CPUMotherboardGraphicsRAM
Intel Core 2 Extreme QX6700 "Engineering Sample" MSI P6N SLI Platinum XFX Radeon 5870 Corsair XMS2 6GB DDR2
Hard DriveCoolingOSMonitor
Seagate 320GB Noctua NH-C12P SE14 Windows 7 64-bit Ultimate with SP1 Dell 2408WFP x Dell 2407WFP - 24"
PowerCase
OCZ ModXStream Pro 700W Modular High Performanc... NZXT Source 210 Mid Tower Case
Quote:
Originally Posted by tonyjones;13038181
Write code to remove duplicates from an unsorted linked list.
How would you solve this problem if a temporary buffer is not allowed?

If efficiency is not a concern:
Compare the first entry against each other entry, if a match is found, remove it from the list. After comparing the first entry against the entire list, move to the second entry and compare it against the whole list (except the first).
Quote:
Originally Posted by tonyjones;13038181
Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate the number of ways of representing n cents.

This one sounds fun, I'll have to ponder it. I'm sure I could find the answer online but what is the fun in that?
 Foldatron (17 items) Mat (10 items) Work iMac (9 items)
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000
PowerCase
750W PC P&C Silencer CoolerMaster 690
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard
Mouse
Mac wireless mouse
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display
Monitor
27" Apple thunderbolt display
 Foldatron (17 items) Mat (10 items) Work iMac (9 items)
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000
PowerCase
750W PC P&C Silencer CoolerMaster 690
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard
Mouse
Mac wireless mouse
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display
Monitor
27" Apple thunderbolt display
Quote:
Originally Posted by tonyjones;13038181
...
Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent), write code to calculate the number of ways of representing n cents.
...

The first one was simple but boring and I was too lazy to write an answer because I haven't worked with linked lists in a while. As for the second, this isn't elegant but...
Code:
``````// Figure out the total number of combinations of coins worth \$0.25 or less in
// a given amount of money.
public int GetCombinations(int totalCents)
{
// Store the number of combinations
int combinations = 0;

// Run through each possible amount of quarters
for(int quarters = 0; quarters <= (totalCents / 25); ++quarters)
{
// The number of cents left to be made up of other coins
int centsAfterQuarters = totalCents - quarters * 25;

// Run through each possible amount of dimes
for(int dimes = 0; dimes <= centsAfterQuarters / 10; ++dimes)
{
// Our combinations for these dimes and quarters are equal to the
// number of possible nickles in the amount of change left to work
// with plus 1 for all pennies
combinations += (centsAfterQuarters - dimes * 10) / 5 + 1;
}
}

// Hope you know what I'm doing here
return combinations;
}```
```

That was fun and I think it is right.
 My giant (13 items)
CPUMotherboardGraphicsRAM
E6600 lapped Asus P5n32-E 680i GeForce 9800GT 512MB 2x1GB (unused ATM) & 2x2Gb Corsair XMS2 PC6400
Hard DriveOSMonitorPower
WDJS SATA-II 160GB + WD80GB + WDAAKS Raid0 320GB Aperature FSII 19" LCD Apevia DarkSide 600W
Case
NZXT Zero
 My giant (13 items)
CPUMotherboardGraphicsRAM
E6600 lapped Asus P5n32-E 680i GeForce 9800GT 512MB 2x1GB (unused ATM) & 2x2Gb Corsair XMS2 PC6400
Hard DriveOSMonitorPower
WDJS SATA-II 160GB + WD80GB + WDAAKS Raid0 320GB Aperature FSII 19" LCD Apevia DarkSide 600W
Case
NZXT Zero
Ok, just done the second test, which was actually harder than the previous one. The questions this time were something like:
Quote:
1. Write a function that given a picture represented as 2-dimensional array of integers applies Sobel operator (a sum of values of surrounding pixels multiplied by it's weight specified in a 3x3 matrices) to each of its pixels and returns new resulting array.

2. Given a [12,12] array check if it's a valid sudoku (no repeating values in rows, columns and 3x3 exclusive sub-squares.

3. Given an array of integers, eg. {1,4,4,3,7,4,15,6,7,7,5,22,5,7,6}, write a function that identifies peaks, i.e. values which have lower values in front and after them. Take into account possible noise, eg. underscored values in example array are noise peaks, which should be ignored while bolded values are real peaks.

I've answered all the questions, but I'm not sure about efficiency of my solutions, as some of them were O(n^3). Should get the results soon. Thanks everyone for help.
Edited by poroboszcz - 4/19/11 at 7:02am
 buka (17 items)
 buka (17 items)
Good luck mate .
 Intellect v2 (9 items)
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC...
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5
Mouse
MIONIX NAOS 7000
 Intellect v2 (9 items)
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC...
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5
Mouse
MIONIX NAOS 7000
Who the hell gives a test for a programing job!!!!!! Anyway good luck.
 Bigspenders money pit (19 items)
 Bigspenders money pit (19 items)
New Posts  All Forums:Forum Nav:
Return Home
Back to Forum: Coding and Programming
• How to prepare for programming job test?
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › How to prepare for programming job test?