SCJP试题-SCJPMockExam3

来源:java认证发布时间:2012-11-12 12:48:16java认证视频



Answer 35)
Objective 9.5)
4)int z = 015;
The letters c and s do not exist as literal indicators and a String must be
enclosed with double quotes, not single as in this case.
--------------------------------------------------------------------------------

Answer 36)
Objective 4.3)
1)double4)instanceofNote the upper case S on switch means it is
not a keyword and the word then is part of Visual Basic but not Java. Also,
instanceof looks like a method but is actually a keyword,
--------------------------------------------------------------------------------

Answer 37)
Objective 9.2)
4) -3.0
--------------------------------------------------------------------------------

Answer 38)
Objective 4.2)
3) one
Command line parameters start from 0 and fromt he first parameter after the
name of the compile (normally Java)
--------------------------------------------------------------------------------

Answer 39)
Objective 10.1)
4) The set is designed for unique elements.
Collection is an interface, not a class. The Collection interface includes a
method called iterator. This returns an instance of the Iterator class which has
some similarities with Enumerators.The name set should give away the purpose
of the Set interface as it is analogous to the Set concept in relational
databases which implies uniquness.
--------------------------------------------------------------------------------

Answer 40)
Objective 8.1)
2) If multiple listeners are added to a component the events will be
processed for all but with no guarantee in the order4) You may remove as
well add listeners to a component.
It ought to be fairly intuitive that a component
ought to be able to have multiple listeners. After all, a text
field might want to respond to both the mouse and keyboard
--------------------------------------------------------------------------------

Answer 41)
Objective 5.1)
1) b=m;3) d =i;
You can assign up the inheritance tree from a child to a parent but not the
other way without an explicit casting. A boolean can only ever be assigned a
boolean value.
--------------------------------------------------------------------------------

Answer 42)
Objective 7.3)
2) You can obtain a mutually exclusive lock on any object3) A thread can
obtain a mutually exclusive lock on a synchronized method of an object4)
Thread scheduling algorithms are platform dependent
Yes that says dependent and not independent.
--------------------------------------------------------------------------------

Answer 43)
Objective 6.1)
2) Ask for a re-design of the hierarchy with changing the Operating System to
a field rather than Class type
This question is about the requirement to understand the difference between
the "is-a" and the "has-a" relationship. Where a class is inherited you have to
ask if it represents the "is-a" relationship. As the difference between the root
and the two children are the operating system you need to ask are Linux and
Windows types of computers.The answer is no, they are both types of Operating
Systems. So option two represents the best of the options. You might consider
having operating system as an interface instead but that is another story.
Of course there are as many ways to design an object hierarchy as ways to
pronounce Bjarne Strousjoup, but this is the sort of answer that Sun will
proabably be looking for in the exam. Questions have been asked in discussion
forums if this type of question really comes up in the exam. I think this is
because some other mock exams do not contain any questions like this. I assure
you that this type of question can come up in the exam. These types of question
are testing your understanding of the difference between the is-a and has-a
relationship in class design.
--------------------------------------------------------------------------------

Answer 44)
Objective 4.1)
1) An inner class may be defined as static4) An inner class may extend
another class
A static inner class is also sometimes known as a top level nested class.
There is some debate if such a class should be called an inner class. I tend to
think it should be on the basis that it is created inside the opening braces of
another class. How could an anonymous class have a constructor?. Remember a
constructor is a method with no return type and the same name as the class.
Inner classes may be defined as private
--------------------------------------------------------------------------------

Answer 45)
Objective 5.3)
4) Compilation and output of "Not equal! 10"
The output will be "Not equal 10". This illustrates that the Output
+=10 calculation was never performed because processing stopped after the first
operand was evaluated to be false. If you change the value of b1 to true
processing occurs as you would expect and the output is "We are equal 20";.
--------------------------------------------------------------------------------

Answer 46)
Objective 5.1)2)j= i<
--------------------------------------------------------------------------------

Answer 47)
Objective 5.3)
4) 12
As well as the binary OR objective this questions requires you to understand
the octal notaction which means that the leading letter zero (not the letter O))
means that the first 1 indicates the number contains one eight and nothing else.
Thus this calculation in decimal mean8|4
To convert this to binary means1000

0100

----

1100

----
Which is 12 in decimal
The | bitwise operator means that for each position where there is a 1,
results in a 1 in the same position in the answer.
--------------------------------------------------------------------------------

Answer 48)
Objective 5.1)
2)s+=i;
Only a String acts as if the + operator were overloaded
--------------------------------------------------------------------------------

Answer 49)
Objective 10.1)
Although the objectives do not specifically mention the need to understand
the I/O Classes, feedback from people who have taken the exam indicate that you
will get questions on this topic. As you will probably need to know this in the
real world of Java programming, get familiar with the basics. I have assigned
these questions to Objective 10.1 as that is a fairly vague objective.
1) File f = new File("/","autoexec.bat");2) DataInputStream d = new
DataInputStream(System.in);3) OutputStreamWriter o = new
OutputStreamWriter(System.out);
Option 4, with the RandomAccess file will not compile because the constructor
must also be passed a mode parameter which must be either "r" or "rw"
--------------------------------------------------------------------------------

Answer 50)
Objective 5.1)1)o1=o2;

2)b=ob;

4)o1=b;
--------------------------------------------------------------------------------

Answer 51)
Objective 5.4)
4) 10,0,20
In the call
another(v,i);
A reference to v is passed and thus any changes will be intact after this
call.
--------------------------------------------------------------------------------

Answer 52)
Objective 6.2)
1) public void amethod(String s, int i){}4) public void
Amethod(int i, String s) {}
Overloaded methods are differentiated only on the number, type and order of
parameters, not on the return type of the method or the names of the
parameters.
--------------------------------------------------------------------------------

Answer 53)
Objective 6.2)
4)Base b = new Base(10);
Any call to this or super must be the first line in a constructor. As the
method already has a call to this, no more can be inserted.

--------------------------------------------------------------------------------

Answer 54)
Objective 4.1)
1)System.out.println(s); 4) System.out.println(iArgs);
A class within a method can only see final variables of the enclosing method.
However it the normal visibility rules apply for variables outside the enclosing
method.
--------------------------------------------------------------------------------

Answer 55)
Objective 7.2)
1) yield()2) sleep4) stop()
Note, the methods stop and suspend have been
deprecated with the Java2 release, and you may get questions on the exam that
expect you to know this. Check out the Java2 Docs for an explanation
--------------------------------------------------------------------------------

Answer 56)
Objective 10.1)
1) addElement
--------------------------------------------------------------------------------

Answer 57)
Objective 4.1)
The import statement allows you to use a class directly instead of fully
qualifying it with the full package name, adding more classess with the import
statement does not cause a runtime performance overhad. I assure you this is
true. An inner class can be defined with the private modifier.
3) An inner class can be defined with the protected modifier4) An
interface cannot be instantiated
--------------------------------------------------------------------------------

Answer 58)
Objective 4.6)
1) mousePressed(MouseEvent e){}4) componentAdded(ContainerEvent e){}
--------------------------------------------------------------------------------

Answer 59)
Objective 10.1)
1) iterator2) isEmpty3) toArray
--------------------------------------------------------------------------------

Answer 60)
Objective 7.3)
2) 2) Ensures only one thread at a time may access a method or object
--------------------------------------------------------------------------------


End of documentMarcus Green copyright 2000

上一页789下一页

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答