JAVA1D

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

D

7. Which of the following statements are true? (Select all that apply.) A. A final object's data cannot be changed. B. A final class can be subclassed. C. A final method cannot be overloaded. D. A final object cannot be reassigned a new address in memory. E. None of the above.

A

8. The keyword extends refers to what type of relationship? A. "is a" B. "has a" C. "was a" D. "will be a" E. None of the above

B

9. Which of the following keywords is used to invoke a method in the parent class? A. this B. super C. final D. static

ABCDE

2. Choose the valid identifiers from those listed here. (Choose all that apply.) A. BigOlLongStringWithMeaninglessName B. $int C. bytes D. $1 E. finalist

B

1. A signed data type has an equal number of non-zero positive and negative values available. A. True B. False

ABD

1. Which of the following are valid declarations? Assume java.util.* is imported. A. Vector<Map> v; B. Set<String> s; C. Map<String> m; D. Map<String, String> m;

B

14. What method call is used to tell a thread that it has the opportunity to run? A. wait() B. notify() C. start() D. run()

C

16. Assertions are used to enforce all but which of the following? A. Preconditions B. Postconditions C. Exceptions D. Class invariants

B

17. The developer can force garbage collection by calling System.gc(). A. True B. False

ACD

18. Select the valid primitive data types. (Select all that apply.) A. boolean B. bit C. char D. float E. All of the above

D

19. How many bits does a float contain? A. 1 B. 8 C. 16 D. 32 E. 64

A

2. You can determine all the keys in a Map in which of the following ways? A. By getting a Set object from the Map and iterating through it. B. By iterating through the Iterator of the Map. C. By enumerating through the Enumeration of the Map. D. By getting a List from the Map and enumerating through the List. E. You cannot determine the keys in a Map.

A

21. A StringBuffer is slower than a StringBuilder, but a StringBuffer is threadsafe. A. True B. False

D

22. Select the list of primitives ordered in smallest to largest bit size representation. A. boolean, char, byte, double B. byte, int, float, char C. char, short, long, float D. char, int, float, long E. None of the above

D

23. Which class provides locale-sensitive text formatting for date and time information? A. java.util.TimeFormat B. java.util.DateFormat C. java.text.TimeFormat D. java.text.DateFormat

B

24. The following line of code is valid. int x = 9; byte b = x; A. True B. False

ABC

25. Which of the following code snippets compile? A. Integer i = 7; B. Integer i = new Integer(5); int j = i; C. byte b = 7; D. int i = 7; byte b = i; E. None of the above

B

27. Java arrays always start at index 1. A. True B. False

C

28. Which of the following statements accurately describes how variables are passed to methods? A. Arguments are always passed by value. B. Arguments are always passed by reference. C. Arguments that are primitive type are passed by value. D. Arguments that are passed with the & operator are passed by reference.

D

29. How do you change the value that is encapsulated by a wrapper class after you have instan- tiated it? A. Use the setXXX() method defined for the wrapper class. B. Use the parseXXX() method defined for the wrapper class. C. Use the equals() method defined for the wrapper class. D. None of the above.

D

3. What keyword is used to prevent an object from being serialized? A. private B. volatile C. protected D. transient E. None of the above

BD

3. Which of the following signatures are valid for the main() method entry point of an application? (Choose all that apply.) A. public static void main() B. public static void main(String arg[]) C. public void main(String [] arg) D. public static void main(String[] args) E. public static int main(String [] arg)

A

30. Suppose you are writing a class that provides custom deserialization. The class implements java.io.Serializable (and not java.io.Externalizable). What method should imple- ment the custom deserialization, and what is its access mode? A. private readObject B. public readObject() C. private readExternal() D. public readExternal()

A

4. An abstract class can contain methods with declared bodies. A. True B. False

D

4. If all three top-level elements occur in a source file, they must appear in which order? A. Imports, package declarations, classes/interfaces/enums B. Classes/interfaces/enums, imports, package declarations C. Package declaration must come first; order for imports and class/interfaces/enum definitions is not significant D. Package declaration, imports, class/interface/enum definitions. E. Imports must come first; order for package declarations and class/interface/enum definitions is not significant

E

5. Select the order of access modifiers from least restrictive to most restrictive. A. public, private, protected, default B. default, protected, private, public C. public, default, protected, private D. default, public, protected, private E. public, protected, default, private

C

6. Which access modifier allows you to access method calls in libraries not created in Java? A. public B. static C. native D. transient E. volatile


Kaugnay na mga set ng pag-aaral

Ch 11 inflammation and wound healing

View Set

Chap 13 Development through the Lifespan, 7e

View Set

Chapter 30: Disorders of Hepatobiliary and Exocrine Pancreas Function

View Set

Unit 1: Mental and Emotional Health

View Set

Banking and Financial Institutions in Society Exam 2 CH 7 & 8

View Set

Questions: mon quartier / ma ville (ORAL)

View Set

ENGLISH REVOLUTION: PEOPLE'S CHOICE

View Set