Академический Документы
Профессиональный Документы
Культура Документы
Choose the valid option that can be substituted in place of xx in the MyCla
ss class.
a) public native void doSomething( );
b) void doSomething( ) { /* valid code fragments */ }
c) private void doSomething( ) { /* valid code fragments */ }
d) protected void doSomething( ) { /* valid code fragments */ }
Ans : a
3)
package com.test.work;
public class A
{
public void m1()
{
System.out.print("A.m1, ");
}
protected void m2()
{
System.out.print("A.m2, ");
}
private void m3()
{
System.out.print("A.m3, ");
}
void m4()
{
System.out.print("A.m4, ");
}
}
class B
{
public static void main(String[] args)
{
A a = new A();
a.m1(); // 1
a.m2(); // 2
a.m3(); // 3
a.m4(); // 4
}
}
Assume that the code appears in a single file named A.java.
What is the result of attempting to compile and run the program?
a) Prints: A.m1, A.m2, A.m3, A.m4,
b) Compile-time error at 2.
c) Compile-time error at 3.
d) Compile-time error at 4.
Ans : c
7) Given:
public class B
{
Integer x;
int sum;
public B(int y)
{
sum=x+y;
System.out.println(sum);
}
public static void main(String[] args)
{
8) Which one of the following is legal declaration for nonnested classes and in
terfaces?
a) final abstract class Test {}
b) public static interface Test {}
c) final public class Test {}
d) protected interface Test {}
Ans : c
9) Given the following,
public class ThreeConst
{
public static void main(String [] args)
{
new ThreeConst();
}
public void ThreeConst(int x)
{
System.out.print(" " + (x * 2));
}
public void ThreeConst(long x)
{
System.out.print(" " + x);
}
public void ThreeConst()
{
System.out.print("no-arg ");
}
}
What is the result?
a) 8 4 no-arg
b) no-arg 8 4
c) Compilation fails.
d) No output is produced.
Ans : d
10) Given the following,
public class ThreeConst
{
public static void main(String [] args)
{
new ThreeConst(4L);
}
public ThreeConst(int x)
{
this();
System.out.print(" " + (x * 2));
}
public ThreeConst(long x)
{
this((int) x);
System.out.print(" " + x);
}
public ThreeConst()
{
System.out.print("no-arg");
}
}
What is the result?
a) 4 8
b) 8 4 no-arg
c) no-arg 8 4
d) Compilation fails.
Ans : c
11)
class A
{
public static void main (String[] args)
{
Error error = new Error();
Exception exception = new Exception();
System.out.print((exception instanceof Throwable
) + ",");
System.out.print(error instanceof Throwable);
}
}
What is the result of attempting to compile and run the program?
a) Prints: false,false
b) Prints: false,true
c) Prints: true,false
d) Prints: true,true
Ans : d
12) Given the following code in the 3 java files:
NewException.java
----------------class NewException extends Exception
{
}
Welcome.java
-----------class Welcome
{
public String displayWelcome(String name) throws NewException
{
if(name == null)
{
a)
b)
c)
d)
Prints:
Prints:
Prints:
Prints:
5,4
6,5
6,4
5,7
Ans : c
15) Which statement is true?
a) Public methods of a superclass cannot be overridden in subclasses.
b) Protected methods of a superclass cannot be overridden in subclasses.
c) Methods with default access in a superclass cannot be overridden in s
ubclasses.
d) Private methods of a superclass cannot be overridden in subclasses.
Ans : d
16)
Ans : c
17) Given:
public class TestOverload
{
public void process()
{
}
public String process()
{
return "hello";
}
public float process(int x)
{
return 67.5f;
}
}
What is the result?
a)
b)
c)
d)
cur.
Ans: c
18) Which of the following is a valid initialization ?
a) boolean b = TRUE;
b) float f = 27.893;
c) int i = 0xDeadCafe;
d) long l = 79,653;
Ans : c
19) What is the result of compiling and executing the below code ?
public class Test
{
public static void main(String[] args)
{
byte b=127;
byte c=15;
byte a = b + c;
}
}
a) Throws runtime exception at line no 7 saying "out of range".
b) Compilation succeeds and a takes the value of 142.
c) Compilation error at line 5. Byte cant take value of 127.
d) Compilation error at line 7.
Ans : d
20) What is the
a) -128
b) -( 2
c) 0 to
d) 0 to
Ans : d
21) Given:
int index = 2;
Boolean[] test = new Boolean[3];
Boolean foo = test [index];
What is the result?
a) foo has the value
b) foo has the value
c) foo has the value
d) foo has the value
of
of
of
of
true.
false.
null.
0.
Ans : c
22) Which one of the expressions will evaluate to true if preceded by the follow
ing code?
String a = "hello";
String b = new String(a);
String c =
char[] d =
a)
b)
c)
d)
Ans : c
a;
{ h , e
(a == "Hello")
(a == b)
a.equals(b)
a.equals(d)
, l
, o
};
23) What will be the result of attempting to compile and run the following code?
public class RefEq
{
public static void main(String[] args)
{
String s = "ab" + "12";
String t = "ab" + 12;
String u = new String("ab12");
System.out.println((s==t) + " " + (s==u));
}
}
a) The program will print true true when run.
b) The program will print false false when run.
c) The program will print false true when run.
d) The program will print true false when run.
Ans : d
24) A special file which is present inside the JAR that contain information abou
t the files packaged in a JAR file is known as
a) Metafest
b) Metadata
c) Manifest
d) Manidata
Ans : c
25) Given the following code:
public class Foo
{
public static void main(String[] args)
{
System.out.println(args[1]);
}
}
If the above code is compiled and run as follows
java Foo Apples 9 8 7
a)
b)
c)
d)
Ans : d
26) Certain DML privileges are required for merge statement.Which of the followi
ng is true?
Ans : b
27) Which datatype can be used for loop counters?
a) LONG
b) FLOAT
c) PLS_INTEGER
d) ROWID
Ans : c
28) An equijoin is a join with a join condition containing an equality operator
a) TRUE
b) FALSE
Ans : a
29) In Oracle, a sub query can be used to _________
a) Create groups of data
b) Sort data in a specific order
c) Convert data to a different format
d) Retrieve data based on an unknown condition
Ans : d
30) In J2EE, _____ are the business components that run on the server.
a) Java Beans
b) Enterprise Java Beans
c) Java Server Pages
d) Java Script
Ans : b
31) Enterprise Information System Tier is also known as
a) Client Tier
b) Applet
c) Messaging System
d) Data Tier
Ans : d
32) Consider the following HTML code
<html>
<body>
<a href=HelloServlet>HelloServlet>HelloServlet</a>
</body>
</html>
Which of the methods of HelloServlet will definitly called if the link is cl
icked?
a) doLink
b) doGet()
c) doPost()
d) doReset()
Ans : b
33) Which of the following is the syntax for JSP declaration?
a) <# ! declaration; [ declaration; ]+ ... #>
b) <% ! declaration; [ declaration; ]+ ... %>
c) <$ ! declaration; [ declaration; ]+ ... $>
d) <@ ! declaration; [ declaration; ]+ ... @>
Ans : b
34) Which of the following JSP variables is not available within a JSP expressio
n?
a) out
b) session
c) request
d) httpsession
Ans : d
35) Which of the following is NOT a standard method called as part of the JSP li
fe cycle?
a) jspInit()
b) jspService()
c) _jspService()
d) jspDestroy()
Ans : b
36) Which statement is true regarding the code snippet given below ?
<jsp:useBean id="abc" class="test.Abc" scope="page">
<jsp:setProperty name="abc" property="name" value="Wipro" />
</jsp:useBean>
a) This will create a new bean each tine it is called and se the proper
ty also.
b) This code will fail to run if abc
bean is not already present.
c) This code set the property only if the bean is newly created.
d) This code set the property only if the bean is already existing.
Ans : c
37) Which method is used to specify the content of the response is a binary fil
e?
a) setContent();
b) setBinaryOutput()
c) setContentType();
d) sendRedirect();
Ans : c
38) Which listener will get notified when an attribute to the context is added?
a) ServletRequestAttributeListener
b) ContextAttributeListener
c) ServletContextListener
d) ServletContextAttributeListener
Ans : d
39) Which method can be used to keep track of number of concurrent users?
a) ServletContextListener
b) ServletSessionListener
c) HttpSessionBindingListener
d) HttpSessionListener
Ans : d
40) Which method is defined in javax.servlet.http.HttpSessionEvent ?
a) getSession
b) getSessionId
c) getAttribute
d) setAttribute
Ans : a
41) Which of the following is a benefit of using static analyzer?
a)
b)
c)
d)
Ans: a
42) What is the purpose of WiproStyle?
a)
b)
c)
d)
Profiling tool
Static Analyzer tool
Unit testing tool
SCM tool
Ans: b
43) WiproStyle supports which of the following graphical reports?
a)
b)
c)
d)
Ans : d
44) Which of the following violations is thrown by WiproStyle in below code sect
ion?
public class Foo
{
public void bar()
{
int x = 2;
switch (x)
{
case 2:
int j = 8;
}
}
}
a)
b)
c)
d)
Ans: c
45) Which of the following violations is thrown by WiproStyle in below code sect
ion?
public interface Foo
{
public void method (); // VIOLATION
abstract int getSize (); // VIOLATION
static int SIZE = 100; // VIOLATION
}
a)
b)
c)
d)
Redundant Modifier
Trailing Array Comma
Avoid Star (Demand) Imports
SuperFinalize
Ans: a
46) Where will coverage analysis results be available?
a) Coverage view
b) Java editor as annotated markers
c) both coverage view and Java editor as annotated markers
d) None of the above
Ans: c
47) User is interested in generating test cases for 15 files out of 20. What is
the recommended way ?
a) Generate test cases for all and then delete unwanted tests
b) Select the files for which tests are not required in test configurati
on file
c) Select the files for which tests are required in test configuration f
ile
d) WiproUT does NOT support this kind of requirement.
Ans: c
48) What is the input taken by WiproUT in auto generated test cases?
a) possible Boundary values
b) only Null values
c) all possible integer values
d) all string values
Ans: a
49) What is the maximum number of test cases generated by WiproUT for a method?
a) One
b) Two
c) Any number depending on complexity of a method
d) as specified by user in Test Case Configuration window
Ans: d
50) What does Coverage analyzer in WiproUT help to identify?
a) only Uncovered code