Miscellaneous Company Exam
Company
Numerical Ability
Lets assume that you have a CPU which takes y microseconds to add 2 floating point numbers and z microseconds to multiply 2 floating point numbers. You have an nxm matrix and an mxp matrix. What is the time taken (in microseconds) to multiply the matrices?
a) It is not possible to multiply them.
b) 100
c) (m*n*p*(y-z))
d) n*p*e^(y+z)
e) (mz+(m-1)*y)*n*p
Read Solution (Total 1)
-
- Call the first matrix A. Matrix A is n x m.
Call the second matrix B. Matrix B is m x p.
Let C = A*B. Matrix C is n x p
Matrix C is defined since you have n x m by m x p. The two 'm's match and the final size of matrix C will be n x p.
There will be n*p elements in matrix C.
For each element, you have to have a combination of multiplication and addition.
To find the element in row1, column1 of matrix C, you are going to multiply m pairs of numbers (the corresponding numbers in row 1 of matrix A with column 1 of matrix B).
So far, the CPU has taken up m*z microseconds.
After you multiply all of those pairs of numbers, you're going to add them. You will have m-1 additions to perform (eg: if you have 10 numbers to add up, you really have 10-1 = 9 addition operations).
Doing these m-1 operations costs you another (m-1)*y microseconds. In total, it takes m*z + (m-1)*y microseconds to calculate the result for the element in row1, column1.
For the element in row1, column2 of matrix C, you do the same number of multiplications and additions. So you take another m*z + (m-1)*y microseconds.
Etc etc
You keep doing this for each of the n*p elements in matrix C. That means you do this n*p times.
So you'll take up a total of (mz+(m-1)*y)*n*p microseconds to multiply matrix A and matrix B to get matrix C.
This is choice E) - 10 years agoHelpfull: Yes(0) No(0)
Miscellaneous Company Exam Other Question
If 9 is added to twice a number and this sum is multiplied by 3, the result is the same as if the number is multiplied by 4 and 13 is added to the product. What is the number?
I got a -7. But when I plugged the -7 back into the equation, it didn't work. What am I doing wrong?
Thank you.
Consider a purely probabilistic game that you have the opportunity to play. Each time you play there are n potential outcomes x1, x2, ..., xn (each of which is a specified gain or loss of euros). These outcomes x1, x2, ..., xn occur with the probabilities p1, p2, ..., pn respectively (where p1 + p2 + ... + pn = 1.0 and 0 <= pi <= 1 for each i). Positive xi values mean a gain of |xi| euros and negative values mean a loss of |xi| euros. Assume that x1, x2, ..., xn and p1, p2, ..., pn are all known quantities. Furthermore, assume that each play of the game takes up one hour of your time, and that only you can play the game (you can't hire someone to play for you). Let M be the game's expected value. That is, M = p1*x1 + p2*x2 + ... + pn*xn. Let S be the game's standard deviation. That is, S = SquareRoot( p1 * (x1 - M)^2 + p2 * (x2 - M)^2 + ... + pn * (xn - M)^2 ).