Professional Documents
Culture Documents
J2 Ee
J2 Ee
366.43
Choice d
366.430000
ans : a
[4] Which of the following is the correct statement that you will add to the code snippet
given below to print a character corresponding to value d + 1?
public class Main
{
public static void main ( String[ ] args )
{
double d = 98 ;
// Add statement here
}
}
Choice a
System.out.println ( ( char ) ++d ) ;
Choice b
System.out.println ( ( unsigned char ) ++d ) ;
Choice c
System.out.println ( ++d ) ;
Choice d
System.out.println ( ++d.ToChar ) ;
Choice a
Runnable r = new Runnable() { };
Choice b
Runnable r = new Runnable(public void run() { });
Choice c
Runnable r = new Runnable { public void run(){}};
Choice d
System.out.println(new Runnable() {public void run() { }});
ans : d
[14] Which of the following statements are correct?
I. Object-oriented programming is a method of programming based on a hierarchy of classes.
I Object-oriented programming is a method of programming based on a well-defined and
cooperating objects.
Choice a
Only I is correct.
Choice b
Only II is correct.
Choice c
Both I and II are correct.
Choice d
Both I and II are incorrect.
ans : c
[15] class B
{
B(String s) { }
B() { }
}
class Bar extends B
{
Bar() { }
Bar(String s) {super(s);}
void zoo()
{
// insert code here
}
}
which one create an anonymous inner class from within class Bar?
Choice a
B f = new B(24) { };
Choice b
B f = new Bar() { };
Choice c
Bar f = new B(String s) { };
Choice d
B f = new B.Bar(String s) { };
ans : b
[16] Which of the following can not be override?
Choice a
class
Choice b
class member functions
Choice c
constructor
Choice d
destructor
ans : c
[17] Polymorphism is a feature that allows one _______ to be used for a general class of
actions.
Choice a
function
Choice b
class
Choice c
package
Choice d
interface
ans : d
[18]
Which of the following statement is correct about interfaces?
Choice a
An interface is a reference type, similar to a class that can contain only constants, method
signatures, and nested types.
Choice b
Interfaces cannot be instantiated.
Choice c
Interfaces can only be implemented by classes or extended by other interfaces.
Choice d
All of the above
ans : d
[19] Which of the following statement is correct?
I. A package cannot be renamed without renaming the directory in which the classes are
stored.
II. Any classes or .class files that are the part of a package must be stored in the directory
having
A1 C = new B1( ) ;
C.fun( ) ;
}
public static void main ( String args[ ] )
{
fun( ) ;
}
}
Choice a
Above program will print the output: i 6.
Choice b
Above program will report error(s) on compilation.
Choice c
Above program will print the output: i 8
Choice d
Above program will report run time error.
ans : c
[22]
The object created after occurrence of an exception is known as _________ object.
Choice a
exceptional
Choice b
exception
Choice c
Error
Choice d
exception handling
Choice b
Allows integration with Content Management tools
Choice c
Allows integration of roles between web developers and application developers
Choice d
Allows separation of Content Management tools
ans : a
[28] When enabling your JAVA EE server application with SSL, which of the following
must occur?
Choice a
The certificate be issued by a third-party Certificate Authority, I.e. Verisign.
Choice b
The certificate be signed either by a Certificate Authority or self-signed.
Choice c
The Sun cryptographic provider package be installed in your JVM.
Choice d
An offline key exchange be done with the client prior to SSL communications.
ans : b
[29] What will be the output of the code snippet given below?
class Main
{
enum Level
{
NOVICE, MEDIUM, EXPERT ;
public void checkLevel ( Level l1, Level l2 )
{
System.out.println ( l1.toString( ).length( ) + l2.toString( ).length( ) ) ;
}
}
public static void main ( String[ ] args )
{
Level level = Level.NOVICE ;
level.checkLevel ( level, Level.EXPERT ) ;
}
}
Choice a
l2
Choice b
l1
Choice c
11
Choice d
12
ans : d
[30] Which of the following statements are correct?
I. We can match the pattern against another sequence using Pattern class.
II. The Pattern class can define constructors.
Choice a
Only I is correct.
Choice b
Only II is correct.
Choice c
Both I and II are correct.
Choice d
Both I and II are incorrect.
***Sorry some question answer is not their..
Please share this blog with your friends.
Thanks.
[1] Which of the following statements are correct? I. The long data type is the
most versatile and efficient type. (true)
II. Data type determines behavior and not size. (false)
Choice a **
Only I is correct.
Choice b
Only II is correct.
Choice c
Both I and II are correct.
Choice d
Both I and II are incorrect.
[2] Which of the following statements are correct?
I. We can operate on chars as if they are integers. (false)
II. Java has a simple data type boolean for logical values. (true)
Choice a
Only I is correct.
Choice b
Only II is correct.
Choice c **
[5] Which of the following statements are correct? I. The Bitwise NOT operator is
called as the bitwise complement operator. (true)
II. The << operator shifts all of the bits in a value to the left a specified number
of times. (true)
Choice a
Only I is correct.
Choice b
Only II is correct.
Choice c **
Both I and II are correct.
Choice d
Both I and II are incorrect.
[6] Which of the following statements are correct? I. Nested if else statements
are not allowed in java. (false)
II. if statements are executed from top to down. (true)
Choice a
Only I is correct.
Choice b **
Only II is correct.
Choice c
Both I and II are correct.
Choice d
Both I and II are incorrect.
[7] What is the output of following block of program ?
boolean var = false;
if(var = true) {
System.out.println("TRUE");
} else {
System.out.println("FALSE");
}
Choice a **
TRUE
Choice b
FALSE
Choice c
Compilation Error
Choice d
Run-time Error
[8] Which of the following statements are correct? I. Objects of type String are
immutable. (true)
II. Once we have created a String object we can use it anywhere that a string is
allowed. (true)
Choice a
Only I is correct.
Choice b
Only II is correct.
Choice c **
Both I and II are correct.
Choice d
Both I and II are incorrect.
Choice a **
setPriority()
Choice b
getPriority()
Choice c
takePriority()
Choice d
none of the above
[11]
Which of the following statement is correct?
I. An inner class is a non static nested class.
II. An inner class is a non static derived class.
Choice a **
Only I is correct.
Choice b
Only II is correct.
Choice c
Both I and II are correct.
Choice d
Choice c
It can be marked public.
Choice d
It can be marked static.
[13]
Which of the following statement is correct?
I. A class defined within the block of for loop is also known as inner class.
II. A class defined within the block of method can be termed as inner class.
Choice a
Only I is correct.
Choice b
Only II is correct.
Choice c **
Both I and II are correct.
Choice d
Both I and II are incorrect.
String str ;
protected Sample( )
{
str = "hello" ;
}
Sample Fun( )
{
return this ;
}
}
class Sample1 extends Sample
{
}
class Sample2 extends Sample1
{
}
class Sample3 extends Sample2
{
}
public class Main
{
public static void main ( String[ ] args )
{
Sample S1 = new Sample3( ) ;
System.out.println ( S1.getClass( ) ) ;
}
}
Choice a
Sample
Choice b
Sample1
Choice c
Sample2
Choice d **
Sample3
[16] Which keyword is used to access the own class data members?
Choice a
my
Choice b
super
Choice c
me
Choice d **
this
[17]
Which of the following statement is correct?
I. A superclass reference variable can refer to a subclass object.
Choice a **
Only II is correct.
Choice b
Both I and II are correct.
Choice c
Both I and II are incorrect.
Choice d
Only I is correct.
[18] If a class includes an interface but does not fully implement the methods
defined by that interface, then that class must be declared as ________.
Choice a
derived
Choice b **
abstract
Choice c
base
Choice d
final
[19] The time between Command Execution and Response is called _____
Choice a
Granularity
Choice b
Latency
Choice c
Lag time
**
Choice d
Delay time
[20]
Which of the following statement is correct?
I. A package cannot be renamed without renaming the directory in which the
classes are stored.
II. Any classes or .class files that are the part of a package must be stored in the
directory having
the same name as that of the package.
Choice a **
Both I and II are correct.
Choice b
Both I and II are incorrect.
Choice c
Only II is correct.
Choice d
Only I is correct.
[21] Which of the following statement is correct about the program given below
where package sample is defined in the file Sample.java and the class NewClass
in another file is starting point of program?
package sample ;
public class Sample
{
int n ;
public Sample( )
{
n=5;
}
static public void main ( String args[ ] )
{
System.out.print ( " Main in package" ) ;
NewClass N = new NewClass( ) ;
N.main ( args ) ;
}
}
import sample.* ;
public class NewClass
{
static Sample S = new Sample ( ) ;
public static void main ( String args[ ] )
{
System.out.print ( "Main outside the package " ) ;
}
}
Choice a
Above program
Choice b
Above program
Choice c
Above program
Choice d
Above program
[24] Collections framework was designed to meet which of the following goals?
I. The framework had to be high-performance.
II. The framework had to allow different types of collections to work in a similar
manner and with a high degree of interoperability.
III. Extending and / or adapting a collection had to be easy.
Choice a
Only I and II
Choice b
Only I and III
Choice c
Only II and III
Choice d ***
I, II and III
Each wrapper object is immutable and stores one primitive value that is set
[27] Which of the following are the valid declarations of varargs for a method?
I. void calculate ( int... x ) { }
II. void evaluate ( int x... ) { }
Choice a
Only I
Choice b **
Only II
Choice c
Both I and II
Choice d
Neither I nor II
[28] When enabling your JAVA EE server application with SSL, which of the
following must occur?
Choice a
The certificate be issued by a third-party Certificate Authority, I.e. Verisign.
Choice b
The certificate be signed either by a Certificate Authority or self-signed.
Choice c
The Sun cryptographic provider package be installed in your JVM.
Choice d
An offline key exchange be done with the client prior to SSL communications.
[29] Which of the following statement is correct about the code snippet given
below?
class WhichOne
{
WhichOne ( Integer... size )
{
System.out.println ( "Var Args version" ) ;
}
public static void main ( String[ ] args )
{
new WhichOne ( 2, 3 ) ;
new WhichOne ( new Integer ( 2 ), new Integer ( 3 ) ) ;
}
}
Choice a **
The code reports an error
Choice b
The code causes an exception
Choice c
The code compiles successfully but does not give any output
Choice d
The code gives an output as
Var Args version
Var Args version
in terms of lpsu.
in terms of ulps.**
in terms of lups.