&
i=2;
&
i=2;
b. 2,3,4,5,6,7
c. compilation error
d. 1,2,3,4,5,6,7
---a)
ANS:
declare
type v_xyz IS varray(10) of INTEGER;
xyz v_xyz;
c Integer ;
begin
xyz:= v_xyz(1,2,3,4,5,6,7);
xyz.trim(1); -- Remove the last 1 element, leaving none.
c:=xyz.count;
for i in 1 .. c LOOP
dbms_output.put_line(xyz(i));
END LOOP;
end;
/
output:-
1
2
3
4
5
6
Statement processed.
0.01 seconds
Unchecked Exception
Checked Exception
ArrayIndexOutOfBoundsException
ClassCastException
IllegalArgumentException
IllegalStateException
NullPointerException
NumberFormatException
AssertionError
ExceptionInInitializerError
StackOverflowError
NoClassDefFoundError
IOException
FileNotFoundException
ParseException
ClassNotFoundException
CloneNotSupportedException
InstantiationException
InterruptedException
NoSuchMethodException
NoSuchFieldException
9.) declare
type city is table of varchar2(20) index by pls_integer;
v1 city;
begin
v1(1):='Bangalore';
v1(6):='Mumbai';
v1(2):='Delhi';
dbms_output.put_line(v1.count); ~~~3
dbms_output.put_line(v1(2)); ~~~~~delhi
dbms_output.put_line(v1.next(6)); ~~~~~~NULL
end;
What will be the output for the above code?
a. 3 delhi delhi
b. 3 delhi mumbai
c. 3 delhi
d. 3 delhi bangalore
---C)
@NS:
~~~~~~~~NEXT(n) returns the subscript that succeeds index n.
~~~~~~~if n has no successor, NEXT(n) returns NULL.
10.) Can we retrieve table after performing purge operation(T/F)
---F)
@NS:
Once Table dropped, tables can be "undropped":
drop table t;
Table dropped.
desc t;
ERROR:
ORA-04043: object t does not exist
> select count(*) from t;
select count(*) from t
*
ERROR at line 1:
ORA-00942: table or view does not exist
> flashback table t to before drop;
Flashback complete.
purge is useful in 10g when you want to "really truly drop a table"
drop table t purge;
&
j=11;
14.)
String x = "abc";
Stringbuffer sb = new Stringbuffer(x);
sysout(sb==x)~~~ Incompatible operands type
;
(True/false)
ANS:
here Objects are different
exception message:
"Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Incompatible operand types StringBuffer and String
Syntax error, insert ";" to complete Statement "
15.) trim(0 from "0003443000");
---select trim('0' from '000003443000') from dual; ----> 3443
ANS:
TRIM enables you to trim leading or trailing characters (or both) from a charact
er string. If trim_character or trim_source is a character literal, then you mus
t enclose it in single quotes.
If you specify LEADING, then Oracle Database removes any leading characters equa
l to trim_character.
If you specify TRAILING, then Oracle removes any trailing characters equal to tr
im_character.
If you specify BOTH or none of the three, then Oracle removes leading and traili
ng characters equal to trim_character.
If you do not specify trim_character, then the default value is a blank space.
~~~~~~~~~~If you specify only trim_source, then Oracle removes leading and trail
ing blank spaces.~~~~~~~~~~
The function returns a value with datatype VARCHAR2. The maximum length of the v
alue is the length of trim_source.
If either trim_source or trim_character is null, then the TRIM function returns
null.
19.) Cursor using basic loop fetch records from table. How to fetch the same rec
ords
using for loop?
ANS:
The nice thing about the cursor FOR loop is that Oracle Database opens the curso
r, declares a record by using %ROWTYPE against the cursor, fetches each row into
a record, and then closes the loop when all the rows have been fetched (or the
loop terminates for any other reason).
21.)
se
For all DML statements one must contain exception handling (T/F)?~~~Fal
22.) Execute immediate will immediately run the dynamic pl/sql block/function(T
/F)?
~~~~T)
ANS:
The EXECUTE IMMEDIATE statement prepares (parses) and immediately executes a dyn
amic SQL statement or an anonymous PL/SQL block. The main argument to EXECUTE IM
MEDIATE is the string containing the SQL statement to execute. You can build up
the string using concatenation, or use a predefined string.
The following PL/SQL block contains several examples of dynamic SQL:
DECLARE
sql_stmt
VARCHAR2(200);
plsql_block VARCHAR2(500);
emp_id
NUMBER(4) := 7566;
salary
NUMBER(7,2);
dept_id
NUMBER(2) := 50;
dept_name VARCHAR2(14) := 'PERSONNEL';
location
VARCHAR2(13) := 'DALLAS';
emp_rec
emp%ROWTYPE;
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE bonus (id NUMBER, amt NUMBER)';
sql_stmt := 'INSERT INTO dept VALUES (:1, :2, :3)';
EXECUTE IMMEDIATE sql_stmt USING dept_id, dept_name, location;
sql_stmt := 'SELECT * FROM emp WHERE empno = :id';
EXECUTE IMMEDIATE sql_stmt INTO emp_rec USING emp_id;
plsql_block := 'BEGIN emp_pkg.raise_salary(:id, :amt); END;';
7.Stored procedure returns always integer value by default zero. where as functi
on return type could be scalar or table or table values
8. Stored procedure is precompiled execution plan where as functions are not.~~~
~~~~~~~~
9.A procedure may modify an object where a function can only return a value The
RETURN statement immediately completes the execution of a subprogram and returns
control to the caller.
26.) Interface have only behaviour and functionality but not implementation(t/f)
---T)
27.) jdbc and odbc drivers are used to -------a. jdbc and odbc drivers
b. jdbc driver
c. odbc driver
d. none
---A)
ANS:
When Java first came out, this was a useful driver because most databases only s
upported ODBC access but now this type of driver is recommended only for experim
ental use or when no other alternative is available.
ODBC is a standard Microsoft Windows interface that enables communication between
database management systems and applications typically written in C or C++.
JDBC is a standard interface that enables communication between applications bas
ed on Oracle Java and database management systems.
The JDBC/ODBC bridge is a Java library that allows Java applications to access t
he ODBC interface.
The JDBC-ODBC Bridge is a JDBC driver which implements JDBC operations by transl
ating them into ODBC operations. To ODBC it appears as a normal application prog
ram. The Bridge implements JDBC for any database for which an ODBC driver is ava
ilable. The Bridge is implemented as the sun.jdbc.odbc Java package and contains
a native library used to access ODBC. The Bridge is a joint development of Inte
rsolv and JavaSoft.
28.) method declared in parent class or protected, what will be the access speci
fier for the method in
child class
1. public & protected
2. protected and default
3. private
4. none
----A)
ANS:
It's a fundamental principle in OOP: the child class is a fully-fledged instance
of the parent class, and must therefore present at least the same interface as
the parent class.
The access modifier of an overriding or hiding method must provide at least as m
uch access as the overridden or hidden method, or a compile-time error occurs. I
n more detail:
If the overridden or hidden method is public, then the overriding or hiding meth
od must be public; otherwise, a compile-time error occurs.
If the overridden or hidden method is protected, then the overriding or hiding m
ethod must be protected or public; otherwise, a compile-time error occurs.
If the overridden or hidden method has default (package) access, then the overri
ding or hiding method must not be private; otherwise, a compile-time error occur
s.
Note that a private method cannot be hidden or overridden in the technical sense
of those terms. This means that a subclass can declare a method with the same s
ignature as a private method in one of its superclasses, and there is no require
ment that the return type or throws clause of such a method bear any relationshi
p to those of the private method in the superclass.
29.) a.joins permanently joins two tables
b.inner joins are also known as equi joins
a. a & b are true
b. a & b are false
c. a true b false
d. a false b true
~~~~D)
ns.
Provides interoperability between unrelated APIs by establishing a common langua
ge to pass collections back and forth.
Reduces the effort required to learn APIs by eliminating the need to learn multi
ple ad hoc collection APIs.
Reduces the effort required to design and implement APIs by eliminating the need
to produce ad hoc collections APIs.
Fosters software reuse by providing a standard interface for collections and alg
orithms to manipulate them.
}
/**
* OUTPUT
*/
true
true
simplerecord
customer record
table record
cursor record
--- 1)
b. compilation error
c. no error
d. -ans---A
54.) We can change the value of "IN" parameter in PLSQL(T/F)
---f)
55.) class while{
public static void main(String[] args)
{
int a = 'A';
int i=a+32;
while(a<='Z')
{
a++;
}
s.o.p(i);
s.o.p(a);
}
a. 97,91
b. A,Z
c. a,z
d, 91,97
ans--- A
55.) Which API are used for reading and writing characters from a source?
a. reader and writer APIS
b. inputstream and output APIs
c. NAtive APIs
---A)
56.) full outer join is used when
a. if there are matched columns/records from both tables
b. if there are matched column/record from only one table
c. if there are unmatched columns/records from both tables
4. when both tables are having null values
---C)
58.) select * from (select rank(), (over order by desc)as marks FROM supplier
order by supplier_name----line1
)where rank<3;
a. query will generate error at line 1
b. it will display the first(highest 2) records
c. it will display the last(lowest 2) records
d. no error
---A)
59.) choosing the two correct syntaxes for left outer join
@NS:
SELECT columns
FROM table1
LEFT [OUTER] JOIN table2
ON table1.column = table2.column;
OR
SELECT columns
FROM table1, table2
WHERE table1 = table2(+);
61.) develop a web application so that user can interact with multiple user inte
rfaces.
In web applications HTML,XML,WML is used. Which is the best design pattern for t
his concept
a. DAO
b. Bridge pattern
c. Model view controller
d. chain of responsibility
---C)
62.) Exception can move across modules with throw & throws keywords(T/F)
---T)
63.) Take out the wrong one
a. import
b. extends
c. implements
d. throwed
---D)
64.) Declare
TYPE numlist is TABLE of NUMBER(10);
n numlist;
BEGIN
n:=numlist(10,8,7,6,5,4,3,2);
dbms(n(1));
END;
a. 10
b. 8
c. error
d. none
---A)
65.) DECLARE
TYPE l_num_list IS TABLE of number;
list l_num_list;
begin
list.extend;
list(1):=1;
dbms(list(1));
END;
a. referenced to uninitialized collection
b. no error
c. 1
---A)
66.) Parameterised queries are also known as ____________?
---Prepared statment.
67.) In interface how we will declare variables by using
a. public
b. static
c. final
d. native
choose multiple options
---A) & B)&C)
71.) An Application can be "Tightly coupled and loosely cohesed"? true or false
---F)
72.) Can we hava an interface inside class?(T/F)
---T)
81.)
public class demo
{
public static void main(String[]args)
{
StringBuffer s1=new StringBuffer("welcome");
StringBuffer s2=new StringBuffer("welcome");
System.out.println(s1.equals(s2));
System.out.println(s1.equals(s1));}
}
options: a. true,false
b.false,true
c.false,false
d.true,true
---B)
82.) wrapper objects of int,char,short can be used by switch case?(T/F)
---T)
83.) a.Any operator : The ANY operator is used to compare a value to any
applicable value in the list according to the condition.
b.All operator: The ALL operator is used to compare a value
to all values in another value set.
a. a and b are true
b. a and b are false
c. a true,b false
d. a false,b true
~~~a)
84.) Following are the two types of data type conversion.(T/F)
1.implicit
2.explicit
---T)
86.) Runtime exception is the super class for all the exceptions that can be
thrown during normal operation of JVM.(T/F)
---T)
@NS:
RuntimeException is the superclass of those exceptions that can be thrown during
the normal operation of the Java Virtual Machine.