Computer Scientist Interview Questions
- 0of 0 votes
AnswersWrite a method to which will download a file from remote server
- Andi November 23, 2012 in India
conditions are: if remote server not responding then should go into resume. Once it up it should start download file from where it got resumed.| Report Duplicate | Flag | PURGE
Adobe Computer Scientist - 0of 0 votes
Answerswrite two separate methods,
- Andi November 23, 2012 in United States
1. read method to read file and
2. write method to write to file,,,
both must be thread safe and throughput (efficiency) should be high.| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Application / UI Design - 0of 0 votes
Answersgiven m x n matrix print all the possible paths top to down.
- junk.programmer October 17, 2012 in United States
Example
1 2 3
4 5 6
7 8 9
path for root(0,0) 1
1-4-7
1-4-8
1-5-7
1-5-8
1-5-9
similarly path for 2(0,1)
2-4-7
2-4-8
2-5-7
2-5-8
2-5-9
2-6-8
2-6-9
note- root 1 can go to middle down or right down since there is no left index available. if root element has left middle and right it can go to all those paths like 2 or 5.
follow up : provide the path which has maximum path sum.
code in java.| Report Duplicate | Flag | PURGE
Yahoo Computer Scientist Matrix - 0of 0 votes
Answerswhat is the difference between multi tasking, multi processing and multi programming operating systems with examples ???
- Surender September 06, 2012 in United States| Report Duplicate | Flag | PURGE
JP Morgan Computer Scientist - 0of 0 votes
AnswersGiven two char arrays X="ZTANBMBLAUCY " and Y ="GABVCBKLAMNC", write an algorithm to find the longest subsequence that is present in both of them.
- ashok.singh.sairam August 24, 2012 in India
In the above case the common subsequence is "ABBAC".
Also describe the time complexity of your algorithm.| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Dynamic Programming - 0of 0 votes
AnswersGiven a string, find out whether the string contains any repeated characters or not. For example, 'abcd' does not contain any repeated character 'abcdaefgh' contains repeated character ('a' is repeated twice).
- babbupandey August 22, 2012 in United States for Big Data
As part B, I was asked if suppose it is given that string contains no more than 20 characters, will you change your algorithm in anyway to improve memory/time performance. Then he specifically added that there is a constraint on memory.| Report Duplicate | Flag | PURGE
Knewton Computer Scientist Algorithm - 0of 0 votes
AnswersCalculate circumference of a tree going clockwise and anticlockwise?
- Yoda July 17, 2012 in India| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Algorithm - 1of 1 vote
AnswersImplement LRU cache?
- Yoda July 15, 2012 in India for PSE| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Algorithm - 0of 0 votes
AnswersHow would you implement Singleton pattern in a multi-threaded environment?
- Yoda July 15, 2012 in India for PSE| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Application / UI Design - 0of 0 votes
AnswersYoda speaks in a jumbled language. Say " Newyork must go we to now". FInd the minimum number of swaps to convert this to proper sentence say "we must go to newyork now". This is similar to minimum swaps to convert string A to string B. where A, B are permutation of each other? Is there a decisive method? I tried using merge sort and selection sort and both time the answers varied.
- Yoda July 05, 2012 in India| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Algorithm - 0of 0 votes
AnswersYou are given intervals in form of Interval(i)={a(i), b(i)} where a,b are start and end points on a straight line. Given an array of intervals, Can you determine whether any such pair exist such that Interval(i) is contained in Interval(j). I told them the O(n log(n)) approach. If we have to find how many such pairs exist is it possible to do it in time less than O(n^2)??
- Yoda July 01, 2012
What if i also have to print all such pairs??| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Algorithm - 0of 0 votes
Answersi was asked the following question and they need java solution for it.
- dev June 17, 2012 in India
Checkers is an ancient board game played by two players, traditionally called 'Black' and 'White'. It is played by turns on an 8x8 board, which has alternating black and white squares. All the pieces are placed on black squares only and move in a diagonal fashion, i.e., a piece cannot move vertically or horizontally, but only diagonally.
When it is a player's turn, he can either make a move or a sequence of jumps. A jump is defined as a diagonal move over exactly one piece of the opposing colour. The piece that has been jumped over is said to be captured, i.e., it is removed from the board. The players try to capture as many of the opponent's pieces as possible and the game ends when all the pieces of any one player are captured.
Checkers rule states that the white piece (A) has a choice of moving to his left, or jumping over the black piece. Since the intent of the game is to capture as many of the opponent's pieces as possible, White should choose 'A' to jump over the black piece. After jumping, 'A' reaches a square from which he can jump further, either left or right. The jump to the left is better because it allows White to make one more jump, unlike the jump to the right, which leads to no more jumps. The white piece (, in the figure, can only move and not jump. Thus, according to the figure, White can jump thrice in one turn, using 'A' or alternatively can move once using 'B'. Obviously, the better choice is jumping with A.
You have to write a program which, given a board configuration, calculates the maximum number of jumps possible in one turn, by any White piece. Given the board above, the program would output '3'.
Notes:
It is illegal to jump over a piece of your own colour.
A player's turn is complete when he makes either a move or a sequence of jumps.
A jump can land only on an empty square.
Input specification:
The input will consist of eight (8) lines of eight (8) characters each. The characters will be one of the set {B, W, ~, #}.
� B => Black piece
� W => White piece
� ~ => An empty black square
� # => White square. Note that a piece can never land on a white square
Output specification:
Your program has to output the maximum number of jumps that can be made by any of the white pieces. If white cannot make any jump at all, then your program must print the integer '0' (zero)
Sample Input and Output:
Input:
#B#~#B#~
B#B#B#B#
#~#~#~#~
~#B#~#~#
#~#W#~#~
~#~#~#~#
#W#W#W#~
W#W#W#W#
Output:
4
Input:
~#~#~#~#
#B#B#B#B
~#~#~#~#
#B#B#~#~
~#~#~#~#
#~#B#~#~
~#W#W#W#
#W#W#W#W
Output:
5| Report Duplicate | Flag | PURGE
CDAC-ACTS Computer Scientist Java - 0of 0 votes
AnswersGiven an array A[n] such that A[i+1] = A[i]+1 OR A[i]-1, and a number k, can you determine in most efficient way whether k is present in A[n] or not?
- Yoda June 12, 2012 in United States for Bing| Report Duplicate | Flag | PURGE
Microsoft Computer Scientist Algorithm - 0of 0 votes
AnswersAn older has a very old computer at his house. It is so old that there is no notion of virtual memory in the operating system. Instead it uses a simple memory allocation technique called the 'Best Fit Algorithm'. The BFA works like this:
- PriyaDarad May 26, 2012 in United States
Whenever a request comes in for some memory space, the OS looks for the smallest, continuous empty space, which can satisfy it, and allocates a portion of this region to the program making the request. If such space cannot be found, the program is terminated and all the memory used by the program is freed. Any program can get terminated due to two reasons:
The program exits
Enough memory is not available to start the program or keep it running
All memory requests that come in at the same time-instant are processed in ascending order of process-id. If while processing, a program is terminated for lack of memory, all memory held by it is freed before processing any other request and no further memory requests by the terminated program are considered. All termination is also done in order of process-id.
You have to write a program to simulate this algorithm and print out the number of processes that were terminated due to lack of memory.
Note:
1.No process will request for memory before its start-time or after its end-time.
2.All memory sizes are specified in KB.
3.The memory is linear in nature, i.e., addresses do not wrap around. It starts at zero and goes up to N-1 KB.
4.At a given time unit, all processes that have reached end-time will be terminated (and memory freed) before other memory requests are serviced.
5.The total free space available in memory might be enough to satisfy a request, however the OS will terminate the process if a continuous region of empty space is not found
Input specification:
First line has an integer N (0 < N <= 1000), size of the memory in KB.
Second line of input will have integer P (0 <= P <= 20), the total number of processes to be run on the system.
Next P lines will have data for each process in the following format:
<process-id> <start-time> <end-time> <initial-memory>
These input lines will be sorted in ascending order of the process-id.Process-id will be unique integers greater than zero.
Next line will have integer R (0<= R <= 20), which specifies the subsequent memory requests by any process.
Next R lines have the following format:
<process-id> <request-time> <memory-required>
Output specification:
An integer specifying the number of processes that were terminated due to lack of memory
Sample Input and Output:
Input:
100
4
1 3 7 20
2 0 4 30
3 0 3 70
4 0 10 25
2
3 2 30
2 2 10
Output:
2
Input:
10
2
1 0 8 4
2 0 3 2
3
1 1 2
2 1 2
1 4 4
Output:
1| Report Duplicate | Flag | PURGE
Lunatic Server Solutions Computer Scientist Java - 0of 0 votes
AnswersGiven a queue with functions as enqueue(), dequeue(), and findmax(). You can use these functions any time. The findmax() should return the largest value in the queue at that point. You can use auxiliary space.
- nihaldps February 21, 2012 in India
Implement the queue with given operations. Find the max value in the queue.| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Data Structures - 0of 0 votes
AnswersDo a merge of two binary trees and tell what the complexity of the merging is. The trees consist of m and n nodes respect.
- nihaldps February 21, 2012 in India| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Trees and Graphs - 0of 0 votes
AnswersReverse a stack without using extra stack (i.e. doing in place reversal). (hinted about using double recursion).
- nihaldps February 21, 2012 in India| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Stacks - 0of 0 votes
AnswersDelete a given node of a linked list, when you do not have info about the head or any other node.
- nihaldps February 21, 2012 in India
The prototype of the function is -
void delete (Struct node* x)
where x is any arbit node of a linked list.| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Linked Lists - 0of 0 votes
AnswersGiven a graph (consider it to be a mxn grid). The nodes are node of a binary tree with left and right pointers. The start point (A) is at the left upper corner and the end point (B) is at right bottom corner. Each node points to its adjacent nodes in the grid (the right pointer points to the node on the right and the left points to the node just below it). The nodes at the lower and right edges will have child as null (right null for the right side edge and left null for the bottom edge). The end node at B is having both as null.
- nihaldps February 21, 2012 in India
How many paths are possible which can lead you to B, if you start from A?| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Trees and Graphs - 0of 0 votes
AnswersHow do you find the value of PI without using a circle? Sorry, should have given more details, basically "How does a caveman find the value of PI?" Assume he knows basic mathematics
- archioliis October 26, 2011 in -| Report Duplicate | Flag | PURGE
Computer Scientist Algorithm - 0of 0 votes
Answerswrite a function which allocates two dimensional array dynamically
- truekool2 June 15, 2011
int ** allocate(int row, int col)| Report Duplicate | Flag | PURGE
Adobe Computer Scientist C - 0of 0 votes
Answersgiven power(x,y)implementation, find number of multiplications in power(5,12)( written test)
- truekool2 June 15, 2011
int pow(int x, int n)
{
if(n==0)return(1);
else if(n%2==0)
{
return(pow(x,n/2)*pow(x,(n/2)));
}
else
{
return(x*pow(x,n/2)*pow(x,(n/2)));
}
}| Report Duplicate | Flag | PURGE
Adobe Computer Scientist C - 0of 0 votes
Answersprint all paths from root to leaves( written test)
- truekool2 June 15, 2011| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Algorithm - 0of 0 votes
Answerswrite a program to find height of a bst.( written test)
- truekool2 June 15, 2011| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Algorithm