Tuesday, November 24, 2009

RBS Interview Questions

1. Write a program in Java to return fibonacci series in an array upto n numbers of the series :

int[] getFibonacci(int n);

2. Write a program to set a given name-value pair in cache so that the value expires after 5 min, the methods could be :

String getValue(String name); // Returns value corresponding to given name, if getValue is called after 5 min of calling setValue for the same pair, this will return null
String setValue(String name, String value); // Sets name, value pair in the cache and expires the data from cache after 5 min of upload

3. Give a design for desktop search engine including different components, data structure used, designs

4. Design a schema for School Management System for teachers, students and subjects where :

a). A teacher can teach to any number of studetns
b). A student can be taught by any number of teachers
c). A teacher can teach many subjects and a subject can be taught by many teachers
d). A student can study any number of subjects

Design the schema considering there are 15 subjects, 100 teachers and 1000 students so that the reports can be generated for conditions like
- Generate report for all the teachers who are teaching a particular subject to students

5. How can we make a class clonable?

6. Give a design for a system which has :
a). A flat-file database system
b). 10-20 processes reading/updating the DB system

Design this considering in mind that there could be clashes when more than 1 process will update the DB and you've to manage this so this conflict can never happen.

7. Why is java platform independent?

8. How you will design a system which needs 100 identical processes to perform some tasks? How many threads can be spawned to optimize this without degrading system performance?

Amazon Interview Questions

1. Write a Java program to find the number of words in a given string, the signature could be like :

int getWords(String s); or,
int getWords(char[] s);

2. Modify the above program to print the different words in different lines.

3. Write a program in O(n) or less order to find a unique character in an array of duplicates, e.g. the content of the array could be like ['a','c','a','b','b' ...]

4. Optimize the above algorithm when the array is sorted.