• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Check The Correct Statements...killer

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks, I have some doubts on the answers to these questions. Hoping you could clarify'em...Thanks
What is required is to check the correct statements of each quesiton.
1-Which correctly create an array of five empty Strings?
A.String a [] = new String [5]; for (int i = 0; i < 5; a[i++] = "");
B.String [] a = new String[5]; for (int i = 0; i < 5; a[i++] = null);
2-What kind of reader do you use to handle ASCII code?
A.BufferedReader
B.ByteArrayReader
C.PrintWriter
D.InputStreamReader
E.FilterReader
3-Choose the correct ones about thread:
A.When JVM exists the main method, it will stop only after all the threads are
stopped.
B.if there are multiple threads, reading or writing of data of class is inconsitent.
4-Which statements are true about listeners?
A.Most components allow multiple listeners to be added.
B.A copy of the original event is passed into a listener method.
C.A copy of the refrence of the Original event is passed to the listener method.
5-What might cause the current thread to stop executing.
A.An InterruptedException is thrown.
B.The thread executes a wait() call.
C.The thread constructs a new Thread.
D.A thread of higher priority becomes ready.
E.The thread executes a waitforID() call on a MediaTracker.
6-Which statements are true about threads?
A.Invoking the suspend() stops a thread so that it cannot be restarted
B.The Java Interpreter's natural exit occurs when no non daemon threads
C.Uncoordinated changes to shared data by multiple threads may result in the
data being read, or left, in an inconsistent state.
D.Most components allow multiple listeners to be added.
7- What is the method used to schedule a thread for execution, is it start() or run()?
8-Which of the following are FilterInputStreams?
A.DataInputStream
B.LineNumberInputStream
C.ByteArrayInputStream
D.BufferedInputStream
9-What does the java runtime option -cs do?
A.check source with debug report
B.clear classes that are existing when starting compilation.
C.check if the source is newer when loading classes.
10-What is the target in an Event?
A.The Object() where the event came from.
B.The Object() where the event is destined for.
C.What the Object() that generated the event was doing.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Posting 10 questions - saying you have doubts, but not saying a thing about what you don't understand is not going to get you any reply from me. Do you just want answers or do you want to understand something?
Bill
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ayman,

Bill is right...... try to attempt to understand...
Here is my answers for a few Questions... Correct me if I am wrong...
1-Which correctly create an array of five empty Strings?
A.String a [] = new String [5]; for (int i = 0; i < 5; a[i++] = "");
B.String [] a = new String[5]; for (int i = 0; i < 5; a[i++] = null);
Ans : Both A & B
3-Choose the correct ones about thread:
A.When JVM exists the main method, it will stop only after all the threads are stopped. - True
B.if there are multiple threads, reading or writing of data of class is inconsitent. - False
5-What might cause the current thread to stop executing.

A.An InterruptedException is thrown.
B.The thread executes a wait() call. - True
C.The thread constructs a new Thread.
D.A thread of higher priority becomes ready.
E.The thread executes a waitforID() call on a MediaTracker. - True

6-Which statements are true about threads?
A.Invoking the suspend() stops a thread so that it cannot be restarted - False.... resume() can restart a suspended thread
B.The Java Interpreter's natural exit occurs when no non daemon threads - True
C.Uncoordinated changes to shared data by multiple threads may result in the data being read, or left, in an inconsistent state.
D.Most components allow multiple listeners to be added.- True
7- What is the method used to schedule a thread for execution, is it start() or run()?
Ans : start()
8-Which of the following are FilterInputStreams?
A.DataInputStream - True
B.LineNumberInputStream True
C.ByteArrayInputStream False (It is InputStream)
D.BufferedInputStream True
Aruna
[This message has been edited by Aru (edited September 16, 2000).]
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You have asked questions from :
Lang. Fundamantals, Threads, IO, AWT in the same post!!!
Most of these doubts can be easily clarified by looking into the API.
I would sincerely suggest you to read a good book on these topic.
BTW Aru, all of your answers except Q7 and Q8 are wrong.
I'ld love to answer the doubts but would not like to promote spoon feeding.
Hints:
1. null string is not same as empty string.
2. Your answer to 3 and 6 contradict each other.
3. Q5 says "might" (this means the Thread may or may not stop executing).
4. Asking Q8 shows 'somebody' does not know about JavaDocs!!!

HTH,
Paul.

------------------
http://pages.about.com/jqplus
Get Certified, Guaranteed!
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1-Which correctly create an array of five empty Strings?
A.String a [] = new String [5];
for (int i = 0; i < 5; a[i++] = "");
B.String [] a = new String[5];
for (int i = 0; i < 5; a[i++] = null);
Only A actually creates any String objects.
B creates an Array object - type String[] - size 5
the loop does nothing because the array contents
are initialized to null.
Bill
 
Ayman Jaffar
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for your reply. I just hate these type of questions and actually I posted them becuase the I had doubts from the site I saw them in.
I've read three books on java and gone through at about 40 sites that have mock exams. So I'll be taking my test tomorrow.
 
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic