Summat Ive

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

Question

Option 1
Iterator is having previous() method.State TRUE
True or False.

Option 4

Correct
2

Which of the Following attributes of page isScriptingEn isELIgnore language


directive are invalid?
abled
d

session

What will be the output of following


code?

None

JavaScript
can be
written
inside the
page body

class Super2
{
public void display()
{
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
respect to including Javascript in HTML
pages.

Option 2
FALSE

Option 3

super class
exe method
super class
display
method

super
class exe
method
sub class
display
method

Compilation
error

JavaScript
can be
written
inside the
header

JavaScript all of the listed


can be
options
written as
an
external
file and
imported
to the
page

What is the data type of m in the


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?

String type

int Type

<jsp:useBean
><jsp:setProp
erty> and
<jsp:getProp
erty>

<jsp:useB <jsp:useBean>
ean>
and<jsp:plugin>
and<jsp:in
clude>

Which method can be used to submit


POST
form data that should not be exposed for
viewing?
How do you separate ASP.NET code from Using
the user interface?
Custom
Controls
What will be the output for following
welcome
code?
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
stored in Global Assembly Cache?
Assemblies

set1 type

GET

REQUEST

Using
User
Controls
error

Using CodeBehind Forms


None

Private
Public
Assemblie Assemblies
s

Object type 4

<jsp:setProp 1
erty>
<jsp:getProp
erty> and
<jsp:forward
>
PUT
1

Using
3
ASP.NET
web pages
compilation 4
error

Shared
Assemblies

Manoj has created the Hello servlet that <servlet><ser <servlet>< <servlet><servlet- <servlet><se 4
displaya Welcome in the browser window. vletservletname>hello</ser rvletThe code of the servlet is:
name>mywo name>hell vlet-name>
name>hello<
rld
o</servlet- <servlet/servletpackage myworld;
hello</servle name>
class>hello</serv name>
import java.io.IOException;
t-name>
<servlet- let-class>
<servletimport java.io.PrintWriter;
<servletclass>my </servlet><servl class>mywor
import javax.servlet.ServletConfig;
class>hello</ world.hell etld.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 ervletjavax.servlet.http.HttpServletRequest;
mapping><se <servlet- vlet-name> <url- mapping><s
import
rvletmapping> pattern>/hello</ ervletjavax.servlet.http.HttpServletResponse;
name>hello< <servlet- urlname>hello<
/servletname>hell pattern></servle /servletpublic class hello extends HTTPServlet
name> <url- o</servlet- t-mapping>
name> <url{
pattern>/hell name>
pattern>/hel
protected void doGet(HttpServletRequest o</url<urllo</urlrequest, HttpServletResponse response) pattern></se pattern>h
pattern></se
throws ServletException, IOException
rvletello</urlrvlet{
mapping>
pattern><
mapping>
PrintWriter out=response.getWriter();
/servletout.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
Which of the following statements is
incorrect about a delegate?

A single
Delegates Delegates are
Delegate is a 4
delegate can can be
type-safe
value type
invoke more shared
wrappers for
than one
function pointers
method

Identify the code snippet


declare EmpNAME;
begin
SELECT ENAME INTO EmpNAME FROM
Emp WHERE EmpNo=101172;
dbms_output.put_line(EmpName);
end;
What will be the output of the above
code?
The result of 10.987+"30.765" is
____________.
What does the LOCAL argument in the
DECLARE CURSOR statement denote?

Error

ENAME of
EmpNO
101172

10.9873.765 10.98730.
765
The LOCAL
Specifies
cursor will be that
implicitly
cursor can
deallocated be
when the
available
batch, stored only in the
procedure or batch,
trigger
stored
terminates procedure
or trigger
in which
the cursor
was
created

10.987
The LOCAL
cursor will have
to be explicitly
deallocated
when the batch,
stored
procedure or
trigger
terminates

2
Specifies
that cursor
can be
available to
all local
resources

1,2

Select two runtime exceptions.

NullPointerEx IOExcepti ArrayIndexOutOf SQLExceptio 1,3


ception
on
BoundsException n

Culture & UICulture properties of a page


class can have different culture values.
State True or False.

TRUE

FALSE

Which of the following statements is


It will output:
correct about the C#.NET program given Bad Format
below if a value "6" is input to it? using
System.
namespace IndiabixConsoleApplication
{
class MYProgram
{
static void Main(string [] args)
{
int index;
int val = 44;
int [] a= new int[5];
try
{
Console.Write("Enter a number");
index=Convert.Toint32(Console.ReadLine(
));
a[index]=val;
}
catch(FormatException e)

It will
output:
Remaining
Program

Consider you are developing shopping cart Implement None of Implement using
application you have to store details of
using Arrays the listed File APIs
items purchased by the each customer in
options
intermediate memory before storing
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?

Implement
using
Collection
APIs

Which of the following statements are


correct?

Instance
1,2,4
members of
a class can
be accessed
only through
an object of
that class

All objects
created from
a class will
occupy equal
number of
bytes in
memory

It will
output:
Bad
Format
Remaining
Program

A class
can
contain
only
instance
data and
instance
member
function

It will ouput:
Index out of
bounds
Remaining
Program

A class is a
blueprint or a
template
according to
which objects
are created

Select correct naming convention used


during class declaration.

Class name
should be
nouns

Class
Should be simple Class name
name can and descriptive starts with
be java
lower case
vaild
keyword

1,3

<pref.tag1>
<%=result %>
</pref.tag1>
Which of the following are valid for the
<body-content> tag of tag1?
interface B
{
public void bM1();
public void bM2();
}
abstract class A implements B
{
public abstract void aM1();
public abstract void aM2();
public void bM1(){};
}
public class Demo extends A
{
}
In above scenerio class Demo must
override which methods?
Which of the following statements are
correct?

empty

scriptless tag dependant

JSP

public void
aM1(){}

All the
listed
options

public void
bM2(){}

public void
aM2(){}

Argument
that uses
param
keyword
must be the
last
argument of
variable
argument list
of a method

Pass by
reference
eliminates
the
overhead
of copying
large data

An argument
passed to the ref
parameter need
not be initialized

Variable
1,2
passed as
out
arguments
need to be
initialized
prior to
being passes

Which of the following Listener is used to HttpSessionB ServletRe HttpSessionListe ServletRequ 3


track number of active sessions or users? indingListene questListe ner
estListener
r
ner

Which statements are true about hash


Tables?

The key can


be the null
reference

The value The key cannot


cannot be be the null
the null
reference
reference

The value
can be the
null
reference

gen has written a JSP Code in which he is


calling the getMessage() function which is
returning a value "hello world". You have
to identify which code should he use to
get this?

<html> <%!
String
message="he
llo world",
String
getMessage()
{ return
message;} %>
Message for
you:<%!
getMessage()
%> </html>

<html>
<%= String
message=
"hello
world",
String
getMessa
ge(){
return
message;}
%>
Message
for
you:<%=g
etMessag
e() %>
</html>

<html> <%String
message="hello
world", String
getMessage(){
return message;}
%> Message for
you:<%=getMess
age() %> </html>

<html> <%! 4
String
message="h
ello world",
String
getMessage(
){ return
message;}
%> Message
for
you:<%=get
Message()
%> </html>

Views are a powerful mechanism for


Functions
customizing the way your data is
presented to users. They can be used to
enhance security and streamline complex
table relationships. Views that create
static results can still be modified using
___________ which allow you to define
how the underlying tables are modified
ensuring your data integrity.

Triggers

Stored
Procedure

Cursors

Which object of JSP holds reference to


javax.servlet.http.HttpSession object?

response request

session

2,3

PageContext 1

Consider you are maintaining ABC


Create index Create
company database. ABC company databse
function
tables are accessed by 1000 users initially
when it was designed from last two years
there was tremendous increase in number
records count also number of users who
are accessing the database tables to fetch
results. Users of ABC company database
are reporting problem that query
processing is taking more time when they
execute query against the database
tables. What will the right solution you
will suggest in such scenerios in order to
increase databse query performance?

Create stored
procedure

Create
trigger

Which statements are true about large


varchar?

A sql_variant
cannot
contain a
large varchar
data type

Large varchar
columns are the
only columns
that can be used
as partitioning
key columns

Large
1,4
varchar
columns
cannot be
used as
partioning
key columns

What will be the output for following


code?
public class CompareStrings{
public static void main(String [] args){
if(" string ".trim()=="string")
System.out.println("both strings are
equal");
else
System.out.println("both strings are not
equal");
}
}

both strings compilatio String operator both string


are not equal n error
cannot compare are equal
using ==
operator

Large
varchar
column
can be
specified
as a key
column in
an index

public class Threads


{
public static void main(String[]args)
{
new Threads().go();
}
public void go()
{
Runnable r = new Runnable()
{
public void run()
{
System.out.print("Run");
}
};
Thread t= new Thread(r);
t.start();
t.start();
}
}
Consider the following code with line
number given below:
Line 4: <%! int a=6; %>
Line 5: <%! int b=8; %>
Line 6: Reult is <%!=a*b; %>
Which of the following are true with
respect to the above code segment?
JAXP stands for:

An exception The code Compilation fails


is thrown at executes
runtime
normally
and prints
"Run"

The code
1
executes
normally but
nothing is
printed

It will
Line 6 is
complie
invalid
successfully
and print 48

Line 5 is
invalid

Java API for


XML
Processing

Line 4 is invalid

Java API None


for
eXtensible
Processing

Java API for 1


eXtensive
Processing

Ronald has observed that his Web


application has some HTML tags or
features that all the Web browsers do not
support. If the client's browser does not
support the application may or may not
run or may generate undesired output in
the Web Browser of the client. Therefore
Ronald wants to identify the type of
browser and other specific information
about the client that sends the request to
the Web application before invoking the
servlet. Which of the following options
will help Ronald provide this functionality?

By modifying By
By createing
the web
programm security
deployment ing filters constraints
descriptor

By
2
implementin
g the
listeners

During translation the scriptlet code is


copied inside:

Scriplet code
gets no space
in the
generated
scriplet

The init()
method of the
generated
servlet

The doGet() 2
method of
the
generated
servlet

By using the
invalidate()
method

By setting
3
the sessiontimeout
parameter in
the web.xml
file to 1
minute

The
service
method of
the
generated
servlet
Which of the following options can be
By using the By using
used by the controller to destroy a session setMaxInacti the
of a web application immediatly?
veInterval() destroy()
method
method
period to 60
seconds

Which of the following statements are


true?

Both A and B Both A


A is true and B is A is false and 2
are false
and B are false
B is true
true

Statement A: Arrays have a fixed upper


bound, but nested tables are unbounded.
Statement B: Second, arrays must have
consecutive subscripts and nested tables
are dense, but they can be sparse(have
non-consecutive subscripts).

Code to get the value of "address" request ${param.addr ${request. ${values.address


parameter is:
ess}
address} }

What will be the output for following


code?
public class VariableDec1
{
public static void main(String[]args)
{
int i=32;
char c=65;
char a=c+i;
System.out.println(a);
}
Consider Vijay is developing a web
application. Which method he can use to
get a collection of elements of same
type(for example paragraph tags) in JAVA
Script?
What will be the output for following
code?
public MethodOverloading {
int m=10,n;
public void div(int a) throws Exception {
n=m/a;
System.out.println(n);
}
public void div(int a,int b) {
n=a/b;
}
public static void main(String[]args)
throws Exception {
MethodOverloading o= new
MethodOverloading();
o.div(0);
o.div(10,2);
}
}
How does SOAP enable creation 7 usage
of Web services?

None

None

getElemen getElementByNa getElementB 4


tByID()
me()
yTagName()

It will print
None
ArithmeticEx
ception and
prints 5

Provides a
robust
mechanism
to Data &
Structure
over the web

Compilation
Error

It will print 5

Uses
Enables
proprietar messaging over
y means HTTP
of
describing
data

97

It will give
4
ArithmeticEx
ception

Uses
standard
means of
describing
data

1,3,4

What does the following code denote?


var orderedCustomers= from customer in
Customers where
customer,Grade == "Premium" orderedby
customer.Name select
customer.Name;
select one or more:

The following
code is an
example of
LINQ query

Which JSTL code snippet can be used to


perform URL rewriting?
Select one:

<a
href='<c:link
value="cogni
zant.jsp"/>'/>

Consider you are developing an ATM


application for ABC Bank using java
application. Several account holders of
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?

InputStream is the class used for stream


of characters
State True or False.

The
following
code
shows the
syntax for
Filtering
data

<a
href='<c:u
rl
value="co
gnizant.jsp
"/>'/>
Using object None
serialization

TRUE

FALSE

The following
code is an
example of
Database query

<a href='<c:link
url="cognizant.js
p"/>'/>

Using object
deserialization

The
1,2,4
following
code shows
the syntax
for Ordering
data

Using Thread 4
Synchronizat
ion

What does the following code denote?

Inheritance

Overriding Encapsulation

Overloading 1

public class Contact


{
public string Name { get,set;}
public string Email { get,set;}
public string Address { get,set;}
}
class Customer:Contact
{
public string Gender { get,set;}
public decimal income { get,set;}
}
What are the Tools & plugs-ins commonly ANT
used in testing java application code?
What are the benefits of using a stored
procedure?

EMMA

Efficient
Reduced
reuse of code network
traffic

JUnit

Efficient
compilation

2,3

Precompiled 1,2,4
execution,
hence faster

Given that URL-rewriting must be used for jsessionid


session management, identity the query
string attribute used when URL-rewriting.

containeri sessionid
d

servletid

Mention some of the important functions Modifying


of Servlet Filter.
the request
or response
consider you are creating a cursor. Choose Declare,Fetch
the correct sequence of steps to work
, Open Fetch
with cursors?
What is the use of ServletConfig
A servlet
interface?
configuration
object used
by a servlet
container to
pass
information
to a servlet
during
initialization

allowing
all the
users
Open,Fetc
h,Close

Security
Checks

1,4

None of the
listed options

Declare,Open,Fe Open,
3
tch,Close
Declare,Fetc
h,Close
All of the The
Defines an 2
listed
ServletConfig
object to
options
object is
provide
contained within client
the
request
ServletContext information
object
to a servlet

<?xml version="1.0" encoding="UTF-8"?>


<taglibxmlns="http://java.sun.com/xml/ns
/j2ee"
xmlns.xsi="http://www.w3.org/2001/XML
Schema-instance"
xsi.schemaLocation="http://java.sun.com/
xml/ns/j2eewebjsptaglibrary_2_0 xsd" version="2.0">
<tlib-version>2.0</tlib-version>
<shortname>SimpleTagForLearning</shortname>

Which complex type specifies that the


elements should always be in the order
specified?

<%@ taglib
prefix="pre"
uri="testuri"
%><html><h
ead> <title>
Demo
</title></hea
d><helloworl
d
attrib="john"
></html>

<%@
taglib
prefix="pr
e"
uri="testu
ri"%><ht
ml><head
> <title>
Demo
</title></
head><pr
e:hellowo
rld
attrib="jo
hn"/></ht
ml>

<%@ taglib
prefix="pre"
uri="testuri"%><
html><head>
<title> Demo
</title></head><
helloworld
"attrib"=john/><
/html>

<xs:complexT
ype
name="Coun
trinfo"><xs:c
hoice><xs:ele
ment
name="count
ryName"
type="xs:stri
ng"/>
<xs:element
name="state
s"
type="xs:inte
ger"/></xs:ch
oice></xs:co
mplexType>

<xs:compl None of the


exType
listed options
name="Co
untrinfo">
<xs:all><x
s:element
name="co
untryNam
e"
type="xs:s
tring"/>
<xs:eleme
nt
name="st
ates"
type="xs:i
nteger"/>
</xs:all></
xs:comple
xType>

<%@ taglib 2
prefix="pre"
uri="testuri"
%><html><h
ead> <title>
Demo
</title></he
ad><pre:hell
oworld/></h
tml>

<xs:complex 4
Type
name="Coun
trinfo"><xs:s
equence><xs
:element
name="coun
tryName"
type="xs:stri
ng"/>
<xs:element
name="state
s"
type="xs:int
eger"/></xs:
sequence></
xs:complexT
ype>

Which statements about JDBC are true?

JDBC is an
API to access
relational
databases,
spreadsheets
and flat files

JDBC is an JDBC has 5 types


API to
of Drivers
bridge the
objectrelational
mismatch
between
OO
programs
and
relational
databases

JDBC stands 1,2,4


for Java
DataBase
Connectivity

What is the significance of the @ Register The directive


directive in a ASP.NET web page?
is used to
register a
web page

The
The directive is
directive used to register
is used to a web site
register a
user
control

The directive 2
is used to
register an
application

As per Java Class names should be nouns , TRUE


in mixed case with first letter of each
internal word capitalized. Try to keep your
class names simple and descriptive. State
True or false.
Which of the following keywords ensures final
that a method cannot be overridden?

FALSE

protected abstract

static

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


correct?

Pass by
reference
eliminates
the overhead
of copying
large data

public class MethodSigExample


{
public int test(String s, int i)
{
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
Java Script code whrn the button is
clicked?
<body>
<script type="text/javascript">
function displayMessage(){
document.write("Displaying message by
using javaScript");
}
</script>
<button type="button"
onclick="DISPLAYMESSAGE()"> Display
Message</button>

Refractor>
move
method

It will print
the message
"Displaying
message by
using
javaScript"

An
argument
passed to
a ref
parameter
need not
be
initialized
first

Variable passed
as out
arguments need
to be initialized
prior to being
passed

Argument
1,4
that uses
params
keyword
must be the
last
argument of
variable
argument
list of a
method
Refractor> Refractor>
Refractor> 3
Extract
Change Method move
method Signature

It will
display
some
error
message
on
browser

It will not print


the message

None

#{expr}

</body>
Select one:
What is the syntax of Expression Language ${expr}
in a JSP page?

${"expr"} $[expr]

Which statements are applicable to Web


services?

The
information
is passed
back & forth
through
HTTP

The data
transfer is
XML
based

The
communication
protocol most
often used for
Web Services is
SOAP

The
1,2,3,4
information
is passed
back & forth
through
TCP/IP

Which two statements are true?


Select one or more:

Deadlocked
threads
release once
their sleep()
method's
sleep
duration has
expired

If a piece
of code is
capable of
deadlocki
ng, you
cannot
eliminate
the
possibility
of
deadlocki
ng by
inserting
invocation
s of
Thread.yie
ld();

The JVM
implementation
guarantees that
multiple threads
cannot enter
into a
deadlocked state

It is possible 2,4
for more
than two
threads to
deadlock at
once

When one method is overridden in sub


TRUE
class the access specifier of the method in
sub class should be equal as method in
super class. State true or false.

FALSE

Which of the following options represents View


the presentation logic to provide the data
of the model in the MVC design pattern?

Connector Controller

Model

Which parser reads small chunk of


DOM
document at a time, parses it, generate an
events and then reads another chunk of
document?
XYZ Company database tables are
Use Cursors
accessed by several users but few users
want to do positional row updates or
deletes operation on databases tables
based on business requirement. What will
the right solution yow will implement in
such scenerio?

None

SAX

Use
database
Indexes

XML

Use
Use Views
database
Trigger

You are developing dynamic web


extends
application using JSP. Which attribute of
page directive specifies the list of classess
imported in the JSP file?
What are the benefits of using a stored
procedure?
Request implicit object is which of the
following type?

Efficient
compilation

import

Reduced
network
traffic
ServletHttpR HttpServle
equest
tRequest

session

language

Precompiled
execution, hence
faster
ServletRequest

Efficient
2,3,4
reuse of
code
HttpRequest 2

What will be the output of following


code?
try
{
System.out.println("Executing try");
}
System.out.println("after try");
catch(Exception ex)
{
System.out.println("Executing catch");
}

Executing try Executing Runtime


Runtime
try after Exception
Exception
try
Executing
catch

Compile
Time
Exception

You being a software developer needs to


develop a web application for your
organization. You decided to use servlets
to create the web application. While you
are creating the servlet you feel the need
to write the code for the initialization of
the servlet. This is needed to initailize the
servlet with the required data after the
servlet instance has been created. How
will you perform this task?

By overriding
the service
method in
the servlet
class

By
overriding
the destroy
method in
the servlet
class

What is the use of attributes in HTML


tags?

Attribute is a Which
None
type of tag
represent
s the
content to
be
displayed
in the
page

By
By overriding the
overriding doGet method in
the init
the servlet class
method in
the servlet
class

Provides
4
additional
behaviour to
the tag

Whenever a request goes from the client footer


to the server some additional information
other than the request is also passed to
the server. This additional information is
in the form of a ____________.
Select the advantages of using coding
conventions in java application
development.
which of the following statements are
true?

header

Session ID

all of the
Improves improves easy
listed options easy
understanding
maintena
nce
A is true, B is Both are Both are false
false
true

Application
ID

Improves
Readability
of the
sofware
A is false, B
is true

Statement A: index by table is also known


as associative arrays. It lets you to look up
elements using arbitrary numbers and
strings for subscript values.
Statement B: Nested tables hold an
arbitrary number of elements. they use
sequential numbers as subscripts.

XYZ company database has SALES table


None
which captures all department sales
information. You have been asked to
create department wise summarized total
sales report from SALES table. Which of
the following correct option will fetch you
meaning full result?

Use
Aggregate
function
along with
WHERE
clause in
query to
retrieve
result

Use Aggregate
function along
with GROUP BY
clause in query
to retrieve result

Use
Aggregate
function
along with
ORDER BY
clause in
query to
retrieve
result

Which statements are applicable to Web


services?

The data
transfer is
XML
based

The
communication
protocol most
often used for
Web Services is
SOAP

The
1,2,3,4
information
is passed
back & forth
through
TCP/IP

The
information
is passed
back & forth
through
HTTP

A filter configuration object used by a


TRUE
servlet container to pass information to a
filter during initialization. State true or
false.

FALSE

Which attribute of the page directive


info
indicates that the JSP engine can handle
more than one request at a time when its
value is set to true?
What will be the output for following
Zero("0")
code?
public class Compare
{
public static void main(String[]args)
{
String s= new String("abc");
String s1= new String("abc");
System.out.println(s.compareto(s1));
}
}

isThreadS extends
afe

autoflush

FALSE

TRUE

What are the benefits of Logging?

Debug
Detect compiler
applicatio errors easily
ns issues
easily

None

None

Trouble
2,3,4
Shoot
performance
problems

Consider you are developing a JDBC


ResultSetMet DataSourc Statement
application, where you have to retrieve
aData
e
Employee table schema information like
table columns name, columns field length
and data type etc. Which API you will use
to retrieve table schema information?

ResultSet

Which of the following is applicable to


Servlet Containers?

All of the
listed
options

These are
responsible
for managing
the lifecycle
of servlets,
mapping a
URL to a
particular
servlet and
ensuring that
the URL
requester has
got the
correct
access right

These are
specialize
d web
servers,
which
support
servlet
execution

These are also


referred to as
web containers
or web engines

Select the benefits of versioning the


Formatting
software in java application development.
Which statement creates
DocumentBuilderfactory instance?

Branching Synchronization Backup and 2,3,4


and
Restore
merging
DocumentBui None
DocumentBuilde DocumentBu 4
lderFactory
rFactory f=new ilderFactory
f=BuilderFact
DocumentBuilde f=Document
ory.newInsta
rFactory();
BuilderFacto
nce();
ry.newInstan
ce();

What will be the output for following


6
code?
import java.util.*;
public class StringTokens
{
public static void main(String[]args)
{
String s="India is a\n developing country";
StringTokenizer o= new
StringTokenizer(s);
System.out.println(o.countTokens());
}
}

What will be the output of the following


code snippet?

It will
display
the date
and time

It will display the It will display 1


date as
the time as
mm:dd;yy
hh:mm:ss

<% page language="java"%>


<html>
<head></head>
<body>
<%java.util.Date now= new
java.util.Date();%>
<H1><%=now.getHours()%>:<%=now.get
Minutes()%>:<%=now.getSeconds()%></H
1>
</body>
</html>

It will display
the current
time as
hh:mm:ss

None

Which of the following is the deployment BankApp.xml WebApp.x deployment.xml web.xml


descriptor file of a web application?
ml
Assuming that the name of the Web
application is BankApp.
Choose a valid package name in JAVA.
123pack
outerpack com.sun.eng
pack123
_innerpac
k

2,3,4

What does the following listing denote?


<configuration>
<system.web>
<pages theme="Website"/>
</system.web>
</configuration>

Registering a Registerin Registering a


skin in
g a theme MasterPage in
web.config in
web.config
web.confi
g

Registering a 2
StyleSheetTh
eme in
web.config

In Java script, for accessing first paragraph document.ge document document.getEle None
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
when we are using frameset?
What is the correct syntax of the
declaration which defines the XML
version?
Identify the code snippet
DECLARE
var_num1 number:=50;
var_num2 number;
BEGIN
var_num2 :=200;
DECLARE
var_mult number;
var_num1 number:=100; --LINE 1

By using
colspan

By using
rows=50%
,50%
<?xml
<?xml
version="1.0" version="
/>
1.0"?>
Compilation Compilati
Fails
on Fails
due to
error in
line 1

By using
rowspan
None

Runs without
any output

By using
2
cols=50%,50
%
<xml
2
version="1.0
"/>
Compiles,
4
executes and
prints 50

BEGIN
var_mult :=var_num1*var_num2;
END;
dbms_output.put_line(var_num1);
END;
What will be the output of the above code
assume serveroutput is on
Try can be followed with either catch or TRUE
finally.State true or false.

FALSE

You are developing a trigger which should


ensure that no negative value is inserted
in employee table?s Age column. you
have created a trigger as follows
create or replace trigger Age Verify
before insert
on employee for each row
when(new.EmpAge<0)
begin
RAISE_APPLICATION_ERROR(-20000,'no
negative age followed');
end;
/
Identify error if any in the above trigger
and give the solution.

The order of
Arguments
passed to
RAISE_APPLI
CATION_ERR
OR is wrong

Which of the following code line will


destroy a session?

session.isAliv session.in session.isNew(fal session.rem 2


e=false;
validate(); se);
oveSession()
;
All members Protected A class can be
If one class is 1
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

Which of the following are true about


protected access specifier?

Which of the following is not an attribute content


of meta tag?

Replacing
RAISE_AP
PLICATION
_ERROR(20000,'no
negative
age
allowed');
to
RAISE_AP
PLICATION
S_ERROR(20000,"no
negative
age
allowed");
will give
the
desired
output

name

Replacing
RAISE_APPLICATI
ON_ERROR(20000,'no
negative age
allowed'); to
RAISE_APPLICATI
ON_ERROR(20000,"no
negative age
allowed"); will
give the desired
output

http-equiv

No problem 4
in the
trigger. It
gives the
desired
result

value

In Thread implementation making method TRUE


synchronized is always better in order to
increase application performance rather
than using synchronize block to
synchronize certain block of statements
written in java inside the method. State
true or false.

FALSE

What will be the output for following


code?
public class Variabledec {
public static void main(String[]args){
boolean x=true;
int a;
if(x) a=x?2:1;
else a=x?3:4;
System.out.println(a);
}
}
Consider the following statements;

A is false and Both are


B is true
true

Both are false

Both are
false

None

Statement A: The PreparedStatement


object enables you to execute
parameterized queries.
Statement B: The SQL query can use the
placeholders which are replaced by the
INPUT parameters at runtime.
Which of the following option is true with
respect to the above statements?

Consider Vijay is developing web page


I
using HTML. Which method he can use for
sending large amount of data on
submitting the form?
I. POST
II. GET

Both I & II II

How can yopu force garbage collection of 1


an object?
1. Garbage collection cannot be forced
2. Call System.gc()
3. Call Runtime.gc()
4. Set all references to the object to new
values(null, for example).

How to drop all tables from recycle bin?

DROP
Cannot
PURGE
DBA_RECYCL drop
RECYCLEBIN
EBIN
tables
from
Recycle
Bin
Which of the following variable represents application exception config
the uncaught throwable object that
resulted from a call to the error page?
Under which two circumstances do you
design database triggers?

To replicate
built-in
constraints in
the Oracle
server such
as primary
key and
foreign key

DROP
3
ALL_TABLE_
RECYCLEBIN

request

To
To duplicate the
guarantee functionality of
that when other triggers
a specific
operation
is
performe
d, related
actions
are
performe
d

For
2,4
centralized,
global
operations
that should
be fired for
the
triggering
statement,
regardless of
which user
or
application
issues the
statement
Refractor> Refractor>
Refractor> 3
move
Change Method Extract
method Signature
method

public class MethodSigExample


Refractor>
{
move
public int test(String s, int i)
{
int x= i+s.length();
return x;
}
}
During refactoring method signature can
be changed using the option:
When comparable interface is used which compareWith compare
method should be overrided?

compareTo

comparator 3

SELECT
Selection,Inte Selection, Intersection,Proj Difference,
e.EMPLOYEE_ID,e.LAST_NAME,e.DEPART rsection, Join Projection ection, Join
Projection
MENT_ID,d.DEPARTMENT_NAME FROM
, Join
Join
EMP e, DEPARTMENT d WHERE
e.DEPARTMENT_ID=d.DEPARTMENT_ID;

In the statement, which capabilities of a


SELECT statement are performed?

What will be the output for following


code?
public class While {
static int i;
public static void main(String[]args){
System.out.println(i);
while(i<=5){
i++;
}
System.out.println(i);
}
}

6,0

0,5

0,6

compilation 3
error

XYZ company database has Customer


Implement Implemen Implement using Implement
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?

DIV tag creates linebreaks similar to


paragraph tags.State true or false.

TRUE

FALSE

Which complex type signifies that only


one of the child elements can appear?

<xs:complexT
ype
name:Countr
Info"><xs:seq
uence>
<xs:element
name="count
ryName"
type="xs:stri
ng"/>
<xs:element
name=""stat
es"
type="xs:inte
ger"/>
</xs:sequenc
e></xs:compl
exType>

<xs:compl
exType
name:Cou
ntrInfo"><
xs:choice>
<xs:eleme
nt
name="co
untryNam
e"
type="xs:s
tring"/>
<xs:eleme
nt
name=""st
ates"
type="xs:i
nteger"/>
</xs:choic
e></xs:co
mplexTyp
e>

<xs:complexType None
name:CountrInfo
"><xs:all><xs:ele
ment
name="countryN
ame"
type="xs:string"/
><xs:element
name=""states"
type="xs:integer
"/></xs:all></xs:
complexType>

What will be the output of the below


Query
query?
contains
select instr('My SQL World','a') from dual; error

Prints 14

Prints 6

How will you access a servlet context


initialization parameter named "companyname"?
"Variables in Java Script should be
declared with data types".
State true or false.
Which method removes the attribute with
the given name from the ServletContext
interface?

${initParam["
companyname"]}
TRUE

${init.com ${contextParam. ${init['comp 1


panycompany-name} any-name']}
name}
FALSE
2

void
clearAttribut
e(String
name)

void
void
removeAt removeAttribute
tribute(Ob (String name)
ject name)

Prints 0

void
3
flushAttribut
e(String
name)

A Web application developed for an


institution requires insertion of a header
file comprising the logo and institution
name. Identify the correct JSP tag from
the options given below to add the logo
and institution name to all the pages of
the Web application. Select one:

<%@ page
<form
<jsp:forward
<%@ include 4
import="Hea method=" page="Header.ht file="Header
der.html"%> post"
ml">
.html"%>
action="H
eader.htm
l">

In which of these following getAttribute() ServletRespo HttpListen ServletRequest


and setAttribute() method has defined?
nse
er

HttpSession 3,4

How to divide the page into two equal


halves when we are using frameset?

By using
3,4
rows=50%.5
0%
Result is 10 2

By using
colspan

Examine the PL/SQL Block


compilation
declare
fails
result Number;
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?

By using
rowspan

By using
cols=50%.50%

Result is 0 Exception
occurred divide
by zero

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


B is false
true

A is false, B is
true

Both are
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.
Statement B: The tag element contains
the tag name, the class of its tag handler,
information on the tag's attributes and
information on the variables created by
the tag.
Which of the following is true about these
statements?
In JavaScript, for reading the contents
inside the first paragraph tag which
statement is used?

document.ge
tElementsBy
TagName("p"
)[0].innertext
()
Which of the following is valid declaration <%@ String
in JSP using declaration tag?
name="Anan
d" %>

None

<%=
public
String
name="An
and";%>

document.getEle
mentsByTagNam
e("p[0]").innerte
xt()

document.g 1
etElementsB
yTagName("
p").innertext
()
<!% String
<%! String
4
name="Rocky"% name="Rock
>
y";%>

Predict output of Expression Language


Null
7
Error
1
$|7*k} if k is null:
What are the major areas PMD tool scans Possible
Coding
Violation of best All the listed 4
java code?
performance Standards practice
options
bottlenecks
What part of database trigger determines Trigger type
the number of times the trigger body
executes?

Trigger
event

Trigger timing

Trigger body 1

What will be the output for following


print 34
print 1
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
accessed by several users but for few
functions
views
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?

print 034

print 3

Use database
trigger

User cursors 2

Which of the following tag is used to


<url-pattern> <servlet- <servlet>
<init-param> 4
specify the initialization parameters in the
mapping>
web.xml file?
Choose valid expression language
${param.user request.ge #{param.userid} None
1
statement for accesssing textfield
id}
tParamete
elements whose name is userid.
r{"userid"}
Filters can create responses by
themselves. State true or false.

TRUE

FALSE

John wants to see how many employees


are there whose salary is above average.
Which of the following query will help
john to achieve this task?

Select
count(*)
from emp
where sal >
(select
avg(sal))
from emp);

Select
count(*)
from emp
where sal
exist
(select
avg(sal))
from
emp);

___________________ are small amounts


of data sent by a program to the browser
and stored on the user's machine to be
retrieved later.
Consider you are maintaining XYZ
company database. XYZ database tables
are accessed by several usera to fetch
daily reports by joining multiple tables
found each user writes query which is
more than 100 line of SQL statement and
submits to server for processing in order
to fetch results. This is really increasing
the network traffic and also response
time. What will the right solution you will
implement in such scenerios in order to
increase performance?

Session
variables

Select count(*)
from emp where
sal > (select
Average(sal))
from emp);

Select
count(*)
from emp
where sal >
(select
max(sal))
from emp);

Applicatio Cookies
n
variables

Objects

Create
Stored
Procedure

Create
view

Create index 1

What does XSL stands for?

Extensible
StyleSheet
Language

Extensible Extensive
Style
StyleSheet
Language Language

None

Which parser is a W3C standard?


You are developing a web application
using Servlets. You have to use filters so
that the web container intercepts the
incoming requests before it is forwarded
to the servlet. Which of the following
method is called for every request
intercepted by the filter?

SAX
doGet

DOM
destroy

None
doFilter

2
4

Create Trigger

XHTML
init

Smith is developing an application using


Java Server Pages. The name of the
component that he has created is
"Emp".he has included the following
statement in her application:
<jsp:setProperty
name="Emp"property=*/>
What would be the result of the above
code?

It will give
run time
error

It will
iterate
over the
current
ServletRe
quest
parameter
s and
setting
each
matched
property
to the
value of
matching
parameter

It will iterate
over the current
ServletRequest
parameters and
would not set
any property to
the value of
matching
parameter

It will iterate 2
over the
current
ServletRequ
est
parameters
and getting
each
property to
the value of
matching
parameter

Which method of jsp is equivalent to


service method of servlet?
Consider the development scenerio where
you have created Employee class with
implementation code and as per the
project requirement you have to ensure
that developer in team reusing code
written in Employee class only using
inheritence by extending the employee
class but not by creating the instance of
Employee object directly. Please suggest
the solution to implement given
requirement?

service()

_jspServic
e()
Make
Employee
class
methods
private

jsp_Service()

jspService()

public class Person


{
private String name;
public Person(String name) { this.name =
name;}
public boolean equals(Person p)
{
return p.name.equals(this.name);
}
}
Which statement is true?

This class
must also
implement
the hashCode
method as
well

The
equals
method
does NOT
proprely
override
the Object
class's
equals
method

The code will


compile as
Object class's
equals method
as well

Make
Employee
class
methods
public

Make Employee Make


class with final Employee
keyword
class with
abstract
keyword

2
4

Compilation 1
fails because
the private
attribute
p.name
cannot be
accessed

Consider you are developing a JDBC


application, where you have to retrieve
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
happens during:
Enumeration is having remove() method.
State true or false.
If your JDBC connection is in auto-commit
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?
Which of the following statements is
correct about an Exception?

PreparedStat None
ement

CallableStateme Statement
nt

Deployment Execution None

TRUE

FALSE

Undeployme 1
nt
2

TRUE

FALSE

Method
Level
It occurs
during linking

Logical
Structure
It occurs
at runtime

Class Level
Structure
It occurs during
compilation

Physical
1,3,4
Structure
It occurs
2
during JustIn-Time
Compilation

A request
is sent
with HTTP
method
POST

The parameter
username is the
only parameter
passed to the
web server in
the request

The
1,4
parameter
username
and
sbbutton are
passed to
the web
server in the
request URL

Consider the following code foe an HTML A request is


form.
sent with
HTTP method
<form action=?/servlet/Login?>
GET
<input type=?text? name=?username?
value=?enter username?/>
<input type=?submit? name=?sbbutton>
value=?signin!..?/>
</form>
Which of the following happens upon
pressing the submit button in the above
form?

Which of the following statements is


incorrect about delegate?

Delegates are Delegates Only one


object
are
method can be
oriented
reference called using a
types
delegate

Delegates
3
are type-safe

select the right coding best practices


followed while using java Collections.

Copy
collections
into other
collections by
calling
addAll()
methods
instead using
iterator to
copy each
collection
element

Which of the following is an empty tag in <br>


HTML?
Which of the following used by container Tag Library
to validate a custom tag in a JSP page?
Descriptor

Use for
loop
instead of
iterator

Use Collections
with generic
with same type
of data

All the listed 1,3


options

<input>

<h1>

<a>

web.xml

Xmlspy

Xerces

Invalid Variable
declaration

Global
Variable

identify the type of variable declared


VARIABLE City Vatchar2(20).

Host Variable Bind


Variable

BufferedWriter constructor CAN ACCEPT


Filewriter Object as a parameter. state
true or false.
Which of the following are used for
executing client side script?
An art of identifying, organizing,
controlling and verifying the modifiaction
to the software work products built by the
developer.
Method keySet() in Map returns a set
view of the keys contained in that map.
State true or false.
Consider you are developing java
application in a team consists of 20
developers and you have been asked to
develop class by Name
ProgrammerAnalyst and to ensure that
other developers in team use
ProgrammerAnalyst class only by creating
object and team member should not be
given provision to inherit and modify any
functionality written in
ProgrammerAnalyst class using
inheritance. how do you achieve this
requirement in development scenerio?

TRUE

FALSE

JSP

Servlets

JavaScript

VBScript

3,4

HCM

SDLC

SVN

SCM

TRUE

FALSE

Declare the
Programmer
Analyst class
as final

Declare
None of the
the
listed options
Programm
erAnalyst
class as
abstract

Declare the 1
Programmer
Analyst class
as private

sam is writing a web application program. initiateConte start()


he has implemented
xt()
ServletcontextListener interface in his
web application program. Which method
of ServletContextlistener interface he
should use to perform startup activities
foe web application?

init()

contextInitial 4
ized()

How can you execute a stored procedure Call method


in the database?
run() on a
ProjectComm
and Object

Call method
execute() on a
StoredProcedure
Object

Call method 4
execute() on
a
CallableProc
edure Object

Platform
dependent

HTML files 1,4


with special
tags that
contain java
source code
to generate
dynamic
content

Call
method
executePr
ocedure()
on a
Statement
Object
Which statement is true about Java server Used to build all of the
pages?
dynamic web listed
pages
options

Consider a development scenerio where


you want to write the object data into
persistence storage devices (like file,disk
etc.). using which of the below concept
you can achieve the given requirement?

Deserializatio Finalizatio Serialization


n
n

An ObjectInputstream deserializes objects TRUE


previously written using an
ObjectOutputStream. state true or false.

FALSE

You have a row level BEFORE UPDATE


trigger on the EMP table. This trigger
contains a SELECT statement on the EMP
table to ensure that the new salary value
falls within the minimum and maximum
salary for a given job title. What happens
when you try to update a salary value in
the EMP table?

The
The Trigger fires
Trigger
successfully
fails
because a
SELECT
statement
on the
table
being
updated is
not
allowed

The Trigger
fails because
you cannot
use the
minimum
and
maximum
functions in a
BEFORE
UPDATE
trigger

Synchronizat 3
ion

The trigger 3
fails because
it needs to
be a row
level AFTER
UPDATE
trigger

Consider the following statements:

A is true and Both are


B is false
true

A is false, B is
true

Both are
false

Statement A: A resource is passive when it


does not have any processing of its own.
Statement B: The content of a passive
resource does not change.
Which of the following is true about these
statements?
What will be the output for following
code?
public class CompareStrings{

compilation
error

both
both strings are Strings
strings are equal
cannot be
not equal
compared
using ==
operator

public static void main(String [] args){


String a= new String("string");
String s= new String("string");
if(a == s)
System.out.println(""both strings are
equal"");
else
System.out.println(""both strings are not
equal"");
}
}
Which of the following statements are
true?
Statement 1: When athread is sleeping as
a result of sleep(), it releases its locks.
Statement 2: The Object.wait() method
can be invoked only from a syncronized
context.

Stmt 1 is true Both are


and stmt 2 is true
false

Stmt 2 is true
and stmt 1 is
false

Both are
false

Which of the following describes JSP life


cycle management?

none

loading
invoking,
destroy.
user
should
manage
this life
cycle

invoking,destroy,
web browser
manages this life
cycle

Translation 4
&
compilation,
Instantiation
,
initialization,
service
destroy
container
manages this
life cycle

How do you declare a tag library within a


JSP page to use custom tags?

By using
unique
variable
query
contains
error

By using
scriptlet

By using taglib
directive

adds 10
minutes
to the
current
timestam
p
I

adds 10 days to
the current
timestamp

By using
path to the
tag handler
adds 10
seconds to
the current
timestamp

None

What will be the output of below query?


select
to_CHAR(sysdate+(10/400),'HH:MI:SS')
from dual;

"Consider Vijay is developing web page


II
using HTML. Which method he can use for
sending data security on submitting the
form?
I. POST
II. GET"
Automatic page refresh can be done by
using refresh Meta Tag. State true or
false.
Consider the following deployment
descriptor(web.xml) file:
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
Then, in the Servlet program code
setMaxInactiveInterval(600)(seconds)for
the session object is invoked. After how
long would session expire?

TRUE

FALSE

30 minutes

10
minutes

Both I & II

gives
None
illegalStateExcep
tion

Which attribute of the @ Register


directive indicates the name you want to
associate with the user control for the
current page?
Which of the following is a marker
interface used for object serialization?

TagName

Src

Cntrl

Externalizatio Runnable Serialization


n

TagPrefix

None

You might also like