Engineer Developer Interview Questions

467,082 engineer developer interview questions shared by candidates

Had 30 minutes to do this quiz. 1.Which of the following decimal numbers has an exact representation in binary notation? (Zero or more may be correct.) A. 0.1 B. 0.2 C. 0.3 D. 0.4 E. 0.5 F. None of the above. 2 .Bob writes down a number between 1 and 1000. Mary must determine that number by asking "yes/no" questions of Bob. Mary knows that Bob always tells the truth. If Mary uses an optimal strategy, then she will determine the answer at the end of exactly how many questions in the worst case? A. 1,000 B. 999 C. 500 D. 32 E. 10 3. Consider a singly linked list of the form cid:image001.gif@01CEF279.4C2C0140 where F is a pointer to the first element in the list and L is a pointer to the last element in the list. The time of which of the following operations depends on the length of the list? (Exactly one answer is correct.) A. Delete the last element of the list. B. Delete the first element of the list. C. Add an element after the last element of the list. D. Add an element before the first element of the list. E. Interchange the first two elements of the list. 4. p = 1; k = 0; while( k < n ) { p = 2 * p; k = k + 1; } For the program fragment above, which of the following is a loop invariant; i.e., true at the beginning of each execution of the loop and at the completion of the loop? A. p = k + 1 B. p = (k + 1)2 C. p = (k + 1)2k D. p = 2k E. p = 2k+1 5. A particular BNF definition for a "word" is given by the following rules. <word> ::= <letter> | <letter><pairlet> | <letter><pairdig> <pairlet> ::= <letter><letter> | <pairlet><letter><letter> <pairdig> ::= <digit><digit> | <pairdig><digit><digit> <letter> ::= a|b|c|...|y|z <digit> ::= 0|1|2|...|9 Which of the following lexical entities can be derived from <word>? (Zero or more answers may be correct.) A. word B. words C. c22 D. 42 E. None of the above. 6. If the variables below are properly initialized, and if i remains within array bounds, then the code below implements the stack operations Push and Pop. Note that the stack is held in an array S[1..N] indexed by the variable i. Push: begin S[i] := x; i :=i + 1 end Pop: begin i:=i - 1; x:= S[i] end Which of the following statements correctly initializes i for this implementation of a stack? A. i := N B. i := N-1 C. i := 1 D. i := 0 E. i := N/2 7. Consider a virtual memory with M resident pages and a page reference sequence p1, p2, . . ., pN of N distinct requests. Assume that physical memory is initially filled with unrelated pages, N = 2M, and a FIFO page replacement algorithm is used. If the access pattern is p1, p2, . . ., pN repeated three times, then the number of page faults is A. N/2 B. N C. N + 3 D. 2N E. 3N 8. Consider the following subroutine. int Func( int n ) { if( n == 4 ) return 2; else return 2 * Func( n + 1 ); } What value is returned by the subroutine call Func(2) ? A. 2 B. 4 C. 8 D. 16 E. 24 9. Consider a queue between the two processes indicated below. N is the capacity (maximum length) of the queue; e, f, and b are semaphores. "P" refers to the operation of acquiring (decrementing) a semaphore, and "V" refers to the operation of releasing (incrementing) a semaphore. init() { e = N; f = 0; b = 1; queue = EMPTY; } process1() { for(;;) { P(e); P(b); queue.enqueue(...); V(b); V(f); } } process2() { for(;;) { P(f); P(b); ... = queue.dequeue(); V(b); V(e); } } Which of the following statements is (are) true? (Zero or more may be correct.) A. The purpose of semaphore f is to ensure that dequeue is not executed on an empty queue. B. The purpose of semaphore e is to ensure that deadlock does not occur. C. The purpose of semaphore b is to provide mutual exclusion for queue operations. D. None of the above. 10. If V is a vector with n items and subroutine Exchange swaps its arguments, then the following code fragment sorts V in descending order. for( j = 0; j < n - 1; j++ ) for( k = 0; k < n - j - 1; k++ ) if( V[k] < V[k+1] ) Exchange( V[k], V[k+1] ); How many calls to Exchange are made if initially, V[i]=i, for i = 0, 1, 2, ..., n - 1 ? A.n-1 B. n C. n(n-1)/2 D.(n-1)(n-2) E. n(n-1)

Software Engineer

Interviewed at Glimmerglass Networks

3.2
Mar 3, 2014

Had 30 minutes to do this quiz. 1.Which of the following decimal numbers has an exact representation in binary notation? (Zero or more may be correct.) A. 0.1 B. 0.2 C. 0.3 D. 0.4 E. 0.5 F. None of the above. 2 .Bob writes down a number between 1 and 1000. Mary must determine that number by asking "yes/no" questions of Bob. Mary knows that Bob always tells the truth. If Mary uses an optimal strategy, then she will determine the answer at the end of exactly how many questions in the worst case? A. 1,000 B. 999 C. 500 D. 32 E. 10 3. Consider a singly linked list of the form cid:image001.gif@01CEF279.4C2C0140 where F is a pointer to the first element in the list and L is a pointer to the last element in the list. The time of which of the following operations depends on the length of the list? (Exactly one answer is correct.) A. Delete the last element of the list. B. Delete the first element of the list. C. Add an element after the last element of the list. D. Add an element before the first element of the list. E. Interchange the first two elements of the list. 4. p = 1; k = 0; while( k < n ) { p = 2 * p; k = k + 1; } For the program fragment above, which of the following is a loop invariant; i.e., true at the beginning of each execution of the loop and at the completion of the loop? A. p = k + 1 B. p = (k + 1)2 C. p = (k + 1)2k D. p = 2k E. p = 2k+1 5. A particular BNF definition for a "word" is given by the following rules. <word> ::= <letter> | <letter><pairlet> | <letter><pairdig> <pairlet> ::= <letter><letter> | <pairlet><letter><letter> <pairdig> ::= <digit><digit> | <pairdig><digit><digit> <letter> ::= a|b|c|...|y|z <digit> ::= 0|1|2|...|9 Which of the following lexical entities can be derived from <word>? (Zero or more answers may be correct.) A. word B. words C. c22 D. 42 E. None of the above. 6. If the variables below are properly initialized, and if i remains within array bounds, then the code below implements the stack operations Push and Pop. Note that the stack is held in an array S[1..N] indexed by the variable i. Push: begin S[i] := x; i :=i + 1 end Pop: begin i:=i - 1; x:= S[i] end Which of the following statements correctly initializes i for this implementation of a stack? A. i := N B. i := N-1 C. i := 1 D. i := 0 E. i := N/2 7. Consider a virtual memory with M resident pages and a page reference sequence p1, p2, . . ., pN of N distinct requests. Assume that physical memory is initially filled with unrelated pages, N = 2M, and a FIFO page replacement algorithm is used. If the access pattern is p1, p2, . . ., pN repeated three times, then the number of page faults is A. N/2 B. N C. N + 3 D. 2N E. 3N 8. Consider the following subroutine. int Func( int n ) { if( n == 4 ) return 2; else return 2 * Func( n + 1 ); } What value is returned by the subroutine call Func(2) ? A. 2 B. 4 C. 8 D. 16 E. 24 9. Consider a queue between the two processes indicated below. N is the capacity (maximum length) of the queue; e, f, and b are semaphores. "P" refers to the operation of acquiring (decrementing) a semaphore, and "V" refers to the operation of releasing (incrementing) a semaphore. init() { e = N; f = 0; b = 1; queue = EMPTY; } process1() { for(;;) { P(e); P(b); queue.enqueue(...); V(b); V(f); } } process2() { for(;;) { P(f); P(b); ... = queue.dequeue(); V(b); V(e); } } Which of the following statements is (are) true? (Zero or more may be correct.) A. The purpose of semaphore f is to ensure that dequeue is not executed on an empty queue. B. The purpose of semaphore e is to ensure that deadlock does not occur. C. The purpose of semaphore b is to provide mutual exclusion for queue operations. D. None of the above. 10. If V is a vector with n items and subroutine Exchange swaps its arguments, then the following code fragment sorts V in descending order. for( j = 0; j < n - 1; j++ ) for( k = 0; k < n - j - 1; k++ ) if( V[k] < V[k+1] ) Exchange( V[k], V[k+1] ); How many calls to Exchange are made if initially, V[i]=i, for i = 0, 1, 2, ..., n - 1 ? A.n-1 B. n C. n(n-1)/2 D.(n-1)(n-2) E. n(n-1)

There were 2 questions I tackled. The first was a power function that needed to be implemented in logn time and a Java encapsulation question (asking questions about making arrays inaccessible from outside the object).
avatar

Software Engineer Intern

Interviewed at Wealthfront

4.2
Mar 25, 2014

There were 2 questions I tackled. The first was a power function that needed to be implemented in logn time and a Java encapsulation question (asking questions about making arrays inaccessible from outside the object).

There is only one coding problem given 100min. The problem is as below: A group of farmers has some elevation data, and we’re going to help them understand how rainfall flows over their farmland. We’ll represent the land as a two-dimensional array of altitudes and use the following model, based on the idea that water flows downhill: If a cell’s four neighboring cells all have higher altitudes, we call this cell a sink; water collects in sinks. Otherwise, water will flow to the neighboring cell with the lowest altitude. If a cell is not a sink, you may assume it has a unique lowest neighbor and that this neighbor will be lower than the cell. Cells that drain into the same sink – directly or indirectly – are said to be part of the same basin. Your challenge is to partition the map into basins. In particular, given a map of elevations, your code should partition the map into basins and output the sizes of the basins, in descending order. Assume the elevation maps are square. Input will begin with a line with one integer, S, the height (and width) of the map. The next S lines will each contain a row of the map, each with S integers – the elevations of the S cells in the row. Some farmers have small land plots such as the examples below, while some have larger plots. However, in no case will a farmer have a plot of land larger than S = 1000. Note: The input uses unix line endings (\n). If you try to view the sample inputs on a windows machine with a program that does not convert line endings (like Notepad), you will see the input appear all on a single line. Your code should output a space-separated list of the basin sizes, in descending order. (Trailing spaces are ignored.) While correctness and performance are the most important parts of this problem, a human will be reading your solution, so please make an effort to submit clean, readable code. In particular, do not write code as if you were solving a problem for a competition. A few examples are below. Input: 3 1 5 2 2 4 7 3 6 9 Output: 7 2 The basins, labeled with A’s and B’s, are: A A B A A B A A A Input: 1 10 Output: 1 There is only one basin in this case. Input: 5 1 0 2 5 8 2 3 4 7 9 3 5 7 8 9 1 2 5 4 3 3 3 5 2 1 Output: 11 7 7 The basins, labeled with A’s, B’s, and C’s, are: A A A A A A A A A A B B A C C B B B C C B B C C C Input: 4 0 2 1 3 2 1 0 4 3 3 3 3 5 5 2 1 Output: 7 5 4 The basins, labeled with A’s, B’s, and C’s, are: A A B B A B B B A B B C A C C C
avatar

Software Engineer

Interviewed at Palantir Technologies

3.7
Mar 7, 2013

There is only one coding problem given 100min. The problem is as below: A group of farmers has some elevation data, and we’re going to help them understand how rainfall flows over their farmland. We’ll represent the land as a two-dimensional array of altitudes and use the following model, based on the idea that water flows downhill: If a cell’s four neighboring cells all have higher altitudes, we call this cell a sink; water collects in sinks. Otherwise, water will flow to the neighboring cell with the lowest altitude. If a cell is not a sink, you may assume it has a unique lowest neighbor and that this neighbor will be lower than the cell. Cells that drain into the same sink – directly or indirectly – are said to be part of the same basin. Your challenge is to partition the map into basins. In particular, given a map of elevations, your code should partition the map into basins and output the sizes of the basins, in descending order. Assume the elevation maps are square. Input will begin with a line with one integer, S, the height (and width) of the map. The next S lines will each contain a row of the map, each with S integers – the elevations of the S cells in the row. Some farmers have small land plots such as the examples below, while some have larger plots. However, in no case will a farmer have a plot of land larger than S = 1000. Note: The input uses unix line endings (\n). If you try to view the sample inputs on a windows machine with a program that does not convert line endings (like Notepad), you will see the input appear all on a single line. Your code should output a space-separated list of the basin sizes, in descending order. (Trailing spaces are ignored.) While correctness and performance are the most important parts of this problem, a human will be reading your solution, so please make an effort to submit clean, readable code. In particular, do not write code as if you were solving a problem for a competition. A few examples are below. Input: 3 1 5 2 2 4 7 3 6 9 Output: 7 2 The basins, labeled with A’s and B’s, are: A A B A A B A A A Input: 1 10 Output: 1 There is only one basin in this case. Input: 5 1 0 2 5 8 2 3 4 7 9 3 5 7 8 9 1 2 5 4 3 3 3 5 2 1 Output: 11 7 7 The basins, labeled with A’s, B’s, and C’s, are: A A A A A A A A A A B B A C C B B B C C B B C C C Input: 4 0 2 1 3 2 1 0 4 3 3 3 3 5 5 2 1 Output: 7 5 4 The basins, labeled with A’s, B’s, and C’s, are: A A B B A B B B A B B C A C C C

Classix 2 eggs problem . * You are given 2 eggs. * You have access to a 100-storey building. * Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical. * You need to figure out the highest floor of a 100-storey building an egg can be dropped without breaking. * Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process
avatar

Senior Software Engineer

Interviewed at Goldman Sachs

3.7
Sep 9, 2009

Classix 2 eggs problem . * You are given 2 eggs. * You have access to a 100-storey building. * Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical. * You need to figure out the highest floor of a 100-storey building an egg can be dropped without breaking. * Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process

Viewing 681 - 690 interview questions

Glassdoor has 467,082 interview questions and reports from Engineer developer interviews. Prepare for your interview. Get hired. Love your job.