0% found this document useful (0 votes)
81 views38 pages

Summat Ive

The document contains a quiz with multiple choice questions about programming concepts. It asks about topics like iterators, Java classes, ASP.NET, JavaScript, exceptions, and more. For each question there are 4 possible answers to choose from and the correct answer is indicated in the last column.

Uploaded by

Aditya Tiwari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views38 pages

Summat Ive

The document contains a quiz with multiple choice questions about programming concepts. It asks about topics like iterators, Java classes, ASP.NET, JavaScript, exceptions, and more. For each question there are 4 possible answers to choose from and the correct answer is indicated in the last column.

Uploaded by

Aditya Tiwari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Question Option 1 Option 2 Option 3 Option 4 Correct

Iterator is having previous() method.State TRUE FALSE 2


True or False.

Which of the Following attributes of page isScriptingEn isELIgnore language session 1


directive are invalid? abled d

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

Which of the following statements is A single Delegates Delegates are Delegate is a 4


incorrect about a delegate? delegate can can be type-safe value type
invoke more shared wrappers for
than one function pointers
method
Identify the code snippet Error ENAME of 2
declare EmpNAME; EmpNO
begin 101172
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 10.9873.765 10.98730. 10.987 2
____________. 765
What does the LOCAL argument in the The LOCAL Specifies The LOCAL Specifies 1,2
DECLARE CURSOR statement denote? cursor will be that cursor will have that cursor
implicitly cursor can to be explicitly can be
deallocated be deallocated available to
when the available when the batch, all local
batch, stored only in the stored resources
procedure or batch, procedure or
trigger stored trigger
terminates procedure terminates
or trigger
in which
the cursor
was
created

Select two runtime exceptions. NullPointerEx IOExcepti ArrayIndexOutOf SQLExceptio 1,3


ception on BoundsException n

Culture & UICulture properties of a page TRUE FALSE 2


class can have different culture values.
State True or False.
Which of the following statements is It will output: It will It will ouput: It will 3
correct about the C#.NET program given Bad Format output: Index out of output:
below if a value "6" is input to it? using Bad bounds Remaining
System. Format Remaining Program
namespace IndiabixConsoleApplication Remaining Program
{ Program
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)

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

<pref.tag1> empty scriptless tag dependant JSP 2


<%=result %>
</pref.tag1>
Which of the following are valid for the
<body-content> tag of tag1?
interface B public void All the public void public void 2
{ aM1(){} listed bM2(){} aM2(){}
public void bM1(); options
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 Argument Pass by An argument Variable 1,2
correct? that uses reference passed to the ref passed as
param eliminates parameter need out
keyword the not be initialized arguments
must be the overhead need to be
last of copying initialized
argument of large data prior to
variable being passes
argument list
of a method

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 The key can The value The key cannot The value 2,3
Tables? be the null cannot be be the null can be the
reference the null reference null
reference reference

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>

Views are a powerful mechanism for Functions Triggers Stored Cursors 2


customizing the way your data is Procedure
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.

Which object of JSP holds reference to session response request PageContext 1


javax.servlet.http.HttpSession object?
Consider you are maintaining ABC Create index Create Create stored Create 3
company database. ABC company databse function procedure trigger
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?

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");
}
};

Thread t= new Thread(r);


t.start();
t.start();
}
}
Consider the following code with line It will Line 6 is Line 4 is invalid Line 5 is 2
number given below: complie invalid invalid
Line 4: <%! int a=6; %> successfully
Line 5: <%! int b=8; %> and print 48
Line 6: Reult is <%!=a*b; %>
Which of the following are true with
respect to the above code segment?
JAXP stands for: Java API for Java API None Java API for 1
XML for eXtensive
Processing eXtensible Processing
Processing
Ronald has observed that his Web By modifying By By createing By 2
application has some HTML tags or the web programm security implementin
features that all the Web browsers do not deployment ing filters constraints g the
support. If the client's browser does not descriptor listeners
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?

During translation the scriptlet code is Scriplet code


The The init() The doGet() 2
copied inside: gets no space
service method of the method of
in the method of generated the
generated the servlet generated
scriplet generated servlet
servlet
Which of the following options can be By using the By using By using the By setting 3
used by the controller to destroy a session setMaxInacti the invalidate() the session-
of a web application immediatly? veInterval() destroy() method timeout
method method parameter in
period to 60 the web.xml
seconds file to 1
minute

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.

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 1


parameter is: ess} address} }
What will be the output for following None a Compilation 97 3
code? Error
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 None getElemen getElementByNa getElementB 4
application. Which method he can use to tByID() me() yTagName()
get a collection of elements of same
type(for example paragraph tags) in JAVA
Script?
What will be the output for following It will print None It will print 5 It will give 4
code? ArithmeticEx ArithmeticEx
ception and ception
public MethodOverloading { prints 5
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 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?

InputStream is the class used for stream TRUE FALSE 2


of characters
State True or False.
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 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

As per Java Class names should be nouns , TRUE FALSE 1


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 protected abstract static 1
that a method cannot be overridden?

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();

When one method is overridden in sub TRUE FALSE 2


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

Which of the following options represents View Connector Controller Model 1


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

Which parser reads small chunk of DOM None XML SAX 4


document at a time, parses it, generate an
events and then reads another chunk of
document?
XYZ Company database tables are Use Cursors Use Use Views Use 1
accessed by several users but few users database database
want to do positional row updates or Trigger Indexes
deletes operation on databases tables
based on business requirement. What will
the right solution yow will implement in
such scenerio?
You are developing dynamic web extends import session language 2
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 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");
}

You being a software developer needs to By overriding By By overriding the By 2


develop a web application for your the service overriding doGet method in overriding
organization. You decided to use servlets method in the init the servlet class the destroy
to create the web application. While you the servlet method in method in
are creating the servlet you feel the need class the servlet the servlet
to write the code for the initialization of class class
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?

What is the use of attributes in HTML Attribute is a Which None Provides 4


tags? type of tag represent additional
s the behaviour to
content to the tag
be
displayed
in the
page
Whenever a request goes from the client footer header Session ID Application 3
to the server some additional information ID
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 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

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 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

A filter configuration object used by a TRUE FALSE 1


servlet container to pass information to a
filter during initialization. State true or
false.
Which attribute of the page directive info isThreadS extends autoflush 2
indicates that the JSP engine can handle afe
more than one request at a time when its
value is set to true?
What will be the output for following Zero("0") FALSE None TRUE 1
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));
}
}

What are the benefits of Logging? None Debug Detect compiler Trouble 2,3,4
applicatio errors easily Shoot
ns issues performance
easily problems

Consider you are developing a JDBC ResultSetMet DataSourc Statement ResultSet 1


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?

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 for following 6 5 4 None 2


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 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>

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


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 2,3,4
_innerpac
k
What does the following listing denote? Registering a Registerin Registering a Registering a 2
<configuration> skin in g a theme MasterPage in StyleSheetTh
<system.web> web.config in web.config eme in
<pages theme="Website"/> web.confi web.config
</system.web> g
</configuration>

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;

What will be the output of the above code


assume serveroutput is on
Try can be followed with either catch or TRUE FALSE 1
finally.State true or false.
You are developing a trigger which should The order of Replacing Replacing No problem 4
ensure that no negative value is inserted Arguments RAISE_AP RAISE_APPLICATI in the
in employee table?s Age column. you passed to PLICATION ON_ERROR(- trigger. It
have created a trigger as follows RAISE_APPLI _ERROR(- 20000,'no gives the
create or replace trigger Age Verify CATION_ERR 20000,'no negative age desired
before insert OR is wrong negative allowed'); to result
on employee for each row age RAISE_APPLICATI
when(new.EmpAge<0) allowed'); ON_ERROR(-
begin to 20000,"no
RAISE_APPLICATION_ERROR(-20000,'no RAISE_AP negative age
negative age followed'); PLICATION allowed"); will
end; S_ERROR(- give the desired
/ 20000,"no output
Identify error if any in the above trigger negative
and give the solution. age
allowed");
will give
the
desired
output

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

Which of the following is not an attribute content name http-equiv value 4


of meta tag?
In Thread implementation making method TRUE FALSE 1
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.

What will be the output for following 2 4 3 1 1


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 Both are false Both are 2
B is true true false
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 Both I & II II None 1


using HTML. Which method he can use for
sending large amount of data on
submitting the form?
I. POST
II. GET
How can yopu force garbage collection of 1 4 3 2 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 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?

Under which two circumstances do you To replicate To To duplicate the


For 2,4
design database triggers? built-in guarantee functionality of
centralized,
constraints in that when other triggers global
the Oracle a specific operations
server such operation that should
as primary is be fired for
key and performe the
foreign key d, related triggering
actions statement,
are regardless of
performe which user
d or
application
issues the
statement
public class MethodSigExample Refractor> Refractor> Refractor> Refractor> 3
{ move move Change Method Extract
public int test(String s, int i) method Signature method
{
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 compareTo comparator 3
method should be overrided?
SELECT Selection,Inte Selection, Intersection,Proj Difference, 2
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 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?

DIV tag creates linebreaks similar to TRUE FALSE 2


paragraph tags.State true or false.
Which complex type signifies that only <xs:complexT <xs:compl <xs:complexType None 2
one of the child elements can appear? ype exType name:CountrInfo
name:Countr name:Cou "><xs:all><xs:ele
Info"><xs:seq ntrInfo">< ment
uence> xs:choice> name="countryN
<xs:element <xs:eleme ame"
name="count nt type="xs:string"/
ryName" name="co ><xs:element
type="xs:stri untryNam name=""states"
ng"/> e" type="xs:integer
<xs:element type="xs:s "/></xs:all></xs:
name=""stat tring"/> complexType>
es" <xs:eleme
type="xs:inte nt
ger"/> name=""st
</xs:sequenc ates"
e></xs:compl type="xs:i
exType> nteger"/>
</xs:choic
e></xs:co
mplexTyp
e>

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:

In which of these following getAttribute() ServletRespo HttpListen ServletRequest HttpSession 3,4


and setAttribute() method has defined? nse er

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.

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 document.ge None document.getEle


document.g 1
inside the first paragraph tag which tElementsBy mentsByTagNam etElementsB
statement is used? TagName("p" e("p[0]").innerte
yTagName("
)[0].innertext xt() p").innertext
() ()
Which of the following is valid declaration <%@ String <%= <!% String <%! String 4
in JSP using declaration tag? name="Anan public name="Rocky"% name="Rock
d" %> String > y";%>
name="An
and";%>

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 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?

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 TRUE FALSE 2


themselves. State true or false.
John wants to see how many employees Select Select Select count(*) Select 1
are there whose salary is above average. count(*) count(*) from emp where count(*)
Which of the following query will help from emp from emp sal > (select from emp
john to achieve this task? where sal > where sal Average(sal)) where sal >
(select exist from emp); (select
avg(sal)) (select max(sal))
from emp); avg(sal)) from emp);
from
emp);

___________________ are small amounts Session Applicatio Cookies Objects 3


of data sent by a program to the browser variables n
and stored on the user's machine to be variables
retrieved later.
Consider you are maintaining XYZ Create Create Create Trigger Create index 1
company database. XYZ database tables Stored view
are accessed by several usera to fetch Procedure
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?

What does XSL stands for? Extensible Extensible Extensive None 1


StyleSheet Style StyleSheet
Language Language Language

Which parser is a W3C standard? SAX DOM XHTML None 2


You are developing a web application doGet destroy init doFilter 4
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?
Smith is developing an application using It will give It will It will iterate It will iterate 2
Java Server Pages. The name of the run time iterate over the current over the
component that he has created is error over the ServletRequest current
"Emp".he has included the following current parameters and ServletRequ
statement in her application: ServletRe would not set est
<jsp:setProperty quest any property to parameters
name="Emp"property=*/> parameter the value of and getting
What would be the result of the above s and matching each
code? setting parameter property to
each the value of
matched matching
property parameter
to the
value of
matching
parameter

Which method of jsp is equivalent to service() _jspServic jsp_Service() jspService() 2


service method of servlet? e()
Consider the development scenerio where Make Make Make Employee Make 4
you have created Employee class with Employee Employee class with final Employee
implementation code and as per the class class keyword class with
project requirement you have to ensure methods methods abstract
that developer in team reusing code public private keyword
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?

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 happens upon


pressing the submit button in the above
form?

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

Which of the following is an empty tag in <br> <input> <h1> <a> 1


HTML?
Which of the following used by container Tag Library web.xml Xmlspy Xerces 1
to validate a custom tag in a JSP page? Descriptor

identify the type of variable declared Host Variable Bind Invalid Variable Global 2
VARIABLE City Vatchar2(20). Variable declaration Variable

BufferedWriter constructor CAN ACCEPT TRUE FALSE 1


Filewriter Object as a parameter. state
true or false.
Which of the following are used for JSP Servlets JavaScript VBScript 3,4
executing client side script?
An art of identifying, organizing, HCM SDLC SVN SCM 4
controlling and verifying the modifiaction
to the software work products built by the
developer.
Method keySet() in Map returns a set TRUE FALSE 1
view of the keys contained in that map.
State true or false.
Consider you are developing java Declare the Declare None of the Declare the 1
application in a team consists of 20 Programmer the listed options Programmer
developers and you have been asked to Analyst class Programm Analyst class
develop class by Name as final erAnalyst as private
ProgrammerAnalyst and to ensure that class as
other developers in team use abstract
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?
sam is writing a web application program. initiateConte start() init() contextInitial 4
he has implemented xt() ized()
ServletcontextListener interface in his
web application program. Which method
of ServletContextlistener interface he
should use to perform startup activities
foe web application?

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

Consider a development scenerio where Deserializatio Finalizatio Serialization Synchronizat 3


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

An ObjectInputstream deserializes objects TRUE FALSE 1


previously written using an
ObjectOutputStream. state true or false.

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.

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 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){

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 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.

Statement 2: The Object.wait() method


can be invoked only from a syncronized
context.
Which of the following describes JSP life none loading invoking,destroy, Translation 4
cycle management? invoking, web browser &
destroy. manages this life compilation,
user cycle Instantiation
should ,
manage initialization,
this life service
cycle destroy
container
manages this
life cycle

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"

Automatic page refresh can be done by TRUE FALSE 1


using refresh Meta Tag. State true or
false.
Consider the following deployment 30 minutes 10 gives None 1
descriptor(web.xml) file: minutes illegalStateExcep
<session-config> tion
<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?
Which attribute of the @ Register TagName Src Cntrl TagPrefix 4
directive indicates the name you want to
associate with the user control for the
current page?
Which of the following is a marker Externalizatio Runnable Serialization None 4
interface used for object serialization? n

You might also like