Software Engineer / Developer Interview Questions
- -1of 1 vote
AnswersRound 2
- sonesh July 12, 2015 in United States
Question 3 : You are given following set of tables
Object{obj_id, obj_name,....<Other object related details>}
Attribute{att_id, att_name,....<Other attribute related details>}
ObjectAttributeMapping{objAtt_id, obj_id, att_id, att_value}
You have to provide the output in following format
Output table with column name {obj_id, obj_name, att_name1, att_name2, att_name3,...}
each object should only be represented in one row, and att_name1 column will have att_id1 values, from ObjectAttributeMapping table, similarly att_name2 column will have value of att_id2 from ObjectAttributeMapping etc...
Note that you have to do this in either SQL/Scope.
Example
Object
obj_id obj_name
1 cube
2 square
3 matrix
Attribute
Att_id Att_name
1 color
2 height
3 length
4 width
ObjectAttributeMapping
objAtt_id obj_id att_id att_value
1 1 1 'red'
2 1 2 10
3 1 3 12
4 1 4 5
5 2 1 'green'
6 2 2 6
7 3 3 5
8 3 4 9
Output should be
obj_id obj_name color height length width
1 cube 'red' 10 12 5
2 square 'green' 6 null null
3 matrix null null 5 9| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer SQL - -1of 1 vote
AnswersRound 2
- sonesh July 12, 2015 in United States
Question 2 : You are given following two tables,
Customer{cust_id, cust_name, ...<Other customer related details>}
Order{order_id, order_name, cust_id, ...<Other order related details>}
You have to provide the output in following format.
cust_id, cust_name, [Total amount of orders]
Please note that you have to do this in SQL/Scope, and print only those customer who have at least one order.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer SQL - -2of 2 votes
AnswersRound 2(taken by PARTNER SCIENTIST MANAGER)
- sonesh July 12, 2015 in United States
Question 1 : How are you ?, What is your interest ?, why you want to change your job and move to our team ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer General Questions and Comments - -3of 3 votes
AnswersRound 1(taken by DATA SCIENTIST 2)
- sonesh July 12, 2015 in United States
Question 1 : You are given a street map of a city, Every day you travel from your home to work. some day you take bus or someday your our car. Bus fare is also not constant, it may change in future, may increase or decrease ?
you have to find shortest path from your home to your work ?.
Note that : you have to expose this as library, so no custom assumptions. need to find out how you incorporate variable bus fare ?, also it is up-to the user to choose between bus and his car ?, in case of bus, you have to minimise the total money, and in case of care, you have to minimise the distance.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Data Structures Trees and Graphs - 0of 0 votes
AnswersGiven an array of contacts with phone numbers/emails you should detect and union identical contacts.
- coredo July 12, 2015 in United States
For example, given the following contacts array:
[ [ "John", "john@gmail.com", "john@fb.com"],
[ "Dan", "dan@gmail.com", "+1234567"],
[ "john123", "+5412312", "john123@skype.com"],
[ "john1985", "+5412312", "john@fb.com"] ]
We can see that john1985, John and john123 are the same person by their contact information.
We should output
[[ 0, 2, 3], [1]] (0,2,3 are the same person and 1 is another one)| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 0of 0 votes
AnswersDescribe the different ways to determine if an integer is a power of 2.
- Yev July 10, 2015 in United States
He was looking for a solution other than dividing by 2.
I suggested initially log2X. They said it has some rounding issues in certain environments. I continued to doing bitwise arithmetic.| Report Duplicate | Flag | PURGE
Vail Systems Software Engineer / Developer Coding - 2of 2 votes
AnswersTech Screening
- sonesh July 02, 2015 in United States
Question 1 : You will be given a stream of integers, and a integer k for window size, you will only receive the streams integers one by one. whenever you receive an integer, you have to return the maximum number among last k integers inclusive of current entry.
Interviewer was expecting O(N) solution for N asks.
Edits: Interviewer was expecting O(N) Time + O(1) avg case space complexity solution for N asks.
and integers are not given in a array, every time only one integer will be passed as input to your method.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Arrays Data Structures - 0of 0 votes
AnswerDesign an object oriented console application named universe that reads in a file containing the schema of a two
- AnonD June 24, 2015 in United States
dimensional (2D) universe and outputs certain information about the universe.
A 2D universe is a simplified universe that contains galaxies, stars, and planets, all of which are located on a flat plane
specified using 2-coordinates (x-axis and y-axis).
There is only one universe and it contains one or more galaxies.
A galaxy may contain one or more stars located in it.
A star may contain zero or more planets located near it in the same galaxy.
A planet may belong to one or two stars located near it in the same galaxy (Planet E465D in the sample file below is an example).
In order to allow the objects to support more descriptive attributes and functionality in future revisions of the
application, all the object types described above should be represented using separate classes. Parent-Child relationships should also be represented using links between the various object instances.
The program will run with three arguments specified: the input-file, and the name of two objects of any type, A and B.
Example command-line: universe text.txt Alpha_Dra E465D
Based on the command line arguments specified, the program will compute and display:
1. The parents location for both object A and B. (If needed, assume the coordinate of the universe is 0,0)
2. The minimum distance between object A (Alpha_Dra) and B (E465D). This is the distance between the two objects
given locations.
3. Any of the two closest stars in the entire universe.
4. The farthest object from A, that is of the same type as A; and the farthest object from B, that is of the same type as
B. (if one exists)
The input file contains new-line separated lines each describing one object using the format:
Type|Unique-Name|X-Coordinate|Y-Coordinate|Parent’s-Name|
Example test.txt input file:
Galaxy|Draco|75434.2|89151.4|Universe|
Star|Beta_And|23315.83|-2234.73|Andromeda|
Star|Alpha_Dra|75243.25|84123|Draco|
Galaxy|Andromeda|2967.78|-2357.2|Universe|
Planet|P165EU|75242.42|84121.2|Alpha_Dra|
Star|Alpha_And|26413.83|-2727.73|Andromeda|
Planet|E465D|26412.4|-2726.51|Alpha_And|
Planet|E465D|26412.4|-2726.51|Beta_And|
Notes:
The Universe object that serves as a parent to the galaxies is implicit, and will not be explicitly defined in the input
file.
The input lines may occur in any order
The file may contain millions of lines.
Example output of running: universe test.txt Alpha_Dra E465D
Parent of Alpha_Dra is located at: 75434.2,89151.4
Parent of E465D is located at: 26413.83,-2727.73
Distance between Alpha_Dra and E465D: 99635.8
Closest two stars in the universe are: Alpha_And and Beta_And| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 2of 2 votes
AnswersShuffle a given array such that each position is equally likely.
- xmlprgrm June 15, 2015 in United States| Report Duplicate | Flag | PURGE
Linkedin Software Engineer / Developer Algorithm - 3of 3 votes
AnswersRotate a array by N. N can be smaller of greater than the array length.
- someone June 10, 2015 in United States
e.g {0,1,2,4,5,6,7} N =4 should return {5,6,7,4,0,1,2}.
1) I did this using extra array but next I was asked to do without extra array and in o(n) time.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - -3of 7 votes
AnswersI have telephonic interview with amazon ? What will they ask? do they ask on algorithms,OOPs, data structure?
- aashish.lad June 08, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 1 vote
AnswersDesign and implement LRU Cache.
- rustyCoder June 04, 2015 in United States| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Algorithm - 5of 5 votes
AnswersSay you have a keypad that has keys for the numbers 0 through 9 and the correct code is some sequence of 5 digits. This keypad does *not* reset after entering an incorrect sequence of 5 digits. ie. If the correct sequence is 12345, entering 7512345 will succeed in opening it because it ends in the correct sequence. If the keypad actually resets after every 5 digits pressed, then it would not succeed b/c it would interpret the above sequence as "75123" then "45".
- Jason May 30, 2015 in United States
1. Write an algorithm that will try to find the correct code for this keypad. Assume you have an API similar to KeyPad.pressKey(int n) where you pass in a number (0...9) and it returns true if the keypad unlocks and false if it's still locked.
Note that you could easily enter all digits of all numbers 00000 through 99999 resulting in 5*100000 key presses, but remember that the panel does not reset after every sequence of 5 digits, so find a way to do this more efficiently. Notice for example that entering the stream 3791283780 will test the length 5 sequences 37912, 79128, 91283, 12837, 28378, 83780; not only the two disjoint sequences 37912 and 83780.
Think of this keypad as remembering the last 4 keys pressed (and the order pressed); when the next key is pressed, if the last 4 keys + the current key equal the correct code, the keypad will unlock. Assume the keypad does all this internally, so you can just keep feeding it keypresses and it will eventually unlock if the last 5 keypresses entered is the correct code.
2. Generalize your algorithm to work for a keypad where you don't know the length of the correct sequence in advance.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersSuppose you are given a puzzle that is represented as a matrix with 0s and 1s, where a 0 indicates you’re allowed to move into that position and 1 means you’re not allowed to move in that position. Write a function that given a start position and an end position, returns a boolean value indicating if there exists a path from start to end. you are only allowed to move up, left, right and down. Diagonal movement is not allowed.
- anom May 28, 2015 in United States
Example #1
Input
0 0 1 0 1
0 0 0 0 0
0 1 1 1 1
0 1 1 0 0
start: 4,1
end 0,3
Output - true
Example #2
Input
0 0 1 1 1
0 1 0 0 0
1 1 1 1 1
0 0 0 0 1
start: 0,0
end: 1,2
Output - false| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Java - 1of 1 vote
AnswersImplement a function that returns the i-th most popular item sold
- anom May 28, 2015 in United States
at xyz company. You cannot rely on any libraries.
Class Item {
String itemId;
int quantitySold;
}
/**
find the i-th most popular item in the list
**/
String find(List<Item> items, int i) {
// your code goes here
}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Java - 0of 0 votes
AnswersSearch in a sorted rotated array.
- Kiara May 21, 2015 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer - 0of 0 votes
AnswersMerge K sorted singly linked list
- Kiara May 21, 2015 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer - 0of 0 votes
Answerspaint a list of N houses and M colors, each combination has cost, minimize the total cost without color in row.
- Kiara May 21, 2015 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer - 0of 0 votes
AnswersHow do you traverse a binary tree and output the nodes in-order? Do it in O(1) space.
- Jack Le Hamster May 05, 2015 in United States
Hint: You can modify the tree.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGiven an unsorted array, find Kth smallest element in it.
- rs.firebolt April 27, 2015 in United States
A = 12, 3, 17, 0, 9, 6, 100
K = 3 -> 6| Report Duplicate | Flag | PURGE
A9 Software Engineer / Developer - 0of 0 votes
Answerswrite a function that takes two integers, k and n, with 0 ≤ k ≤ n, and prints out all subsets of size k of the integers 1, ..., n, one subset per line. The order of the subsets and the order of elements within the line doesn't matter.
- rs.firebolt April 27, 2015 in United States
example 1: print_subsets(k=1, n=2);
1
2
example: print_subsets(k=2, n=3);
3 1
2 3
1 2| Report Duplicate | Flag | PURGE
A9 Software Engineer / Developer - 1of 1 vote
AnswersGiven two binary trees ( not BST) , return true if both of them have same inorder else return false.
Eg.B / \ A C
A \ B \ C
Both of the trees have same inorder ( A-B-C) hence function will return true
- Anonymous April 25, 2015 in United States
P.S.
Please note, we can write inorder method call it once for first tree and then second tree, and finally compare both inorder.
We want to parallely do inorder on both tree, if there is mismatch between inorder nodes of both trees, we can stop the traversal and return false| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Trees and Graphs - 0of 0 votes
AnswersBring up as many approaches: Your goal is to make faster web browser for phones. You can change the phones, the data center etc. There's a limited network bandwidth and the browsers from the companies can't be altered.
- ghirlwhocodes April 23, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Brain Storming - 0of 0 votes
AnswersWe've got Quad-trees making up a screen. Every box of the Quad-tree has either color white or black. How would you design the data structure of this Quad-tree?
And how would you count the number of pixels in a screen of a given color, given a Quad-tree?int numberOfPixelsGivenColor(QuadTree* t, bool col)
i used bool to specify white/black.
- ghirlwhocodes April 23, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 3of 3 votes
Answerswrite a function:
int median(int a, int b, int c)
and then write another function:
- ghirlwhocodes April 23, 2015 in Switzerlandint median(int a, int b, int c, int min, int max)
| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersStarted out with simple question - to get warmed up:
Implement a function:makeNumeronym(string s){...}
Ex: house -> h3e, marcus -> m3s
- ghirlwhocodes April 23, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a singly linked list, swap the list items in pairs (reconnect the pointers, not simply swap the values). For example:
- Kiara April 22, 2015 in United States
Before: A->B->C->D
After: B->A->D->C| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer - -1of 1 vote
AnswersHardest bug you faced
- danny April 17, 2015 in United States for Amazon Music| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Behavioral - 3of 3 votes
AnswersLet's assume that there's an array that has nonzero natural numbers where all the numbers repeat an even number of times, except for one value that repeats an odd number of times. Can you write me a function that takes this array, and returns the value that occurs the odd number of times?
- danny April 17, 2015 in United States for Amazon Music
Ex : - [ 4, 7, 2, 2, 5, 3, 5, 7, 7, 3, 4, 5 ]| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm