Veloz Tech Test

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Thank you for your interest in working for The Veloz Group.

We would like you to participate in a


first-round screening interview, which consists of the programming test below. When solving the
problems, please solve them in PHP unless another language is specified. It is ideal if you can
solve without using any references, but if you must use a reference please include links to
whichever references you use with each problem that you used that reference for. Please also
include how long it took you to solve each problem.



REQUIRED: Please solve Problem #1 and #2

Problem #1 Write a function that takes an array of numbers and the length of the array. The array of
numbers of can of any length with the numbers being any size. Your function should (a) report the range
of the numbers (i.e. min and max), (b) print to screen a list of all numbers within the range that are
missing from the array (c) print the count of all numbers that appear 2 or more times within the array.
For example: if given [3, 1, -5, 3, 3, -5, 0, 10, 1, 1] and the corresponded array length of 10, we would
output the following:
Range is -5 to 10
Missing Numbers:
-4
-3
-2
-1
2
4
5
6
7
8
9
Duplicate Numbers:
3 appears 3 times
1 appears 3 times
-5 appears 2 times

Rules for Problem #1:
a) You may use any data structures you would like, and you may use data structure libraries (for example
you may use a Standard Library Linked List if you think that is the right data structure to use).
b) You may not use any helper functions such as min(), max(), find(), etc
c) No sorting is allowed
d) Must be linear time O(N), so no nested loops are allowed
e) Must be memory efficient, so for input of [1, -100000, 100000], if you allocate a data structure like int
[100000], you are doing something wrong, since you are using memory of sizeof(int)*100000 even
though the input array only has 3 ints.


Problem #2 Our goal is to build a transcript system for a university, such as the one below:

Name: John Doe
Id: 123-456-789
GPA: 3.63
Major: Computer Science

Winter 2013
Math 1C B+
Comp Sci 100 A
Comp Sci 111 A-
Fall 2012
Math 1B B
English 1 A
Comp Sci 2 A-
Spring 2012
Math 1A A-
History 10 B+
Comp Sci 1 A

For this transcript system do all of the following. If you are unable to do all of them, do whichever you are
capable of solving:
(a) Design a SQL Schema to store the data above
(b) Write the SQL Queries to get the data above from the database using the schema you design in A
(c) Write the HTML code to display the page above
(d) Write the CSS to display items as formatted above (e.g. bold, underline, white space/indenting, italics,
etc)
(e) Write Javascript code so that after the page finishes loading, the GPA is dynamically calculated from
the grades and displayed within the transcript.


Problem #3 Write a script in Shell, PHP, Python or Perl that gets all search results from Google which
contain the word 'aeron' in the title of the search result. Output all page titles and the respective links in a
plain text list where each line contains the title and url of a different search result.


LINUX: Please solve two or more of the following questions

Problem #4 How would I change the permissions of a file in linux so that is can be read by anyone,
executed by only someone in the same group, and written to by only the owner?

Problem #5 How would I list all the files in a directory and the day they were created?

Problem #6 How would I check the size of a file and the size of a directory?

Problem #7 How do you count the number of lines in a file?

Problem #8 What 5 commands do you use on the right-hand side of a pipe? For example, "more" in the
command 'grep foo.txt | more' or "less" in the command 'cat foo.txt | less'


OPTIONAL: Please solve additional problems below as you feel
suitable to demonstrated your programming abilities

Problem #9 Write a script that searches ebay for all items for sale for $0.10 or less and outputs the item
number and price of each of these items.

Problem #10 Write a script that finds all results on craigslist for items located in either Los Angeles,
Orange County or San Diego that contain the word 'herman miller' and are listed for $350 or less.

Problem #11 Write a script to gets all search results from Google which contain the word 'aeron' in the
title of the search result. Output all page titles and the respective links in a plain text list where each line
contains the title and url of a different search result.

Problem #12 Given two arrays of numbers (for example [1,2,3,4,5] and [2,3,1,0,5]) and their sizes, write
a single function to find (a) which numbers are present in the second array and not the first, (b) which
numbers are present in the first array but not the second, and (c) which numbers are present in both
arrays. Performance does not matter, but the single function must return all three pieces of
information back to the user that called the function.

Problem #13 A palindrome is a word that is spelled the same forward and backwards, for example
"wow", "dad" and "racecar" are all palindromes, whereas "cat", "foo", and "bar" are not palindromes. (a)
Write an iterative function that takes a string as an argument and returns true or false based on whether
or not it is a palindrome, without calling any other functions. (b) Write a recursive function with the same
function prototype as A but solves the problem recursively instead of iteratively.

Problem #14 Write code to check whether a number is power of two or not. You may not simply use a
power, square root or other 'magic' function.

Problem #15 Our job is to write a recursive function to find the nth Fibonacci number. We come up with
the function below. Is there anything about this function that is majorly inefficient? If there is, say what is
inefficient, and change the code or write a new function to make it more efficient. The new function must
remain recursive. Fibonacci numbers are 0 1 1 2 3 5 8 13 21 34 55 89 144

long fib (int n)
{
if (n == 0)
{
return 0;
}
else if (n == 1)
{
return 1;
}
else
{
return fib(n-1) + fib(n-2);
}
}