SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
|
Email
Search
Test your basic knowledge |
Oracle Sun Certified Java Programmer
Start Test
Study First
Subjects
:
certifications
,
it-skills
Instructions:
Answer 50 questions in 15 minutes.
If you are not ready to take this test, you can
study here
.
Match each statement with the correct term.
Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.
This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. When overriding a method - the return type must be what?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
2. What access level does the following interface method have? void getSomething(); public.
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
3. An instance variable cannot be...
5.0
No - they can be their own file.
abstract
An unchecked exceptions.
4. What is the most basic construction for an Enum?
enum EnumName { VALUE1 - VALUE 2 - VALUEX }; Take special note of the ending semicolon - which is optional.
No limit. Notice: Only overriden instance methods are dynamically invoked based on the real object's type. This does not apply to static methods nor instance variables. ...
It cannot be more restrictive. It CAN be less restrictive than the supertype method.
Technically no. A 'fresh' method with the same name - return type and signature could be made in the subclass - but there is complete separation between the one in the superclass and subclass.
5. An interface method cannot be...
the same file
modified with strictfp
final (cannot use static - final - abstract - volatile or transient)
Interface methods are always public. A lack of modifier does not make this 'default' in the typical sense of a package-only default access modifier.
6. What is the code format for an abstract method?
No limit. Notice: Only overriden instance methods are dynamically invoked based on the real object's type. This does not apply to static methods nor instance variables. ...
Yes - as long as the final method has code in curly braces.
EnumName.VALUE;
access modifiers - abstract modifier - other non-access modifiers - return type - method name - parenthesis - semi-colon. e.g.: public abstract String getName();
7. What is the purpose of making a method 'synchronized'?
HiThereSally.java because the file name must exactly match the public class name (excepting the .java extension).
Compilation
It indicates that a method can only be accessed by one thread at a time.
access modifiers - abstract modifier - other non-access modifiers - return type - method name - parenthesis - semi-colon. e.g.: public abstract String getName();
8. When accessing an object you really don't have access to (it's 'private' or 'default' in another package - etc) - when will you get an error: at compilation or at run-time?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
9. What is the length in bytes of type 'long' - and what is it's maximum size?
extend another interface
No limit. Notice: Only overriden instance methods are dynamically invoked based on the real object's type. This does not apply to static methods nor instance variables. ...
8 bytes - 2^63 -1.
To limit values to a predetermined set.
10. Can an abstract class have a final method?
modified with strictfp
Yes - as long as the final method has code in curly braces.
No - Identifiers cannot begin with numbers - further more identifiers may not contain hyphens.
EnumName.VALUE;
11. What is the effect of making a method argument final?
final (cannot use static - final - abstract - volatile or transient)
Object type - ellipsis - object reference variable. e.g. doStuff(String ... necklace) { }
The argument cannot be reassigned to a different object/value within the method.
synchronized - or - native
12. You cannot _____ a static method
It indicates that a method can only be accessed by one thread at a time.
No - the type cannot change - only the object to which it points can change.
On either side of the variable name - e.g.: String [] var; String var [];
override
13. Enums can be declared...
final - abstract - static - synchronized - native - & strictfp
inside a Class
The override cannot throw BROADER exceptions nor NEW exceptions. If an exception is a subclass of the original exception - it can be thrown and still be an override. The override can also throw less exceptions.
Subtype.
14. At what point will you get an error if an interface method is 'protected' or 'private'?
Compilation.
inside a Class
The argument cannot be reassigned to a different object/value within the method.
Compilation. Classes can't be modified as protected (or private).
15. What occurs when a class is marked as 'final'?
4 bytes - 2^31 - 1.
Yes - it is. Identifiers can begin with currency symbols.
When the class is instantiated (not at compile or run time).
No other class can extend it.
16. What is the purpose of making a class 'abstract'?
Java SE 5.0
variables
Exactly the same as the original method.
The abstract class can never be instantiated. It must be extended to be used.
17. What are the only two access modifiers valid for a Class?
default and public. Protected and private modifiers are not permissible and will give a compile time error.
Technically no. A 'fresh' method with the same name - return type and signature could be made in the subclass - but there is complete separation between the one in the superclass and subclass.
final (cannot use static - final - abstract - volatile or transient)
Java SE 5.0
18. Putting abstract and final in the class declaration will give you a run-time or compile time error?
extend another interface
At compilation
4 bytes - 2^31 - 1.
When the class is instantiated (not at compile or run time).
19. How many non public classes can be in any one file?
No limit.
Only classes in the same package. The public methods are restricted by the default class level access.
The field 'aNumber' is public - static and final. The value cannot be changed -- it is a constant.
strictfp - final - and abstract
20. What is the length in bytes of type 'short' - and what is it's maximum size?
8 bytes - 2^63 -1.
2 Bytes - 2^15 - 1.
strictfp and final are legal - strictfp and abstract are legal - but you can't put final and abstract together.
Yes. Abstract methods must be marked as abstract - even if the class is abstract. However this isn't true with Interfaces: all methods in an interface are by default abstract as no non-abstract methods can exist in an Interface.
21. How many public classes can be defined in one source code file?
Yes - technically speaking.
Only one public class
No limit.
No - the enum only calls it within itself.
22. A class is access modified as default. It's methods are access modified as 'public'. What other class files can access the methods in this class?
synchronized - or - native
extend another interface
Only classes in the same package. The public methods are restricted by the default class level access.
The field 'aNumber' is public - static and final. The value cannot be changed -- it is a constant.
23. What is the syntax for declaring multiple variables on one line?
32 bits.
No. It can throw less or no exceptions.
Object a - b - c; or Object a -b -c = new Object();
byte - short - int - long - float - double - boolean - and char
24. What is the purpose of making a field 'transient'?
It cannot be more restrictive. It CAN be less restrictive than the supertype method.
It allows platform-dependent code - like C. It can only be used to modify a method (not a class or field).
equals(Object) - clone() - notify() - wait(empty/long/long - int) - finalize() - getClass() - hashCode() - toString() - & notifyAll()
It prevents the field from being serialized as the JVM will skip it.
25. A reference variable can be reassigned to another object that is of the same type. It can also be reassigned to a supertype or subtype of the original type?
Yes. Abstract methods must be marked as abstract - even if the class is abstract. However this isn't true with Interfaces: all methods in an interface are by default abstract as no non-abstract methods can exist in an Interface.
It allows platform-dependent code - like C. It can only be used to modify a method (not a class or field).
Subtype.
In the same <i>package</i> it can be public - protected - or default and cannot be final or private.
26. An original method that will be overriden by a class in the same package as the original could have what access levels and still be considered an 'override'?
32 bits.
In the same <i>package</i> it can be public - protected - or default and cannot be final or private.
modified with strictfp
synchronized - or - native
27. Can you make an overriding method more access restrictive (public to private) or less restrictive (private to public)?
It cannot be more restrictive. It CAN be less restrictive than the supertype method.
It indicates that a method can only be accessed by one thread at a time.
strictfp and final are legal - strictfp and abstract are legal - but you can't put final and abstract together.
On either side of the variable name - e.g.: String [] var; String var [];
28. All fields in an interface must have what three access & non-access modifiers?
Compilation.
public - final - and static. However - these modifiers are implicit and do not have to be typed. Interfaces only have Constants.
Subtype.
Compilation
29. What must you do when extending an abstract class or implementing any interface?
Yes - as long as the final method has code in curly braces.
You must implement every abstract method in the abstract class - as well as every method defined in the interface. Except... however - if a supertype has already made implementation of the abstract methods.
Yes - technically speaking.
It allows platform-dependent code - like C. It can only be used to modify a method (not a class or field).
30. What Java version began allowing an Enum type?
No other class can extend it.
5.0
Compilation. Classes can't be modified as protected (or private).
variables
31. Is this identifier name valid? Why or why not? int 34myVar-Yes;
No - the type cannot change - only the object to which it points can change.
64 bits.
No - Identifiers cannot begin with numbers - further more identifiers may not contain hyphens.
Yes. Beware though that they point to the same object on the heap - whereas primitives maintain separate values.
32. What is the proper syntax for declaring a var-arg in a method signature?
instance
64 bits.
Object type - ellipsis - object reference variable. e.g. doStuff(String ... necklace) { }
The argument cannot be reassigned to a different object/value within the method.
33. What is the length in bytes of type 'int' - and what is it's maximum size?
No - Identifiers cannot begin with numbers - further more identifiers may not contain hyphens.
No - the enum only calls it within itself.
No limit. Notice: Only overriden instance methods are dynamically invoked based on the real object's type. This does not apply to static methods nor instance variables. ...
4 bytes - 2^31 - 1.
34. Enums can be declared outside a Class - but in...
the same file
Object a - b - c; or Object a -b -c = new Object();
The argument cannot be reassigned to a different object/value within the method.
The abstract class can never be instantiated. It must be extended to be used.
35. Calling what method will return an Array of Enum values?
public - final - and static. However - these modifiers are implicit and do not have to be typed. Interfaces only have Constants.
'native'
access modifiers - abstract modifier - other non-access modifiers - return type - method name - parenthesis - semi-colon. e.g.: public abstract String getName();
.values()
36. Does an override have to throw all the exceptions of the original method?
No. It can throw less or no exceptions.
In an Enum declaration - it allows you to override an Enum default methods and values. You use it in the Enum value declaration list - just after the value in curly braces.
When the class is instantiated (not at compile or run time).
synchronized - or - native
37. If an Enum has a constructor - can you call that constructor?
In an Enum declaration - it allows you to override an Enum default methods and values. You use it in the Enum value declaration list - just after the value in curly braces.
byte - short - int - long - float - double - boolean - and char
Compilation.
No - the enum only calls it within itself.
38. How many bits does a primitive 'float' hold?
32 bits.
final - abstract - static - synchronized - native - & strictfp
The class must be abstract in order to have any abstract methods (or it could be an interface rather than a class).
EnumName.VALUE;
39. What is the purpose of making a method 'native'?
2 Bytes - 2^15 - 1.
It allows platform-dependent code - like C. It can only be used to modify a method (not a class or field).
No. It can throw less or no exceptions.
To limit values to a predetermined set.
40. How many var-arg's can you have in a method signature?
No other class can extend it.
No limit.
Just one.
When the class is instantiated (not at compile or run time).
41. What are the eight primitive types in Java?
At the end of the list.
When the class is instantiated (not at compile or run time).
byte - short - int - long - float - double - boolean - and char
No. It can throw less or no exceptions.
42. Do Enums have to be within an existing class?
2 Bytes - 2^15 - 1.
The override cannot throw BROADER exceptions nor NEW exceptions. If an exception is a subclass of the original exception - it can be thrown and still be an override. The override can also throw less exceptions.
No - they can be their own file.
Yes. Beware though that they point to the same object on the heap - whereas primitives maintain separate values.
43. Is this identifier name valid? Why or why not? int $_myVar;
Yes - it is. Identifiers can begin with currency symbols.
abstract
The override cannot throw BROADER exceptions nor NEW exceptions. If an exception is a subclass of the original exception - it can be thrown and still be an override. The override can also throw less exceptions.
No. It can throw less or no exceptions.
44. When are class instance variables instantiated?
When the class is instantiated (not at compile or run time).
Compilation. Classes can't be modified as protected (or private).
In the same <i>package</i> it can be public - protected - or default and cannot be final or private.
Just one.
45. An original method that will be overriden by a class not in the same package as the original could have what access levels and still be considered an 'override'?
It cannot be more restrictive. It CAN be less restrictive than the supertype method.
The original can be overriden if is public or protected and not final.
The abstract class can never be instantiated. It must be extended to be used.
override
46. Can a private method be overriden by a subclass?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
47. Can a subclass see and use inherited 'private' methods and fields?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
48. What kinds of exceptions can an overriding method throw that the original does not have?
EnumName.VALUE;
No limit. Notice: Only overriden instance methods are dynamically invoked based on the real object's type. This does not apply to static methods nor instance variables. ...
An unchecked exceptions.
default and public. Protected and private modifiers are not permissible and will give a compile time error.
49. Var-args have been possible since what Java version?
The override cannot throw BROADER exceptions nor NEW exceptions. If an exception is a subclass of the original exception - it can be thrown and still be an override. The override can also throw less exceptions.
Java SE 5.0
Exactly the same as the original method.
Yes. Abstract methods must be marked as abstract - even if the class is abstract. However this isn't true with Interfaces: all methods in an interface are by default abstract as no non-abstract methods can exist in an Interface.
50. Local ________ can be marked final
variables
The abstract class can never be instantiated. It must be extended to be used.
At compilation.
Subtype.
Sorry!:) No result found.
Can you answer 50 questions in 15 minutes?
Let me suggest you:
Browse all subjects
Browse all tests
Most popular tests
Major Subjects
Tests & Exams
AP
CLEP
DSST
GRE
SAT
GMAT
Certifications
CISSP go to https://www.isc2.org/
PMP
ITIL
RHCE
MCTS
More...
IT Skills
Android Programming
Data Modeling
Objective C Programming
Basic Python Programming
Adobe Illustrator
More...
Business Skills
Advertising Techniques
Business Accounting Basics
Business Strategy
Human Resource Management
Marketing Basics
More...
Soft Skills
Body Language
People Skills
Public Speaking
Persuasion
Job Hunting And Resumes
More...
Vocabulary
GRE Vocab
SAT Vocab
TOEFL Essential Vocab
Basic English Words For All
Global Words You Should Know
Business English
More...
Languages
AP German Vocab
AP Latin Vocab
SAT Subject Test: French
Italian Survival
Norwegian Survival
More...
Engineering
Audio Engineering
Computer Science Engineering
Aerospace Engineering
Chemical Engineering
Structural Engineering
More...
Health Sciences
Basic Nursing Skills
Health Science Language Fundamentals
Veterinary Technology Medical Language
Cardiology
Clinical Surgery
More...
English
Grammar Fundamentals
Literary And Rhetorical Vocab
Elements Of Style Vocab
Introduction To English Major
Complete Advanced Sentences
Literature
Homonyms
More...
Math
Algebra Formulas
Basic Arithmetic: Measurements
Metric Conversions
Geometric Properties
Important Math Facts
Number Sense Vocab
Business Math
More...
Other Major Subjects
Science
Economics
History
Law
Performing-arts
Cooking
Logic & Reasoning
Trivia
Browse all subjects
Browse all tests
Most popular tests