.
  Vyom World.com . Let's Touch the Sky Together!  
.

Home
VyomWorld.com Home
Interview Questions
VyomLinks.com Home
JobsAssist.com Home
Vyom Network
Contact Us
Jobs & Careers
Resume Submitter
Placement Papers
IT Companies Directory
Computer Jobs
Interview Questions
Online Exams
Vyom Career eMag.
Fun
Send FREE SMS!
SMS Jokes
Source Codes Library
Source Codes Home
ASP Source Codes
C Source Codes
C++ Source Codes
COBOL Source Codes
Java Source Codes
Pascal Source Codes
Submit Source Codes
GATE
GATE an Overview
GATE Preparation
Study Materal
GRE
GRE an Overview
GRE Questions
GRE Preparation
GRE Universities
TOEFL Preparation
TOEFL Resources
GMAT Preparation
GMAT Resources
MBA Preparation
MBA Resources
Networking Concepts
Networking Concepts
Testing Preparation
Testing Resources
Webmasters
Free Traffic Builder
Webmaster Articles
Web Hosting
Tutorials
Hardware Tutorial
1500 Free eBooks New!
Get 30,000 Interview Questions & Answers in an eBook.

Interview Success Kit - Get Success in Job Interviews





Interview Success Kit - Get Success in Job Interviews Interview Success Kit - 30,000 Interview Que. & Ans.


Home » Placement Papers » Oracle Placement Papers » Oracle Placement Paper

New Click here to Download 2017 Latest placement papers of this company New


Oracle Placement Paper


Advertisements
Advertisements



1. What is the output of the following program

main()
{
int i = 5;
printf("%d\n", i++ * i--);
}

(A) 25 
(B) 24 
(C) 20 
(D) 30


2. What is the output of the following program

main()
{
char ch='a';
printf("%d ",ch);
printf("%d\n",((int)ch)++);
}

(A) 97 98
(B) 97 
(C) 97 97 
(D) compilation error


3. What does the following program do ?

int main()
{
int i;
int array1[10], array2[10] ;
int *ep, *ip2 = &array2[0];
int *ip1 = &array1[0];
for(ep = &array1[9]; ep >= ip1; ep--)
*ep = *ip2++ ;
}

(A) copies array1 to array2
(B) copies array2 to array1
(C) copies array1 to array2 in reverse order
(D) copies array2 to array1 in reverse order


4. what does the following program do ?

#include
int main()
{
char string[100];

char *p;

gets(string);
for(p = string; *p != '\0'; p++)
;

printf("%d", p - string);
}

(A) prints the memory used by "string"
(B) prints the character values of "string"
(C) prints the length of "string"
(D) errors out.

5. What is the output if the input to following program is, 
INDIA DEVELOPMENT CENTRE 

#include 
int trail(char *line, int max);
main()
{
char p[100];
printf("%d",trail(p,10));
}
int trail(char *line, int max)
{
int nch = 0;
int c;
max = max - 1; 

while((c = getchar()) != EOF)
{
if(c == '\n')
break;

if(nch < max)
{
*(line + nch) = c;
nch = nch + 1;
}
}

if(c == EOF && nch == 0)
return EOF;

*(line + nch) = '\0';
return nch;
}

(A) 22
(B) 24
(C) 10
(D) 9


6. What is the output of the following program :

main()
{ int i=1 ;
for (;;);
{
if(i==1)
{
printf("%d",i);
exit();
}
}
}

(A) Will print 1 and exit.
(B) Compilation error .
(C) will loop infinitely .
(D) None of the above .

7. What is the output, if 5 is the input for 'i' ?

main()
{
int *i;
i =(int *)malloc(10);
printf("Enter the value for i:");
scanf("%d",i);
++*i--;
printf("value of i :%d", *i);
}

(A) value of i :4
(B) value of i :6
(C) value of i :5
(D) value of i :1

8. What is the output of the following program ?

const int n = 7;
int a[n];
main()
{
int i,k=8;
for (i=0;i
void main()
{
void recurse(int);
int i = 5;
recurse(i);
}
void recurse(int u)
{
if (u > 0)
recurse(u-1);
printf("%d ",u);
}

(A) 1 2 3 4 5 
(B) 5 4 3 2 1
(C) 0 1 2 3 4 5 
(D) 5 4 3 2 1 0 

12. What is the output of the following program

#include 
void main()
{
void assign(int[]);
int i[5],a=0;
for (a = 0;a < 5;a++)
i[a] = 10;
assign(i);
for (a = 0; a< 5 ;a++)
printf(" %d",i[a]);
}
void assign(int y[])
{
int b = 1;
y[b] = 5;
}

(A) 5 10 10 10 10
(B) 10 5 10 10 10
(C) 10 10 10 10 10
(D) Compilation Error

13. What is the output of the following program

#include
void main()
{
char *p ;
p = (char*)malloc(100);
strcpy(p,"Oracle India");
(p[5] == 'l') ? printf("Oracle") : printf("India");
}

(A) Oracle 
(B) India
(C) Compilation Error
(D) Run-Time Error (Core Dump)

14. What is the output of the following program

#include 
void main()
{
int a=5,b,i;
int func(int y);
for(i = 0;i < 5;i++)
{
a = b = func(a);
printf("%d ",b);
}
}

int func(int y)
{
static int x = 0;
x++;
y = y + x;
return(y);
}

(A) 6 7 8 9 10
(B) 5 7 9 11 13
(C) 6 8 10 12 14 
(D) 6 8 11 15 20

15. What is the output of the following program

#include 
void main()
{
char i;
for(i=0;i<=256;i++)
printf("%d",i);
}

(A) Endless Loop
(B) Compilation Error
(C) Run-Time Error
(D) Ascii Characters from 1-256

16. NO_DATA_FOUND Exception is raised only

(A) When the Where clause of an explicit cursor does not match any rows
(B) for SELECT ..INTO statements, when the where clause of the query does not match any rows
(C) for update/delete statement , when the WHERE clause does not match any rows
(D) All the Above 

17. Consider the following PL/SQL Code

DECLARE
Cursor c_emp is
select * 
from emp1
where dno = 10 
for update ; 
v_empinfo c_emp%rowtype ;
BEGIN
FOR v_empinfo in c_emp LOOP 
update emp1 
set salary = salary * 10 
where current of c_emp ;
commit ;
END LOOP ;
END ;
/

Data in EMP Table : 

Empno Name Sal Dno

100 abc 1000 10
200 def 2000 10
300 ghi 3000 20

What is the output ?

(A) (Empno,Sal) -> (100,10000),( 200,20000),(300,30000) 
(B) (Empno,Sal) -> (100,10000),(200,20000),(300,3000)
(C) Error : "Use of Where Current of Restricted "
(D) Error : "Fetch Out of Sequence "

18. Consider the following PL/SQL code. 

declare
v_char varchar2(3) := 'ABCD';
begin
dbms_output.put_line('Value of v_char ' || v_char);

exception
when others then
dbms_output.put_line('Exception Captured');
end;
/


What is the output ?

(A) "Value of v_char ABCD"
(B) "Exception Captured"
(C) ORA-06502: PL/SQL: numeric or value error 
(D) ORA-1458-invalid length inside variable character string

19. Consider the following PL/SQL Code

declare
empno emp1.empno%type ;
begin

select empno
into empno
from emp1
where sal > 1000
and rownum < 2 ;

update emp1
set sal = sal + 1000
where empno = empno ;

exception when others then
dbms_output.put_line('Exception Raised' );


end ;
/

Data in Emp Table :

Empno Name Sal 
100 ABC 1000
200 DEF 2000
300 GHI 3000

What will be the output ?

(A) (Empno,Sal) -> (100,1000,200,3000,300,4000)
(B) (Empno,Sal) -> (100,1000),(200,3000),(300,3000)
(C) (Empno,Sal) -> (100,2000),(200,3000),(300,4000)
(D) Error: Invalid usage of variable name which is same as column name

20. Consider the following PL/SQL Code

Create or replace procedure Test_Proc(
p_empno in number ,
p_dno in number ,
p_sal in out number ) is
v_tempvar number ;
begin 
if p_sal < 1000 then
p_dno = 20 ;
p_sal = p_sal+ 1000 ;
end if ;
end ;


When the above procedure is compiled , it will 

(A) Create procedure Test_Proc ,if one already exists replace it. 
(B) Error : Expression 'P_DNO' cannot be used as an assignment target 
(C) Error : 'P_SAL' cannot be used as both "In" and "Out" 
(D) Warning : v_tempvar not used anywhere 

21. Identify the value of l_result at the end of the following PL/SQL block:

DECLARE 
l_var_1 NUMBER := 1;
l_var_2 CHAR(4) := 'Test';
l_result VARCHAR2 (20);
BEGIN
DECLARE
l_var_1 VARCHAR2(10) := 10;
l_var_3 NUMBER := 2;
BEGIN
l_result := l_var_3 * l_var_1;
END;
l_result := l_var_2 || l_result || l_var_1;
dbms_output.put_line (l_result);
END;


(A) Test21
(B) Test2010
(C) Test201
(D) Test210 

22. Consider the following PL/SQL block.

DECLARE 
l_var NUMBER := 1;
BEGIN
IF (l_var = 1) THEN
GOTO Jump;
END IF;
IF (l_var < 5) THEN
<>
dbms_output.put_line (l_var);
END IF;
END;

Which of the following statements is correct?

(A) Usage of labels is invalid in PL/SQL. 
(B) GOTO cannot branch into an IF statement
(C) GOTO is not a valid syntax.
(D) (A) and (C) are correct statements.

23. Consider the following PL/SQL block.

DECLARE
l_var1 NUMBER := &a;
l_var2 NUMBER := &b;
Data_problem EXCEPTION;
BEGIN
BEGIN
IF (l_var1 > l_var2) THEN
RAISE NO_DATA_FOUND;
ELSE
RAISE Data_Problem;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line ('No Data');
WHEN Data_Problem THEN
RAISE Data_problem; 
END;
EXCEPTION
WHEN Data_problem THEN
dbms_output.put_line ('Data Problem'); 
END;

Identify which of the following statements is/are correct.

(A) Output printed is 'No Data' when a > b .
(B) Exception cannot be used to move from inner to outer block.
(C) Output printed is 'Data Problem' when b > a .
(D) Statements A and C are correct.

24. Employee table has records of 10 employees. 
Execution of the following PL/SQL block given below will result in :

DECLARE
CURSOR C1 IS
SELECT name, basic+hra salary
FROM employee ;
Incentive NUMBER;
l_name VARCHAR2(30);
l_salary NUMBER;
BEGIN
LOOP
Fetch c1 INTO l_name, l_salary;
EXIT WHEN c1%NOTFOUND OR
c1%ROWCOUNT = 9 ;
Incentive := l_salary * 0.1 ;
END LOOP;
close c1;
dbms_output.put_line ('Name - ' || l_name);
dbms_output.put_line ('Incentive =' || Incentive);
END;


(A) Error as alias cannot be used in cursor.
(B) Name & Incentive of nine employees will be printed. 
(C) Error as %NOTFOUND & %ROWCOUNT cannot be used with explicit cursors.
(D) Error - Invalid cursor

25. Consider the procedure given below:

PROCEDURE calc_bonus (salary IN INTEGER, gross_salary IN OUT NUMBER, 
bonus OUT NUMBER) IS
BEGIN
IF (salary > 1000) THEN 
bonus := Salary * .1 ; -- statement 1
ELSE
salary := Salary * 2; -- statement 2
bonus := salary * 0.1 ; -- statement 3
END IF;
gross_salary := Salary * 2 ; -- statement 4
END;

(A) No errors are there in the PL/SQL block
(B) Statements 1 and 3 will result in error.
(C) Statement 2 will result in error.
(D) Statements 1, 2 and 3 will result in error.

26. Consider the following data

TABLE A TABLE B
COL1 COL1
------ -------
10 15
20 20
30 25
40 30
50 35
60 40
70 45
80 50
10 35
100 60
65
30
80
90
100


select count(*)
from (select A1.col1 col1
from A A1, A A2
where A1.col1 = A2.col1
UNION ALL
select A.col1 col1
from A, B
where A.col1(+) = B.col1 );

What would be output of the above SQL query?

(A) 25 
(B) 27 
(C) 29 
(D) error

27. Consider the following DDL

create table emp(
empno number,
name char(30),
sal number,
deptno number,
manager number)

create table dept(
deptno number,
name char(30),
location char(30))


i) create view view1 as
select location, count(empno) emp_count
from emp, dept
where emp.deptno = dept.deptno
group by location;

ii) create view view2 as
select empno, name, location
from emp, dept
where emp.deptno = dept.deptno;

iii) create view view3 as
select *
from emp, dept;

Which is the correct view definition ?

(A) i 
(B) i and ii
(C) ii and iii
(D) All

28. What is the output of the SQL statement

select floor((ceil(-0.42) - abs(round(-0.64)))/2) from dual;

(A) -2 
(B) -1 
(C) 0 
(D) 1

29. Consider the following data 

Table STUDENT

Name subject status
----------- --------------- --------
Student1 Sub1 P
Student1 Sub2 F
Student2 Sub1 P
Student3 Sub2 F
Student4 Sub1 F
Student4 Sub2 P
Student5 Sub1 P
Student5 Sub2 P
Student6 Sub1 F
Student6 Sub2 F

i) select * from student
where status = 'P' OR status = 'F' AND subject = 'Sub1';

ii) select * from student
where (status = 'P' OR status = 'F') AND subject = 'Sub1';

iii) select * from student
where subject = 'Sub1' AND status = 'P' OR status = 'F';

iv) select * from student
where status = 'P' OR (status = 'F' AND subject = 'Sub1');


Which statements would produce same output

(A) i & ii 
(B) ii & iii 
(C) iii & iv 
(D) i & iv 

30. Consider the following DML operation along with table data from above question

i) update student s1
set s1.status = 'P'
where s1.subject = 
( select distinct(s2.subject)
from student s2
where s1.name = s2.name );

ii) delete from student s1
where status > 'F'
and s1.name not in 
( select s1.name
from student s2
where s2.subject = 'Sub2');

iii) update student s1
set s2.status = 'P' 
where s1.subject in 
( select s2.subject
from student s2
where s2.status = 'F');

Which statement(s) are incorrect/errors out:

(A) i & ii
(B) ii & iii
(C) i & iii
(D) i, ii & iii


Answers:a,d,d,c,d,c,d,c,a,a,c,b,b,d,a,b,d,c,c,b,c,b,d,d,c,b,a,b,d,c
--------------------------------------------------------------------------------------------
1. What is the output of the following program
class ExceptionClass1 extends Error {
public String toString() {
return "ExceptionClass1";
}
}

class ExceptionClass2 extends Exception {
public String toString() {
return "ExceptionClass2";
}
}

public class ExceptionClassesTest {
private static final int CLASS1 = 10;
private static final int CLASS2 = 20;

public static void main( String[] args ) {
int param = Integer.parseInt(args[0]);
try {
exceptionClassTest( param );
}
catch(Throwable t) {
System.out.println("" + t );
}
}
public static void exceptionClassTest(int param) throws ExceptionClass2 {
try {
if( param == CLASS1 ) throw new ExceptionClass1();
if( param == CLASS2 ) throw new ExceptionClass2();
}
catch( Exception ex ) {
System.out.println("" + ex );
throw (ExceptionClass2)ex;
}
}
}

main()
{
int i = 5;
printf("%d\n", i++ * i--);
}

If you compile the above program and do the following, what is the output ?

1. java ExceptionClassesTest 10
2. java ExceptionClassesTest 20
3. java ExceptionClassesTest 30

(A) Cannot do the above because the program will give compilation error unreported exception java.lang.ExceptionClass1; declared to be thrown'
(B) ExceptionClass1( twice ), ExceptionClass2 ( twice ), No output
(C) ExceptionClass1( once ), ExceptionClass2( twice ), No output
(D) Cannot do the above because the program will give compilation error 'incompatible types found : ExceptionClass1, required: java.lang.Throwable'


2. When trying to establish a JDBC connection, it fails with the message Driver not found.

This is due to

(A) The DriverManager class is not found
(B) The JDBC driver is not registered
(C) The JDBC driver does not exist in the CLASSPATH
(D) The Connection class is not found


3. 

public class Select {

public static void main (String args[]) {
String url = "jdbc:oracle://Carthage.imaginary.com/ora";
Connection con = null;

try {
String driver = "com.imagiary.sql.oracle.OracleDriver";
Class.forName(driver).newInstance();
}
catch (Exception e) {
System.out.println("Failed to load Oracle Driver.");
return;
}

try {
con = DriverManager.getConnection(url, "borg", "");
Statement select = con.createStatement();
ResultSet result = select.executeQuery("SELECT DATE_OF_JOINING from EMP");

While (result.next()) {
System.out.println("The date of joining is " + result.getString(1));
}
}
}
}

Note: the column DATE OF JOINING is not null and it always has a value.

What would be the output of this code?

(A) This code does not compile
(B) "The date of joining is 01-JUN-1999". (The sample date fetched by the SQL stmt)
(C) The code complies but results in run-time exception
(D) "The date of joining is ". ( The date is null)


4. As far as handling null values in JAVA and SQL is concerned which of the following statements is wrong?

(A) For Java Objects SQL NULL maps to JAVA NULL
(B) While using the method getInt( ), the JAVA NULL maps the SQL NULL 
(C) a Java ResultSet has no way of representing a SQL NULL value for any numeric SQL column
(D) Call to getInt() could return some driver attempt at representing NULL, most likely 0.


5. As per the JDBC Specification for SQL to Java Datatype Mappings, which of the following statements is correct?


(A) The SQL datatype FLOAT maps to the Java datatype float
(B) The SQL datatype FLOAT maps to the Java datatype long
(C) The SQL datatype FLOAT maps to the Java datatype double
(D) The SQL datatype FLOAT maps to the Java datatype int


6. Which of the following is not valid array declarations/definitions?


(A) int iArray1[10];
(B) int iArray2[];
(C) int iArray3[] = new int[10];
(D) int []iArray5 = new int[10];


7. As per the JDBC Specification for Java to SQL Datatype Mappings, which of the following statements is correct?

(A) The Java datatype float maps to the SQL datatype REAL
(B) The Java datatype float maps to the SQL datatype DOUBLE
(C) The Java datatype float maps to the SQL datatype INTEGER
(D) The Java datatype float maps to the SQL datatype SMALLINT


8. Which of the following is a legal return type of a method overloading the following method:

public void add(int a) { . }

(A) void
(B) int
(C) Can be anything
(D) short

9. Which of the following is not one of the methods for the class DriverManager?

(A) static public synchronized Connection getConnection ( String url, Properties info) throws SQLException
(B) static public synchronized Connection getConnection ( String url,Strng user, String password) throws SQLException
(C) static public synchronized Connection getConnection ( String url ) throws SQLException
(D) static public synchronized Connection getConnection ( String url, Strng user, String password, Properties info) throws SQLException


10. Which of the following is false with respect to updateable result sets 

(A) The select should pertain to a single table and should include the primary key columns
(B) JDBC drivers are not required to support updateable result sets
(C) If the driver does not support updateable result set, it will always throw an exception
(D) If the driver does not support updateable result set, it will issue a SQLWarning and assigns the result set to a type it can support.


11. Which of the following is not true about jsp:forward

(A) This allows the request to be forwarded to another JSP, a servlet or a static resource.
(B) The resource to which the request is being forwarded should be in the same context as the JSP dispatching the request
(C) Execution in the current JSP stops when it encounters jsp:forward tag
(D) The output stream need not be buffered and it can contain some output written to it.

12. A session has been created by the client. If the client does not continue the session within a specified time, which of the following will not happen


(A) the server will expire the session and delete all data associated with the session
(B) the server will expire the session but the data associated with the session are retained
(C) The session key is invalidated
(D) The old session key is not associated with any session


13. What is the output of the following program

class getBoolValues {
public static void main (String args[]) {
boolean a = true;
boolean b = false;
boolean c = a ^ b;
boolean d = (!a & b) | (a & !b)
System.out.println(" a ^ b = " + c);
System.out.println(" !a&b|a&!b = " + d);
}
}

(A) The code does not compile.
(B) a ^ b = true 
!a&b|a&!b = true
(C) The code compiles but raises an exception during runtime.
(D) a ^ b = true
!a&b|a&!b = false



14. What is the output of the following program

class questionA {
public static void main ( String args[] ) {
int i, k;
i = 10;
k = i < 0 : -i ? i; // get absolute value of i
System.out.print("Absolute value of ");
System.out.println(i + " is " + k);
i = -10;
k = i < 0 ? -i : i; // get absolute value of i
System.out.print("Absolute value of ");
System.out.println(i + " is " + k);
}
}

(A) The code does not compile.
(B) Absolute value of 10 is 10
Absolute value of -10 is 10
(C) The code compiles but raises an exception during runtime.
(D) Absolute value of 10 is 10
Absolute value of -10 is -10

15. What is the output of the following program

class questionB {
static public void main ( String args[] ) {
char Que[ ] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
byte b = (byte) 0xf1;
System.out.println("b = 0x" + Que[ ( e >> 4) & 0xf ] + Que[ e & 0x0f ] );
}
}

(A) 0xf1
(B) 0xff
(C) 0xf0
(D) 0x0f



16. What is the output of the following program

class questionC {
int a;
public int c;
private int c;

void setc(int i) {
c = i;
}

int getc() {
return c;
}
}

class printQuestionC {
public static void main ( String args[ ] ) {
questionC qc = new questionC( );
qc.a = 10;
qc.b = 20;
qc.c = 100;
qc.b = qc.a + qc.c;
System.out.println ( "a, b and c : " + qc.a + ", " + qc.b + ", " + qc.getc());
}
}

(A) a, b and c : 10, 20, 100
(B) a, b and c : 10, 110, 100
(C) a, b and c : 10, 110,
(D) The code does not compile.


17. Which of the following is not true about serialization 

(A) Only an object that implements the Serializable interface can be saved and restored
(B) The Serializable interface defines no members
(C) transient variables can be saved by the serialization facilities
(D) static variables are not saved by the serialization facilities


18. What is the output of the following program ? 

class Promote {
public static void main ( String args[ ] ) {
byte b 42;
char c = 'a';
short s = 1-24;
int i = 50000;
float f = 5.67 f;
double d = .1234;
double resuot = (f * b) + (i / c) - (d * s);
System.out.println("Result = " + result);
}
}

(A) The code does not compile.
(B) The final result of the expression is a double
(C) The final result of the expression is a float
(D) The final result of the expression is an int


19. Consider the following Java Code

public class Alias {
int i;
Alias(int ii) { i = ii; }
public static void main ( String [ ] args ) {
Alias x = new Alias(7);
Alias1 y = x;
System.out.println("x : " + x.i);
System.out.println("y : " + y.i);
x.i++;
System.out.println("x : " + x.i);
System.out.println("y : " + y.i);
}
}

What will be the output ?

(A) The code does not compile
(B) The code compiles but gives runtime exception
(C) x = 7
y = 7
x = 8
y = 7
(D) x = 7
y = 7
x = 8
y = 8

20. Consider the following Java Code

public class Test {
public static void main (String args []) {
int age;
age = age + 1;
System.out.println("The age is " + age);
}
}

What will be output of the above code?

(A) Compiles and runs with no output
(B) Compiles and runs printing out The age is 1
(C) Compiles but generates a runtime error
(D) The code does not compile


21. What is the result of the executing the following code, using the parameters 4 and 0 ?

public void divide(int a, int b) {
try {
int c = a / b;
} catch (Exception e) {
System.out.print("Exception ");
} finally {
System.out.println("Finally");
}


(A) Prints out: Exception Finally
(B) Prints out: Finally
(C) Prints out: Exception
(D) No output 


22. Consider the following Java code.

import java.util.*;
import java.sql.*;

public class t6{
public t6(){}
public t6(String temp){System.out.println("In constructor of t6"+temp); }
public static long f(int n){
if (n<=2) return 1;
else
return (f(n-1)+f(n-2));
}
public static void main(String args[]){
System.out.println(args[0]+"th Fibonacci number is " + f(Integer.parseInt(args[0])));
}
}

import java.util.*;
import java.sql.*;

public class t7 extends t6{
public t7(){}
public t7(String temp){System.out.println("In constructor of t6"+temp); super(temp); }
public static void main(String args[]){
System.out.println(args[0]+"th Fibonacci number is " + f(Integer.parseInt(args[0])));
}
}

What would be the output for executing t7?

(A) The code does not compile
(B) The code compiles, but does not give an output
(C) The code compiles, but gives runtime error
(D) The code compiles and prints the n'th Fibonacci number.


23. In a constructor where can you place a call to the constructor defined in the super class ? 

(A) Anywhere
(B) The first statement in the constructor
(C) The last statement in the constructor
(D) You can't call super in a constructor

24. Which of the following will compile correctly

(A) short myshort = 99S;
(B) String name = 'Excellent tutorial Mr Green';
(C) char c = 17c;
(D) int z = 015;

25. Given the following variables which of the following lines will compile without error ? 

1. String s = "Hello";
2. long l = 99;
3. double d = 1.11;
4. int i = 1;
5. int j = 0;
6. j= i < 7 && d < 5 || d > 20 
B. c > 0 && d < 5 || d > 50 
C. c > 1 && d < 6 || d > 0 
D. c < 0 && d > 0 || d < 0 

27. Consider the following Java code

class E extends Exception { 


class ExceptHandle { 
public static void f() throws E { 

public static void main (String args[]) throws E { 
try { f(); 
System.out.println("no throw"); 

catch (E e) { 
System.out.println(" only handling"); 




Result of this program 

A. Compilation Error 
B. no throw 
C. only handling 
D. no throw only handling 

28. 

public class A 

public static void main(String[] args) 

System.out.println(new B().g()); 

private int f() 

return 2; 

int g() 

return f(); 



class B extends A { 
public int f() { 
return 1; 



What is the out put of the above code 

A. 1 
B. 2 
C. Null 
D. compilation error 

29. Consider the following java code

class AClass { 
static AClass createA() 

return new AClass(); 
} // createA() 


public class Tester { 
public static void main(String[] parms) { 
AClass aVar = null; 
System.out.println(aVar.createA().hashCode()); 



Compiling and Running of this will result in 

A. Compilation Error 
B. Run time exception (NullPointerException) because aVar is null so can not access null object members 
C. No compilation and runtime error. Returns null because aVar is null hence static member of this object will also return null 
D. No compilation and runtime error. Returns a value because when accessing a static member of an object, object value is not considered 


30. 

1 class XYZ { 
2 int i = 3; 
3 int j = this.i; 
4 static int k = this.i; 
5 static class A 
6 { 
7 static int l; 
8 } 

10 static A anA = new XYZ.A(); 
11 
12 A returnA1() 
13 { 
14 return this.anA; 
15 } 
16 static A returnA2() 
17 { 
18 return this.anA; 
19 } 
20 } 



Compile and Run this code will cause 

A. No Compilation error 
B. Compilation error at line 3 and 14 
C. Compilation error at line 4 and 18 
D. Compilation error at line 5 and 10 

Ans:d,a,c,a,d,c,b,d,c,c,b,b,c,a,c,c,c,a,c,c,d,a,d,a,c,c,b,b,d,c
--------------------------------------------------------------------------------------------1. Which of the following lines will compile without warning or error. 

A) float f=1.3; 
B) char c="a"; 
C) byte b=257; 
D)int i=10;

Answer: D



2. Which of the following statements are true? 

A) Methods cannot be overriden to be more private
B) Static methods cannot be overloaded
C) Private methods cannot be overloaded
D) An overloaded method cannot throw exceptions not checked in the base class

Answer: A

3. If you wanted to find out where the position of the letter v (ie return 2) in the string s 
containing "Java", which of the following could you use? 

A) mid(2,s); 
B) charAt(2); 
C) s.indexOf('v'); 
D) indexOf(s,'v');

Answer: C

4. Given the following declarations 

String s1=new String("Hello")
String s2=new String("there");
String s3=new String();

Which of the following are legal operations? 

A) s3=s1 + s2; 
B) s3=s1-s2; 
C) s3=s1 & s2; 
D) s3=s1 && s2

Answer: A

5. Which of the following will successfully create an instance of the Vector class and add an element? 
1) Vector v=new Vector(99); 
v[1]=99; 
2) Vector v=new Vector(); 
v.addElement(99); 
3) Vector v=new Vector(); 
v.add(99); 
4 Vector v=new Vector(100); 
v.addElement("99");

Answer: D

6.Which of the following is not valid array declarations/definitions?

A) int iArray1[10];
B) int iArray2[];
C) int iArray3[] = new int[10];
D) int []iArray5 = new int[10];

Answer: A

7.Assuming a method contains code which may raise an Exception (but not a RuntimeException), what is the correct way for a method to indicate that it expects the caller to handle that
exception:

A) throw Exception 
B) throws Exception 
C) new Exception 
D) Don't need to specify anything

Answer: B

8.Which of the following is a legal return type of a method overloading the following method:

public void add(int a) {}

A) void 
B) int 
C) Can be anything
D) short

Answer: C

9.What class must an inner class extend:

A) The top level class 
B) The Object class 
C) Any class or interface 
D) It must extend an interface

Answer: C

10.What is the effect of adding the sixth element to a vector created in the following manner:

new Vector(5, 10);

A) An IndexOutOfBounds exception is raised. 
B) The vector grows in size to a capacity of 10 elements 
C) The vector grows in size to a capacity of 15 elements 
D) Nothing, the vector will have grown when the fifth element was added

Answer: C



11. What is the value returned by 

abcd instanceof Object
A) abcd
B) true
C) false
D) String

Answer: B

12. Which of the following are true about constructors?

A) A class inherits its constructors from its parent
B) The compiler supplies a default constructor if no constructors are provided for a class
C) All constructors have a void return type
D) A constructor cannot throw an exception

Answer: B

13. Which of the following are true about an unreachable object?

A) It will be garbage collected
B) Its finalize() method will be invoked
C) It can become reachable again
D) It has a null value

Answer: C

14. Which of the following must be true of the object thrown by a throw statement?

A) It must be assignable to the Throwable type
B) It must be assignable to the Error type
C) It must be assignable to the Exception type
D) It must be assignable to the String type

Answer: A

15. Can a null value e added to a List?

A) Yes
B) Yes, but only if the List is linked
C) Yes, provided that the List is non-empty
D) No

Answer: C

16. Which of the following are valid Java identifiers?

A) %id
B) @id
C) _id
D) #id

Answer: C

17.Which of the following are true about this variable declaration?
private static int I=3; 

A) The value of variable I may not be changed after it is assigned a value
B) Variable I may only be updated by a static method
C) The value of I is shared among all instances of the class in which it is declared
D) Variable I may be accessed within the static methods of other classes

Answer: C


18.

class Aliasing
{
private String s1;
private String s2;

public Aliasing( String a, String b )
{
s1 = a;
s2 = b;
}
public static void main( String[] args )
{
String s1 = new String("Hello");
String s2 = new String("World");
Aliasing a = new Aliasing( s1, s2 );
System.out.println( " Original " + a );
a.swap();
System.out.println( " After swaping " + a );
a.swap2( s1, s2 );
System.out.println( s1 + " " + s2 );
}
public String toString()
{
return s1 + " " + s2;
}
public void swap()
{
String s3 = new String();
s3 = s1;
s1 = s2;
s2 = s3;
}
public static void swap2( String s1, String s2 )
{
String s3 = new String("World");
s1 = s3;
s2 = s1;
s1 = s3;
}
}

If the above program is compiled and executed, what are the values of
s1 and s2 the end of the program ?

a. Hello, World
b. World, Hello
c. World, World
d. Hello, Hello

Answer : A


19.

class A {
A() { System.out.println("A"); }
}

class B {
static A a = new A();
{
System.out.println("C");
}
B() { System.out.println("B"); }
public static void main( String[] args ) {
System.out.println("D");
new B();
}
}

Consider the code given above, what is the output
of the following command

java B

a. A,C,D,B
b. D,A,C,B
c. A,D,C,B
d. No output, the code will give compilation errors

Answer : C


20.

class ExceptionClass1 extends Error {
public String toString() {
return "ExceptionClass1";
}
}

class ExceptionClass2 extends Exception {
public String toString() {
return "ExceptionClass2";
}
}

public class ExceptionClassesTest {
private static final int CLASS1 = 10;
private static final int CLASS2 = 20;

public static void main( String[] args ) {
int param = Integer.parseInt(args[0]);
try {
exceptionClassTest( param );
}
catch(Throwable t) {
System.out.println("" + t );
}
}
public static void exceptionClassTest(int param) throws ExceptionClass2 {
try {
if( param == CLASS1 ) throw new ExceptionClass1();
if( param == CLASS2 ) throw new ExceptionClass2();
}
catch( Exception ex ) {
System.out.println("" + ex );
throw (ExceptionClass2)ex;
}
}
}


If you compile the above program and do the following, what is the output ?

1. java ExceptionClassesTest 10
2. java ExceptionClassesTest 20
3. java ExceptionClassesTest 30

a. Cannot do the above because the program will give compilation error
'unreported exception java.lang.ExceptionClass1; must be caught or
declared to be thrown'
b. ExceptionClass1( twice ), ExceptionClass2 ( twice ), No output
c. ExceptionClass1( once ), ExceptionClass2( twice ), No output
d. Cannot do the above because the program will give compilation error
'incompatible types found : ExceptionClass1, required: java.lang.Throwable'

Answer : c


21.

public class ExceptionTest
{
private static final int FIRST_RETURN = 10;
private static final int CATCH_RETURN = 20;
private static final int FINALLY_RETURN = 30;

public static void main( String[] args ) {
int i = 0;
try {
int param = Integer.parseInt( args[0] );
i = raiseException(param);
}
catch(Exception e) { }
System.out.println(i);
}
public static int raiseException(int param) throws Exception {
try {
if( param == FIRST_RETURN ) throw new Exception();
return FIRST_RETURN;
}
catch( Exception e ) {
if( param == CATCH_RETURN ) throw new Exception();
return CATCH_RETURN;
}
finally {
if( param == FINALLY_RETURN ) throw new Exception();
return FINALLY_RETURN;
}
}
}

Assuming that the above has been compiled,
What is the output of the following commands
1. java ExceptionTest 10
2. java ExceptionTest 20
3. java ExceptionTest 30
4. java ExceptionTest 40

a. 20,30,30,30
b. 30,30,30,0
c. 30,30,30,30
d. 30,30,0,30

Answer : d


22.

interface A {
int i = 0;
}


Which of the following is true with respect to the
above code

a. i is static, final and public
b. Invalid declaration
c. i is protected
d. i has package access

Answer : a


23.


class A {
A() { what(); }
void what() { System.out.println( "This is A" ); }
public static void main( String[] args ) {
A a = new A();
}

}

class B extends A {
B() { what(); }
void what() { System.out.println( "This is B" ); }
public static void main( String[] args ) {
new B();
}
}

With respect to the above code, what is the output given by
the following command..

java B

a. This is A, This is B
b. This is B, This is A
c. This is A, This is A
d. This is B, This is B

Answer : d


24.

class A {
int i = 10;
public int what() { return i; }
}
class B extends A {
int i = 17;
public int what() { return i; }
public static void main( String[] args ) {
A a = new B();
System.out.println( a.i );
System.out.println( a.what() );
}
}

With respect to the above code, what is the output of
the following command ?

java B

a. 10, 17
b. 10, 10
c. 17, 17
d. 17, 10

Answer : a


25.

1. class Primitives
2. {
3. public static void main( String[] args )
4. {
5. char c = 90;
6. byte b = 128;
7. int i = 32657;
8. float f = 10.5;
9. System.out.println( " char = " + c );
10. System.out.println( " byte = " + b );
11. System.out.println( " int = " + i );
12. System.out.println( " float = " + f );
13. }
14. }


Which line(s) of the above gives an error on compilation?
a. 5, 6
b. 5, 8
c. 6, 8
d. only 5

Answer : c


26. Assuming c = 4 and d = 14, then which of the following statements is true? 

a. c > 7 && d < 5 || d > 20 
b. c > 0 && d < 5 || d > 50 
c. c > 1 && d < 6 || d > 0 
d. c < 0 && d > 0 || d < 0 


Answer: c 

27.
class E extends Exception { 


class ExceptHandle { 
public static void f() throws E { 

public static void main (String args[]) throws E { 
try { f(); 
System.out.println("no throw"); 

catch (E e) { 
System.out.println(" only handling"); 





Result of this program 

a. Compilation Error 
b. no throw 
c. only handling 
d. no throw only handling 


Answer: b 



28. 

public class A 

public static void main(String[] args) 

System.out.println(new B().g()); 

private int f() 

return 2; 

int g() 

return f(); 



class B extends A { 
public int f() { 
return 1; 





Whats is the out put of the above code 

a. 1 
b. 2 
c. Null 
d. compilation error 


Answer: b 


29. 

class AClass { 
static AClass createA() 

return new AClass(); 
} // createA() 


public class Tester { 
public static void main(String[] parms) { 
AClass aVar = null; 
System.out.println(aVar.createA().hashCode()); 



Compiling and Running of this will result in 

a. Compilation Error 
b. Run time exception (NullPointerException) because aVar is null so can not 
access null object members 
c. No compilation and runtime error. Returns null because aVar is null hence 
static member of this object will also return null 
d. No compilation and runtime error. Returns a value because when accessing 
a static member of an object, object value is not considered 


Answer: d 

30.

1 class XYZ { 
2 int i = 3; 
3 int j = this.i; 
4 static int k = this.i; 
5 static class A 
6 { 
7 static int l; 
8 } 

10 static A anA = new XYZ.A(); 
11 
12 A returnA1() 
13 { 
14 return this.anA; 
15 } 
16 static A returnA2() 
17 { 
18 return this.anA; 
19 } 
20 } 



Compile and Run this code will cause 

a. No Compilation error 
b. Compilation error at line 3 and 14 
c. Compilation error at line 4 and 18 
d. Compilation error at line 5 and 10 


Answer: c 


31.
public class A { 
public static void main(String[] args) { 
float k = 7.0F; 
float m = 1.0F; 
try { 
m = a() * (k = 0.0F); 

catch(Exception e) {} 
System.out.println(k +" - "+m); 

private static float a() throws Exception { 
float m = 23.0F; 
throw new Exception("Its Exception!"); 




The output of the above code is 

a. 7 - 1 
b. 0 - 0 
c. 0 - 23 
d. 7 - 23 


Answer: a 



32.
// File: xyz/A.java 
package xyz; 

public class A { 
protected int protectedVar; 


// File: Test.java 

import xyz.A; 
public class Test { 
private A a = new A() { 
void someMethod() { 
protectedVar = 1; 

}; 



When compile and tried to run above code 

a. Gives compilation error because variable protectedVar can not be accessed from Test class. 
b. Gives compilation error because protectedVar has not been accessed as a.protectedVar 
c. No compilation error because whenever you import a package, all protected/public variables are availble 
d. No compilation error because 'private A a = new A()' creates a subclass of A within Test class.
Answer: D
-------------------------------------------------------------------------------------------
1. Which of the following lines will compile without warning or error. 

A) float f=1.3; 
B) char c="a"; 
C) byte b=257; 
D)int i=10;

Answer: D



2. Which of the following statements are true? 

A) Methods cannot be overriden to be more private
B) Static methods cannot be overloaded
C) Private methods cannot be overloaded
D) An overloaded method cannot throw exceptions not checked in the base class

Answer: A

3. If you wanted to find out where the position of the letter v (ie return 2) in the string s 
containing "Java", which of the following could you use? 

A) mid(2,s); 
B) charAt(2); 
C) s.indexOf('v'); 
D) indexOf(s,'v');

Answer: C

4. Given the following declarations 

String s1=new String("Hello")
String s2=new String("there");
String s3=new String();

Which of the following are legal operations? 

A) s3=s1 + s2; 
B) s3=s1-s2; 
C) s3=s1 & s2; 
D) s3=s1 && s2

Answer: A

5. Which of the following will successfully create an instance of the Vector class and add an element? 
1) Vector v=new Vector(99); 
v[1]=99; 
2) Vector v=new Vector(); 
v.addElement(99); 
3) Vector v=new Vector(); 
v.add(99); 
4 Vector v=new Vector(100); 
v.addElement("99");

Answer: D

6. As per the JDBC Specification for SQL to Java Datatype Mappings, which of the following statements is correct?

a) The SQL datatype DOUBLE maps to the Java datatype float
b) The SQL datatype DOUBLE maps to the Java datatype long
c) The SQL datatype DOUBLE maps to the Java datatype double
d) The SQL datatype DOUBLE maps to the Java datatype int

Answer : c

7.Assuming a method contains code which may raise an Exception (but not a RuntimeException), what is the correct way for a method to indicate that it expects the caller to handle that
exception:

A) throw Exception 
B) throws Exception 
C) new Exception 
D) Don't need to specify anything

Answer: B

8. As per the JDBC Specification for Java to SQL Datatype Mappings, which of the following statements is correct?

a) The Java datatype long maps to the SQL datatype REAL
b) The Java datatype long maps to the SQL datatype DOUBLE
c) The Java datatype long maps to the SQL datatype INTEGER
d) The Java datatype long maps to the SQL datatype BIGINT

Answer : d

9.What class must an inner class extend:

A) The top level class 
B) The Object class 
C) Any class or interface 
D) It must extend an interface

Answer: C

10.What is the effect of adding the sixth element to a vector created in the following manner:

new Vector(5, 10);

A) An IndexOutOfBounds exception is raised. 
B) The vector grows in size to a capacity of 10 elements 
C) The vector grows in size to a capacity of 15 elements 
D) Nothing, the vector will have grown when the fifth element was added

Answer: C



11. What is the value returned by 

abcd instanceof Object
A) abcd
B) true
C) false
D) String

Answer: B

12. Which of the following are true about constructors?

A) A class inherits its constructors from its parent
B) The compiler supplies a default constructor if no constructors are provided for a class
C) All constructors have a void return type
D) A constructor cannot throw an exception

Answer: B

13. Which of the following are true about an unreachable object?

A) It will be garbage collected
B) Its finalize() method will be invoked
C) It can become reachable again
D) It has a null value

Answer: C

14. Which of the following must be true of the object thrown by a throw statement?

A) It must be assignable to the Throwable type
B) It must be assignable to the Error type
C) It must be assignable to the Exception type
D) It must be assignable to the String type

Answer: A

15. Can a null value e added to a List?

A) Yes
B) Yes, but only if the List is linked
C) Yes, provided that the List is non-empty
D) No

Answer: C

16. Which of the following are valid Java identifiers?

A) %id
B) @id
C) _id
D) #id

Answer: C

17.Which of the following are true about this variable declaration?
private static int I=3; 

A) The value of variable I may not be changed after it is assigned a value
B) Variable I may only be updated by a static method
C) The value of I is shared among all instances of the class in which it is declared
D) Variable I may be accessed within the static methods of other classes

Answer: C


18.

class Aliasing
{
private String s1;
private String s2;

public Aliasing( String a, String b )
{
s1 = a;
s2 = b;
}
public static void main( String[] args )
{
String s1 = new String("Hello");
String s2 = new String("World");
Aliasing a = new Aliasing( s1, s2 );
System.out.println( " Original " + a );
a.swap();
System.out.println( " After swaping " + a );
a.swap2( s1, s2 );
System.out.println( s1 + " " + s2 );
}
public String toString()
{
return s1 + " " + s2;
}
public void swap()
{
String s3 = new String();
s3 = s1;
s1 = s2;
s2 = s3;
}
public static void swap2( String s1, String s2 )
{
String s3 = new String("World");
s1 = s3;
s2 = s1;
s1 = s3;
}
}

If the above program is compiled and executed, what are the values of
s1 and s2 the end of the program ?

a. Hello, World
b. World, Hello
c. World, World
d. Hello, Hello

Answer : A


19.

class A {
A() { System.out.println("A"); }
}

class B {
static A a = new A();
{
System.out.println("C");
}
B() { System.out.println("B"); }
public static void main( String[] args ) {
System.out.println("D");
new B();
}
}

Consider the code given above, what is the output
of the following command

java B

a. A,C,D,B
b. D,A,C,B
c. A,D,C,B
d. No output, the code will give compilation errors

Answer : C


20.

When trying to establish a JDBC connection, it fails with the message
"Class not found". 

This is due to 
a) The DriverManager class is not found
b) The JDBC driver is not registered
c) The JDBC driver does not exist in the CLASSPATH
d) The Connection class is not found

Answer : c

21.

public class ExceptionTest
{
private static final int FIRST_RETURN = 10;
private static final int CATCH_RETURN = 20;
private static final int FINALLY_RETURN = 30;

public static void main( String[] args ) {
int i = 0;
try {
int param = Integer.parseInt( args[0] );
i = raiseException(param);
}
catch(Exception e) { }
System.out.println(i);
}
public static int raiseException(int param) throws Exception {
try {
if( param == FIRST_RETURN ) throw new Exception();
return FIRST_RETURN;
}
catch( Exception e ) {
if( param == CATCH_RETURN ) throw new Exception();
return CATCH_RETURN;
}
finally {
if( param == FINALLY_RETURN ) throw new Exception();
return FINALLY_RETURN;
}
}
}

Assuming that the above has been compiled,
What is the output of the following commands
1. java ExceptionTest 10
2. java ExceptionTest 20
3. java ExceptionTest 30
4. java ExceptionTest 40

a. 20,30,30,30
b. 30,30,30,0
c. 30,30,30,30
d. 30,30,0,30

Answer : d


22.

interface A {
int i = 0;
}


Which of the following is true with respect to the
above code

a. i is static, final and public
b. Invalid declaration
c. i is protected
d. i has package access

Answer : a


23.


class A {
A() { what(); }
void what() { System.out.println( "This is A" ); }
public static void main( String[] args ) {
A a = new A();
}

}

class B extends A {
B() { what(); }
void what() { System.out.println( "This is B" ); }
public static void main( String[] args ) {
new B();
}
}

With respect to the above code, what is the output given by
the following command..

java B

a. This is A, This is B
b. This is B, This is A
c. This is A, This is A
d. This is B, This is B

Answer : d


24.

class A {
int i = 10;
public int what() { return i; }
}
class B extends A {
int i = 17;
public int what() { return i; }
public static void main( String[] args ) {
A a = new B();
System.out.println( a.i );
System.out.println( a.what() );
}
}

With respect to the above code, what is the output of
the following command ?

java B

a. 10, 17
b. 10, 10
c. 17, 17
d. 17, 10

Answer : a


25.

1. class Primitives
2. {
3. public static void main( String[] args )
4. {
5. char c = 90;
6. byte b = 128;
7. int i = 32657;
8. float f = 10.5;
9. System.out.println( " char = " + c );
10. System.out.println( " byte = " + b );
11. System.out.println( " int = " + i );
12. System.out.println( " float = " + f );
13. }
14. }


Which line(s) of the above gives an error on compilation?
a. 5, 6
b. 5, 8
c. 6, 8
d. only 5

Answer : c


26. Assuming c = 4 and d = 14, then which of the following statements is true? 

a. c > 7 && d < 5 || d > 20 
b. c > 0 && d < 5 || d > 50 
c. c > 1 && d < 6 || d > 0 
d. c < 0 && d > 0 || d < 0 


Answer: c 

27.
class E extends Exception { 


class ExceptHandle { 
public static void f() throws E { 

public static void main (String args[]) throws E { 
try { f(); 
System.out.println("no throw"); 

catch (E e) { 
System.out.println(" only handling"); 





Result of this program 

a. Compilation Error 
b. no throw 
c. only handling 
d. no throw only handling 


Answer: b 



28. 

public class A 

public static void main(String[] args) 

System.out.println(new B().g()); 

private int f() 

return 2; 

int g() 

return f(); 



class B extends A { 
public int f() { 
return 1; 





What is the out put of the above code 

a. 1 
b. 2 
c. Null 
d. compilation error 


Answer: b 


29. 

class AClass { 
static AClass createA() 

return new AClass(); 
} // createA() 


public class Tester { 
public static void main(String[] parms) { 
AClass aVar = null; 
System.out.println(aVar.createA().hashCode()); 



Compiling and Running of this will result in 

a. Compilation Error 
b. Run time exception (NullPointerException) because aVar is null so can not 
access null object members 
c. No compilation and runtime error. Returns null because aVar is null hence 
static member of this object will also return null 
d. No compilation and runtime error. Returns a value because when accessing 
a static member of an object, object value is not considered 


Answer: d 

30.

1 class XYZ { 
2 int i = 3; 
3 int j = this.i; 
4 static int k = this.i; 
5 static class A 
6 { 
7 static int l; 
8 } 

10 static A anA = new XYZ.A(); 
11 
12 A returnA1() 
13 { 
14 return this.anA; 
15 } 
16 static A returnA2() 
17 { 
18 return this.anA; 
19 } 
20 } 



Compile and Run this code will cause 

a. No Compilation error 
b. Compilation error at line 3 and 14 
c. Compilation error at line 4 and 18 
d. Compilation error at line 5 and 10 


Answer: c 



--------------------------------------------------------------------------------------------

Question 1:

class ExceptionClass1 extends Error {
public String toString() {
return "ExceptionClass1";
}
}

class ExceptionClass2 extends Exception {
public String toString() {
return "ExceptionClass2";
}
}

public class ExceptionClassesTest {
private static final int CLASS1 = 10;
private static final int CLASS2 = 20;

public static void main( String[] args ) {
int param = Integer.parseInt(args[0]);
try {
exceptionClassTest( param );
}
catch(Throwable t) {
System.out.println("" + t );
}
}
public static void exceptionClassTest(int param) throws ExceptionClass2 {
try {
if( param == CLASS1 ) throw new ExceptionClass1();
if( param == CLASS2 ) throw new ExceptionClass2();
}
catch( Exception ex ) {
System.out.println("" + ex );
throw (ExceptionClass2)ex;
}
}
}


If you compile the above program and do the following, what is the output ?

1. java ExceptionClassesTest 10
2. java ExceptionClassesTest 20
3. java ExceptionClassesTest 30

a. Cannot do the above because the program will give compilation error
'unreported exception java.lang.ExceptionClass1; must be caught or
declared to be thrown'
b. ExceptionClass1( twice ), ExceptionClass2 ( twice ), No output
c. ExceptionClass1( once ), ExceptionClass2( twice ), No output
d. Cannot do the above because the program will give compilation error
'incompatible types found : ExceptionClass1, required: java.lang.Throwable'

Answer : c

Question 2:

When trying to establish a JDBC connection, it fails with the message
"Driver not found". 

This is due to 
a) The DriverManager class is not found
b) The JDBC driver is not registered
c) The JDBC driver does not exist in the CLASSPATH
d) The Connection class is not found

Answer : b

Question 3:

public class Select {

public static void main (String args[]) {
String url = "jdbc:oracle://Carthage.imaginary.com/ora";
Connection con = null;

try {
String driver = "com.imagiary.sql.oracle.OracleDriver";
Class.forName(driver).newInstance();
}
catch (Exception e) {
System.out.println("Failed to load Oracle Driver.");
return;
}

try {
con = DriverManager.getConnection(url, "borg", "");
Statement select = con.createStatement();
ResultSet result = select.executeQuery("SELECT DATE_OF_JOINING from EMP");

While (result.next()) {
System.out.println("The date of joining is " + result.getString(1));
}
}
}
}

Note: the column DATE OF JOINING is not null and it always has a value.

What would be the output of this code?

a) This code does not compile
b) "The date of joining is 01-JUN-1999". (The sample date fetched by the SQL stmt)
c) The code complies but results in run-time exception
d) "The date of joining is ". ( The date is null)

Answer : b

Question 4:

As far as handling null values in JAVA and SQL is concerned which of the following statements is wrong?

a) For Java Objects SQL NULL maps to JAVA NULL
b) While using the method getInt( ), the JAVA NULL maps the SQL NULL 
c) a Java ResultSet has no way of representing a SQL NULL value for any numeric SQL column
d) Call to getInt() could return some driver attempt at representing NULL, most likely 0.

Answer : b

Question 5:

As per the JDBC Specification for SQL to Java Datatype Mappings, which of the following statements is correct?

a) The SQL datatype FLOAT maps to the Java datatype float
b) The SQL datatype FLOAT maps to the Java datatype long
c) The SQL datatype FLOAT maps to the Java datatype double
d) The SQL datatype FLOAT maps to the Java datatype int

Answer : c

Question 6:

6.Which of the following is not valid array declarations/definitions?

A) int iArray1[10];
B) int iArray2[];
C) int iArray3[] = new int[10];
D) int []iArray5 = new int[10];

Answer : a

Question 7:

As per the JDBC Specification for Java to SQL Datatype Mappings, which of the following statements is correct?

a) The Java datatype float maps to the SQL datatype REAL
b) The Java datatype float maps to the SQL datatype DOUBLE
c) The Java datatype float maps to the SQL datatype INTEGER
d) The Java datatype float maps to the SQL datatype SMALLINT

Answer : a

Question 8:

Which of the following is a legal return type of a method overloading the following method:

public void add(int a) {}

A) void 
B) int 
C) Can be anything
D) short

Answer : c

Question 9:

Which of the following is not one of the methods for the class DriverManager?

a) static public synchronized Connection getConnection ( String url,
Properties info) throws SQLException
b) static public synchronized Connection getConnection ( String url,
Strng user, String password) throws SQLException
c) static public synchronized Connection getConnection ( String url ) throws SQLException
d) static public synchronized Connection getConnection ( String url,
Strng user, String password, Properties info) throws SQLException

Answer : d

Question 10:

Which of the following is false with respect to Updatable Result Sets

a) The select should pertain to a single table and should include the primary key columns
b) JDBC drivers are not required to support updateable result sets.
c) If the driver does not support updateable result set, it will always throw an exception
d) If the driver does not support updateable result set, it will issue a SQLWarning and assigns the result 
set to a type it can support.

Answer : c

Question 11:

Which of the following is not true about jsp:forward

a) This allows the request to be forwarded to another JSP, a servlet or a static resource.
b) The resource to which the request is being forwarded should be in the same context as teh JSP dispatching the request
c) Executing in thecurrent JSP stops when it encounters jsp:forward tag.
d) The output stream need not be buffered and it can contain some output written to it.

Answer : d

Question 12:

A session has been created by the client. If the client does not continue the session within a specified time, which of the following will not happen

a) the server will expire the session amd delete all data associated with the session
b) the server will expire the session but the data associated with the session are retained
c) The session key is invalidated
d) The old session key is not associated with any session

Answer : b

Question 13:

class getBoolValues {
public static void main (String args[]) {
boolean a = true;
boolean b = false;
boolean c = a ^ b;
boolean d = (!a & b) | (a & !b)
System.out.println(" a ^ b = " + c);
System.out.println(" !a&b|a&!b = " + d);
}
}

What is the output of the above code.

a) The code does not compile.
b) a ^ b = true
!a&b|a&!b = true
c) The code compiles but raises an exception during runtime.
d) a ^ b = true
!a&b|a&!b = false

Answer : b

Question 14:

class questionA {
public static void main ( String args[] ) {
int i, k;
i = 10;
k = i < 0 : -i ? i; // get absolute value of i
System.out.print("Absolute value of ");
System.out.println(i + " is " + k);
i = -10;
k = i < 0 ? -i : i; // get absolute value of i
System.out.print("Absolute value of ");
System.out.println(i + " is " + k);
}
}

a) The code does not compile.
b) Absolute value of 10 is 10
Absolute value of -10 is 10
c) The code compiles but raises an exception during runtime.
d) Absolute value of 10 is 10
Absolute value of -10 is -10

Answer : a

Question 15:

class questionB {
static public void main ( String args[] ) {
char Que[ ] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
byte b = (byte) 0xf1;
System.out.println(" b = 0x" + Que[ ( e >> 4) & 0xf ] + Que[ e & 0x0f ] );
}
}

What is the output of the above code?

a) 0xf1
b) 0xff
c) 0xf0
d) 0x0f

Answer = d

Question 16:

class questionC {
int a;
public int c;
private int c;

void setc(int i) {
c = i;
}

int getc() {
return c;
}
}

class printQuestionC {
public static void main ( String args[ ] ) {
questionC qc = new questionC( );
qc.a = 10;
qc.b = 20;
qc.c = 100;
qc.b = qc.a + qc.c;
System.out.println ( "a, b and c : " + qc.a + ", " + qc.b + ", " + qc.getc());
}
}

What is the output of the above code?

a) a, b and c : 10, 20, 100
b) a, b and c : 10, 110, 100
c) a, b and c : 10, 110,
d) The code does not compile.

Answer : d

Question 17:

Which of the following is not true about serialization

a) Only an object that implements the Serializable interface can be saved and restored
b) The Serializable interface defines no members
c) transient variables can be saved by the serialization facilities
d) static variables are not saved by the serialization facilities

Answer : c

Question 18:

class Promote {
public static void main ( String args[ ] ) {
byte b 42;
char c = 'a';
short s = 1-24;
int i = 50000;
float f = 5.67 f;
double d = .1234;
double resuot = (f * b) + (i / c) - (d * s);
System.out.println("Result = " + result);
}
}

What is the output of the above code?

a) The code does not compile.
b) The final result of the expression is a double
c) The final result of the expression is a float
d) The final result of the expression is an int 

Answer : b

Question 19:

public class Alias {
int i;
Alias(int ii) { i = ii; }
public static void main ( String [ ] args ) {
Alias x = new Alias(7);
Alias1 y = x;
System.out.println("x : " + x.i);
System.out.println("y : " + y.i);
x.i++;
System.out.println("x : " + x.i);
System.out.println("y : " + y.i);
}
}

What is the output of the above code?

a) The code does not compile
b) The code givies runtime exception
c) x = 7
y = 7
x = 8
y = 7
d) x = 7
y = 7
x = 8
y = 8

Answer : d

Question 20:

public class Test {
public static void main (String args []) {
int age;
age = age + 1;
System.out.println("The age is " + age);
}
}

What will be output of the above code?

a) Compiles and runs with no output 
b) Compiles and runs printing out The age is 1 
c) Compiles but generates a runtime error 
d) The code does not compile 

Answer : d

Question 21:

What is the result of executing the following code, using the parameters 4 and 0:

public void divide(int a, int b) {
try {
int c = a / b;
} catch (Exception e) {
System.out.print("Exception ");
} finally {
System.out.println("Finally");
}


a) Prints out: Exception Finally 
b) Prints out: Finally 
c).Prints out: Exception 
d) No output

Answer : a

Question 22:

mport java.util.*;
import java.sql.*;

public class t6{
public t6(){}
public t6(String temp){System.out.println("In constructor of t6"+temp); }
public static long f(int n){
if (n<=2) return 1;
else
return (f(n-1)+f(n-2));
}
public static void main(String args[]){
System.out.println(args[0]+"th Fibonacci number is " + f(Integer.parseInt(args[0])));
}
}

import java.util.*;
import java.sql.*;

public class t7 extends t6{
public t7(){}
public t7(String temp){System.out.println("In constructor of t6"+temp); super(temp); }
public static void main(String args[]){
System.out.println(args[0]+"th Fibonacci number is " + f(Integer.parseInt(args[0])));
}
}

What would be the output for executing t7?
a) The code does not compile
b) The code compiles, but does not give an output
c) The code compiles, but gives runtime error
d) The code compiles and prits the n'th Fibonacci number.

Answer : c

Question 23:

Where in a constructor, can you place a call to a constructor defined in the super class?

a) Anywhere 
b) The first statement in the constructor 
c) The last statement in the constructor 
d) You can't call super in a constructor

Select the most appropriate answer.

Answer : b

Question 24:

Which of the following will compile correctly

a) short myshort = 99S;
b) String name = 'Excellent tutorial Mr Green';
c) char c = 17c;
d) )int z = 015;

Answer : d

Question 25:

Given the following variables which of the following lines will compile without error?

1. String s = "Hello";
2. long l = 99;
3. double d = 1.11;
4. int i = 1;
5. int j = 0;
6. j= i <> 4) & 0xf ] + Que[ e & 0x0f ] );
}
}

What is the output of the above code?

a) 0xf1
b) 0xff
c) 0xf0
d) 0x0f

Answer = d

Question 16:

class questionC {
int a;
public int c;
private int c;

void setc(int i) {
c = i;
}

int getc() {
return c;
}
}

class printQuestionC {
public static void main ( String args[ ] ) {
questionC qc = new questionC( );
qc.a = 10;
qc.b = 20;
qc.c = 100;
qc.b = qc.a + qc.c;
System.out.println ( "a, b and c : " + qc.a + ", " + qc.b + ", " + qc.getc());
}
}

What is the output of the above code?

a) a, b and c : 10, 20, 100
b) a, b and c : 10, 110, 100
c) a, b and c : 10, 110,
d) The code does not compile.

Answer : d

Question 17:

Which of the following is not true about serialization

a) Only an object that implements the Serializable interface can be saved and restored
b) The Serializable interface defines no members
c) transient variables can be saved by the serialization facilities
d) static variables are not saved by the serialization facilities

Answer : c

Question 18:

class Promote {
public static void main ( String args[ ] ) {
byte b 42;
char c = 'a';
short s = 1-24;
int i = 50000;
float f = 5.67 f;
double d = .1234;
double resuot = (f * b) + (i / c) - (d * s);
System.out.println("Result = " + result);
}
}

What is the output of the above code?

a) The code does not compile.
b) The final result of the expression is a double
c) The final result of the expression is a float
d) The final result of the expression is an int 

Answer : b

Question 19:

public class Alias {
int i;
Alias(int ii) { i = ii; }
public static void main ( String [ ] args ) {
Alias x = new Alias(7);
Alias1 y = x;
System.out.println("x : " + x.i);
System.out.println("y : " + y.i);
x.i++;
System.out.println("x : " + x.i);
System.out.println("y : " + y.i);
}
}

What is the output of the above code?

a) The code does not compile
b) The code givies runtime exception
c) x = 7
y = 7
x = 8
y = 7
d) x = 7
y = 7
x = 8
y = 8

Answer : d

Question 20:

public class Test {
public static void main (String args []) {
int age;
age = age + 1;
System.out.println("The age is " + age);
}
}

What will be output of the above code?

a) Compiles and runs with no output 
b) Compiles and runs printing out The age is 1 
c) Compiles but generates a runtime error 
d) The code does not compile 

Answer : d

Question 21:

What is the result of executing the following code, using the parameters 4 and 0:

public void divide(int a, int b) {
try {
int c = a / b;
} catch (Exception e) {
System.out.print("Exception ");
} finally {
System.out.println("Finally");
}


a) Prints out: Exception Finally 
b) Prints out: Finally 
c).Prints out: Exception 
d) No output

Answer : a

Question 22:

mport java.util.*;
import java.sql.*;

public class t6{
public t6(){}
public t6(String temp){System.out.println("In constructor of t6"+temp); }
public static long f(int n){
if (n<=2) return 1;
else
return (f(n-1)+f(n-2));
}
public static void main(String args[]){
System.out.println(args[0]+"th Fibonacci number is " + f(Integer.parseInt(args[0])));
}
}

import java.util.*;
import java.sql.*;

public class t7 extends t6{
public t7(){}
public t7(String temp){System.out.println("In constructor of t6"+temp); super(temp); }
public static void main(String args[]){
System.out.println(args[0]+"th Fibonacci number is " + f(Integer.parseInt(args[0])));
}
}

What would be the output for executing t7?
a) The code does not compile
b) The code compiles, but does not give an output
c) The code compiles, but gives runtime error
d) The code compiles and prits the n'th Fibonacci number.

Answer : c

Question 23:

Where in a constructor, can you place a call to a constructor defined in the super class?

a) Anywhere 
b) The first statement in the constructor 
c) The last statement in the constructor 
d) You can't call super in a constructor

Select the most appropriate answer.

Answer : b

Question 24:

Which of the following will compile correctly

a) short myshort = 99S;
b) String name = 'Excellent tutorial Mr Green';
c) char c = 17c;
d) )int z = 015;

Answer : d

Question 25:

Given the following variables which of the following lines will compile without error?

1. String s = "Hello";
2. long l = 99;
3. double d = 1.11;
4. int i = 1;
5. int j = 0;
6. j= i < 
B. %ROWTYPE 
C. TYPE IS A TABLE OF 
D. none of the above 

18. Which of the following is not a cursor attribute in PL/SQL ? 
A. %FOUND 
B. %NOTFOUND 
C. %TYPE 
D. %ROWCOUNT 
E. %ISOPEN 



19. A save point is 
A. a synchronisation point in DataBase
B. indicates that DataBase buffers must be saved in disk, to help in recovery
C. a point which indicates a place in transaction, for partial rollbacks later
D. an auto-timer mechanism, that indicates to user to save his work
E. a point at which program issues commit statement


20. ROLLBACK statement in the following segment of code: 
A. Rolls back the DML changes to savepoint1
B. Rolls back the DML changes to the place where program started
C. Rolls back the DML changes of the last DML statement just before ROLLBACK statement.
D. Rolls back the DML changes to savepoint2
E. None of the above

Ans p1

21. "An order could be either for an item or for a service". How can we represent this scenario in a E-R?
A. Sub-Type relation
B. Many-to-Many relation
C. Arc relation
D. Recursive relation
E. None of the above

22. In RDBMS which of the following is true?
A. A relation must always have a primary key
B. A relation must always have a foreign key
C. A relation must have indices
D. All of the above
E. None of the above

23. In RDBMS all data is stored in
A. Tables 
B. Views & indexes
C. indexes
D. All of the above
E. None of the above

24. How does the user/application connect to Oracle database?
A. SQL*Net
B. TCP/IP
C. SPX/IPX
D. a,b

25. Data dictionary is owned by the following user:
A. DBA
B. SYSTEM
C. SYS
D. USER



SA1

1 C
2 A
3 C
4 D
5 C
6 4
7 3
8 1
9 D
10 A
11 D
12 C
13 D
14 B
15 C
16 D
17 B
18 C
19 C
20 B
21 C
22 B
23 A
24 A
25 C

---------------------------------------------------------------------------------------------
) What is operator overloading ?
a) Using the operator in a function
b) Using the operaotor in a procedure
c) Giving new functionality to the operator.
d) None

2) Constructors and Destructors are
a) mandatory for a class in C++
b) Constructor is not mandatory but Destructor is.
c) Destructor is not mandatory but Constructor is.
d) Neither of this mandatory.


3) The features of OOPs are
1)Polymorphism 2) GUI 3) Data Abstraction 

a) 1 & 2
b) 2 & 3
c) 1 & 3
d) 1,2 & 3


4) What is the procedure for swapping a,b ?
a) tmp = a ; a = b ; b = tmp; 
b) a = a + b ; b = a - b; a = a - b;
c) a = a - b; b = a + b; a = b - a ;
d) All of the above


5) What will be the value of tmp ?
Given a = b = c = d = e = f = 5 and
tmp = (a + b ) * (c - d) - (e / f) ; 
a) 9
b) -1 
c) 0
d) None


.A camp counselor is organizing a game among nine campers. Three of the campers F, G and H are eight year olds; the other six campers J, K, M, O, P and S - are nine year olds. Two teams team 1 and team 2 - will be organized. Team 1 will have four campers; team 2 will have five campers. In assigning campers to teams, the counselor observes the following restrictions:

Team 1 must have exactly two of the eight year old campers.
K must be on the same team as O
F and J cannot be on either of the teams together.
M and P cannot be on either of the teams together.
If K is on the same team as P, then H must be on the team that does not include K and P.
6 If H and K are on team 2, which of the following is a pair of campers who must be on team 1?
[1] F and M [2] F and O [3] F and P [4] J and P [5] M and S

7 If F, M, and S are on team 1, which of the following must be true?
[1] G is on team 2 [2] H is on team 2 [3] K is on team 1 
[4] O is on team 1 [5] P is on team 1

8. Two operators # and for real numbers a and b are defined as follows:

(i) a # b = a + b if both a and b are positive
= 1, otherwise
(ii) a b = (ab) a+b if ab is positive 
= 1, otherwise
The value of ((1 # 1) # 2) (10 1..3 # log 10 0.1 ) is
2V1
[1] (4 10 1.3)/2 [2] 1/8 [3] 3/8 [4] 15/8


9) UNIX is a 
a) Single user operating system . 
b) Multitasking operating system . 
c) Multiuser and multitasking operating system. 
d) None of the above . 


10) The primary advantages of a Dynamic Linked Library are:

(a) Reduced size of the executable

(b) More amenable to maintenance

(c) Faster execution

(d) (a) and (b) above

(e) (a), (b) and (c) above


11) ROWID is 
a) the primary column of the table
b) A unique number assigned to each row by the user
c) A data type which is used to store the addrss of each records

12) Union is the operator used 
a) get the common rows of the tow or more quires
b) to merge the result of the tow or more quires
c) none of the above


Consider a table EMP with following structure

EMP NO - Primary Key Name Salary
10 AA 1000
20 BB 2000
30 CC 3000

13) The following SQL statement will result in syntax error or not
INSERT into emp values (40, DD);
a) This will a syntax error
b) Will run sucessfuly


14) When we run the following SQL 
UPDATE emp set salary = decode(salary,null,1000,salary);
1) This will not affect any rows
2) This will update rows only if the slary is null
3) Update all the rows.
4) none of the above

15) Select sum(salary) from emp group by emp_no having sum(salary) > 2000 will result
a) Sum of all the employees salary whose salary are grater than 2000
b) Salary of the employees whose salary is grater than 2000
c) will give syntax error

Assume a table T1 with m rows and x columns,
a table T2 with n rows and y columns

Consider the following :

Select * from T1, T2;

16. How many records does the above select statement return?
a) m^n
b) mx + ny
c) n^n
d) mn
e) m + n

17 How many columns does the above select return?
a) x^y
b) y^x
c) mx+ny
d) xy
e) x+y

18. Consider the following select statement
( Select * from T1) Union (select * from T2)
where T1 & T2 follows the same definition as specified in Question 4.

The above statement will fail unless 
a) x!= y
b) x > y
c) x=y
d) x c-b ? b:c;
printf("%d",a);
}

a) 10
b) 5
c) 0
d) Error

6). If the remainder is 1 when the integer n is divided by 15, what is the remainder when n is divided by 5?
[1] 1 [2] 2 [3] 3 [4] 4 [5] It cannot be determined from the information given

Two operators # and for real numbers a and b are defined as follows:

(i) a # b = a + b if both a and b are positive
= 1, otherwise
(ii) a b = (ab) a+b if ab is positive 
= 1, otherwise

7. The value of ( 2 # 3) #( (-1) 5) is 
(1 2) # ((-1) # 5)
[1] 2/3 [2] [3] 1/3 [4] None of these

8. The value of ((1 # 1) # 2) (10 1..3 # log 10 0.1 ) is
2V1
[1] (4 10 1.3)/2 [2] 1/8 [3] 3/8 [4] 15/8

9. What is a process?
a) A command 
b) A logged in User
c) A compiled executable
d) An executing program 
e) None of the above

10. The underlying protocol for the World Wide Web ( www ) is 
a) Hyper Text Transfer Protocol (HTTP) . 
b) World Wide Web Protocol (WWWP) . 
c) Internet Protocol Version 6 (IP v6) 
d) Hyper Text Markup Language ( HTML) 

11) In oracle the data type date is used to store
a) Date alone
b) date and time
c) time only

12) ROWNUM is 
a) a pseudo column
b) The physical sequance number of the row in the table
c) User defined column

Questions 13 - 19 

Assume there are two tables EMP and SAL with following structure and data

Table : EMP
EMP_NO Name Deptno
1 RAM 1
2 AJAY 2
3 Ravi 2

Table : SAL
EMP_NO Basic
1 10,000
2 20,000
4 30,000


13) Select EMP.name, nvl(Sal.Basic,0)
from emp, sal
where emp.emp_no = sal.emp_no
and emp.emp_no = 3;

What is the output of the above SQL?
a) Ravi, NULL
b) Ravi, 0
c) No records are returned by the SQL
d) none of the above

14) SELECT nvl(emp.name, no name), nvl(sal.basic,0) 
from emp,sal
where emp.emp_no = sal.emp_no(+);
a) RAM, 10000 , AJAY 20000 , RAVI 0
b) RAM, 10000 , AJAY 20000 , no name 0
c) Error

15) Select sum(sal.basic) 
from sal
where sal.emp_no not in
(select emp_no from emp);

a) 50,000
b) 30,000
c) 20,000
d) 10,000

16) Select count(emp_no) from emp
group by deptno
having count(*) > 1;
a) 2
b) 1
c) 2, 3
d) error : not a group by expression

17) Select emp.name from emp
where exists (select X from sal where sal.emp_no = emp.emp_no);
a) RAM, Ajay, Ravi
b) Ram, Ajay
c) Ram, Ravi
d) No rows selected

18) Update sal set basic = basic + 5000
where emp_no in ( select emp_no from where deptno = 2);
This update will update how many rows ?

1
b) 2
c) 0
d) Error

19) What is the output of the following sql :

select substr(Test for Oracle , 10)
from dual; 
a) Test for Oracle
b) Test for 
c) Oracle
d) O
e) racle

20) What is the output of the following : 


Insert into emp .
Create table test (test_no number(3));

rollback ;

Table test is created but insert fails 
b) Table test is created and insert also happens 
c) Neither table nor insert happens
d) Table is not created but insert happens 

21) Which of the following is TRUE about a PROCEDURE ?

a) Can return a Value 
b) Can be used in SQL statement 
c) All of the above
None of the above 

22) Which of the following is true about Unique index ?
All values should be unique 
b) Null values are not accepted 
c) None of the above 
d) a & b 


23) Which of the following is true about Foreign Key ?

a) Allow null values 
b) Allow duplicate values 
a & b
d) None of the above

24) Which of the following is True ?

a) null is same as blank 
b) null is same as zero
c) a & b
None of the above


25) How many join conditions are needed in a join query to 
avoid a cartesian product ?

a) No. of tables + 1 
b) No. of columns + 1 
c) No. of tables - 1 
d) No. columns - 1 


SA3

1 C
2 A
3 B
4 B
5 A
6 1
7 1
8 2
9 D
10 A
11 B
12 A
13 C
14 B
15 B
16 A
17 B
18 A
19 C
20 A
21 D
22 A
23 C
24 D
25 C

--------------------------------------------------------------------------------------------

1 ) What is the output of the following code :
void main()
{
int ret,I = 10;
ret = func1(I);
printf("%d",ret);
}

int func1(int d)
{
int ret1;
ret1 = func2(d--);
return(ret1);
}

int func2(int y)
{
return(++y);
}

a) 10
b) 12
c) 11
d) None


2) What is the output of the following :
void main()
{
char str[20];
strcpy(str,"Oracle India");
printf("%c",str[10]);
}

a) d
b) n
i
d) None



3) What is the output :
void main()
{
int a,b=-10,c=10;
a = b-a >c-b ? b:c;
printf("%d",a);
}

10
b) 5
c) 0
d) Error


4) What is the output of the code :
void main()
{
int I=0,j=1;
printf("%d %d",--I ,j++);
}
a) 0,0 
b) -1,2
c) 0,1
-1,1

5) What is the output of the following code :
void main()
{
char i;
for (I=0;I<=256;I++)
printf("%c",i);
}

a) 0,1256
b)ascii values
Endless Loop
d) None of Above.


.A camp counselor is organizing a game among nine campers. Three of the campers F, G and H are eight year olds; the other six campers J, K, M, O, P and S - are nine year olds. Two teams team 1 and team 2 - will be organized. Team 1 will have four campers; team 2 will have five campers. In assigning campers to teams, the counselor observes the following restrictions:

Team 1 must have exactly two of the eight year old campers.
K must be on the same team as O
F and J cannot be on either of the teams together.
M and P cannot be on either of the teams together.
If K is on the same team as P, then H must be on the team that does not include K and P.

6. Which of the following is a possible assignment of campers to the two teams?
Team 1 Team 2
[1] F, G, K, O H, J, M, P, S
[2] F, G, M, S H, J, K, O, P
[3] F, H, J, M G, K, O, P, S
[4] F, H, M, S G, J, K, O, P
[5] F, K, P, S G, H, J, M, O

7. If S and O are on team 2, the campers assigned to team 1 could be
[1] F, H, K, M [2] G, H, J, K [3] G, H, J, P [4] G, H, K,M [5] G, J, M, P

8. If H and K are on team 2, which of the following is a pair of campers who must be on team 1?
[1] F and M [2] F and O [3] F and P [4] J and P [5] M and S

9 If F, M, and S are on team 1, which of the following must be true?
[1] G is on team 2 [2] H is on team 2 [3] K is on team 1 
[4] O is on team 1 [5] P is on team 1

10. If G is on the same team as H, which of the following must be true?
[1] G is on the same team as J [2] M is not on the same team as S 
[3] P is on the same team as S [4] F is not on the same team as M
[5] J is not on the same team as P

11. What is the output of the following sql :

select substr(Test for Oracle , 10)
from dual; 
a) Test for Oracle
b) Test for 
c) Oracle
d) O
e) racle

12. A Pl/Sql block can exist with 

a) Declare Section alone
Body alone
c) Exception alone 
d) Declare and Exception 

13. Which of the following is valid about Views ?

a) View can be based only on a single table 
View can be based on more than one table 
c) View is used to store data 
d) None of the above 

14. Which of the following is true about Unique index ?

All values should be unique 
b) Null values are not accepted 
c) None of the above 
d) a & b 

15) The 3 operators used in the relational model are 
A. select, union, project
B. select, join, intersect
C. select, project, join
D. none of the above

16) What is the maximum value of an integer that can be stored in a 2 byte signed integer datatype:
32768
b) 65536
c) 4
d) 100
e) None of the above

17) Table Emp_sal has 20 rows with salary above 200 . 
How many rows do the following query will retrieve ?

select emp_name from emp_sal 
where sal > 200
and rownum > 10 ;

10
b) 20
c) No rows selected 

18) Declare
Name1 varchar2(10);
Name2 char(10);
begin
Name1 := ABC;
Name2 := ABC
IF name1 = name2 then
print("Hi");
else
print("Hello");
end if;
end;
What is the out put of above pl/sql
a) Hi
Hello
c) Error - char can not be compared with varchar2


19) Which clause would you use to exclude rows before grouping
them ?

Where
b) Having
c) Group By
d) Minus

20) Which Type of entity relation ship exists between patient and doctor ? 
a) One -to -One
b) One-to-Many
Many-to-One
d) Many-to-Many

21) 
What happens when rows are found using a FETCH statement ? 
a) the cursor opens
b) the cursor closes
the current row values are loade into variables
d) variable are created to hold the current row values. 

22) Evaluate this PL/SQL block:
DECLARE
v_lower NUMBER := 2;
v_upper NUMBER := 100;
v_count NUMBER := 1;

BEGIN
FOR i IN v_lower..v_lower LOOP
INSERT INTO test(results)
VALUES (v_count);
v_count := v_count + 1;
END LOOP;
END;
How many times will the executable statements inside the FOR LOOP execute? 
a) 0
b) 1

c) 2
d) 98
e) 100

23) For every new ballplayer added to the PLAYER table, a record must be inserted into the PLAYER_BAT_STAT table. You have written a trigger to accomplish this task.

To which timing will this trigger be assigned?
AFTER
b) BEFORE
c) STATEMENT
a) PRE-INSERT

24. INSTR function is used to:
return the position within string1 where string2 is placed
b) return the length of the string
c) return portion of string 
d) None of the above

25. ROWID is represented in the following format:
a) row.block.file
b) file.block.row
block.row.file
d) block.row


SA4

1 C
2 C
3 A
4 D
5 C
6 4
7 3
8 3
9 1
10 1
11 C
12 B
13 B
14 A
15 B
16 A
17 A
18 B
19 A
20 C
21 C
22 B
23 A
24 A
25 C*
* There is problem in question paper

---------------------------------------------------------------------------------------------
1. Which of the following is a daemon process
a. getty process
b. login process
c. c shell process
d. all the above



2. Unix inter process communication is accomplished through the use of
a. semaphores
b. message queues
c. shared memory
d. all the above
e. none of the above



3. Which of the following are valid layers in the ISO-OSI architecture
a. application layer
b. session layer
c. protocol layer
a and b only
e. a,b and c



4. What is RS-232C
a physical interface for data communication
b. a card in a PC
c. belongs to the OSI protocol suite
d. name of a cable company
e. all of the above



5. A save point is
a. a synchronization point in Db
b. indicates that DB buffers must be saved in disk, to help in recovery
c. a point which indicates a place in transaction, for partila rollbacks later
d. an auto-timer mechanism, that indicates to uesr to save his work




6. In RDBMS s which of the following are true
a. a relation must always have a primary key
b. a relation must always have a foreign key
c. a relation must have indexes
d. all of the above
e. none of the above
f. 
7. BUFFERS=50 in config.sys means
a. maximum of 50 temporary buffers can be used the SORT command
b. for buffering the most recent 50 commands for DOSKEY
c. used for disk catching
d. none of the above
8. INT 21 is
a. DOS interrupt
b. BIOS interrupt
c. hardware interrupt
d. none of the above



9. The 3 operators used in the relational model are
a. select, union, project
b. select, join, intersect
c. select, project, join
d. none of the above




10. If you are using Developer 2000, the following is true
a. restricted procedures can be used in all triggers
b. restricted procedures can be used in restricted mode
c. restricted procedures can be used in key triggers
d. none of the above






11. The difference between fork and exec in UNIX OS is
a. fork creates a child process and exec creates a parent process
b. fork creates a child process and exec executes a process
c. fork creates a parent process and exec executes a process
d. fork creates an identical child process and exec overlays the existing process.

12. Which of the following process scheduling algorithms may lead to starvation?
a. round ribon
b. first come first serve
c. priority based
d. shortest job first
e. all of the above
13. In a typical disk system, if you were to order seek time, latency and transfer time in the order from highest to lowest, the order would be: 
a. transfer time, latency, seek time
b. seek time, transfer time, latency
c. transfer time, seek time, latency
d. seek time, latency, transfer time
e. latency, seek time, transfer time


New Click here to Download 2017 Latest placement papers of this company New




 


.

Recently Updated: New Placement Papers added.
Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Programming & Source Codes | GRE Preparation | Jobs, Discussions | Software Listing | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | International Business Information | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | FAQs | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Excellent Mobiles | Software Testing | Interview Questions | Freshers Jobs | Server Insiders | File Extension Directory

Copyright ©2003-2017 Vyom Technosoft Pvt. Ltd., All Rights Reserved. Read our Privacy Policy