Nomura java/sql iview

Q: If you keep Employee.java instances in a list, how do you keep the list sorted on Employee.firstName? What if you can’t modify Employee.java source code?
%%A: define a new comparitor class

Q: what kind of messaging designs do you know?
A: multicast (RV) vs non-multicast; durable vs non-durable; point-to-point vs pub/sub

Q: can a message consumer subscribe to multiple topics?
A: single-thread model. each session has a dedicated thread?
(Interviewer said there are ways around it.)

Q: perl advantage over shell script? what can perl do that shell script can’t?
A: (I said on the spot) IPC, unicode, creating threads, OO, socket server
Now i think i can add — DB access, network access

Q: A text file contains 200 tab-delimited lines like “Stock1 $100n”. Write a shell/perl script to print the 10 most expensive stocks.

Q: write a shell/perl script to kill a unix process named Prc1, assume Prc1 is a unique process name.

Q: write a full singleton class. Don’t omit anything.

Q: write a LinkedList class with a reverse() method to reverse the list in-place. How about an ArrayList or a Vector? You are allowed to create your own Node class in the LinkedList.

Q: write the code to reverse a String without using String.reverse()

Q: what’s the benefit of hashing in a hash table? What’s wrong with a million bucket holding one entry each?
A: without hashCode, how do we save an entry in an array? I feel a million entry without collision is gr8.

—SQL

Q: for SQL what’s the advantage of clustered index over regular indices?
A: range select; avoid insert hot spot; probably the fastest index(?) I have a post in http://bigblog.tanbin.com/2007/07/clustered-index.html

Q: select * from tableA, tableA (TableA has 10 columns and 10 rows) How many rows and columns do u get?

Q: select * from tableA, tableB where…
TableB has 20 rows. What where-clause can u use to get the minimum/maximum resultset?

Q: Table C has Stock and Price columns. Select the 10 most expensive stocks

Q: (multipart SQL question)
select entity=’EntireBank’, minCode=1, maxCode=24 into e — entity table
insert e select ‘FI’, 2, 12
insert e select ‘mortgage’, 3,4 — a desk
insert e select ‘muni’, 5,6 — a desk
insert e select ‘repo’, 7,8 — a desk
insert e select ‘eq’, 13,23
insert e select ‘US’, 14,15 — a desk
insert e select ‘Japan’, 16,17 — a desk
insert e select ‘eqFutures’, 18,19 — a desk

select entity=’mortgage’, PL=-281 into pl — 281 millions Loss
insert pl select ‘muni’, 81
insert pl select ‘repo’, 100
insert pl select ‘US’, 709
insert pl select ‘Japan’, -555
insert pl select ‘eqFutures’, 90

You can roll up trading desk P/L into department P/L, and roll up department p/l into bank p/l. Now there are 3 roll-up levels, but system will support 10 roll-up levels.

For example, FI department P/L = -281 + 81 + 100 = -$100 million

Task1: design the java classes, important method signatures, queries … to support ad-hoc report P/L for any entity. Analyze performance, scalability,

Task 2: write a query to list all entities and number of desks within.

Task 3: write a query to show all level-2 entities (departments) and their P/L

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s