Carter Bailey Tech Thoughts, lessons learned, and motivation

12Jul/110

Hired Help: Tech Interview Questions Galore

For the past two months, I have been searching for a new job. As a software developer, most companies like to ask technical questions and give interviewees programming puzzles to solve. I thought that other software programmers out there (especially those who are currently looking for jobs) would like to see the technical questions and puzzles that many companies are giving for their technical assessments. I have also included some of my answers below. Let me know what you think of their questions and my answers!

Note: The original wording of the questions might be off slightly because I did not make a copy immediately after the technical assessment.

Interview questions:

  1. You are tasked with creating an abstract shape class that can be inherited by other shape classes (triangle, rectangle, circle, etc). There should be a getArea() function for returning the area of the shape.
  2. Write a function to return the max area of a collection of shapes (the shape objects you wrote in problem 1). What are the advantages or disadvantages of your function?
  3. Write a program to determine the Nth Fibonacci number. Your program should accept N as an argument and return the Nth Fibonacci number, where f(0) = 0 and f(1) = 1. What are the advantages or disadvantages of your program?
  4. Write a program to determine the first non-repeated character in a string. Your program should accept a string as an argument and return the first non-repeated character in that string ('tooth' => 'h'; 'hello' => 'h'). What are the advantages or disadvantages of your program?
  5. What are the differences between an abstract class and an interface? When would you use each?
  6. Write an SQL statement to get a list of a given customer's orders. Customers table (CustomerID, CustomerName) and Orders table (OrderID, CustomerID, Total).
  7. Write an SQL statement to get the combined order totals for each customer using the tables above.
  8. You maintain a database driven web app, and a user is complaining about very poor speed performance. How would you go about assessing, analyzing and solving the issue?
  9. You are tasked with creating a system for managing objects (eg, appointments). Users should be able to create, read, edit, and delete the objects. What security issues and measures should be taken into consideration?
  10. What is your favorite design pattern?
  11. What is your favorite Object Relational Manager (ORM)?

Here is an incomplete list of my answers:
3.

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$n=$argv[1];
 
// init first two fib#s
$fib[0] = 0;
$fib[1] = 1;
 
if ($n>count($fib)){
 for($i=count($fib);$i<=$n;$i++) $fib[$i]=$fib[$i-1]+$fib[$i-2];
}
 
print $fib[$n-1] . "\n";
?>

4.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
 $sentence = $argv[1];
 $found = false;
 
 while(!$found && $sentence!== ""){
  // get first char in sentence
  $c = $sentence[0];
  // get number of times that char is in the sentence
  $count = substr_count($sentence,$c);
 
  // if only 1 , found first non-repeating char
  // else, remove all instances of repeated char
  if($count == 1) $found = true;
  else $sentence = str_replace($c,"",$sentence);
 }
 print "$c\n";
?>

Posted by Carter Bailey

Comments (0) Trackbacks (0)

No comments yet.


Leave a Reply

No trackbacks yet.