Vous êtes sur la page 1sur 4

Java Certification Exam

1. Valid modifiers :
2. Range of int & char
3. Valid top level class declarations
Class A { }
Class A extends B,C{ }
Class A extends B{ }
Import java.awt.*;
Public Class A { }
4. Given a class declaration, what are the valid statements that can be inserted before the class definition
class A{

Import java.awt.*;
Package awt;
Class B { }
Static int I=10;
5. Given a class One in which a public void method( ){ } is defined, what are the valid
method definitions that can be included in a sub class of A without changing the class
Class One{
Public void method( ){ }
Class Two extends One{
Public void meth1( ){ }
void othermethod( ){}
int method( ){.}
int method(String s){ .}
void method( ){ }
public int othermethod (String s ){ }
6. Octal representation of an integer.
7. If else construct, if(x>4)
Else if(x>9)
What is the value of x that can print test2 None.

8. Garbage collection:
(i)Programmer can explicitly indicate that the memory space allocated to an object
reference variable is no longer used & can be freed
(ii) the time when the memory is freed by garbage collection is not predictable
9. Threads: What causes a thread to stop :
The thread execute wait( )
A thread of higher priority gets into Runnable state.
An interrupted Exception is thrown
A thread requests for getID
10. Threads:
(i) The JVM exits as soon as the main method exits.
(ii)Inconsistency of data arises when multiple threads access the same object without a
11. Keyword used to work with multiple threads accessing the same object using object
locks: synchronized
12. The argument that is passed into all the methods of mouse listeners. MouseEvent
13. The return value of all listener methods in Delegation Event Model Void
13. GridBagLayout:
weightx & weighty values range from 0.0 to 1.0
relationship between anchor & fill
only one row or column is modified when the window is resized
14. Height of the component varies with window resizing but width remains constant
(East & West of Border Layout)
15. The component size should always be retained irrespective of the resizing of
container. Flow Layout
16. Class panel1 extends Panel{
String s;
Button b=new Button(Click me);
b.addActionListener(new ActionListener(
public void actionPerformed(ActionEvent ae){
s= message;
System.out.println(message is +s);
What happens when the button (click me ) is pressed.
17. Return type of main method Void

17. The util interface that is used to group objects with ordering allowing duplicates : List
18. Reading one line of data at a time from a socket connected to the network with an
input stream object s. The output to be in standard ASCII character encoding.
BufferedReader b= new
BufferedReader (new InputStreamReader(s.getInputStreamReader),
19. An application consists of a set of user interfaces & the various operations are to be
performed based on the various user invoked events. Which of the following are true
for the above application
Extending Adapter classes is not suitable
Some listener interface must be implemented
If a particular event listener is implemented only the methods of interest to us
need to be implemented
Multiple event listeners can be added to a single component
The order in which the events are processed is the order in which the listeners
are added
20. class A {
String str;
Int x;
Int z;
public A(String s , int a){
str = s ;
public A(int a,String s){
class B extends A{
public B(String s, int a){
public B(String s, int a, int c) {
z = c;
What code can be inserted at /////A so that it fully implements the existing code to
initialise the values of x & str.
21. class Str {
String s= Hello ;
String s1= there;
Public static void main(String[] args){

System.out.println(s+ my friend); } }
22. class A{
String s1=Hi;
String s2=There;
public static void main(String[] args){
What is the earliest point where the memory space allocated to the string in line 2(s1)
can be released.
23. Two String Buffers are given & the result of the assignment of one reference to the
other is tested using the .equals( ) method.
24. Valid array declarations for a two dimensional array
Int arr[][] = new int[10][10]
Int [][] arr = new int[10][10]
Int[]arr[] = new int[10][10]
25.Which of the following statements throws a null pointer exception
given String s=null;
25. An Employee is a Person & he has a name that is stored in a string ,& info that is
stored in a vector.construct the class definition
Public class Employee extends Person
26. Similar question select the datatypes used
Vector, String
27. class A{
int a;
meth( ){
meth1( ){ }
if meth1( ) can throw a Protocol Exception which is not a subclass of Runtime
Exception, what are the types of exceptions that can be declared to be thrown by the
method definition of meth( )
Protocol Exception