Enter your search terms
Submit search form
Web
examineonline.googlepages.com
Online Exam
>>
Programming
>>
Java
>>
Java Practice 1
Menu
Programming
COMPTIA
GMAT
English
IQ
DataBase
OS
MCSE
CISCO
Finance
Management
Health
Soft Skills
Web Building
Multimedia
Java Practice 1
1 . Fill in the blanks :- The main subclass of the Exception class is _______ class.
A.
RuntimeException
B.
NumberFormatException
2 . Fill in the blanks :- Only subclasses of ______class may be caught or thrown.
A.
Throwable
B.
Throws
3 . Fill in the blanks :- Any user-defined exception class is a subclass of the _____ class.
A.
Exception
B.
Throws
C.
Throwable
4 . How do you achieve multiple inheritance in Java?
A.
Using interfaces.
B.
Using abstract classes
C.
Using final classes
D.
None of the above
5 . Name interfaces without a method? (Select multiple)
A.
Serializable
B.
Cloneble
C.
Remote
D.
UserDefined
6 . What are the advantages of inheritance? (Select multiple)
A.
Reusability of code
B.
accessibility of variables of the superclass by subclasses.
C.
Accessibility of methods of the superclass by subclasses.
D.
a,b are true
7 . State true or false :- Final methods can be overridden.
A.
True
B.
False
8 . State true or false :- Declaration of methods as final results in faster execution of the program?
A.
True
B.
False
9 . State true or false :- Final variables should be declared in the beginning?
A.
True
B.
False
10 . State true or false :- Can we declare variable inside a method as final variables?
A.
True
B.
False
11 . An interface contains __ methods
A.
Non-abstract
B.
Implemented
C.
unimplemented
12 . What is the use of valueOf( ) method?
A.
It converts data from its internal format into a human-readable form.
B.
It converts integer value to string
C.
It converts string to int value
D.
None of the above
13 . Which of the following is not a wrapper class?
A.
String
B.
Integer
C.
Boolean
D.
Character
14 . Which of the following methods cause the String object referenced by s to be changed? (Select multiple)
A.
s.concat( )
B.
s.toUpperCase( )
C.
s.replace( )
D.
s.valueOf( )
15 . What are the constants defined by Byte, Short, Integer and Long? 1. MAX_VALUE, 2. MIN_VALUE 3. TYPE.
A.
1, 2
B.
2, 3
C.
1, 2, 3
D.
1, 3
16 . Fill in the blanks :- System class provides access to the _______________ resources.
A.
Data
B.
System
C.
Util
17 . Which of the following classes is used to perform basic console I/O?
A.
System
B.
SecurityManager
C.
Math
D.
Runtime
18 . Which of the following are true? (Select multiple)
A.
The Class class is the superclass of the Object class.
B.
The Object class is final.
C.
The Class class can be used to load other classes.
D.
The ClassLoader class can be used to load other classes.
19 . Which of the following methods are methods of the Math class?
A.
absolute( )
B.
log( )
C.
cosine( )
D.
sine( )
20 . Which of the following are true about the Error and Exception classes?
A.
Both classes extend Throwable.
B.
The Error class is final and the Exception class is not.
C.
The Exception class is final and the Error is not.
D.
Both classes implement Throwable.
21 . Which of the following are true?
A.
The Void class extends the Class class.
B.
The Float class extends the Double class.
C.
The System class extends the Runtime class.
D.
The Integer class extends the Number class.
22 . Which of the following statements are true?
A.
UTF characters are all 8-bits.
B.
UTF characters are all 16-bits.
C.
UTF characters are all 24-bits.
D.
Unicode characters are all 16-bits.
23 . State true or false :- The File class contains a method that changes the current working directory.
A.
True
B.
False
24 . Which of the following are true about the File class? (Select multiple)
A.
File objects can be garbage collected.
B.
A File object can be used to access the files in the current directory.
C.
When a File object is created, a corresponding directory or file is created in the local file system.
D.
File objects are used to access files and directories on the local file system.
25 . How do you create a Reader object from an InputStream object?
A.
Use the static createReader( ) method of InputStream class.
B.
Use the static createReader( ) method of Reader class.
C.
Create an InputStreamReader object, passing the InputStream object as an argument to the InputStreamReader constructor.
D.
Create an OutputStreamReader object, passing the InputStream object as an argument to the OutputStreamReader constructor.
26 . Which of the following can you perform using the File class? (Select multiple)
A.
Change the current directory
B.
Return the name of the parent directory
C.
Delete a file
D.
Find if a file contains text or binary information
27 . What is true regarding the uses of servlets
A.
A servlet can handle multiple requests concurrently, and can synchronize requests. This allows servlets to support systems such as on-line conferencing.
B.
Servlets can forward requests to other servers and servlets.
C.
Servlets can be used to balance load among several servers that mirror the same content, and to partition a single logical service over several servers, according to task type or organizational boundaries.
D.
All of the above.
28 . What is the legal range of a byte integral type?
A.
0 - 65, 535
B.
(-128) - 127
C.
(-32,768) - 32,767
D.
(-256) - 255
29 . What will be the result of compiling the following code:
public class Test {
static int age;
public static void main (String args []) {
age = age + 1;
System.out.println("The age is " + age);
}
}
A.
Compiles and runs with no output
B.
Compiles and runs printing out The age is 1
C.
Compiles but generates a runtime error
D.
Does not compile
E.
Compiles but generates a compile time error
30 . Which of the following are correct?
A.
128 >> 1 gives 64
B.
128 >>> 1 gives 64
C.
128 >> 1 gives -64
D.
128 >>> 1 gives -64
Test Name :
Java Practice 1
Category :
Java
Number of Question :
30
Pass Score :
80
Test Result
Your Score :
Passing Score :
80
Result :
Copyright by
VanTuMinh
© 2007