Sunday, 27 August 2017

Oracle Online Assessment - Java and PL/SQL

Oracle Online Assessment

Below are few of the good questions from Java and PL/SQL asked in online assessment of Oracle Financial Services. Please prepare them.


Q1 Result of compiling and running following program
class Test
 public static void main (String[] args) {
  int test = 5;
  int[] test1 = new int[ test ];
  for (int i=0;i < test; ++i) {

A. 00000
B. No output
C. 01234
D. Compiler error

Q2 Output of following program
class Test
 public static void main (String[] args) throws java.lang.Exception
  Test1 test1 = new Test2();
public class Test1 {
 int i = 100;
 public void test() {
public class Test2 extends Test1 {
 int i = 120;
 public void test() {

A. Test2110
B. Test2100
C. Test1100
D. Test1110

Q3 Result of compiling and running following program
public class Test
 static int test = 10;
 static { test += 5; }
 public static void main (String[] args) throws java.lang.Exception
  System.out.println("test = " + test);
 static { test /= 5; }

A. Compiler Error
B. test = 10
C. test = 16
D. test = 3

Q4 Which of the following is the correct implementation of abstract class in Java
A. abstract class TestClass3 {

B. class TestClass1 {
    public abstract void myMethod();

C. abstract class TestClass2 {
    public abstract void myMethod() {}

D. abstract class TestClass4 {
    public void myMethod();

Q5 The method declared at line 2 of Test should be accessible to members of the same class, other classes in the same package and to subclasses of Test but not to other classes. What should be inserted on line 2 to accomplish this?
public class Test {
  myVar = 5;
  System.out.println("myVar equals " + myVar);

A. private static void test() {
B. protected static void test() {
C. public static void test() {
D. static void test() {

Q6 A child object constructor always needs to construct its parent first, which in turn calls its parent constructor. This is known as -
A. Constructor linking
B. Constructor nesting
C. Constructor chaining
D. Constructor overloading

Q7 Which of the following statements is True?
A. List is a collection that is ordered by index.
B. A Map cannot store duplicate values
C. List is a collection that cannot have duplicates
D. JDK provides a direct implementation of the Collection interface

Q8 The class HashMap can be used by importing the package java.util, Which of the following statements can be put at the beginning of a class's file to allow using HashMap without having to qualify it with its package name?
1. import java.util.HashMap;
2. import java.util.*;
3. import java.*

A. 1, 2 and 3
B. 1 only
C. 1 and 2, but not 3
D. 2 only

Q9 Which of the following is not a valid declaration?
A. Map<string, string > test;
B. Map<string > test;
C. Set<string> test;
D. Vector<map> test;

Q10 Which among the following is the correct representation of wildcard generics?
1. List< ? extends Object >
2. List<object extends ? >
3. List< ? super Object >
4. List< object super ? >

A. 1 and 2
B. 2 and 3
C. 3 and 4
D. 1 and 3


Q1 Is the following statement correct?
'PL/SQL calls a constructor implicitly'
A. No
B. Yes
C. Only if it is declared by Oracle already
D. PL/SQL declares and calls a constructor itself

Q2 Records cannot be tested for which of the following
1. Nulity
2. Equality
3. Inequality

A. 1, 2 and 3
B. 3 only
C. 1 and 2
D. 2 and 3

Q3 What is not True about PL/SQL record?
A. It is not possible to make use of %ROWTYPE attribute with views and cursors
B. The %ROWTYPE attribute allows to declare a record that represents a row in a database table
C. A record is a group of related data items stored in fields, each with its own name and datatype.
D. A record can be considered as a variable that can hold a table row or some columns from a table row

Q4 Collections are of which of the following dimensions?
A. Single dimensional
B. Two dimensional
C. Multi dimensional
D. Three dimensional

Q5 A collection is an ordered group of elements, and shall be of .......... types-
A. different
B. same
C. same or different
D. any types except NOT NULL

Q6 Implicit cursors are declared by PL/SQL implicitly for all ....... and ....... statements
A. DCL and DDL
B. DML and DQL
C. DDL and DQL
D. DDL and DML

Q7 Conside the following statement
CURSOR emptype_cur IS
SELECT emptype.type _desc
FROM employees emp, employee_type emptype
WHERE emp.type_code = emptype.type_code;

IF NOT emptype_cur%ISOPEN
OPEN emptype_cur;
DBMS_OUTPUT.PUT_LINE('Cursor has ' || emptype_cur%ROWCOUNT || ' rows');
CLOSE emptype_cur;

What will the program print if the select statement retrieves 10 rows?
B. 0
C. 10
D. 1

Q8 What does the %ROWCOUNT cursor attribute return if the cursor is declared but not open?
B. 0 (Zero)

Q9 The OLD and NEW qualifiers are available for which of the following triggers?
A. ROW level triggers
B. STATEMENT level triggers
C. LOG on triggers
D. All the above

Q10 Suppose a table has two columns A and B. How many BEFORE UPDATE triggers can be defined on this table?
A. 2
B. 1
C. 3
D. 0

I have highlighted answers for Java. Please comment below answers for PL/SQL and I will highlight them.

No comments :

Post a Comment