Java Certification Exam
Valid modifiers :
Range of int & char
Valid top level class declarations
Class A
Class A extends B,C
Class A extends B
Import java.awt.*;
Public Class A
Given a class declaration, what are the valid statements that can be inserted before the class definition
////X
class A
Package awt;
Class B
Static int I=10;
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 definitions.
Class One{
Public void method( )
Class Two extends One{
Public void meth1( )
//X
void othermethod( )
int method( )
int method(String s)
void method( )
public int othermethod (String s )
Octal representation of an integer.
If else construct, if(x>4)
System.out.println "test1");
Else if(x>9)
System.out.println "test2");
Else
System.out.println "test3");
What is the value of x that can print "test2" None.
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
Threads: What causes a thread to stop :
(i) The thread execute wait( )
(ii) A thread of higher priority gets into Runnable state.
(iii) An interrupted Exception is thrown
(iv) A thread requests for getID
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 lock.
Keyword used to work with multiple threads accessing the same object using object locks: synchronized
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
GridBagLayout
(i) weightx & weighty values range from 0.0 to 1.0
(ii) relationship between anchor & fill
(iii) only one row or column is modified when the window is resized
Height of the component varies with window resizing but width remains constant (East & West of Border Layout)
The component size should always be retained irrespective of the resizing of container. Flow Layout
Class panel1 extends Panel
What happens when the button ("click me" ) is pressed.
Return type of main method Void
The util interface that is used to group objects with ordering allowing duplicates : List
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), "8859_1");
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
(i) Extending Adapter classes is not suitable
(ii) Some listener interface must be implemented
(iii) If a particular event listener is implemented only the methods of interest to us need to be implemented
(iv) Multiple event listeners can be added to a single component
(v) The order in which the events are processed is the order in which the listeners are added
class A
public A(int a,String s)
class B extends A
public B(String s, int a, int c)
What code can be inserted at /////A so that it fully implements the existing code to initialise the values of x & str.
This(s,a)
class Str }
class A
What is the earliest point where the memory space allocated to the string in line 2(s1) can be released.
Two String Buffers are given & the result of the assignment of one reference to the other is tested using the .equals( ) method.
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;
if((s!=null)&&(s.length>0))
if((s!=null)&(s.length>0))
if((s!=null)|(s.length>0))
if((s==null)||(s.length>0))
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
Similar question select the datatypes used
Vector, String..
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( )
Exception
Protocol Exception
|