OutDash Interview Exam 7

3
OutDash Interview Exam #7 Name: ________________________ Date: _____________________ Rules: 1. You must work without the help of a complier or any programming environment. The questions are to be treated as though they are done on paper. 2. Please enter the time taken for each answer. (Where you have been asked to explain your answer, you need not count that towards the time taken.) 3. This is a closed book exam (i.e. done without help from the internet, books, development environments, etc…) 4. We have indicated the average time needed to answer the question (par). Questions: 1. Please write out in JavaScript or pseudo code a function or functions that will print out the first 100 prime numbers. If you are using pseudo code, please use the % symbol for mod, == for comparison statements and the pseudo code function writeOutput( x ) for outputting result data. Par: 10-15 minutes 2. Consider this function declaration: void quiz(int i) { if (i > 1) { quiz(i / 2); quiz(i / 2); } writeOutput("*"); } How many asterisks are printed by the function call quiz(5)? Explain your answer. Par: 5-10 minutes 3. Julia states: “When I went fishing the other day, every fish that I caught was a tuna, and every tuna I saw I caught.” Of the following statements listed below, which one can be concluded from the observations of Julia? How do you know? A. Tuna was the only fish that Julia saw while she was fishing. B. While Julia was fishing, no other fish were caught by her. C. In the area that Julia fished, there were no other fish. D. All of the fish that Julia saw she caught. E. Julia did not see any other fish while she was fishing Par: <5 minutes

Transcript of OutDash Interview Exam 7

Page 1: OutDash Interview Exam 7

OutDash Interview Exam #7 Name: ________________________ Date: _____________________

Rules: 1. You must work without the help of a complier or any programming environment. The questions are to be

treated as though they are done on paper.

2. Please enter the time taken for each answer. (Where you have been asked to explain your answer, you need not

count that towards the time taken.)

3. This is a closed book exam (i.e. done without help from the internet, books, development environments, etc…)

4. We have indicated the average time needed to answer the question (par).

Questions:

1. Please write out in JavaScript or pseudo code a function or functions that will print out the first 100 prime numbers.

If you are using pseudo code, please use the % symbol for mod, == for comparison statements and the pseudo code

function writeOutput( x ) for outputting result data.

Par: 10-15 minutes

2. Consider this function declaration:

void quiz(int i)

{

if (i > 1)

{

quiz(i / 2);

quiz(i / 2);

}

writeOutput("*");

}

How many asterisks are printed by the function call quiz(5)?

Explain your answer.

Par: 5-10 minutes

3. Julia states: “When I went fishing the other day, every fish that I caught was a tuna, and every tuna I saw I caught.”

Of the following statements listed below, which one can be concluded from the observations of Julia? How do

you know?

A. Tuna was the only fish that Julia saw while she was fishing.

B. While Julia was fishing, no other fish were caught by her.

C. In the area that Julia fished, there were no other fish.

D. All of the fish that Julia saw she caught.

E. Julia did not see any other fish while she was fishing

Par: <5 minutes

Page 2: OutDash Interview Exam 7

4. Suppose you and I have the same amount of money. How much must I give you so that you have ten dollars more

than I?

Par: <5 minutes

5. A dealer bought an article for $7, sold it for $8, bought it back for $9, and sold it for $10. How much profit did he

make?

Par: <5 minutes

6. Imagine that you have a client that has a UI for reviewing his many thousands of orders, 50 per page. The UI also

allows the client to limit the orders based on the current status of the order. The orders are in a database table

called [ORDERS] with a numeric, incrementing primary key named [ORDER_ID]. The table also has a column

[ORDER_STATUS] with three possible values:

• “PROCESSING”

• “COMPLETED”

• “CANCELLED”

Please write out a MS SQL statement that will output the third page of “CANCELLED” orders (the 101-150th

cancelled orders). Bear in mind that while the [ORDER_ID] values are probably sequential in the database, the

[ORDER_ID] values for the “CANCELLED” orders are not. Please note that MS SQL does not support MySQL’s

LIMIT command. Your answer should contain only SQL statements and not make use of other technologies (such

as ASP/PHP/Java/etc…) Please write your answer on the back of this sheet.

Par: 10-15 minutes

7. 500 men are arranged in an array of 10 rows and 50 columns according to their heights. The tallest man in each row

is asked to come out and A isthe shortest among them. After resuming their original positions, the shortest among

each column is asked to come out and B is the tallest among them. Who is taller, A or B ?

Explain your answer.

Par: 5-10 minutes

8. You have 26 constants, labeled A through Z. Let A equal 1. The other constants have values equal to the letter's

position in the alphabet, raised to the power of the previous constant. That means that B (the second letter) = 2^A =

2^1 = 2. C = 3^B = 3^2 = 9, D = 4^C = 4 ^ 9 and so on.

The value for this expression: (X-A) * (X-B) * (X-C) * ... * (X-Y) * (X-Z) will

A. Fit into an Int32

B. Fit into an Int64

C. Not fit into either

Explain your answer.

Par: 5-10 minutes

Page 3: OutDash Interview Exam 7

9. On the popular children’s television show, the “Creature Buddies” are four animated animals. Since they are

animated, they can’t make a live stage performance so, while the Creature Buddies are on tour, each is represented

by a puppet that is operated by a chief and an assistant puppeteer.

The Creature Buddies are a: Camel, Koala, Kangaroo, and Cobra.

The Creature’s Names are: Audrey, Alan, Andrew, Anthony

The Chief Puppeteers are: Ben, Brenda, Brian and Britney

The Assistant Puppeteers are: Dave, Diane, Debby and Drew

1. Andrew isn’t the puppet who is operated by Britney and her assistant Debby.

2. Alan’s chief puppeteer (who is not Brenda) is assisted by Drew.

3. Ben is in charge of the camel, but Brenda doesn’t have anything to do with the kangaroo.

4. Dave is the assistant puppeteer for the cobra.

5. Anthony, whose chief is Brian, isn’t the koala (whose name is not Andrew).

What is the name of the camel?

A. Audrey

B. Alan

C. Andrew

D. Anthony

E. Arthur

Explain your answer.

Par: 15-20 minutes