Coding Interview Questions
- 0of 0 votes
AnswersIP address to decimal formula.
- Artin April 07, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersAmazon conducted a written test in hyderabad for SDE .Questions are.Although i wrote the solutions. I didnt clear the test. Not sure what they were looking for?.
- Raga March 30, 2011
They expected me to write a fully working code in any language.which i did.
Do they expect a specific solution which they already know?
or Do they expect the timing,space complexity to be at best
Anyway had a disappointing run
1.Given an infix expression convert into postfix| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite the code (either c++ or Java) to generate factorial of a number? Please don't laugh at it yet, the program must be highly scalable, it should (somehow) be able to return the factorial of a number as big as a million.
- JustStarted March 25, 2011| Report Duplicate | Flag | PURGE
Flipkart Software Engineer / Developer Coding - 0of 0 votes
AnswersImplement the tokenize function in C and how do you handle multiple spaces between words ?
- Ashish Daga March 09, 2011
So if the string is "abc def (2spaces)ghi" how do you separate out words in an array ??| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C Coding - 0of 0 votes
AnswersGiven an array of integers all but 1 appear even number of times, Find the integer that appears odd number of times.I gave the XOR solution. Then he said what if its an array of objects and not integers. I said I would use hashtable.He asked me to write the code for that.
- troy March 08, 2011
There was some glitch in my code in the return value. So he asked how I would handle that in Java. I told using try-catch. He said OK and then asked when do you use Exceptions in java?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersThere is an array of positive integers...all the elements in an array is repeated even number of times except one number,which is repeated odd number of time...WAP to get that element which is repeated odd number of time...After then he asked me to test the code...
- RGarg March 06, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Coding - 0of 0 votes
AnswersImplement atoi function
- Richa Aggarwal March 04, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Coding - 0of 0 votes
AnswersYou are given a function. When it is called, it returns 0 with 60% probability, and 1 with 40% probability. Now using this function, write a new function that returns 0 with 50% probability and 1 with 50% probability.
- thear February 28, 2011| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Coding - -1of 1 vote
AnswersI heard some people mentioning an onsite test for developer position. I was wondering if any of you had to take it. Also, what kind of questions were on it? Thanks!
- anonymous February 24, 2011| Report Duplicate | Flag | PURGE
Goldman Sachs Financial Software Developer Coding - 0of 0 votes
AnswersWrite code to create a form with two tabs. First tabs contains a form which has name, address etc. After filling first form when we click submit button, page goes to second tab which has some information or something. You have to write in javascript/css/html.
- JavaJavas February 19, 2011
Both tabs should be visible, but not forms.| Report Duplicate | Flag | PURGE
PayPal Web Developer Coding - 0of 0 votes
AnswersDesign a Thread safe Array Based queue with a fixed size.
- kapilraju February 19, 2011
The behavior should be in such a way that if multiple threads are accessing the same queue and if the queue is full the threads will wait for their turn and if some other threads removes elements from queue, the waiting threads will get a chance to add elements.| Report Duplicate | Flag | PURGE
Adobe Developer Program Engineer Coding - 0of 0 votes
AnswersCode for a method that takes two arrays and returns true if one array is contained in the other..
- Anonymous February 16, 2011
1,2,3,4,5
2,3
true
1,2,3,4,5
2,4
false.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - 0of 0 votes
AnswersA consulting firm has many employees e1, e2, e3... en. Each employee can work at multiple client sites, i.e. a subset of c1,c2,c3... cm.
- anonymous February 10, 2011
For each valid pair (e,c) where employee e works at client c, there are attribute-value list (a1,v1), (a2,v2).... like salary=$100, hours=40, priority=P2 etc.
construct a data structure that can efficiently perform:
public void set(emp, cli, att, val)
public List<AttributeValue> get(emp, cli)
public val get(emp, cli, att)
You can assume all attributes and values are strings.
You can represent Employee and Client in any way you want.
Try to do better than O(mn) for both the get queries. Try not to denormalize your data structure too much.| Report Duplicate | Flag | PURGE
Software Engineer / Developer Coding - 0of 0 votes
AnswersCode malloc() in C
- J February 10, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Coding - 0of 0 votes
AnswersImplement a pattern matching dictionary using Trie?
- bk February 07, 2011| Report Duplicate | Flag | PURGE
One97 Software Engineer / Developer Coding - 0of 0 votes
AnswersIf a function has a variable declared (say int a) and returns its address, what would happen?
- Gagan February 05, 2011
Well, its an automatic variable and on stack. So, its bad. The question is :
Why does the compiler let you do this (and just give a warning)? Any scenario where this is required?| Report Duplicate | Flag | PURGE
Coding - 0of 0 votes
AnswersWrite a program to print hello world without using semi colon
- Rajesh February 02, 2011| Report Duplicate | Flag | PURGE
Development Support Engineer Coding - 0of 0 votes
AnswersGive an unsorted array of integers A and and an integer I, find out if any two members of A add up to I.
- Jerry February 01, 2011
For example:
A = < 3, 25, 9, 15>
I = 12 returns true
but I = 19 returns false.
Can you find the answer in O(n*log(n)) time?
Can you find the answer in O(n) time?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite a c code to check if a given c syntax is correct (a small module of compiler)
- Anonymous January 27, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite a method to return the index of first out of order letter in input string
- jp January 06, 2011| Report Duplicate | Flag | PURGE
Google Developer Program Engineer Coding - 0of 0 votes
AnswersGiven the current board configuration of "Game of Life" game, write a method/function to next generation board configuration.
Note: search "Conway's Game of Life" wikipedia for rules
Input: 2D array int[][]board,
board[i][j] = 1 if cell at i,j is alive
board[i][j] = 0 if cell at i,j is dead
Problem:
- jp January 06, 2011public static int[][] nextConfig(int[][] board) { //code to calculate next board configuration //return new config }
| Report Duplicate | Flag | PURGE
Google Developer Program Engineer Coding - 0of 0 votes
Answers1. concept of TCP and UDP and use case.
- Hai.Vincent December 22, 2010
2. serialize and deserialize.
say given ab,cd,fgh, output a single string
given that single string output ab,cd,fgh
string serialize(string str[], int n)
{
string result = "";
if(n < 1)
return result;
for (int i = 0; i < n; i++)
{
result += "\"";
for(int j = 0; j < str[i].length(); j++)
{
if(str[i][j] == '\\')
{
result += "\\\\";
}
else if(str[i][j] == '\"')
{
result += "\\\"";
}
else
{
result += str[i][j];
}
}
result += "\"";
}
cout<<result<<endl;
return result;
}
void deserialize(string str)
{
if(str == "")
return ;
string token;
bool doubleQuoteBegin = false;
bool skip = false;
for (int i = 0; i < str.length(); i++)
{
if(str[i] == '\\' && !skip)
{
skip = true;
}
else if(str[i] == '\"')
{
if(skip)
{
token += '\"';
skip = false;
}
else
{
if(doubleQuoteBegin)
{
doubleQuoteBegin = false;
cout<<token<<endl;
token = "";
}
else
{
doubleQuoteBegin = true;
}
}
}
else if(str[i] == '\\' && skip)
{
token += '\\';
skip = false;
}
else if(str[i] == '\\' && !skip)
{
skip = true;
}
else
{
token += str[i];
}
}
}| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - 0of 0 votes
Answers<Written>
- googler December 09, 2010
WAP to alternate merge 2 LL.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
Answers<Written>
- googler December 09, 2010
WAP to find cycle in a directed graph.If multiple cycles are found print any but starting with the smallest node no.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding