Some Oracle and Java interview questions
Posted in :
(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
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
“…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.
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)
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
interface design pattern
pass value vs. pass by reference, which method do we use for primitive data types
final (keyword)
unchecked exception, error vs. exception
default value of an object (null)
methods serializable interface must implement (WriteObject, ReadObject)
does static data member serialize, how about transient data, how about integer, string primitive data
how to find out memory foot print of an object
after a thread being created, what’s its state
what is demon thread,
what is synchronized, map vs. hashmap, vector vs. arraylist
JSP expression
JSP system provided/build in class?
Serverlet context
doGet vs. doPost: Get limit, 1) security (expose the full address, parameter); 2) buffer overrun, 2000 or 4000 bytes
web: forward vs. redirect