Summat Ive
Summat Ive
What will be the output of following super class super Compilation None 4
code? exe method class exe error
super class method
class Super2 display sub class
{ method display
public void display() method
{
System.out.println("super class display
method");
}
public void exe()
{
System.out.println("super class exe
method");
display();
public void display()
{
System.out.println("sub class display
method");
}
public static void main(String [] args)
{
InheritMethod o= new InheritMethod();
o.exe();
}
}
Please select the correct statement with JavaScript JavaScript all of the listed JavaScript 3
respect to including Javascript in HTML can be can be options can be
pages. written written as written
inside the an inside the
header external page body
file and
imported
to the
page
What is the data type of m in the String type int Type set1 type Object type 4
following code?
import.java.util.*;
public class set1
{
public static void main (String [] args)
{
Set s= new HashSet();
s.add(20);
s.add("abc");
for(____m.s)
System.out.println(m);
}
}
Tags for using JavaBeans with JSP? <jsp:useBean <jsp:useB <jsp:useBean> <jsp:setProp 1
><jsp:setProp ean> and<jsp:plugin> erty>
erty> and and<jsp:in <jsp:getProp
<jsp:getProp clude> erty> and
erty> <jsp:forward
>
Which method can be used to submit POST GET REQUEST PUT 1
form data that should not be exposed for
viewing?
How do you separate ASP.NET code from Using Using Using Code- Using 3
the user interface? Custom User Behind Forms ASP.NET
Controls Controls web pages
What will be the output for following welcome error None compilation 4
code? error
public class Exe3
{
public static void main (String [] args)
{
try
{
int i=10;
int j=1/0;
return;
Which of the following assembles can be Friend Private Public Shared 4
stored in Global Assembly Cache? Assemblies Assemblie Assemblies Assemblies
s
Manoj has created the Hello servlet that <servlet><ser <servlet>< <servlet><servlet- <servlet><se 4
displaya Welcome in the browser window. vlet- servlet- name>hello</ser rvlet-
The code of the servlet is: name>mywo name>hell vlet-name> name>hello<
rld o</servlet- <servlet- /servlet-
package myworld; hello</servle name> class>hello</serv name>
import java.io.IOException; t-name> <servlet- let-class> <servlet-
import java.io.PrintWriter; <servlet- class>my </servlet><servl class>mywor
import javax.servlet.ServletConfig; class>hello</ world.hell et- ld.hello</ser
import javax.servlet.ServletException; servlet-class> o</servlet- mapping><servle vlet-class>
import javax.servlet.http.HttpServlet; </servlet><se class> t- </servlet><s
import rvlet- </servlet> name>hello</ser ervlet-
javax.servlet.http.HttpServletRequest; mapping><se <servlet- vlet-name> <url- mapping><s
import rvlet- mapping> pattern>/hello</ ervlet-
javax.servlet.http.HttpServletResponse; name>hello< <servlet- url- name>hello<
/servlet- name>hell pattern></servle /servlet-
public class hello extends HTTPServlet name> <url- o</servlet- t-mapping> name> <url-
{ pattern>/hell name> pattern>/hel
protected void doGet(HttpServletRequest o</url- <url- lo</url-
request, HttpServletResponse response) pattern></se pattern>h pattern></se
throws ServletException, IOException rvlet- ello</url- rvlet-
{ mapping> pattern>< mapping>
PrintWriter out=response.getWriter(); /servlet-
out.println("<html>"); mapping>
out.println("<head>");
out.println("<title> My Servlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h>WELCOME</h>");
Which two statements about packages You achieve A package Packages can be The contents 1,4
are true? information is loaded nested of packages
hiding by into can be
making memory shared by
package each time many
constructs it is applications
private. invoked
Consider you are developing shopping cart Implement None of Implement using Implement 4
application you have to store details of using Arrays the listed File APIs using
items purchased by the each customer in options Collection
intermediate memory before storing APIs
purchase details in actual database
permanently note that number of
different items purchased by customer is
not definite it may vary.n How do you
implement given requirement using java
considering best performance of the
application?
Which of the following statements are All objects A class A class is a Instance 1,2,4
correct? created from can blueprint or a members of
a class will contain template a class can
occupy equal only according to be accessed
number of instance which objects only through
bytes in data and are created an object of
memory instance that class
member
function
Select correct naming convention used Class name Class Should be simple Class name 1,3
during class declaration. should be name can and descriptive starts with
nouns be java lower case
vaild
keyword
gen has written a JSP Code in which he is <html> <%! <html> <html> <%String <html> <%! 4
calling the getMessage() function which is String <%= String message="hello String
returning a value "hello world". You have message="he message= world", String message="h
to identify which code should he use to llo world", "hello getMessage(){ ello world",
get this? String world", return message;} String
getMessage() String %> Message for getMessage(
{ return getMessa you:<%=getMess ){ return
message;} %> ge(){ age() %> </html> message;}
Message for return %> Message
you:<%! message;} for
getMessage() %> you:<%=get
%> </html> Message Message()
for %> </html>
you:<%=g
etMessag
e() %>
</html>
Which statements are true about large A sql_variant Large Large varchar Large 1,4
varchar? cannot varchar columns are the varchar
contain a column only columns columns
large varchar can be that can be used cannot be
data type specified as partitioning used as
as a key key columns partioning
column in key columns
an index
What will be the output for following both strings compilatio String operator both string 1
code? are not equal n error cannot compare are equal
public class CompareStrings{ using ==
public static void main(String [] args){ operator
if(" string ".trim()=="string")
System.out.println("both strings are
equal");
else
System.out.println("both strings are not
equal");
}
}
public class Threads An exception The code Compilation fails The code 1
{ is thrown at executes executes
public static void main(String[]args) runtime normally normally but
{ and prints nothing is
new Threads().go(); "Run" printed
}
public void go()
{
Runnable r = new Runnable()
{
public void run()
{
System.out.print("Run");
}
};
Which of the following statements are Both A and B Both A A is true and B is A is false and 2
true? are false and B are false B is true
true
Statement A: Arrays have a fixed upper
bound, but nested tables are unbounded.
How does SOAP enable creation 7 usage Provides a Uses Enables Uses 1,3,4
of Web services? robust proprietar messaging over standard
mechanism y means HTTP means of
to Data & of describing
Structure describing data
over the web data
What does the following code denote? The following The The following The 1,2,4
var orderedCustomers= from customer in code is an following code is an following
Customers where example of code example of code shows
customer,Grade == "Premium" orderedby LINQ query shows the Database query the syntax
customer.Name select syntax for for Ordering
customer.Name; Filtering data
select one or more: data
Which JSTL code snippet can be used to <a <a <a href='<c:link 2
perform URL rewriting? href='<c:link href='<c:u url="cognizant.js
Select one: value="cogni rl p"/>'/>
zant.jsp"/>'/>value="co
gnizant.jsp
"/>'/>
Consider you are developing an ATM Using object None Using object Using Thread 4
application for ABC Bank using java serialization deserialization Synchronizat
application. Several account holders of ion
ABC Bank have opted for add-on cards.
There is a chance that two users may
access the same account at same time
and do transaction simultaneously
knowingly or unknowingly from different
ATM machine from same or different
bank branches. As developer you have to
ensure that when one user login to
account until he finishes his transaction
account should be locked to other users
who are trying access the same account.
How do you implement given requirement
programmatically using java?
class Customer:Contact
{
public string Gender { get,set;}
public decimal income { get,set;}
}
What are the Tools & plugs-ins commonly ANT EMMA JUnit 2,3
used in testing java application code?
What are the benefits of using a stored Efficient Reduced Efficient Precompiled 1,2,4
procedure? reuse of code network compilation execution,
traffic hence faster
Given that URL-rewriting must be used for jsessionid containeri sessionid servletid 1
session management, identity the query d
string attribute used when URL-rewriting.
Mention some of the important functions Modifying allowing None of the Security 1,4
of Servlet Filter. the request all the listed options Checks
or response users
consider you are creating a cursor. Choose Declare,Fetch Open,Fetc Declare,Open,Fe Open, 3
the correct sequence of steps to work , Open Fetch h,Close tch,Close Declare,Fetc
with cursors? h,Close
What is the use of ServletConfig A servlet All of the The Defines an 2
interface? configuration listed ServletConfig object to
object used options object is provide
by a servlet contained within client
container to the request
pass ServletContext information
information object to a servlet
to a servlet
during
initialization
<?xml version="1.0" encoding="UTF-8"?> <%@ taglib <%@ <%@ taglib <%@ taglib 2
<taglibxmlns="http://java.sun.com/xml/ns prefix="pre" taglib prefix="pre" prefix="pre"
/j2ee" uri="testuri" prefix="pr uri="testuri"%>< uri="testuri"
xmlns.xsi="http://www.w3.org/2001/XML %><html><h e" html><head> %><html><h
Schema-instance" ead> <title> uri="testu <title> Demo ead> <title>
xsi.schemaLocation="http://java.sun.com/ Demo ri"%><ht </title></head>< Demo
xml/ns/j2eeweb- </title></hea ml><head helloworld </title></he
jsptaglibrary_2_0 xsd" version="2.0"> d><helloworl > <title> "attrib"=john/>< ad><pre:hell
d Demo /html> oworld/></h
<tlib-version>2.0</tlib-version> attrib="john" </title></ tml>
<short- ></html> head><pr
name>SimpleTagForLearning</short- e:hellowo
name> rld
attrib="jo
hn"/></ht
ml>
Which complex type specifies that the <xs:complexT <xs:compl None of the <xs:complex 4
elements should always be in the order ype exType listed options Type
specified? name="Coun name="Co name="Coun
trinfo"><xs:c untrinfo"> trinfo"><xs:s
hoice><xs:ele <xs:all><x equence><xs
ment s:element :element
name="count name="co name="coun
ryName" untryNam tryName"
type="xs:stri e" type="xs:stri
ng"/> type="xs:s ng"/>
<xs:element tring"/> <xs:element
name="state <xs:eleme name="state
s" nt s"
type="xs:inte name="st type="xs:int
ger"/></xs:ch ates" eger"/></xs:
oice></xs:co type="xs:i sequence></
mplexType> nteger"/> xs:complexT
</xs:all></ ype>
xs:comple
xType>
Which statements about JDBC are true? JDBC is an JDBC is an JDBC has 5 types JDBC stands 1,2,4
API to access API to of Drivers for Java
relational bridge the DataBase
databases, object- Connectivity
spreadsheets relational
and flat files mismatch
between
OO
programs
and
relational
databases
What is the significance of the @ Register The directive The The directive is The directive 2
directive in a ASP.NET web page? is used to directive used to register is used to
register a is used to a web site register an
web page register a application
user
control
Given a Filter class definition with this request.doFil chain.doFi request.forward( chain.forwar 2
method: ter(request,r lter(reque request,respons d(request,re
21. public void doFilter(ServletRequest esponse); st,respons e); sponse);
request, e);
22. Servletresponse response,
23. filterChain chain)
24. throws ServletException, IOException {
25. // insert code here
26. }
Which code line should you insert at line
25 to property invoke the next filter in the
chain, or the target servlet if there are no
more filters?
Which of the following statements are Pass by An Variable passed
Argument 1,4
correct? reference argument as out that uses
eliminates passed to arguments need
params
the overhead a ref to be initialized
keyword
of copying parameter prior to being
must be the
large data need not passed last
be argument of
initialized variable
first argument
list of a
method
public class MethodSigExample Refractor> Refractor> Refractor> Refractor> 3
{ move Extract Change Method move
public int test(String s, int i) method method Signature
{
int x=i+s.length();
return x;
}
}
During refactoring method signature can
be changed using the option:
Select one:
What will be the output of the following It will print It will It will not print None 3
Java Script code whrn the button is the message display the message
clicked? "Displaying some
<body> message by error
<script type="text/javascript"> using message
function displayMessage(){ javaScript" on
document.write("Displaying message by browser
using javaScript");
}
</script>
<button type="button"
onclick="DISPLAYMESSAGE()"> Display
Message</button>
</body>
Select one:
What is the syntax of Expression Language ${expr} ${"expr"} $[expr] #{expr} 1
in a JSP page?
Which statements are applicable to Web The The data The The 1,2,3,4
services? information transfer is communication information
is passed XML protocol most is passed
back & forth based often used for back & forth
through Web Services is through
HTTP SOAP TCP/IP
Which two statements are true? Deadlocked If a piece The JVM It is possible 2,4
Select one or more: threads of code is implementation for more
release once capable of guarantees that than two
their sleep() deadlocki multiple threads threads to
method's ng, you cannot enter deadlock at
sleep cannot into a once
duration has eliminate deadlocked state
expired the
possibility
of
deadlocki
ng by
inserting
invocation
s of
Thread.yie
ld();
What are the benefits of using a stored Efficient Reduced Precompiled Efficient 2,3,4
procedure? compilation network execution, hence reuse of
traffic faster code
Request implicit object is which of the ServletHttpR HttpServle ServletRequest HttpRequest 2
following type? equest tRequest
What will be the output of following Executing try Executing Runtime Compile 4
code? Runtime try after Exception Time
try Exception try Exception
{ Executing
System.out.println("Executing try"); catch
}
System.out.println("after try");
catch(Exception ex)
{
System.out.println("Executing catch");
}
Select the advantages of using coding all of the Improves improves easy Improves 1
conventions in java application listed options easy understanding Readability
development. maintena of the
nce sofware
which of the following statements are A is true, B is Both are Both are false A is false, B 2
true? false true is true
XYZ company database has SALES table None Use Use Aggregate Use 3
which captures all department sales Aggregate function along Aggregate
information. You have been asked to function with GROUP BY function
create department wise summarized total along with clause in query along with
sales report from SALES table. Which of WHERE to retrieve result ORDER BY
the following correct option will fetch you clause in clause in
meaning full result? query to query to
retrieve retrieve
result result
Which statements are applicable to Web The The data The The 1,2,3,4
services? information transfer is communication information
is passed XML protocol most is passed
back & forth based often used for back & forth
through Web Services is through
HTTP SOAP TCP/IP
What are the benefits of Logging? None Debug Detect compiler Trouble 2,3,4
applicatio errors easily Shoot
ns issues performance
easily problems
Which of the following is applicable to These are These are These are also All of the 4
Servlet Containers? responsible specialize referred to as listed
for managing d web web containers options
the lifecycle servers, or web engines
of servlets, which
mapping a support
URL to a servlet
particular execution
servlet and
ensuring that
the URL
requester has
got the
correct
access right
Select the benefits of versioning the Formatting Branching Synchronization Backup and 2,3,4
software in java application development. and Restore
merging
Which statement creates DocumentBui None DocumentBuilde DocumentBu 4
DocumentBuilderfactory instance? lderFactory rFactory f=new ilderFactory
f=BuilderFact DocumentBuilde f=Document
ory.newInsta rFactory(); BuilderFacto
nce(); ry.newInstan
ce();
What will be the output of the following It will display It will It will display the It will display 1
code snippet? the current display date as the time as
time as the date mm:dd;yy hh:mm:ss
<% page language="java"%> hh:mm:ss and time
<html>
<head></head>
<body>
<%java.util.Date now= new
java.util.Date();%>
<H1><%=now.getHours()%>:<%=now.get
Minutes()%>:<%=now.getSeconds()%></H
1>
</body>
</html>
In Java script, for accessing first paragraph document.ge document document.getEle None 1
tag in the document which of the tElementsBy .getEleme mentsByTagNam
statement is used? TagName("p" ntsByTagN e("p"[0])
)[0] ame("p")
How to divide the page into two rows By using By using By using By using 2
when we are using frameset? colspan rows=50% rowspan cols=50%,50
,50% %
What is the correct syntax of the <?xml <?xml None <xml 2
declaration which defines the XML version="1.0" version=" version="1.0
version? /> 1.0"?> "/>
Identify the code snippet Compilation Compilati Runs without Compiles, 4
DECLARE Fails on Fails any output executes and
var_num1 number:=50; due to prints 50
var_num2 number; error in
BEGIN line 1
var_num2 :=200;
DECLARE
var_mult number;
var_num1 number:=100; --LINE 1
BEGIN
var_mult :=var_num1*var_num2;
END;
dbms_output.put_line(var_num1);
END;
Which of the following code line will session.isAliv session.in session.isNew(fal session.rem 2
destroy a session? e=false; validate(); se); oveSession()
;
Which of the following are true about All members Protected A class can be If one class is 1
protected access specifier? of abstract is default declared as having
class are by access protected protected
default modifier method then
protected of a child the method
class is available
for subclass
which is
present in
another
package
How to drop all tables from recycle bin? DROP Cannot PURGE DROP 3
DBA_RECYCL drop RECYCLEBIN ALL_TABLE_
EBIN tables RECYCLEBIN
from
Recycle
Bin
Which of the following variable represents application exception config request 2
the uncaught throwable object that
resulted from a call to the error page?
What will be the output for following 6,0 0,5 0,6 compilation 3
code? error
public class While {
static int i;
public static void main(String[]args){
System.out.println(i);
while(i<=5){
i++;
}
System.out.println(i);
}
}
XYZ company database has Customer Implement Implemen Implement using Implement 2
personal Information. View table using using Stored t using cursors using
which customer can update their personal Procedures triggers functions
information like address, phone number
fields when user updates address and
phone number fields in view table. We
need to take care of updating address and
phone number fields in underlying
database base table automatically. What
right solution do you suggest to
implement this requirement?
What will be the output of the below Query Prints 14 Prints 6 Prints 0 4
query? contains
select instr('My SQL World','a') from dual; error
How will you access a servlet context ${initParam[" ${init.com ${contextParam. ${init['comp 1
initialization parameter named "company- company- pany- company-name} any-name']}
name"? name"]} name}
"Variables in Java Script should be TRUE FALSE 2
declared with data types".
State true or false.
Which method removes the attribute with void void void void 3
the given name from the ServletContext clearAttribut removeAt removeAttribute flushAttribut
interface? e(String tribute(Ob (String name) e(String
name) ject name) name)
A Web application developed for an <%@ page <form <jsp:forward <%@ include 4
institution requires insertion of a header import="Hea method=" page="Header.ht file="Header
file comprising the logo and institution der.html"%> post" ml"> .html"%>
name. Identify the correct JSP tag from action="H
the options given below to add the logo eader.htm
and institution name to all the pages of l">
the Web application. Select one:
How to divide the page into two equal By using By using By using By using 3,4
halves when we are using frameset? colspan rowspan cols=50%.50% rows=50%.5
0%
Examine the PL/SQL Block compilation Result is 0 Exception Result is 10 2
declare fails occurred divide
result Number; by zero
num1 Number:=&number1;
num2 Number:=&number2;
begin
select num1/num2 into result from dual;
dbms_output.put_line('Result is '||result);
exception
when ZEROS_DIVIDE then
dbms_output.put_line('Exception Occured
Divide by Zero');
end;
/
What will be the output of the above code
when user passes the value for NUM1 as 0
and NUM2 as 10?
Consider you are developing web <%@ page <%@ page <%@ include <%@ include 2
application. Which of the following option session="true import="j autoFlush="java. import="java
is avalid in JSP for importing the package? "%> ava.util.*" util.*"%> .util.*"%>
%>
Consider the following statements: A is true and Both are A is false, B is Both are 2
B is false true true false
Statement A: When tags are implemented
with tag handlers written in Java, each tag
in the library must be declared in the TLD
with a tag element.
What part of database trigger determines Trigger type Trigger Trigger timing Trigger body 1
the number of times the trigger body event
executes?
What will be the output for following print 34 print 1 print 034 print 3 3
code?
public class Exception1{
public static void main(String args[]){
int i=1,j=1;
try{
i++;
j--;
if(i/j > 1)
i++;
}catch(AirthmeticException 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);
}
}
XYZ Company database tables are Use database Create Use database User cursors 2
accessed by several users but for few functions views trigger
users need to be provided provision for
updating information like address, phone
number, email address in secured manner
without providing direct access to
underlying database base tables. What
will the right solution you will implement
in such scenerio to meet requirement?
public class Person This class The The code will Compilation 1
{ must also equals compile as fails because
private String name; implement method Object class's the private
public Person(String name) { this.name = the hashCode does NOT equals method attribute
name;} method as proprely as well p.name
public boolean equals(Person p) well override cannot be
{ the Object accessed
return p.name.equals(this.name); class's
} equals
} method
Which statement is true?
Consider you are developing a JDBC PreparedStat None CallableStateme Statement 3
application, where you have to retrieve ement nt
quarterly report from databse by
executing databse store procedure
created by databse developer. Which
statement API you will use to execute
store procedure and retrieve resultSet
information?
Translation and Complitaion of JSP Deployment Execution None Undeployme 1
happens during: nt
Enumeration is having remove() method. TRUE FALSE 2
State true or false.
If your JDBC connection is in auto-commit TRUE FALSE 1
mode,which it is by default, then every
SQL statement is committed to the
databse upon its completion. State true or
false.
What are the types of refactoring? Method Logical Class Level Physical 1,3,4
Level Structure Structure Structure
Which of the following statements is It occurs It occurs It occurs during It occurs 2
correct about an Exception? during linking at run- compilation during Just-
time In-Time
Compilation
Consider the following code foe an HTML A request is A request The parameter The 1,4
form. sent with is sent username is the parameter
HTTP method with HTTP only parameter username
<form action=?/servlet/Login?> GET method passed to the and
<input type=?text? name=?username? POST web server in sbbutton are
value=?enter username?/> the request passed to
<input type=?submit? name=?sbbutton> the web
value=?signin!..?/> server in the
</form> request URL
Which of the following statements is Delegates are Delegates Only one Delegates 3
incorrect about delegate? object are method can be are type-safe
oriented reference called using a
types delegate
select the right coding best practices Copy Use for Use Collections All the listed 1,3
followed while using java Collections. collections loop with generic options
into other instead of with same type
collections by iterator of data
calling
addAll()
methods
instead using
iterator to
copy each
collection
element
identify the type of variable declared Host Variable Bind Invalid Variable Global 2
VARIABLE City Vatchar2(20). Variable declaration Variable
How can you execute a stored procedure Call method Call Call method Call method 4
in the database? run() on a method execute() on a execute() on
ProjectComm executePr StoredProcedure a
and Object ocedure() Object CallableProc
on a edure Object
Statement
Object
Which statement is true about Java server Used to build all of the Platform HTML files 1,4
pages? dynamic web listed dependent with special
pages options tags that
contain java
source code
to generate
dynamic
content
You have a row level BEFORE UPDATE The Trigger The The Trigger fires The trigger 3
trigger on the EMP table. This trigger fails because Trigger successfully fails because
contains a SELECT statement on the EMP you cannot fails it needs to
table to ensure that the new salary value use the because a be a row
falls within the minimum and maximum minimum SELECT level AFTER
salary for a given job title. What happens and statement UPDATE
when you try to update a salary value in maximum on the trigger
the EMP table? functions in a table
BEFORE being
UPDATE updated is
trigger not
allowed
Consider the following statements: A is true and Both are A is false, B is Both are 2
B is false true true false
Statement A: A resource is passive when it
does not have any processing of its own.
What will be the output for following compilation both both strings are Strings 2
code? error strings are equal cannot be
not equal compared
public class CompareStrings{ using ==
operator
public static void main(String [] args){
else
Which of the following statements are Stmt 1 is true Both are Stmt 2 is true Both are 3
true? and stmt 2 is true and stmt 1 is false
false false
Statement 1: When athread is sleeping as
a result of sleep(), it releases its locks.
How do you declare a tag library within a By using By using By using taglib By using 3
JSP page to use custom tags? unique scriptlet directive path to the
variable tag handler
What will be the output of below query? query adds 10 adds 10 days to adds 10 2
select contains minutes the current seconds to
to_CHAR(sysdate+(10/400),'HH:MI:SS') error to the timestamp the current
from dual; current timestamp
timestam
p
"Consider Vijay is developing web page II I Both I & II None 2
using HTML. Which method he can use for
sending data security on submitting the
form?
I. POST
II. GET"