# 869

Questions d'entretien pour Research Staff Member partagées par les candidats

## Principales questions d'entretien

Trier: Pertinence|Populaires|Date
On a demandé à un Senior Member of Technical Staff...25 janvier 2010

### given 8 coins and one of them heavier than the others, how many weighings will be needed to find the odd one ?

5 réponses

two weighings are needed. separate into three groups (3,3,2) put three on each side of scale, if sides balance then place two remaining coins on either side of scale to see which is heavier. If sides don't balance, take two coins from the heavier side and put on the scale to see if one is heavier, if they balance, the one you took off is the heaviest. Moins

@Cigar lover ... no. once you put coins on the scale, that counts as a weighing, and every time you remove coins it counts as a weighing. this boils down to the 3-3-2 solution above. the first time you remove 2 and weight, you are weighing 3-3. at that point there are 3 possibilities still. the scale is even, or one or the other side is down. you have to do one more weighing from there. Moins

divide it into 2 group of 4 each.remove the group that weighs less.then divide the remaining 4 into 2 groups of 2 each.remove the group weigh less.again weigh the remaining 2.u get the heavier one.so 3 weighing. Moins

Afficher Plus de réponses

### Given an array of integers write a function so that all the even numbers are on the left side of the array and all the odd numbers are on the right side of the array.

4 réponses

keep left=0, right=ia.len() indices in input array, ia[] while(left &lt; right) { if(odd(ia[left])) { left++; continue; } if(even(ia[right])) { right--; continue; } //get here, then swap array contents left++; right--; } Moins

for (var b=[], i=0; i&lt; a.length; i++) { if (a[i] %2 == 0) b.unshift(a[i]); else b.push(a[i]); } Moins

void partition(int *A, int size) { int j = 0; for(int i = 0;i &lt; size; i+++) { if(A[i] % 2 == 0) { swap(A[i], A[j]); j++; } } } Moins

Afficher Plus de réponses

### Rotate elements in an array to right k times.

4 réponses

#define element int element a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; int rotate_a(int k) { int i, bufsize, a_size; element *buf; a_size = sizeof(a); bufsize = sizeof(element) * k; if (!(buf = malloc(bufsize))) return -1; memcpy(buf, (void *)a + a_size - bufsize, bufsize); memmove((void *)a + bufsize, a, a_size - bufsize); memcpy(a, buf, bufsize); return 1; } Moins

private static int[] flipArrayRight(int[] array, int times) { for (int i = 0; i 0; k--) { array[k] = array[k - 1]; } array = last; } return array; } Moins

public static Array rotateArrayByNFromRight(int[] ArrayToBeRotated, int N) { int ArrayLength = ArrayToBeRotated.Length; if ((N &gt; 0) &amp;&amp; (N &lt;= ArrayLength)) { Array.Reverse(ArrayToBeRotated, 0, ArrayLength - N); Array.Reverse(ArrayToBeRotated, ArrayLength - N, N); Array.Reverse(ArrayToBeRotated); } else { Console.WriteLine("invalid"); } return ArrayToBeRotated; } Moins

Afficher Plus de réponses

### If we write return statement in try, catch and finally block, which one will execute when and why ?

4 réponses

The return written in finally will take precedence over others.

Finally block will definitely execute, because it always gets executed and very important code is to be put in finally block like closing of file, return statement etc. Moins

public class TryCatch { public static int getReturn() { try { return 1; } catch(Exception e) { return 2; } finally { return 3; } } public static void main(String[] args) { System.out.println(getReturn()); } } 3 will be returned. Moins

Afficher Plus de réponses

### Given 2 unsorted integer arrays, get the intersection of the 2.

2 réponses

Sort one of the array using nlogn algorithm (merge sort or heap sort) and then take an element from second array perform binary search in the sorted array if you find it store it in your result array. Complexity: nlogn for sorting the array with n elements, and logn for each lookup you do and since you it m times (which is the number of elements in array 2) it becomes mlogn. So the final complexity will be nlogn + mlogn == log(n) * (m + n). Moins

how long are the arrays (absolutely or relative to each other). What are the ranges of the numbers? Are there duplicates within either array? Moins

### Gaussian linear models are often insufficient in practical applications, where noise can be heavy- tailed. In this problem, we consider a linear model of the form yi = a · xi + b + ei. The (ei) are independent noise from a distribution that depends on x as well as on global parameters; however, the noise distribution has conditional mean zero given x. The goal is to derive a good estimator for the parameters a and b based on a sample of observed (x, y) pairs. 1.1 Instructions: 1. Load the data, which is provided as (x, y) pairs in CSV format. Each file contains a data set generated with different values of a and b. The noise distribution, conditional on x, is the same for all data sets. 2. Formulate a model for the data-generating process. 3. Based on your model, formulate a loss function for all parameters: a, b, and any additional parameters needed for your model. 4. Solve a suitable optimization problem, corresponding to your chosen loss function, to obtain point estimates for the model parameters. 5. Formulate and carry out an assessment of the quality of your parameter estimates. 6. Try additional models if necessary, repeating steps 2 − 5.

3 réponses

I think we need to use Generalized Method of Moments to get the estimates. Since E[e|x] = 0, we have E[h(x)e] = 0 by the law of iterated expectation for any give function h(x). Now we need to find a best function h*(x) such that it will give you efficient GMM estimator. Moins

Actually, you will get least squares estimate as the best estimator in the following sense: y = ax+b+e E(e|x)=0 For any h(x), E(h(x)*e) = E(E(h(x)*e)|x) (where the outer expectation is over X E(h(x)*e|x) = h(x)*E(e|x) = 0 Therefore E(h(x)*e)=0 Take h(x) = y-a-b*x The moment condition is: E(e*(y-a-b*x))=0 This would lead to Least Squares. Moins

I believe the true model was y = ax + b + sigma*(x^2). You can use least squares to define the likelihood or use an L1 penalty. Moins

### "Do you have silicon flowing in your veins?" (Not really difficult, just pointless)

2 réponses

I didn't. I knew the interview was a farce by this time.

FYI: Contrary to the person trying to deflect criticism, there is only ONE General Micro Systems and both locations (Rancho Cucamonga CA &amp; Stuart FL) are owned by the same person, Udi Levin. They refer to the Stuart location as GMS East. Moins

### it was most of algorithms and data structure, one easy thing that i remember was an organisation employee search problem where the organisation has hierarchies and i have to find the common senior hierarchy of a list of given emploeyees.

2 réponses

I used the common ancestor technique to solve this.

The key in these questions is to cover the fundamentals, and be ready for the back-and-forth with the interviewer. Might be worth doing a mock interview with one of the Zoho or ex-Zoho Member Technical Staff experts on Prepfully? They give real-world practice and guidance, which is pretty helpful. prepfully.com/practice-interviews Moins

### There was a lot of stress on the whole procedure of a System Call where they asked in detail about every step of the process

1 réponses

ga tau

1 - 10 sur 869 Questions d'entretien