QCM1 Final
QCM1 Final
QCM1 Final
QUESTION 7
You want subclasses in any package to have access to members of a superclass. Which is
the most restrictive access that accomplishes this objective?
A. public
B. private
C. protected
D. transient
E. default access
Answer:
QUESTION 8
Which of these are valid declaration of the main() method?
(a) static void main(String args[]) {/* */}
(b) public static int main(String args[]) {/* */}
(c) public static void main(String args) {/* */}
(d) final static public void main(String[] arguments) {/* */}
(e) public int main(String args[], int argc) {/* */}
(f) public void main(String args[]) {/* */}
Answer:
QUESTION 9
Which are valid declarations? (Choose all that apply.)
A. int $x;
B. int 123;
C. int _123;
D. int #dim;
E. int %percent;
F. int *divide;
G. int central_sales_region_Summer_2005_gross_sales;
Answer:
QUESTION 10
Given:
1. enum A { A }
2. class E2 {
3. enum B { B }
4. void C() {
5. enum D { D }
6. }
7. }
Which statements are true? (Choose all that apply.)
A. The code compiles.
B. If only line 1 is removed the code compiles.
C. If only line 3 is removed the code compiles.
D. If only line 5 is removed the code compiles.
3
QUESTION 12
Which declare a compilable abstract class? (Choose all that apply.)
A. public abstract class Canine { public Bark speak(); }
B. public abstract class Canine { public Bark speak() { } }
C. public class Canine { public abstract Bark speak(); }
D. public class Canine abstract { public abstract Bark speak(); }
Answer:
QUESTION 13
Given:
1. class Voop {
2. public static void main(String [] args) {
3. doStuff(1);
4. doStuff(1, 2);
5. }
6. // insert code here
7. }
Which, inserted independently at line 6, will compile? (Choose all that apply.)
A. static void doStuff(int... doArgs) { }
B. static void doStuff (int [] doArgs) { }
C. static void doStuff(int doArgs...) { }
4
QUESTION 17
Please select floating point types
A. byte
B. int
C. double
D. short
E. long
F. float
Answer:
QUESTION 18
The private modifier can be applied to ...
A. A variable
B. A method
C. A top level class
D. All of the above
Answer:
QUESTION 19
Please select invalid java keywords
A. ifdef
B. sizeof
C. goto
Answer:
QUESTION 20
What keyword is used to prevent an object from being serialized?
A.private
B.volatile
C.protected
D.transient
E.None of the above
Answer:
QUESTION 21
A Java Bean component has the following field:
private Boolean enabled;
Which two pairs of method declarations follow the JavaBean standard for accessing
this fields?
A. public void setEnabled ( Boolean enabled)
public Boolean getEnabled ( )
B. public void setEnabled ( Boolean enabled)
public void isEnabled ( )
6