Questions
Questions
Questions
{
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>My Servlet</title>");
out.println("</head>");
out.println("<body>"); <servlet> <servlet-
out.println("<h>WELCOME</h>"); name>hello</servlet-name>
out.println("</body>"); <servlet-
out.println("</html>"); class>hello</servlet-class>
out.close(); </servlet> <servlet-
} mapping> <servlet-
} name>hello</servlet-name>
Which of the following code snippets correctly defines the deployment <url-pattern>/hello</url-
descriptor for the preceding servlet? pattern> </servlet-mapping>
Carefully read the question and answer accordingly. <HTML> <BODY> <FORM
Which of the following codes will allow the user to load the servlet ACTION=http://localhost:80
using form. The form should first display submit button and when the 80/servlet/myservlet
user clicks on submit button it should load the servlet called METHOD=GET> </FORM>
myservlet? </BODY> </HTML>
RequestDispatcher
dispatcher =
request.getRequestDispatc
her("Servlet2");
Carefully read the question and answer accordingly. dispatcher.forward(req,
Select the code to chain a servlet with another servlet resp);
Carefully read the question and answer accordingly.
Mahesh has observed that some users are able to directly access the
content files stored in the Web application from the Web browser.
Which of the following options should Mahesh use to prevent the By storing the content files
users from directly accessing the content files? under the dist directory
Layered architecture
separates the functionalities
Carefully read the question and answer accordingly. to individual layers, thereby
Which of the following is / are true about the layered architecture improving maintainability &
style? reusability
Carefully read the question and answer accordingly. web application provides
Which of the following is / are true about web applications? cross platform compatibility
Session timeout
declarations made in the
Carefully read the question and answer accordingly. DD(web.xml) can specify
Which statements about session timeouts are true? time in seconds.
public void
doGet(HttpServletRequest
req, HttpServletResponse
res) throws
ServletException,
IOException { HttpSession
Carefully read the question and answer accordingly. session = req.getSession();
Choose the valid option for creating session object and to add a session.setAttribute("BookI
attribute "BOOKID" into session object. D","Core Java"); }
<jsp:include page=”user-
Carefully read the question and answer accordingly. pref.jsp”> <jsp:param
In an web page how would you write the JSP standard action code to name=”userPref” value=”$
import a JSP segment that generates user preference specific {user.preference}” />
content? </jsp:include>
Carefully read the question and answer accordingly. Print something on the
The purpose of a JSP Expression tag is to: screen
private void
_jspService(HttpServletReq
uest request,
HttpServletResponse
response)throws
Carefully read the question and answer accordingly. ServletException,
Which of the following is valid _jspService() method signature? java.io.IOException
Carefully read the question and answer accordingly.
If an error occurs while the JSP page is being compiled, the server will
return a Exception. Identify the type of the Exception ParseException
Carefully read the question and answer accordingly. Servlets are written in the
What language is used to write servlets and JSP? Java language
Carefully read the question and answer accordingly. The init method of the
During translation the scriptlet code is copied inside: generated servlet
o.exe();
}
super class exe method sub
} class display method
Carefully read the question and answer accordingly. Reduce response time of
Which of these is not a benefit of Multithreading? process.
Carefully read the question and answer accordingly.
You have created a TimeOut class as an extension of Thread, the
purpose of which is to print a “Time’s Over” message if the Thread is
not interrupted within 10 seconds of being started. Here is the run
method that you have coded:
public void run() {
System.out.println(“Start!”);
try {
Thread.sleep(10000);
System.out.println(“Time’s Over!”);
} catch (InterruptedException e) {
System.out.println(“Interrupted!”); Exactly 10 seconds after the
} start method is called,
}Given that a program creates and starts a TimeOut object, which of “Time’s Over!” will be
the following statements is true? printed.
try
{
}
catch(IOException t)
{
System.out.println("B");
}
System.out.println("C");
}
} Compile time error
Carefully read the question and answer accordingly.
What will be the output of the program?
public class Test {
public static void aMethod() throws Exception {
try {
throw new Exception();
} finally {
System.out.print("finally");
}
}
public static void main(String args[]) {
try {
aMethod();
} catch (Exception e) {
System.out.print("exception ");
}
System.out.print("finished"); /* Line 24 */
}
} exception finished
Carefully read the question and answer accordingly. Try block always needed a
which are true for try block catch block followed
Carefully read the question and answer accordingly.
What will be the output of following code?
public class Exception1{
public static void main(String args[]) {
int i=1, j=1;
try {
i++;
j--;
if(i/j > 1)
i++;
} catch(ArithmeticException e) {
System.out.println(0);
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println(1);
} catch(Exception e) {
System.out.println(2);
}
finally {
System.out.println(3);
}
System.out.println(4);
}
}
1.0
2.1
3.3
4.4. 1&2
Carefully read the question and answer accordingly. The number of bytes is
What is the number of bytes used by Java primitive long compiler dependent
Carefully read the question and answer accordingly. Call method execute() on a
How can you execute a stored procedure in the database? CallableStatement object
Carefully read the question and answer accordingly. select ename ,sal ,deptno
You are writing a query to select all employees whose salary is less from emp a where a.sal <
than the average of all the employees' salaries in the same (select avg(sal) from emp b
department. where a.deptno = b.deptno)
Which query will help you to achieve your goal? order by deptno;
Carefully read the question and answer accordingly. Start an instance, Open the
Which of the following gives the order of Database administrative Database, Mount the
steps needed to open an Oracle Database? database
Carefully read the question and answer accordingly. A column contains a wide
Identify the circumstance under which you will create an Index? range of values.
Carefully read the question and answer accordingly.
You are using the system account to create a synonym as follows: A synonym with the name
Create synonym User for UserDetails UserDetails is created and
Which statements are true with respect to the above synonym? only system can access it
Carefully read the question and answer accordingly. IN Parameter is the default
Which statements are true about IN parameter? parameter.
Carefully read the question and answer accordingly. %TYPE variables do not
Pick the CORRECT statement about %TYPE variables inherit NOT NULL
such as the NOT NULL or or default values constraints
Carefully read the question and answer accordingly. A Default index is created in
In SQL, which of the following is NOT true with respect to Primary the column which acts as a
Key? Primary key.
Carefully read the question and answer accordingly. Value before change (:OLD)
What will be the old and new value of a database column before : Null Value After change
AFTER and DELETE operation? (:NEW) : Null
Carefully read the question and answer accordingly. The SELECT list or clause
User-defined PL/SQL functions can be used in of a query
Carefully read the question and answer accordingly.
which parameter passing mode passes a value from the calling
environment to the procedure and a possibly different value from the
procedure back to the calling environment using the same
parameter ? IN
Comparison operators
cannot be used to test
Carefully read the question and answer accordingly. cursor variables for equality,
What are the restrictions of REF cursor in PLSQL? inequality, null, or not null.
Carefully read the question and answer accordingly. Opening the cursor
What occurs when a cursor is opened? allocates the memory first.
When we issues a
SELECT.. FOR UPDATE
clause the RDBMS will
automatically place a locks
Carefully read the question and answer accordingly. on the all the rows identified
What is FOR UPDATE clause in Cursors? by the select statement.
DECLARE exception_name
EXCEPTION
EXCEPTION_INIT
PRAGMA
(exception_name ,
err_code); Begin Execution
section Exception WHEN
Carefully read the question and answer accordingly. exception_name THEN
What is the syntax of PRAGMA EXCEPTION_INIT? Handle the exception END;
Implicit cursors are
automatically created by
oracle when a select query
in PLSQL is executed.
Explicit cursors is explicitly
Carefully read the question and answer accordingly. attached to a select query
What are the true aspects of implicit and explicit cursors? by programmer.
Carefully read the question and answer accordingly. <! ELEMENT element-
How to declare element with minimum one occurrence? name(element-content+)>
Carefully read the question and answer accordingly. DTD are used by parsers for
Which of the following correctly defines use of DTD in XML validating the structure of
development? the XML
Carefully read the question and answer accordingly.
Any text that should not be parsed by the xml parser needs to declare
as:
I: PCDATA
II: CDATA I
Carefully read the question and answer accordingly. Extensive Style sheet
What does XSL stands for? language
DocumentBuilderFactory
Carefully read the question and answer accordingly. f=new
Which statement creates DocumentBuilderFactory instance? DocumentBuilderFactory();
Carefully read the question and answer accordingly. Java API eXtensive
JAXP Stands for: processing
<xs:complexType
name="CountrInfo"><xs:all>
<xs:element
name="countryName"
type="xs:string"/>
Carefully read the question and answer accordingly. <xs:element name="states"
Which complex type specifies that the elements should always be in type="xs:integer"/></xs:all>
the order specified? </xs:complexType>
<xs:element
name="CountryName"
Carefully read the question and answer accordingly. type="xs:string"
Which statement specifies a constant value for a simple element? constant="India"/>
<xs:complexType
name="CountrInfo"><xs:all>
<xs:element
name="countryName"
type="xs:string"/>
Carefully read the question and answer accordingly. <xs:element name="states"
Which complex type signifies that only one of the child elements can type="xs:integer"/></xs:all>
appear? </xs:complexType>
By multithreading CPU’s
idle time is minimized, and
Carefully read the question and answer accordingly. we can take maximum use
Which of the following statement is incorrect? of it.
Carefully read the question and answer accordingly. If the equals() method
Which statements are true about comparing two instances of the returns true, the hashCode()
same class, given that the comparison == might return
equals() and hashCode() methods have been properly overridden? false
CREATE TRIGGER
log_errors BEGIN IF
(IS_SERVERERROR
(1017)) THEN <special
Carefully read the question and answer accordingly. processing of logon error>
Which of the trigger is used to log all errors and also to do some ELSE <log error number>
special processing when the log error is 1017? END IF; END;
CREATE OR REPLACE
PACKAGE
employee_package AS
TYPE emp_rec IS RECORD
( employeeid NUMBER,
firstname VARCHAR2(10),
lastname VARCHAR2(10),
salary NUMBER);
Carefully read the question and answer accordingly. minimum_count
Which is the valid Package specification for the below requirements. CONSTANT NUMBER := 4;
1) A procedure to update each professors salary FUNCTION get_employee
2) A function to return the professor details who receive less salary RETURN emp_rec;
compared to others. PROCEDURE
3) A REF CURSOR to be declared update_salary (employeeid
4) A employee record with employeeid , employee name , salary. IN NUMBER); END
5) A constant with datatype NUMBER with value 4 employee_package;
Faster application
development. Because the
database stores triggers,
Carefully read the question and answer accordingly. you do not have to code the
Which of the following is the benefits using triggers in database trigger actions into each
management system? database application.
Carefully read the question and answer accordingly.
What is the collection exception raised for the below code?
DECLARE
TYPE NumList IS TABLE OF NUMBER;
nums NumList;
BEGIN
nums(1) := 1; SUBSCRIPT_BEYOND_CO
END; UNT
CREATE OR REPLACE
TRIGGER salary_changes
BEFORE DELETE OR
INSERT OR UPDATE ON
TBL_EMPLOYEES FOR
EACH ROW DECLARE
sal_diff NUMBER; BEGIN
sal_diff := :NEW.salary -
:OLD.salary;
DBMS_OUTPUT.PUT(:OLD
.firstname||','||:OLD.lastnam
e|| ': ');
DBMS_OUTPUT.PUT('Old
salary = ' || :OLD.salary || ',
Carefully read the question and answer accordingly. ');
Which trigger is used to display the salary change information DBMS_OUTPUT.PUT('New
whenever a DELETE , INSERT or UPDATE statement affects the salary = ' || :NEW.salary || ',
tbl_employees table(Salary Column)- The trigger should be FOR ');
EACH ROW trigger. DBMS_OUTPUT.PUT_LINE
SAMPLE OUTPUT : Fahan,Karn: Old salary = 3500, New salary = ('Difference: ' || sal_diff);
4500, Difference: 1000 END;
Cohesion is the OO
Carefully read the question and answer accordingly. Concept which hides the
Which are the statements are true implementation
Compilation and
output of the
contents of
menu.jsp followed Compilation, but runtime
by "Output after error, the buffer has
menu.jsp" Compilation error been flushed
By setting the
session-timeout By setting the
parameter in the setMaxInactiveInterval()
web.xml file to 1 method period to 60 By using the destroy()
minute seconds method
HttpSession session
= HttpSession session =
request.getSession(t request.getSession("jses None of the listed
rue); sionid"); options
Gives None of the listed
10 minutes illegalStateException options
Statement A is true
and statement B is Statement A is false and Statement A is false and
false. statement B is true. statement B is false.
<HTML> <BODY>
<FORM
ACTION=http://local <HTML> <BODY>
host:8080/servlet/m <FORM
yservlet ACTION=http://localhost
METHOD=GET> :8080/servlet
<INPUT <HTML> <BODY> METHOD=GET>
TYPE=SUBMIT <INPUT TYPE=SUBMIT <INPUT TYPE=SUBMIT
VALUE=SUBMIT> VALUE=SUBMIT> VALUE=SUBMIT>
</FORM> </BODY> </FORM> </BODY> </FORM> </BODY>
</HTML> </HTML> </HTML>
RequestDispatcher
dispatcher = RequestDispatcher
request.getRequest dispatcher =
Dispatcher("Servlet2 request.getRequestDispa
"); tcher("Servlet2");
dispatcher.dispatch( dispatcher.chain(req, request.sendRedirect("S
req, resp); resp); ervlet2");
By storing the
content files under By storing the content By storing the content
the META-INF files under the WEB-INF files under the INF
directory directory directory
FALSE
FALSE
Statement A is true
and statement B is Statement A is false and Statement A is false and
false. statement B is true. statement B is false.
Statement A is true
and statement B is Statement A is false and Statement A is false and
false. statement B is true. statement B is false.
FALSE
FALSE
These are
responsible for
managing the
lifecycle of servlets,
mapping a URL
(Universal Resource
Locator) to a
particular servlet,
and ensuring that
the URL requester These are also referred
has got the correct to as Web containers or
access rights Web engines. All of the listed options
to provide the
configuration details to provide listener
on how the web information to notify has to list down the
server should use certain classes when external API's which are
them to serve the some events (like used in the web
incoming requests session creation) happen application
1 10
FALSE
FALSE
FALSE
Application client
Web container container Applet container
FALSE
FALSE
To access the
application, the device
Web applications allows like mobile phones,
Little or no the users to invoke from tablets, computers need
diskspace is any device like mobile to open the port for
required on the phones, tablets that has connectivity to web
client browsers server
FALSE
session.removeSession(
session.isNew(false) session.invalidate() )
Cookies Hidden Field All of the listed options
TRUE
FALSE
setMaxInactiveInterv
al() setMaxInactive_interval() setInactiveInterval()
HttpSessionAttributeList
HttpListener HttpSessionListener ener
HttpServletRespons
e ServletContext HttpServletRequest
public void
doGet(HttpServletR public void
equest req, doGet(HttpServletReque
HttpServletRespons st req,
e res) throws HttpServletResponse
ServletException, res) throws
IOException ServletException,
{ session = IOException { Session
req.getSession(); session =
session.getAttribute( req.getSession();
"BookID","Core session.setAttribute("Boo None of the listed
Java"); } kID","Core Java"); } options
request.createSessi request.getSessionObjec
on() t() request.makeSession()
ServletRequestListe HttpSessionBindingListe
ner HttpSessionListener ner
$
${init['company- ${initParam[“company- {contextParam.company
name']} name”]} -name}
FALSE
Statement A is true
and statement B is Statement A is false and Statement A is false and
false. statement B is true. statement B is false.
<%taglib
prefix="pre"
uri="testuri" %>
<html> <head> <%@ taglib prefix="pre" <%@ taglib prefix="pre"
<title>Demo on uri="testuri" %> <html> uri="testuri" %> <html>
helloworldCustom <head> <title>Demo on <head> <title>Demo on
tag</title> </head> helloworldCustom helloworldCustom
<h1> tag</title> </head> <h1> tag</title> </head> <h1>
<pre:helloworld <pre:helloworld <helloworld
attrib="John"> </h1> attrb="John"/> </h1> "attrb"="John"/> </h1>
</html> </html> </html>
Statement A is true
and statement B is Statement A is false and Statement A is false and
false. statement B is true. statement B is false.
<font color='green'>
<ul> <c:forEach
flag="errmsg" <font color='green'> <ul> <font color='green'> <ul>
items="$ <c:forEach flag="errmsg" <c:forEach flag=errmsg
{errorMsgs}"> <li>$ items="${errorMsgs}"> items="${errorMsgs}">
{errmsg}</li> <li>$errmsg</li> <li>${errmsg}</li>
</c:forEach> </ul> </c:forEach> </ul> </c:forEach> </ul>
</font> </font> </font>
<jsp:useBean
id="myBeanAttribute <jsp:useBean <jsp:useBean
" id="myBeanAttribute" id="myBeanAttribute"
class=”com.cts.MyB type=”com.cts.MyBean" type=”com.cts.MyBean"
ean" /> scope=”request”/> />
It will iterate over the
current It will iterate over the
ServletRequest current ServletRequest
parameters getting parameters and would
each property to the not set any property to
value of the It will give a run-time the value of the
parameter error. matching parameter
<jsp:import
page=”user-
pref.jsp”> <jsp:import file=”user- <jsp:include path=”user-
<jsp:param pref.jsp”> <jsp:param pref.jsp”> <jsp:param
name=”userPref” name=”userPref” name=”userPref”
value=”$ value=”$ value=”$
{user.preference}” /> {user.preference}” /> {user.preference}” />
</jsp:include> </jsp:import> </jsp:include>
<jsp:useBean
<jsp:useBean id="account"
id="account" type="com.cts.Accoun
<jsp:useBean type="com.cts.Account” t" scope="session">
id="account" scope="session"/> <jsp:getProperty
type=”com.cts.Account” / <jsp:getProperty name="account"
<%= > <%= name="account" property="accountNu
employee.getAccou employee.getAccountNu property="accountNumb mber" />
ntNumber();%> mber(); %> er" /> </jsp:useBean>
The code sets value The code sets the values The code does not
of all properties of of all properties of compile as there is no
employee bean to employee bean with property attribute of None of the given
"*". default values. setProperty tag. option
<jsp:useBean
identity="login"
scope="Session" <jsp:useBean id="login"
class="s.beans.Logi <jsp:useBean id="login" scope="Session"
nBean"> <%! scope="Session" class="s.beans.LoginBe
login.setValue(reque class="s.beans.LoginBea an">
st.getParameter("Lo n"> <login.setValue(request.
ginid")); login.setValue(request.g getParameter("Loginid"))
login.setAddress(req etParameter("Loginid")); ;/>
uest.getParameter(" login.setAddress(request. <login.setAddress(reque
address")); %> getParameter("address")) st.getParameter("addres
<jsp:useBean> ; </jsp:useBean> s"));/> </jsp:useBean>
<jsp:include
page='WEB-
INF/jsp/header.jsp'> <jsp:insert file='WEB-
<jsp:param INF/jsp/header.jsp'>
name='pageTitle' <jsp:include file='WEB- <jsp:param
value='Welcome INF/jsp/header.jsp'> $ name='pageTitle
Page'/> {pageTitle='Welcome value=”Welcome
</jsp:include> Page'} </jsp:include> Page” /> </jsp:insert>
<jsp:setProperty>
<jsp:useBean> and <jsp:getProperty> and <jsp:useBean> and
<jsp:include> <jsp:forward> <jsp:plugin>
It will display the It will display time as It will display the current
date and time. hh/mm/ss. time as hh:mm:ss.
in request response
FALSE
<%@ page
ErrorPage="true" <%@ page <%@ page
%> isErrorPage="false" %> ErrorPage="false" %>
It is NOT possible to
String x = (String) access the pageContext String x = (String)
pageContext.getReq object from within pageContext.getReques
uestScope("foo"); doStartTag. t().getAttribute("foo");
<%@ include
<%@ page <%@ include autoFlush="java.util.*"
session="true*" %> import="java.util.*" %> %>
<% page import <% import="java.util.*" <% import java.util.*
java.util.* %> %> %>
The ServletConfig
object is contained
within the Defines an object to
ServletContext provide client request
object. information to a servlet All of the listed options
void
setAttribute(String void setAttribute(Object void setAttribute(Object
name, String value) object,String name) object, Object object)
after constructor
runs after service() runs after servlet is loaded
getServletName(String getInitParameterName(
getParameter() name) String name)
void void void
clearAttribute(String removeAttribute(Object removeAttribute(String
name) name) name)
public void
_jspService(HttpSer public void public void
vletRequest request, _jspService(HttpServletR _jspService(HttpServlet
HttpServletRespons equest request, Request request,
e response)throws HttpServletResponse HttpServletResponse
ServletException, response)throws response)throws
java.io.IOException ServletException java.io.IOException
JasperException CompilerException JSPCompilerException
FALSE
It will compile
Line 5 is invalid Line 6 is invalid successfully and print 48
FALSE
MalformedElementExcep
JasperException tion TranslationException
FALSE
It depends on the servlet
WEB-INF/classes container settings WEB-INF/class
FALSE
None of the listed
Execution Undeployment options
FALSE
JSP page is
translated to a
servlet, code is JSP is compiled, JSP JSP is loaded into
compiled, servlet is page is translated to a memory, Code is
loaded into memory, servlet, code is loaded, compiled, instance is
instance is created instance is created created
FALSE
Multithreading
support JSP support Application Controller
Statement A is true
and statement B is Statement A is false and Statement A is false and
false. statement B is true. statement B is false.
<load-on-start> <loadonstartup> <load-on-Init>
2&3 1&2 3
FALSE
Servlets are written Servlets are written in the Servlets are written in
in the Java script C++ the PHP
FALSE
Web Application
ARchive Web Application Request Web Application Report
invoking, destroy.
Web Browser loading invoking, destroy.
manages this life User Should manages None of the listed
cycle this life cycle options
FALSE
FALSE
1&3 2&3 2
FALSE
TRUE
super class show sub class show method
method super class show method Compilation Error
TRUE
FALSE
TRUE
display method
display method 10 display method display super class method
10 method 20 20 display method 10 10
super class exe
method super class None of the listed
display method Compilation error options
FALSE
Composition Generic Polymorphic
FALSE
20 50 20 10 10 20
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
1&3 2&3 3&4 2&4
FALSE
public void aM1(){} public void bM2(){} All of the listed options
FALSE
FALSE
Compilation fails
because the private This class must also The code will compile as
attribute p.name implement the hashCode Object class's equals
cannot be accessed. method as well. method is overridden.
No Output will be
Compilation Error Runtime Exception displayed
Compilation Error DigiCam do Charge Runtime Error
FALSE
Runtime Error. WD 500 Compile Error.
FALSE
FALSE
Neither Statements A
Statement A alone Statement B alone nor B
dot scope resolution none of these
System.setGarbage
Collection(); System.out.gc(); System.gc();
34 4 Compilation error
FALSE
13,12,0 13,13,0 12,13,-1
3 4 2
FALSE
TRUE
Statement A is true
and Statement B is Statement A is false and Both Statements A and
false Statement B is true B are false
line 4 line 5 line 1
FALSE
Important job
running in MyThread Runtime Exception Non of the options
FALSE
Statement2 is TRUE
but Statement1 is BOTH Statement1 & BOTH Statement1 &
FALSE. Statement2 are TRUE. Statement2 are FALSE.
FALSE
FALSE
FALSE
FALSE
FALSE
Statement A is true
and Statement B is Statement A is false and Both Statements A and
false Statement B is true B are false
Creates a Date
object with '01-01- Creates a Date object Creates a Date object
1970 12:00:00 AM' with current date and with current date alone
as default value time as default value as default value
B C D E
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
both strings are not
equal compilation error Runtime error
FALSE
Strings cannot be
both strings are not compare using ==
equal compilation error operator
FALSE
FALSE
FALSE
x="" x = Java x="JAVA"
FALSE
FALSE
Strings cannot be
both strings are not compare using ==
equal compilation error operator
TRUE
RunTimeException are
Runtime exceptions the exceptions which
include arithmetic forces the programmer
exceptions, pointer RuntimeException is a to catch them explicitly
exceptions class of I/O exception in try-catch block
Executing try
Runtime Exception Compile Time Exception Runtime Exception
Shows unhandled
exception type
IOException at line Demands a finally block Demands a finally block
number 5 at line number 4 at line number 5
FileNotFoundExcept
ion SQLException NullPointerException
3 compilation error
FALSE
FALSE
FALSE
Statement A is true
and Statement B is Statement A is false and Both Statements A and
false Statement B is true B are false
FALSE
finally throw throwable
FALSE
FALSE
FALSE
FALSE
None of the listed
error compilation error options
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
2 4 8 64
FALSE
The number 1 gets The number 2 gets The number 3 gets The program
printed with printed with printed with generates a
AssertionError AssertionError AssertionError compilation error.
FALSE
Statement A is True
and Statement B is Statement A is False and Both Statements A and
False. Statement B is True. B are False.
Connection
cn=DriverManager.g Connection Connection
etConnection("jdbc: cn=DriverManager.getCo cn=DriverManager.getC
odbc:Mydsn", nnection("jdbc:odbc onnection("jdbc:odbc:ds
"username", ","username", n" ,"username",
"password"); "password"); "password");
FALSE
FALSE
java.jdbc and
java.jdbc.sql java.sql and javax.sql java.rdb and javax.rdb
adds 10 minutes to
the current adds 10 days to the date functions cannot
Timestamp current Timestamp query contains error be converted into char
Top 2 student
record with lowest If LINE 1 is removed
marks will be Query will generate an than the query will
displayed error execute
Flashback Query
needs to be enabled Flashback Query does
and disabled using not apply to code objects
the like Packages,
DBMS_FLASHBAC Procedures, Function or None of the listed
K package. Triggers options
Create sequence Create sequence MySeq Create sequence MySeq Create sequence
MySeq ( Start with 2 ( Start with 2 Increment Start with 2 Increment MySeq as Start with 2
Increment by 1 ) by 2 ) by 2 Increment by 2
FALSE
FALSE
Mount the database, Start an instance, Mount Start the database, Start
Start the instance, the database, Open the the instance, Mount the
Open the database database(smo) Database
Data Dictionary
Cache Shared Pool Library Cache
The table is large and
One or more columns are most queries are
A column contains frequently used together expected to retrieve less
large number of null in a where clause or a than 2 to 4 % of the All of the listed
values. join condition. rows. options
A synonym with the A synonym with the A synonym with the
name UserDetails is name User is created name User is created
created and any and only system can use and any user can Incorrect syntax to
user can access it it access it create a synonym
FALSE
FALSE
DROP
PURGE ALL_TABLE_RECYCLE DROP Cannot drop tables
RECYCLEBIN BIN DBA_RECYCLEBIN from Recycle Bin
UNDO_TABLESPA
CE UNDO_RETENTION DBA_UNDO_EXTENTS
FALSE
FALSE
Natural Join Non Equi Join Invalid Syntax for Join Inner Join
FALSE NULL
Column constraints,
such as the NOT
NULL and check Column constraints, such
constraint, or default as the NOT NULL and
values are not check constraint, or %TYPE is used when
inherited by items default values are declaring variables to
declared using inherited by items hold database table
%TYPE. declared using %TYPE. values
FALSE
if you change the
database definition of
last_name, perhaps to
make it a longer
character string, the
datatype of v_last_name
memory changes accordingly at
consumption is less run time. faster processing
FALSE
FALSE
FALSE
1&2&3 1&3&4 1&2&4 1&3&5
Leads to compilation
error Displays nothing Leads to Exception
DBMS_OUTPUT.PUT_L
DBMS_OUTPUT.PU DBMSOUTPUT.PUT_LI INE(' The employee
TLINE NE name is : X')
%TYPE variables do
not inherit check %TYPE variables do not %TYPE variables inherit
constraint, inherit default values default values
Return FALSE if a
Return FALSE if no successful fetch has Return the number of
rows was returned been executed. rows fetched
In a table, if no single
Primary Key column can be assigned
constraint has to be uniquely as primary key,
explicitly dropped A primary key can be then a combination of
before completely referenced in another two columns can act as
removing the table. table as a Foreign Key. a Primary Key.
The selector is
followed by one or
more WHEN
clauses, which are
checked
sequentially. The
value of the selector
determines which
clause is executed.
If the value of the
selector equals the
value of a WHEN- The ELSE clause does
clause expression, not works similarly to the
that WHEN clause is ELSE clause in an IF CASE statements can
executed statement be labeled
FALSE
The Subprograms that
A package body are present inside a
appears without package cannot exists
package A package can be separately as database
specification invoked by itself. objects.
max_days_in_year CONSTANT
CONSTANT max_days_in_year
INTEGER := 366; INTEGER := 366; None of the listed option
Value before
change (:OLD) :
Value before delete Value before change
Value After change (:OLD) : Null Value After
(:NEW) : Null change (:NEW) : Not Null None of the above
A GOTO statement
can transfer control
from one IF
statement clause to
another, or from one
CASE statement A GOTO statement can A GOTO statement
WHEN clause to transfer control into an cannot transfer control
another. exception handler. out of a subprogram.
FALSE
Conditional
expressions of the
WHERE and The VALUES clause of The SET clause of the
HAVING clauses the INSERT statement UPDATE statement
OUT IN OUT None of the listed option
CREATE OR
REPLACE
TRIGGER
check_sal BEFORE
UPDATE OF sal ON CREATE OR REPLACE CREATE OR REPLACE
emp FOR EACH TRIGGER check_sal TRIGGER check_sal
ROW WHEN BEFORE UPDATE OF AFTER UPDATE OR sal
(new.sal < old.sal sal ON emp WHEN ON emp WHEN
OR new.sal > old.sal (new.sal < old.sal OR (new.sal < old.sal OR
* 1.1) BEGIN new.sal > old.sal * 1.1) -new.sal > old.sal * 1.1)
RAISE_APPLICATI BEGIN BEGIN
ON_ERROR ( - RAISE_APPLICATION_ RAISE_APPLICATION_
20508, ‘Do not ERROR ( - 20508, ‘Do ERROR ( - 20508, ‘Do
decrease salary not not decrease salary not not decrease salary not
increase by more increase by more than increase by more than None of the listed
than 10%’); END; 10%’); END; 10%’); END; options
combined(positional and
named named) None of the listed option
FALSE
Statement-level FOR EACH ROW trigger Statement-level trigger FOR EACH ROW
trigger on the EMP on the AUDIT_TABLE on the AUDIT_TABLE statement-level trigger
table. table. table. on the EMP table.
dbms_output.put_line(se dbms_output.put_line(
dbms_output.put_lin dbms_output.put_line(se cond_rec.nested_rec.var second_rec.nested_re
e(second_rec.var1); cond_rec.first_rec.var1); 1); c.first_rec.var1);
When a PL/SQL-
packaged construct The package
is referenced for the specification may also
first time, the whole include PRAGMAs, PRAGMAs are not
package is loaded which are directives to allowed as part of
into memory the compiler package specification
combined(positional and
named named) None of the listed option
None of these
commands; you cannot
ALTER employees ALTER TABLE disable multiple triggers
DISABLE ALL employees DISABLE on a table in one
TRIGGERS; ALL TRIGGERS; command.
FALSE
Functions called
from: An UPDATE Functions called from:
or DELETE An UPDATE or DELETE
statement on a table Functions called from: • statement on a table T
T cannot query or A SELECT statement can query or contain
contain DML on the can contain DML DML on the same table
same table T statements T
FALSE
ex_invalid_id
exception will be The program will be TOO MANY ROWS
raised terminated abruptly. exception will be raised
Replacing Replacing
RAISE_APPLICATI Replacing RAISE_APPLICATIO
ON_ERROR(- RAISE_APPLICATION_ N_ERROR(-20000,
20000, 'no negative ERROR(-20000, 'no 'no negative age
age allowed'); to negative age allowed'); allowed'); to
RAISE_APPLICATI to RAISE_APPLICATIO
ONS_ERROR(- RAISE_APPLICATIONS N_ERROR(-
20000, 'no negative _ERROR(-20000,”no 20000,”no negative
age allowed'); will negative age allowed”); age allowed”); will
give the desired No problem in the trigger. will give the desired give the desired
output It gives the desired result output output
FALSE
The value of a
cursor variable can Two types of cursors are
be stored in a 1) Strongly typed and 2) Null cannot be assigned
database column Weakly Typed. to a cursor variable
The select
statement provided
within the cursor
statement gets Open statement retrieves
executed when we the rows from the cursor The active set pointer is
open the cursor. and will process it. set to the second row.
DECLARE
CURSOR DECLARE CURSOR
occupancy_cur IS DECLARE CURSOR occupancy_cur IS
SELECT pet_id, occupancy_cur IS SELECT pet_id,
room_number SELECT pet_id, room_number FROM
FROM occupancy room_number FROM occupancy WHERE
WHERE occupancy WHERE occupied_dt =
occupied_dt = occupied_dt = SYSDATE; BEGIN
SYSDATE; BEGIN SYSDATE; BEGIN FOR OPEN occupancy_cur
FOR occupancy_rec occupancy_rec IN FOR occupancy_rec IN
IN occupancy_cur occupancy_cur LOOP occupancy_cur LOOP
LOOP update_bill update_bill update_bill
(occupancy_rec.pet (occupancy_rec.pet_id, (occupancy_rec.pet_id,
_id, occupancy_rec.room_nu occupancy_rec.room_nu
occupancy_rec.roo mber); END LOOP; mber); END LOOP;
m_number); END CLOSE occupancy_cur; CLOSE occupancy_cur;
LOOP; END; END; END;
DECLARE
exception_name DECLARE
EXCEPTION exception_name DECLARE
PRAGMA EXCEPTION PRAGMA exception_name
EXCEPTION_INIT EXCEPTION_INIT EXCEPTION PRAGMA
(exception_name , (exception_name , EXCEPTION_INIT
err_code); Begin err_code); Begin (exception_name);
Execution section Execution section Begin Execution section
Exception WHEN Exception WHEN Exception WHEN
exception_name PRAGMA exception_init exception_name THEN
THEN Handle the THEN Handle the Handle the exception
exception END; exception END; END;
Whenever a DML
statement (INSERT,
For INSERT UPDATE and DELETE)
operations, the is issued, an implicit
implicit cursor holds cursor is not The implicit cursor is
the data that need automatically associated declared in the
to be inserted with this statement declaration section.
Compiles successfully
and terminates the
program due to an
Result is 10 Result is 0 Compilation fails Exception
FALSE
If v2:=ABC(); is removed
Compiles , executes than the code will Compiles fine and prints Compiles fine and
without any output compile and print 78 the output as 78 prints the output as 1
TRUE
Alternative text to be
ID used to identify displayed if the image is None of the listed
the image not displayed options
By using
rows=50%,50% By using colspan By using rowspan
3&4 2&3 1&4
FALSE
FALSE
TRUE
document.getEleme document.getElementsB
ntsByTagName("p") yTagName("p[0]").innerte None of the listed
[0].innerText; xt() options
It will not print the It will display some error None of the listed
message message on browser options
2 2&3 1
DocumentBuilder
DocumentBuilder b=factory.new None of the listed
b=new Builder(); DocumentBuilder(); options
Java API eXtensible Java API for XML None of the listed
Processing Processing options
<xs:complexType
name="CountrInfo"> <xs:complexType
<xs:choice> name="CountrInfo"><xs:
<xs:element sequence> <xs:element
name="countryNam name="countryName"
e" type="xs:string"/> type="xs:string"/>
<xs:element <xs:element
name="states" name="states"
type="xs:integer"/>< type="xs:integer"/></xs:s
/xs:choice></xs:com equence></xs:complexT None of the listed
plexType> ype> options
<xs:element <xs:element
name="CountryNam name="CountryName"
e" type="xs:string" type="xs:string" None of the listed
fixed="India"/> fixedvalue="India"/> options
<xs:complexType
name="CountrInfo"> <xs:complexType
<xs:choice> name="CountrInfo"><xs:
<xs:element sequence> <xs:element
name="countryNam name="countryName"
e" type="xs:string"/> type="xs:string"/>
<xs:element <xs:element
name="states" name="states"
type="xs:integer"/>< type="xs:integer"/></xs:s
/xs:choice></xs:com equence></xs:complexT None of the listed
plexType> ype> options
FALSE
2&3 1&3 3
createOutputFile()
testSomethingWithF testSomethingWithFile() deleteOutputFile()
ile() createOutputFile() createOutputFile()
deleteOutputFile() deleteOutputFile() testSomethingWithFile()
FALSE
2&3 1&3 3
1&2&3 1&3&4 1&2&4 1&3
TRUE
InputStream and
OutputStream None of the listed
Stream APIs Collection APIs options
None of the listed
PreparedStatement CallableStatement options
If the equals()
method returns
false, the If the hashCode() If the hashCode()
hashCode() comparison == returns comparison == returns
comparison == true, the equals() method true, the equals()
might return true must return true method might return true
java.util.LinkedHash
Set java.util.List java.util.ArrayList
Mark Employee
class with final Make Employee class Make Employee class
keyword methods private methods public
Declare the Declare the
ProgrammerAnalyst ProgrammerAnalyst None of the listed
class has private class has final options
FALSE
FALSE
Allows
interoperability
among unrelated Reduces effort to learn All of the listed
APIs and to use new APIs Fosters software reuse options
FALSE
DECLARE TYPE
EmpRec IS DECLARE TYPE
RECORD ( emp_id EmpRec IS RECORD
emp.empno%TYPE, ( emp_id emp.empno
job_title %TYPE, job_title
VARCHAR2(9), VARCHAR2(9), salary
salary NUMBER(7,2));
NUMBER(7,2)); emp_info EmpRec;
emp_info EmpRec; emp_null EmpRec;
BEGIN BEGIN
emp_info.emp_id := emp_info.emp_id :=
7788; 7788;
emp_info.job_title := emp_info.job_title :=
'ANALYST'; 'ANALYST';
emp_info.salary := emp_info.salary := 3500;
3500; emp_info := emp_info := emp_null;
emp_null; END; END; None of the above
FALSE
CREATE TRIGGER
log_errors AFTER
SERVERERROR
ON DATABASE
BEGIN IF CREATE TRIGGER
(IS_SERVERERRO AFTER SERVERERROR
R (1017)) THEN ON DATABASE BEGIN
<special processing IF (IS_SERVERERROR
of logon error> (1017)) THEN <special
ELSE <log error processing of logon
number> END IF; error> ELSE <log error
END; number> END IF; END; None of the above
CREATE OR
REPLACE
PACKAGE
employee_package
AS TYPE
t_ref_cursor IS REF
CURSOR; TYPE
emp_rec IS CREATE OR REPLACE
RECORD PACKAGE
( employeeid employee_package AS
NUMBER, firstname TYPE t_ref_cursor IS
VARCHAR2(10), REF CURSOR; TYPE
lastname emp_rec IS RECORD
VARCHAR2(10), ( employeeid NUMBER,
salary NUMBER); firstname VARCHAR2,
minimum_count lastname VARCHAR2,
CONSTANT salary NUMBER);
NUMBER := 4; minimum_count
FUNCTION CONSTANT NUMBER :=
get_employee 4; FUNCTION
RETURN emp_rec; get_employee RETURN
PROCEDURE emp_rec; PROCEDURE
update_salary update_salary
(employeeid IN (employeeid IN
NUMBER); END NUMBER); END None of the listed
employee_package; employee_package; options
Global enforcement
of business rules. Easier maintenance. If a
Define a trigger business policy changes, Improve performance in
once and then reuse you need to change only client/server
it for any application the corresponding trigger environment. All rules
that uses the program instead of each run in the server before All of the listed
database. application program. the result returns. options
COLLECTION_IS_N
ULL NO_DATA_FOUND VALUE_ERROR
FALSE
SELECT dept_id,
MIN (salary), MAX SELECT dept_id, MIN
(salary) FROM SELECT dept_id, (salary), MAX (salary)
employees WHERE MIN(salary), MAX(salary) FROM employees
MIN (salary) < 2000 FROM employees GROUP BY dept_id
AND MAX (salary) > HAVING MIN (salary) < HAVING MIN(salary) <
5000 GROUP BY 2000 AND MAX (salary) 2000 AND MAX (salary)
dept_id > 5000 > 5000
FALSE
IF
old_company_rec.name
=
new_company_rec.name
AND
old_company_rec.incorp
_date =
new_company_rec.incor
p_date AND
old_company_rec.addres
IF old_company_rec s1 =
> new_company_rec.addre
new_company_rec) ss1 AND THEN ... the Records cannot be
THEN -------- END two records are compared with each
IF; identical ... END IF; other.
SUBSCRIPT_BEYOND_ None of the listed
NO_DATA_FOUND COUNT options
CREATE OR
REPLACE
TRIGGER CREATE OR REPLACE
salary_changes TRIGGER
BEFORE DELETE salary_changes
OR INSERT OR BEFORE DELETE OR
UPDATE ON INSERT OR UPDATE
TBL_EMPLOYEES ON TBL_EMPLOYEES
FOR EACH ROW DECLARE sal_diff
DECLARE sal_diff NUMBER; BEGIN
NUMBER; BEGIN sal_diff := :NEW.salary
DBMS_OUTPUT.PU - :OLD.salary;
T(:OLD.firstname||','| DBMS_OUTPUT.PUT(:O
|:OLD.lastname|| ': LD.firstname||','||:OLD.las
'); tname|| ': ');
DBMS_OUTPUT.PU DBMS_OUTPUT.PUT('Ol
T('Old salary = ' || d salary = ' || :OLD.salary
:OLD.salary || ', '); || ', ');
DBMS_OUTPUT.PU DBMS_OUTPUT.PUT('N
T('New salary = ' ew salary = ' ||
|| :NEW.salary || ', '); :NEW.salary || ', ');
DBMS_OUTPUT.PU DBMS_OUTPUT.PUT_LI
T_LINE('Difference: NE('Difference: ' ||
' || sal_diff); END; sal_diff); END;
SELECT ABS(-80),
Absolute FROM SELECT ABS("-80") SELECT ABS('-80')
DUAL Absolute FROM DUAL Absolute FROM DUAL
Use Aggregate
function along with Use Aggregate function
WHERE clause in along with ORDER BY
query to retrieve clause in query to None of the listed
result retrieve result options
DECLARE
CURSOR c1 is
SELECT
employeeid,
firstname||','||
lastname "Name" ,
salary FROM
tbl_employees
ORDER BY salary
DESC; DECLARE CURSOR c1
v_employeeid is SELECT employeeid,
NUMBER; v_name firstname||','||lastname
VARCHAR2(30); "Name" , salary FROM
v_salary NUMBER; tbl_employees ORDER
BEGIN OPEN c1; BY salary DESC;
FOR i IN 1..4 LOOP v_employeeid NUMBER;
FETCH c1 INTO v_name VARCHAR2(30);
v_employeeid, v_salary NUMBER;
v_name, v_salary; BEGIN OPEN c1;
INSERT INTO temp FETCH c1 INTO
VALUES v_employeeid, v_name,
(v_employeeid, v_salary; INSERT INTO
v_name, v_salary); temp VALUES
EXIT WHEN (v_employeeid, v_name,
c1%NOTFOUND; v_salary); EXIT WHEN
COMMIT; END c1%NOTFOUND;
LOOP; CLOSE c1; COMMIT; END LOOP; None of the listed
END; CLOSE c1; END; options
Create Stored
Procedure Create index Create Trigger
FALSE
FALSE
FALSE
FALSE
DECLARE x
VARCHAR2 (5);
BEGIN SELECT BEGIN SELECT
dummy_var INTO x pkg_var.dummy_var
FROM DUAL; INTO x FROM DUAL;
DBMS_OUTPUT.pu DBMS_OUTPUT.put_line None of the listed
t_line (x); END; (x); END; options
FALSE
FALSE
Model - View -
Controller Chain of Responsibility Bridge Pattern
FALSE
Factory Abstract Factory MVC
It increases the
complexity of the
remote interface and It increases the network
access by removing Minimizes the latency performance by
coarse grained and server resource introducing multiple fine
methods usage grained remote requests
Chain of
Responsibility
pattern Template Method Pattern MVC Pattern
Decorator Pattern Proxy Pattern Template Pattern
Software coupling
defined as the Cohesion is clear Cohesion is the OO
degree to which a separation of related principle most closely
software module functionality into distinct associated with
relies or depends on modules, Components , Cohesion maximizes allowing an object to
other modules. or classes. code reusability have many types
FALSE
AnswerD
Grade2 Grade3 Grade4 Grade5 escription QuestionMAnswerMedAuthor Reviewer Is Numeric
Is Numeric