Showing posts with label interview questions. Show all posts
Showing posts with label interview questions. Show all posts

Thursday, March 22, 2012

Google question

Tell me what you know about security
What is cursor
Tell me about event system
Dealer inventory, what data structure, if large data,how you display partial while getting the whole
Junit ,what things you need pay attention

Thursday, November 17, 2011

interview questions

1.draw architect design of the project you worked on.
2. SQL;
employee, dept
find departid which has duplicate employee name
SELECT name, departid  COUNT(name) AS NumOccurrences FROM employee GROUP BY name,departid HAVING ( COUNT(name) > 1 )
find the person who has the highest salary in one dept
select name

where salary = (select max(salary)
from employee
group by departid )
from employee
3. List
sort the list
(calling Collection.sort)
4.tapestry design
5.java jdbc calls what is the common mistakes
6. http protocol
7. WAR config
8. webservices structure

(ST)

Sunday, November 13, 2011

final array

void foo() {
final int[] number = {1,2,3};
numbers[1] = 50; // is this legal?
}

legal, the final is on the array, so you can not change the length of array, but you can change the element

Saturday, March 26, 2011

recursion to iterative

f(){

if( condition = false)
return;

f();
g()
}

change to iterative
f(){
while(condition = true){
g();
}
}

powerSet -- binary approach


The binary approach just means you're considering each element of the original set(e) as a bit value of a binary number. So if you have an original set of four elements(A, B, C, D) you would consider each one a bit value.

A - 00000001
B - 00000010
C - 00000100
D - 00001000

The size of a power set is calculated by 2^N of the original set. So in this case the size of the power set will be 2^4 or 16. This means that you must create sixteen elements for your power set with binary values starting at 0 and ending at 15 in binary. For each binary value you would add the elements of the original set which have similar bits.

Example:

00000000 - (O) - {Empty Set}
00000001 - (1) - {A}
00000010 - (2) - {B}
00000011 - (3) - {A, B}
00000100 - (4) - {C}
00000101 - (5) - {A,C}
00000111 - (6) - {A,B,C}

collection of technical interview questions

http://www.scribd.com/doc/7691861/A-collection-of-technical-interview-questions

Wednesday, March 2, 2011

How to reduce the number of bugs when coding?

Junit , run code coverage, find bugs tool.

Avoid fancy coding. The more complicated the code, the more likely there's bugs. Usually on modern systems, clearly written code will be fast and small enough.

Use available libraries. The easiest way to not have bugs writing a utility routine is to not write it.

Learn a few formal techniques for the more complicated stuff. If there's complicated conditions, nail them down with pen and paper. Ideally, know some proof techniques. If I can prove code correct, it's almost always good except for big, dumb, obvious bugs that are easy to fix. Obviously, this only goes so far, but sometimes you can formally reason about small but complicated things.

Beyond that, set the highest warning level your compiler offers, and make sure warnings are treated as errors. Bugs often hide in those "erroneous" errors.

  • Don't ignore error codes - e.g. don't assume that you got a valid result, that a file has been successfully created, etc... Because some day, something will happen.
  • Don't assume that your code will never enter some condition and that therefore "it's safe to ignore that condition".
  • Test your code, then have it tested by someone else. I find I'm the worst person to test my own code.
  • Take a break, then re-read your code and see if you "missed the obvious". Often happens to me.
if you're so sure that condition X will never happen... use an assert to make sure that when condition X happens, you'll know about it (through an exception, or logging, or whatever).

I found that if I pass all of the context to a function (or method) that that function needs to do its job, and return the meaningful data that I'm looking for, that my code has become much more robust.

Implicit state is the enemy and in my experience is the #1 source of bugs. This state can be global variables or member variables, but if results are dependent on something that's not passed to the function you're asking for trouble. Clearly it is not feasible to eliminate state, but minimizing it has huge positive effects on program reliability.

Involve your testers as early as you can


http://programmers.stackexchange.com/questions/7927/how-to-reduce-the-number-of-bugs-when-coding

Thursday, February 24, 2011

Java interview questions

what is disadvantage of using Java Generic?

http://www.javabeat.net/articles/33-generics-in-java-50-1.html

what is the common practice you do to reduce bugs?

what do you do to write thread safe code?

WildCard

Sunday, February 6, 2011

interview questions : distributed sorting

if you have a large log which contains urls and queries, design a algorithm finding top 100 most frequent searched queries
1. extract the queries from the log first, then put in the hashmap, get the top 100
2. what is limitation of hashmap?
might be too limited if the queries are too many. in memory operation
3. what would you do instead?
add more CPUs, distributed into multiple computers
4. what if the file is still too large?
divide the file in chunks, say each file only get queries starting with A.

Monday, January 31, 2011

great website for tutorial

http://www.vogella.de/java.html

Saturday, January 29, 2011

interview questions

reflections in java
BST
join - outer join
ACID
level of isolation DB provides.
deadlocks, how to avoid them
concurrentmodification exception java - what code will you look at
command to list open files for a process
command to list processes which have opened a specific file
commands related to find and grep