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. 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
2. What is the purpose of making a method 'synchronized'?
Compilation.
IEEE 754
It indicates that a method can only be accessed by one thread at a time.
An unchecked exceptions.
3. What is the length in bytes of type 'short' - and what is it's maximum size?
equals(Object) - clone() - notify() - wait(empty/long/long - int) - finalize() - getClass() - hashCode() - toString() - & notifyAll()
2 Bytes - 2^15 - 1.
64 bits.
Just one.
4. At what point will you get an error if an interface method is 'protected' or 'private'?
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.
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. ...
override
Compilation.
5. An instance variable cannot be...
Just one.
abstract
.values()
enum EnumName { VALUE1 - VALUE 2 - VALUEX }; Take special note of the ending semicolon - which is optional.
6. How many interfaces can a class implement?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
7. Can you make an overriding method more access restrictive (public to private) or less restrictive (private to public)?
No limit.
It cannot be more restrictive. It CAN be less restrictive than the supertype method.
Only one public class
modified with strictfp
8. What is the length in bytes of type 'long' - and what is it's maximum size?
It indicates that a method can only be accessed by one thread at a time.
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.
The class must be abstract in order to have any abstract methods (or it could be an interface rather than a class).
9. Where can the brackets for an array declaration go?
5.0
Yes - it is. Identifiers can begin with currency symbols.
On either side of the variable name - e.g.: String [] var; String var [];
the same file
10. Is this identifier name valid? Why or why not? int $_myVar;
No - the enum only calls it within itself.
To limit values to a predetermined set.
Yes - it is. Identifiers can begin with currency symbols.
When the class is instantiated (not at compile or run time).
11. Once a reference variable is defined - can it's object type be changed?
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.
It indicates that a method can only be accessed by one thread at a time.
No. It can throw less or no exceptions.
No - the type cannot change - only the object to which it points can change.
12. 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?
Subtype.
access modifiers - abstract modifier - other non-access modifiers - return type - method name - parenthesis - semi-colon. e.g.: public abstract String getName();
Yes - as long as the final method has code in curly braces.
.values()
13. 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
14. What is the purpose of making a method 'native'?
access modifiers - abstract modifier - other non-access modifiers - return type - method name - parenthesis - semi-colon. e.g.: public abstract String getName();
4 bytes - 2^31 - 1.
Only one public class
It allows platform-dependent code - like C. It can only be used to modify a method (not a class or field).
15. What is the purpose of making a class 'abstract'?
IEEE 754
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.
The abstract class can never be instantiated. It must be extended to be used.
The argument cannot be reassigned to a different object/value within the method.
16. How many var-arg's can you have in a method signature?
Only one public class
override
It indicates that a method can only be accessed by one thread at a time.
Just one.
17. How many bits does a primitive 'float' hold?
32 bits.
Only one
Volatile forces the JVM to reconcile the private field with the one in master memory. Won't generally be covered on test.
Compilation. Classes can't be modified as protected (or private).
18. What are the only two access modifiers valid for a Class?
At the end of the list.
default and public. Protected and private modifiers are not permissible and will give a compile time error.
variables
On either side of the variable name - e.g.: String [] var; String var [];
19. You cannot _____ a static method
Public and Abstract
byte - short - int - long - float - double - boolean - and char
No other class can extend it.
override
20. What is the length in bytes of type 'int' - and what is it's maximum size?
No other class can extend it.
4 bytes - 2^31 - 1.
HiThereSally.java because the file name must exactly match the public class name (excepting the .java extension).
It prevents the field from being serialized as the JVM will skip it.
21. Enums can be declared outside a Class - but in...
the same file
No. It can throw less or no exceptions.
The class must be abstract in order to have any abstract methods (or it could be an interface rather than a class).
final (cannot use static - final - abstract - volatile or transient)
22. What are the seven non-access modifiers for methods?
Either the same or a SUBTYPE of the original method's return 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.
instance
final - abstract - static - synchronized - native - & strictfp
23. What is the basic construction for calling an Enum value?
No limit.
The field 'aNumber' is public - static and final. The value cannot be changed -- it is a constant.
EnumName.VALUE;
a method?
24. What kinds of exceptions can an overriding method throw that the original does not have?
An unchecked exceptions.
public - final - and static. However - these modifiers are implicit and do not have to be typed. Interfaces only have Constants.
strictfp and final are legal - strictfp and abstract are legal - but you can't put final and abstract together.
No. It can throw less or no exceptions.
25. 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'?
The original can be overriden if is public or protected and not final.
32 bits.
No limit.
Only one
26. Do Enums have to be within an existing class?
enum EnumName { VALUE1 - VALUE 2 - VALUEX }; Take special note of the ending semicolon - which is optional.
To limit values to a predetermined set.
No - they can be their own file.
override
27. What occurs when a class is marked as 'final'?
No other class can extend it.
IEEE 754
At compilation.
The class must be abstract in order to have any abstract methods (or it could be an interface rather than a class).
28. How many classes can a class extend?
An unchecked exceptions.
Subtype.
Only one
Compilation. Classes can't be modified as protected (or private).
29. If a class's public class declaration is something like - 'public class HiThereSally {' - what must the source code file be named? Why?
The abstract class can never be instantiated. It must be extended to be used.
HiThereSally.java because the file name must exactly match the public class name (excepting the .java extension).
The field 'aNumber' is public - static and final. The value cannot be changed -- it is a constant.
EnumName.VALUE;
30. Which of the three non-access modifiers (strictfp - final - abstract) can and can't be used together in a class declaration?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
31. The following field is defined in an interface. What do we know about it's access and non-access modifiers? int aNumber = 59;
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
32. What is a 'constant specific class body' and where can you use it?
No other class can extend it.
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.
Yes - technically speaking.
the same file
33. Enums cannot be declared inside...
final - abstract - static - synchronized - native - & strictfp
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.
strictfp and final are legal - strictfp and abstract are legal - but you can't put final and abstract together.
a method?
34. If a class is abstract - do the methods which ares supposed to be abstract too need to be marked 'abstract'?
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
35. Can multiple non-primitive variables be defined in one line?
On either side of the variable name - e.g.: String [] var; String var [];
extend another interface
Yes. Beware though that they point to the same object on the heap - whereas primitives maintain separate values.
In the same <i>package</i> it can be public - protected - or default and cannot be final or private.
36. Where in the source code must a 'package' statement be?
4 bytes - 2^31 - 1.
The very first line - excepting any comments.
the same file
enum EnumName { VALUE1 - VALUE 2 - VALUEX }; Take special note of the ending semicolon - which is optional.
37. 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?
Only classes in the same package. The public methods are restricted by the default class level access.
'native'
It cannot be more restrictive. It CAN be less restrictive than the supertype method.
Only one
38. What are the eight primitive types in Java?
5.0
byte - short - int - long - float - double - boolean - and char
IEEE 754
To limit values to a predetermined set.
39. An instance variable cannot be marked...
Compilation
synchronized - or - native
variables
No limit.
40. Calling what method will return an Array of Enum values?
No limit.
Only one
.values()
4 bytes - 2^31 - 1.
41. What must you do when extending an abstract class or implementing any interface?
.values()
At compilation
64 bits.
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.
42. All fields in an interface must have what three access & non-access modifiers?
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.
public - final - and static. However - these modifiers are implicit and do not have to be typed. Interfaces only have Constants.
Volatile forces the JVM to reconcile the private field with the one in master memory. Won't generally be covered on test.
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.
43. Can an abstract class have a final method?
It allows platform-dependent code - like C. It can only be used to modify a method (not a class or field).
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.
Yes - technically speaking.
44. An interface method cannot be modified as...
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
45. What IEEE standard does using strictfp conform to?
Compilation.
IEEE 754
HiThereSally.java because the file name must exactly match the public class name (excepting the .java extension).
Compilation. Classes can't be modified as protected (or private).
46. An interface method cannot be...
modified with strictfp
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.
No other class can extend it.
default and public. Protected and private modifiers are not permissible and will give a compile time error.
47. What are the built-in methods for class Object?
No other class can extend it.
Compilation. Classes can't be modified as protected (or private).
equals(Object) - clone() - notify() - wait(empty/long/long - int) - finalize() - getClass() - hashCode() - toString() - & notifyAll()
4 bytes - 2^31 - 1.
48. 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
49. What are the rules for checked exceptions in overriding a method?
Compile and Run time. It will normally happen at compilation - but in case the 'private' method class was changed to private/default/protected after the calling class was compiled - it will be a Run Time 'IllegalAccessError' exception.
Compilation. Classes can't be modified as protected (or private).
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.
equals(Object) - clone() - notify() - wait(empty/long/long - int) - finalize() - getClass() - hashCode() - toString() - & notifyAll()
50. For any method to be abstract - what must also be true about the class?
The class must be abstract in order to have any abstract methods (or it could be an interface rather than a class).
Compile and Run time. It will normally happen at compilation - but in case the 'private' method class was changed to private/default/protected after the calling class was compiled - it will be a Run Time 'IllegalAccessError' exception.
To limit values to a predetermined set.
2 Bytes - 2^15 - 1.
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