File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes A suggestion for list of Mock Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A suggestion for list of Mock Questions" Watch "A suggestion for list of Mock Questions" New topic

A suggestion for list of Mock Questions

Prasanna Joshi

Joined: Apr 25, 2000
Posts: 11
I have a small suggestion.I have observed in this list that
a same set of Tricky Questions from various Mock Exams Crop
up again and again.Shall we make a list in this thread
of all the Tricky Questions/Questions related to fundamentals
we find,without repeating any of them so that we have a consolidated list of Questions Also, We should put only the hardest questions and their answers.Also if we have to discuss about any of the questions in this list ,we should do it in a different Thread ,so That this thread does not get Cluttered.
To start The Thread I add a question I felt tested your fundamentals

Q 1)
class ApBase extends Object implements Runnable.
1. Apbase aBase = new ApBase();
2. Runnable aR = aBase;
3. Object obj = aR;
4. Apbase x = (Apbase)obj;
What will happen when we try to compile and run?
a. Compiler objects to line 2.
b. Compiler objects to line 3.
c.Code compiles but when run , throws ClassCastException in line 4.
d. Compiles and runs fine.
Answer --> D

Another Question
Which of the options below will print
running on the Command Line
1. class RunTest implements Runnable {
2. public static void main(String args[]) {
3. RunTest rt = new RunTest();
4. Thread t = new Thread(rt);
5. //A
6. }
7. public void run() {
8. System.out.println("running");
9. }
10. void go() {
11. start(1);
12. }
13. void start(int i) {
14. }
15. }
Select all valid answers.
a. System.out.println("running");
b. rt.start();
c. rt.go();
d. rt.start(1);
Ans--> a
[This message has been edited by Prasanna Joshi (edited June 30, 2000).]
[This message has been edited by Prasanna Joshi (edited June 30, 2000).]
Paul Smiley
Ranch Hand

Joined: Jun 02, 2000
Posts: 244
Good idea for a topic, but you need to put the name and location of the mock exam(s) in your post in order to keep in the spirit of JavaRanch. Thanks!
Ranch Hand

Joined: May 29, 2000
Posts: 45
Nice thought, but for the subjective term "tricky". How does one ascertain whether the question is 'tricky' enough to be posted here(in this thread) or not. It may be tricky for me but for Satya, it may not be...may be for Ajith...but may not be for only some moderator intervenes regularly for cleaning up the thread...for fine tuning it....
..sorry for pouring cold water !
I agree. Here's the link:
subject: A suggestion for list of Mock Questions
It's not a secret anymore!