Hi again,
I've been solving these questions from past exam papers, and im not entirely confident about my answers. Im hoping that you guys can double check them for me.
These are the questions:
1- Which of the following methods must be over-ridden in order to tell the system how to execute a Thread?
(A) thread()
(B) execute()
(C) start()
(D) run()
2- Which of the following is a correct event handling method?
(A) mousePressed(Mo useEvent e){}
(B) MousePressed(Mo useClick e){}
(C) functionKey(Key Press k){}
(D) ComponentAdded( keyPress e){}
(3) A monitor called mon has 5 threads in its waiting pool; all these waiting threads have the same priority. One of the threads is thread1. How can you notify thread1 so that it alone moves from Waiting state to Ready State?
(A) Execute notify(thread1) ; from within synchronized code of mon.
(B) Execute mon.notify(thre ad1); from synchronized code of any
object.
(C) Execute thread1.notify( ); from any code(synchroniz ed or not) of
any object.
(D) You cannot specify which thread will get notified.
(4) How can you retrieve a circle’s radius value that’s passed to an applet?
(A)
public void init() {
String s = getParameter("r adius");
doSomethingWith Radius(s); }
(B)
public static void main(String[] args) {
String s = getParameter("r adius");
DoSomethingWith Radius(s); }
(C)
public void init() {
int radius = getParameter("r adius");
doSomethingWith Radius(radius); }
(D)
public void init() {
int radius = getParameter();
doSomethingWith Radius(radius); }
true/false
1- The method drawRect(int a, int b, int c, int d) defined in
java.awt draws the outline of a rectangle with a, b being the x,y coordinates of top left corner, and c,d being the x,y co-ordinates of the
bottom right corner.
TRUE
2- There is no statement in Java to free storage.
FALSE //finalize() is used
Once again im really hoping that you guys may help me figure out if my answers are correct or not.
Thanks in advance
I've been solving these questions from past exam papers, and im not entirely confident about my answers. Im hoping that you guys can double check them for me.
These are the questions:
1- Which of the following methods must be over-ridden in order to tell the system how to execute a Thread?
(A) thread()
(B) execute()
(C) start()
(D) run()
2- Which of the following is a correct event handling method?
(A) mousePressed(Mo useEvent e){}
(B) MousePressed(Mo useClick e){}
(C) functionKey(Key Press k){}
(D) ComponentAdded( keyPress e){}
(3) A monitor called mon has 5 threads in its waiting pool; all these waiting threads have the same priority. One of the threads is thread1. How can you notify thread1 so that it alone moves from Waiting state to Ready State?
(A) Execute notify(thread1) ; from within synchronized code of mon.
(B) Execute mon.notify(thre ad1); from synchronized code of any
object.
(C) Execute thread1.notify( ); from any code(synchroniz ed or not) of
any object.
(D) You cannot specify which thread will get notified.
(4) How can you retrieve a circle’s radius value that’s passed to an applet?
(A)
public void init() {
String s = getParameter("r adius");
doSomethingWith Radius(s); }
(B)
public static void main(String[] args) {
String s = getParameter("r adius");
DoSomethingWith Radius(s); }
(C)
public void init() {
int radius = getParameter("r adius");
doSomethingWith Radius(radius); }
(D)
public void init() {
int radius = getParameter();
doSomethingWith Radius(radius); }
true/false
1- The method drawRect(int a, int b, int c, int d) defined in
java.awt draws the outline of a rectangle with a, b being the x,y coordinates of top left corner, and c,d being the x,y co-ordinates of the
bottom right corner.
TRUE
2- There is no statement in Java to free storage.
FALSE //finalize() is used
Once again im really hoping that you guys may help me figure out if my answers are correct or not.
Thanks in advance
Comment