Software Engineer / Developer Interview Questions
- 0of 0 votes
AnswersImplement printf() library function using system-calls assuming a single argument which is a string
eg: printf("Hello world\n");
- anil.auece July 31, 2014 in Indiavoid printf(char *str)
| Report Duplicate | Flag | PURGE
Cavium Networks Software Engineer / Developer Operating System - 0of 0 votes
AnswerImplement sleep() in kernel mode using C-pseudo code
- anil.auece July 31, 2014 in Indiavoid sleep(int seconds) {}
| Report Duplicate | Flag | PURGE
Cavium Networks Software Engineer / Developer Operating System - 0of 0 votes
AnswersImplement a trivial spinlock and spinunlock functions using C-pseudo code eg: spinlock(&lock);
void spinlock(int *lock){}
- anil.auece July 31, 2014 in Indiavoid spinunlock(int *lock){}
| Report Duplicate | Flag | PURGE
Cavium Networks Software Engineer / Developer Operating System - 0of 0 votes
AnswerWhich one of the following applies to multi-core system?
- anil.auece July 31, 2014 in India
a. Multiple users can use the system at the same time
b. The kernel can run in SMP mode
c. Multiple tasks can execute in parallel without the need for scheduling
d. semaphores and mutexes should be replaced with spinlock| Report Duplicate | Flag | PURGE
Cavium Networks Software Engineer / Developer Operating System - 0of 0 votes
AnswersWhat are the differences between interrupt and exception?
- anil.auece July 31, 2014 in India| Report Duplicate | Flag | PURGE
Cavium Networks Software Engineer / Developer Operating System - 0of 0 votes
AnswersExplain how page fault and segmentation fault is handled/resolved
- anil.auece July 31, 2014 in India| Report Duplicate | Flag | PURGE
Cavium Networks Software Engineer / Developer Operating System - 1of 1 vote
AnswersGiven a multidimensional array like below:
0 1 0 0 3 0 3 3 0 0 0 0 0 0 2 0 0 1 0 2 0 0 0 0 0
"objects" are considered groups of numbers that touch along top, left, right, or bottom edges.
- Chris July 30, 2014 in United States
Find the number of objects.
For example given the above array, your code should detect 4 unique "Objects". {1,3,3}, {3}, {1}, and {2, 2}.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - -2of 2 votes
AnswersTo design classes and methods for casino cards games, what would you consider when doing it?
- yu_stfx@hotmail.com July 30, 2014 in Canada| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design - 1of 1 vote
AnswersWrite a method that takes a binary tree and return whether the tree is sorted.
- yu_stfx@hotmail.com July 30, 2014 in Canada| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersIn a programming language,we have a conditional statement like "a ? b : c",(you can assume all the expressions here could be represented by single character).The task is to generate a syntax tree like this.
- safulas July 29, 2014 in United States for Backend
a
b c
Here are more examples of the input and output,
a ? (b ? c : d) : e
a
b e
c d
a ? b : (c ? d :e)
a
b c
d e| Report Duplicate | Flag | PURGE
Pocketgems Software Engineer / Developer Algorithm - 0of 0 votes
AnswerHow to split a string using spaces with a given condition, the string inside quotes (") will not be split.
- Victor July 28, 2014 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm - -7of 7 votes
AnswersWrite a method to return first five 10 digit prime numbers
- saudip100 July 22, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 2of 4 votes
AnswersWrite a method to return first five 10 digit prime numbers.
- saudip100 July 22, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 0of 2 votes
AnswersWhich is faster?
- talktomenow July 20, 2014 in India
while(1) {}
or
while(2) {}
I said both have same speed as the expression inside while should finally evaluate to true or false. in this case both evaluates to true and there are no extra instructions inside the while so both have same speed of execution. Interviewer said while (1) is faster than while (2).
I do not agree . do you ?
By the way interviewer was a senior manager (i,e. does not code on day-to-day basis)| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer - 0of 0 votes
AnswersCome up with an algorithm for mapping the following scenario:
- AK July 18, 2014 in India
You have a source LED which has the following possible output combinations.
1. OFF
2. ON- Having RED SOLID color
3. ON- Having a GREEN BLINKING (one flash every second)-> This will result in LED turning OFF->ON and then OFF->ON
every one second.
When the source LED changes it's state (ON->OFF, OFF->ON, or changes COLOR ), you will get an interrupt.
As part of the interrupt handling, you will have to drive a single LED which has these possible values:
OFF-> when the source LED is OFF
RED-> when the source LED is RED SOLID
GREEN->when the source LED is green flashing.
Give the algorithm of only mapping these scenario and not the interrupt handling.| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm - 0of 0 votes
AnswersImplement an algorithm to print all valid (e.g., properly opened and closed) combinations of n-pairs of parentheses.
- mosh111 July 16, 2014 in United States
EXAMPLE:
input: 3 (e.g., 3 pairs of parentheses)
output: ()()(), ()(()), (())(), ((()))
This question is from "Cracking the coding interview" (Fourth Edition) and I think that I found mistake in the answer.| Report Duplicate | Flag | PURGE
CareerCup Software Engineer / Developer Algorithm - 16of 18 votes
AnswersOutput top N positive integer in string comparison order. For example, let's say N=1000, then you need to output in string comparison order as below:
- John July 15, 2014 in United States
1, 10, 100, 1000, 101, 102, ... 109, 11, 110, ...| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - 2of 2 votes
AnswersFind the longest sequence of prefix shared by all the words in a string.
- employee11 July 15, 2014 in Israel
"abcdef abcdxxx abcdabcdef abcyy" => "abc"| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 5of 15 votes
AnswersGiven a function
- mabid.mahmood July 15, 2014 in United States
getRandomTripplet()
which returns a random triplet of letters from a string. You don't know the string using calls to this function you have to correctly guess the string. the length of the string is also given.
Lets say the string is helloworld the function getRandomTriplet will return things like
hlo
hew
wld
owo
the function maintains the relative order of the letters. so it will never return
ohl since h is before o in the string.
owe since w is after e
The string is not known you are only given length of the string.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 1of 3 votes
AnswersGive a function
- mabid.mahmood July 15, 2014 in United States
getRandomTripplet()
which returns a random triplet of letters from a string. You don't know the string using calls to this function you have to correctly guess the string. the length of the string is also given.
Lets say the string is helloworld the function getRandomTriplet will return things like
hlo
hew
wld
owo
the function maintains the relative order of the letters. so it will never return
ohl since h is before o in the string.
owe since w is after e
The string is not known you are only given length of the string.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 0of 0 votes
Answersgiven a binary tree, assign a new next pointer to each node, such that next pointer points to any node which is right side of the node(ie it may point to its sibling right node , or a left node of next subtree).
if no node on right or if the node itself if right most, the next points to null6
/ \
7-------->2
/ \ / \
- talktomenow July 14, 2014 in United States1 - ->5-->4 ->13
| Report Duplicate | Flag | PURGE
Akamai Software Engineer / Developer Algorithm - 6of 8 votes
AnswersGiven a NxN matrix which contains all distinct 1 to n^2 numbers, write code to print sequence of increasing adjacent sequential numbers.
- talktomenow July 14, 2014 in United States
ex:
1 5 9
2 3 8
4 6 7
should print
6 7 8 9| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven is a matrix arr[n][n], find a submatrix sub[m][m] such summation of all the elements in submatrix is maximum.
- nav July 13, 2014 in India
Given condition,
1. m <= n
2. m >= 2
3. consider positive, negavive and zero integers in arr[n][n]
4. User provide n.| Report Duplicate | Flag | PURGE
Software Engineer / Developer Matrix - 0of 0 votes
Answerfloat range is only 4 byte but if apply the more than 4 byte also execute why?
- SethuRaman447 July 12, 2014 in India| Report Duplicate | Flag | PURGE
Software Engineer / Developer C# - 1of 3 votes
AnswersPower set P(S) of a set S is the set of all subsets of S. For example S = {a, b, c} then P(s) = {{}, {a}, {b}, {c}, {a,b}, {a, c}, {b, c}, {a, b, c}}.
If S has n elements in it then P(s) will have 2^n elements
- 4661 July 12, 2014 in United Statespublic List<List<int>> ComputePowerSet(int[] nums) { List<List<int>> powerSet = new List<List<int>>(); if (nums == null) return powerSet; bool[] bits = new bool[nums.Length]; bool overFlowBit = false; while (!overFlowBit) { List<int> lst = new List<int>(); for (int i = 0; i < nums.Length; i++) { if (bits[i]) lst.Add(nums[i]); } //function PlusOne returns false if the end is reached i.e. 2^n if (!PlusOne(bits)) overFlowBit = true; powerSet.Add(lst); } return powerSet; } public bool PlusOne(bool[] bits) { bool carry = true; //add i i.e. true to the bits int i = bits.Length-1; while (i >= 0 && carry) { bool b = bits[i]; bits[i] = b ^ carry; carry = b & carry; i--; } //if carry is true implies reached the end i.e. 1111 + 1 = 0000, carry = 1 return !carry; }
| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer - 1of 1 vote
AnswersFind the deepest node in a binary tree:
- 4661 July 11, 2014 in United States
Example:
A
/ \
B C
/ \ / \
D E F G
\
H
Return Node ‘H’| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer