I am in charge of selecting a new software development intern for a company that I work with. I wanted to throw a little 'quiz' at the applicants before moving forth with interviews so as to weed out the group a little bit to find some people that can demonstrate some skill. I put together the following quiz to send to applicants, it focuses only on PHP, but that is because that is what about 95% of the work will be done in. I'm hoping to get some feedback on A. if its a good idea to send this to applicants and B. if it can be improved upon.
# 1. FizzBuzz
# Write a small application that does the following:
# Counts from 1 to 100
# For multiples of 3 output "Fizz"
# For multiples of 5 output "Buzz"
# For multiples of 3 and 5 output "FizzBuzz"
# For numbers that are not multiples of 3 nor 5 output the number.
<?php
?>
# 2. Arrays
# Create a multi-dimensional array that contains
# keys for 'id', 'lot', 'car_model', 'color', 'price'.
# Insert three sets of data into the array.
<?php
?>
# 3. Comparisons
# Without executing the code, tell if the expressions
# below will return true or false.
<?php
if ((strpos("a","abcdefg")) == TRUE) echo "True";
else echo "False";
//True or False?
if ((012 / 4) == 3) echo "True";
else echo "False";
//True or False?
if (strcasecmp("abc","ABC") == 0) echo "True";
else echo "False";
//True or False?
?>
# 4. Bug Checking
# The code below is flawed. Fix it so that the code
# runs properly without producing any Errors, Warnings
# or Notices, and returns the proper value.
<?php
//Determine how many parts are needed to create a 3D pyramid.
function find_3d_pyramid($rows) {
//Loop through each row.
for ($i = 0; $i < $rows; $i++) {
$lastRow++;
//Append the latest row to the running total.
$total = $total + (pow($lastRow,3));
}
//Return the total.
return $total;
}
$i = 3;
echo "A pyramid consisting of $i rows will have a total of ".find_3d_pyramid($i)." pieces.";
?>
# 5. Quick Examples
# Create a small example to complete the task
# for each of the following problems.
# Create an md5 hash of "Hello World";
# Replace all occurances of "_" with "-" in the string "Welcome_to_the_universe."
# Get the current date and time, in the following format, YYYY/MM/DD HH:MM:SS AM/PM
# Find the sum, average, and median of the following set of numbers. 1, 3, 5, 6, 7, 9, 10.
# Randomly roll a six-sided die 5 times. Store the 5 rolls into an array.
<?php
?>