Categories
Software development

Some Oracle and Java interview questions

Reading Time: 4 minutes

Last Updated on February 28, 2019 by stlplace

(Update 02-27-2019) It’s 5 and half years since last update. And two more jobs for me :] Noticed from recent job search in STL, code exercise and code testing (at the spot, pair programming, TDD) is becoming common now in STL, which is unthink of 5.5 years back. I did add a few blog posts on this fronts recently.

Javascript jasmine node.js based testing

Code exercise : linear chamber animation / simulation

Spring, Spring Boot and React

Also, on pure concepts side, Java (J2SE) and J2EE (Spring and Hibernate) are still important and questions were asked around both areas too.

Example questions:
JPA annotations
Hibernate configuration (XML file)
OOP Concepts
Java Interface vs Abstract class (do we need to implement abstract method to use the class)
final finally finalize java
spring model view controller annotation
classpath loading

(Updated 08-31-2013) For those brave hearts venture out the silicon valley/seattle, here is the must-do homework (LeetCode). Chinese version (here and here).

(Original)
Oracle
SQL: Inner join and out join

Function, (stored) procedure and package

What is a trigger in Oracle

“…Oracle lets you define procedures called triggers that run implicitly when an INSERT, UPDATE, or DELETE statement is issued against the associated table or, in some cases, against a view, or when database system actions occur. These procedures can be written in PL/SQL or Java and stored in the database, or they can be written as C callouts.

Triggers are similar to stored procedures. A trigger stored in the database can include SQL and PL/SQL or Java statements to run as a unit and can invoke stored procedures. However, procedures and triggers differ in the way that they are invoked. A procedure is explicitly run by a user, application, or trigger. Triggers are implicitly fired by Oracle when a triggering event occurs, no matter which user is connected or which application is being used…”

A shorter version at orafaq forum

Longer version at orafaq.com/wiki

7. Compare and contrast TRUNCATE and DELETE for a table.
Both the truncate and delete command have the desired outcome of getting rid of all the rows in a table. The difference between the two is that the truncate command is a DDL operation and just moves the high water mark and produces a now rollback. The delete command, on the other hand, is a DML operation, which will produce a rollback and thus take longer to complete.

8. Give the reasoning behind using an index.
Faster access to data blocks in a table.

11. Give some examples of the types of database contraints you may find in Oracle and indicate their purpose.
A Primary or Unique Key can be used to enforce uniqueness on one or more columns.
A Referential Integrity Contraint can be used to enforce a Foreign Key relationship between two tables.
A Not Null constraint – to ensure a value is entered in a column
A Value Constraint – to check a column value against a specific set of values.

DDL vs DML
Data Definition Language (DDL) statements are used to define the database structure or schema. Some examples:
CREATE – to create objects in the database
ALTER – alters the structure of the database
DROP – delete objects from the database
TRUNCATE – remove all records from a table, including all spaces allocated for the records are removed
COMMENT – add comments to the data dictionary
RENAME – rename an object

Data Manipulation Language (DML) statements are used for managing data within schema objects. Some examples:
SELECT – retrieve data from the a database
INSERT – insert data into a table
UPDATE – updates existing data within a table
DELETE – deletes all records from a table, the space for the records remain
MERGE – UPSERT operation (insert or update)
CALL – call a PL/SQL or Java subprogram
EXPLAIN PLAN – explain access path to data
LOCK TABLE – control concurrency

1. Describe the difference between a procedure, function and anonymous pl/sql block. Candidate should mention use of DECLARE statement, a function must return a value while a procedure doesn?t have to.

PL/SQL developer vs. Toad

Reporting
SQL Server Reporting Services (Microsoft); SQL Server Reporting Services (wiki)

Oracle 10g reports (PDF); Oracle Reports Tutorial

LIMS (wiki)

Java
(Updated 08-31-2013) OOPS Interview Questions

Top 20 Core Java Interview questions answers asked in Investment Bank

(Original) 30 Core Java questions (sys-con)

J2EE interview questions (techInterviews.com)

more j2ee interview questions

Java: hashMap and hashTable

Hashtable is synchronized, whereas HashMap is not. This makes HashMap better for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones.

Difference between Get and Post method on web (link one)

Lazy initialization, dependency injection

3 Things in OO:
data encapsulation, polymorphism, dynamic dispatch (when a method is invoked on an object, the object itself determines what code gets executed by looking up the method at run time in a table associated with the object. This feature distinguishes an object from an abstract data type (or module), which has a fixed (static) implementation of the operations for all instances. It is a programming methodology that gives modular component development while at the same time being very efficient.)

How to use static method? (Include class name)

Aggregation

Throwable interface (exception)

What is reflection

Interface vs. abstract class
non-static method
final: immutable, e.g. String
finalized method

tree-reflection

Categories
Fun

Youyou’s new words

Reading Time: < 1 minute

Last Updated on November 24, 2011 by omaha

Last week (Friday), when at friends’ house, and the hostess offered snack, she asked “这是什么呀?(what is this)”?

Today, after we put her to crib, when my wife and I both read iPhone on bed (her crib is next to our bed), she said “在看什么呀?(what are you reading)?”…Later, she also said “what are you doing?”

Categories
Software development

JSF Richfaces best practice: drop down and data scroller

Reading Time: < 1 minute

Last Updated on November 10, 2011 by stlplace

drop down box
Clear a list for selectionOneMenu every time, got burned by this in a “page number” drop down for Richfaces data scroller. And some other places.

Use validator
keep in mind it will overwrite the required = “true”, if the user does not select a valid value from drop down, it will give error message during Save method.

Assign 0 to “–select–” ?
Yes or no. Add 0 means 0 is a selectable option, so if one wants to enforce user to select something using required=”true”, it will pass this check. Thus comes in the validator, in which one can say “0” is not valid.

Page number for data scroller
1) t:saveState if we can not have session scope for dataBean;
2) the drop down tip above;
3) When “adding or deleting rows” and it cause the total number of pages changes, make sure set the correct page number in the “action” (save) methods.

Categories
finance

Southwest Rapid Reward 20% off points for Giftcards & Certificates

Reading Time: < 1 minute

Last Updated on October 19, 2011 by omaha

Saw it at dealsea. This is a good deal, if one does not plan to travel Southwest using the points soon.

They offer wide variety of giftcards (not limited to Amazon). I got some Wal-mart gift cards instead, per my wife’s suggestion 🙂

wal-mart gift card
(image credit: onlinegiftcardsblog.com)

Categories
Software development

Oracle, Java etc.

Reading Time: 2 minutes

Last Updated on October 11, 2011 by stlplace

The following was written more than a year ago…

======
Got opportunity to work on those two technologies recently due to job change. Had some gotchas as I transform from C++, CAD programming to this new program paradigm.

Data problem vs. coding error
In CAD world, sometimes there is problem with the data (CAD file) itself. But most of the time I focus my effort debugging the coding error in my own code, not trying to debugging the data itself. In Oracle/Database world, I found it more often that the data itself could complicate problem. Because the relational database has relationship between table, sometimes we can not add/delete/update table at will due to dependencies (data integrity). This also bring about the second topic I want to discuss.

C++ vs. Java
Java is not as flexible as C++. For instance, how to pass data back from a function, so far I found one way: using the return data. In C++, I used the pointer and reference quite a bit. The wiring of inheritance and interface (implementation) could also got a bit complicated: basically one needs to draw the relationships on a paper to better understand all those.

Eclipse vs. Visual Studio
Eclipse (the free Java IDE) is quite powerful, actually. It’s also highly configurable, with so many plug-ins, e.g., this subclipse integrates Eclipse with Subversion. I remember I could not do such things inside Visual Studio (for Perforce).

Categories
iPhone app

Steve Jobs

Reading Time: < 1 minute

Last Updated on October 7, 2011 by stlplace

Stanford commencement speech (2005)

Macintosh 1984 commercial

Steve Jobs and Bill Gates in 1983 Apple event

My other post on Steve Jobs.

Walt Mossberg on Steve Jobs.

Categories
advice and tips Fun

Youyou’s 1st month at Hope Montessori Toddler program

Reading Time: < 1 minute

Last Updated on January 10, 2024 by stlplace

(Update 10-01-2011) We went to Youyou’s school this morning for “Parents work day”, basically they have some small playground improvement projects (painting, making a new climber), and in the lunch time, we have a BBQ and potluck. The ethnic diversity of the students/parents background surprised me a bit, reminded of Rolla (a lot of Indian and Chinese faculties and graduate students). It took some efforts to pull together such an event, thanks to David and his staffs 🙂

(Original) Youyou is a 18 month and 18 days old. She started the program on Aug 29, and 4 weeks has passed. She has transformed from “crying when mom left her in the school” to today “she no longer cries when mom drop her”.

She can say quite a few Chinese words and some sentences. She has good memory probably due to genetic reason (we are both good at memorizing things). She also can feed herself a bit, and be much more proactive when playing with us. For instance, she came to grab me for dinner when I was on phone last Sunday evening (mom did not ask her). Not to mention grabbing my glasses (she is very fast). When I go to work, she will usually say “Mao Zi” which means “wear a cap”, and say “bye bye” (which she learned a while ago).

I attended a class offered by David (the head of Hope Toddler program) this morning, Dave is quite enthusiastic and I think the No. 1 thing for me is to learn, because kid is learning from parents all the time.

Categories
Software development

Dirty flag java script, dynamic drop down

Reading Time: < 1 minute

Last Updated on August 31, 2011 by stlplace

Dirty flag on a HTML form is much trickier than I thought, that is, it is tricker when I started to programming for dirty flag.

Saw this javascript snippet. It works great except in my case, I was generating dynamic drop down (selection menu), and in a lot of cases it behaves as opposite to expected (i.e., it shows the form is dirty when it is not, and vice versa). Found out there are couple things came into play.

1) The default selection (type “0”), or select “nothing”, I forgot to set the value “0” (string type).

2) Second, I forgot to clear some of the derivative selections when I make selection the primary selection menu (basically it will dynamically generate other drop downs based on the primary selection).

3) Third, allow type “0” has other effect, I had to remove required=”true” validation from the selection menu, and validate it manually. Also, after I made this optional (removed required=”true”), the actionListener will get triggered when I make selection type “0”, previously it was not entering it, and caused other rendering issues.

4) Last but not least, I added a “validator” to the primary selection menu (basically it will give error if I select “0” type), and it will not trigger the actionListener again. Madness. So basically I have to do the validation somewhere else.

Categories
advice and tips finance

Airline and hotel credit card offers

Reading Time: 2 minutes

Last Updated on July 9, 2011 by omaha

I felt it’s easier to make money from those offers from writing iPhone, iPad and iOS apps. At least this is true for me so far. Another plus side people may not pay attention is the “no tax” benefit of the bonus miles/points. Also keep in mind if one needs to apply for home loan (buying new home, or refinance), he/she should be careful not applying too many credit cards in the near term to hurt his/her credit score (and potentially pay higher rate for home loan). With that in mind, I would describe some of the cards I applied this year.

Airline cards
United Mileage Plus Visa Signature Chase: earlier this year I applied this via my Mileage acct, received the 50,000 bonus miles. UA is doing 30,000 miles with $50 coupon now. Check united.com web site.

Continental OnePass MasterCard Chase: applied this after UA card. 50,000 miles. They are offering 30,000 miles as of now. One needs to sign up OnePass from Continental site first. Continental has merged with United, and the milage program will be merged at the end of 2011.

British Airways Visa Signature Chase: applied this in May. Got 50,000 miles with remaining 50,000 miles pending (needs to spend $2,500 in first 3 months).

Hotel cards
Marriott Visa Signature via Chase: 50,000 points worth about 5 nights at Courtyard. And one free night at category 4 or above. The link is here.

Intercontinental Hotel Group Priority Club: 60,000 points, worth about 4 nights at Holiday Inns. New account only. Link is there.

Currently I am thinking about two cards, the Amex HHonors (62,500 points for Hilton family hotels, as described by Loyal Traveller) and Chase Sapphire reward card.

Note compared to writing apps, one can not expect make this as a business, rather than a nice way (almost effortless) to complement income. I have used my bonus AA miles, and Marriott hotel points for my recent travel to Shanghai. Not to mention the convenience brought by my Amex SPG (Starwood Preferred Guest) when travel in the US.

(Update 07-09-11) I saw this Southwest airline reward card deal from myMoneyBlog. I jumped.

Categories
iPhone app

Did Apple change iTunes App store ranking algorithm lately?

Reading Time: < 1 minute

Last Updated on June 29, 2011 by stlplace

It looks like it. Obviously my observation could be quite limited. But here is the background, in the good old days, Apple ranks app mostly by the download number in a given amount of time, and the ratings/reviews. So basically the popular the app, the higher the rank. This process could reinforce itself. Apple realized this approach probably has its limitation, one example being a fairly popular app Facebook (by usage) is not ranked the 1st. So Apple changed its algorithm a bit, it not only ranks by the download number, it also monitors the usage. By “usage” I assume Apple measures mostly by network activity, my reasoning being if an app just does its thing locally, Apple has no way to know it.

Also keep in mind the rating and reviews also play a role in the ranking, my understanding is if all things equal, higher rating or favorable reviews will push the rank higher.

More recently, it seems Apple started to give usage more weight. This is just from my own observation, I have 2 little apps, both are standalone (no network features), and one does fairly well last few month, until recent, it totally went down cliff. I did not know why until I did keyword search, in the past, it ranked 2 or 3, not it fell out of top 25. I tried to rescue such as free download for a limited time. After the free period, download number drops back, and this thing fell out top 25 again 🙁

I think from product lifecycle management (PLM) point of view, this app thing is not as good as traditional software revenue model 🙂