Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 217 pages
Exam (elaborations)

PRO 192 FULL EXAM PREP STUDY GUIDE | 100% Correct | Verified | 2024 Version

Document preview thumbnail
Preview 4 out of 217 pages

A, B, D - - - - Which of the following are valid declarations? Assume .* is imported. (choose 3) A. VectorMap v; B. SetString s; C. MapString m; D. MapString, String m; A - - - - 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 D - - - - What keyword is used to prevent an object from being serialized? A ⦁ private B ⦁ volatile C ⦁ protected D ⦁ transient E ⦁ None of the above A - - - - An abstract class can contain methods with declared bodies. A ⦁ True B ⦁ False E - - - - 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 - - - - 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 D - - - - 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 - - - - 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 - - - - Which of the following keywords is used to invoke a method in the parent class?A ⦁ this B ⦁ super C ⦁ final D ⦁ static C - - - - Given the following code, what will be the outcome? public class Funcs extends .Math { public int add(int x, int y) { return x + y; } public int sub(int x, int y) { return x - y; } public static void main(String [] a) { Funcs f = new Funcs(); Sln("" + (1, 2)); } } A ⦁ The code compiles but does not output anything. B ⦁ "3" is printed out to the console. C ⦁ The code does not compile. D ⦁ None of the above. D - - - - Given the following code, what is the expected outcome? public class Test { public static void main(String [] a) { int [] b = [1,2,3,4,5,6,7,8,9,0]; Sln("a[2]=" + a[2]); } } A ⦁ The code compiles but does not output anything. B ⦁ "a[2]=3" is printed out to the console. C ⦁ "a[2]=2" is printed out to the console.D ⦁ The code does not compile. E ⦁ None of the above. D - - - - What is the value of x after the following operation is performed? x = 23 % 4; A. 23 B. 4 C. 5.3 D. 3 E. 5 C - - - - Given the following code, what keyword must be used at line 4 in order to stop execution of the for loop? boolean b = true; for (;;) { if (b) { insert code } // do something } A ⦁ stop B ⦁ continue C ⦁ break D ⦁ None of the above B - - - - What method call is used to tell a thread that it has the opportunity to run?A ⦁ wait() B ⦁ notify() C ⦁ start() D ⦁ run() A - - - - Given the following code, which of the results that follow would you expect? 1. package mail; 2. interface Box { protected void open(); void close(); public void empty(); } A ⦁ The code will not compile because of line 4. B ⦁ The code will not compile because of line 5. C ⦁ The code will not compile because of line 6. D ⦁ The code will compile C - - - - Assertions are used to enforce all but which of the following? A ⦁ Preconditions B ⦁ Postconditions C ⦁ Exceptions D ⦁ Class invariants B - - - - The developer can force garbage collection by calling S(). A ⦁ True B ⦁ FalseA, C, D - - - - Select the valid primitive data types. (Select all that apply) A ⦁ boolean B ⦁ bit C ⦁ char D ⦁ float E ⦁ All of the above D - - - - How many bits does a float contain? A. 1 B. 8 C. 16 D. 32 E. 64 A - - - - What is the value of x after the following line is executed? x = 32 * (31 - 10 * 3); A. 32 B. 31 C. 3 D. 704 E. None of the above A - - - - 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. .TimeFormat B. .DateFormat C. .TimeFormat D. .DateFormat B - - - - 24. The following line of code is valid. int x = 9; byte b = x; A. True B. False A, B, C - - - - 25. Which of the following code snippets compile? (choose 3) 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 D - - - - 26. What will be the output of the following code? public class StringTest { public static void main(String [] a) { String s1 = "test string"; String s2 = "test string"; if (s1 == s2) {Sln("same"); } else { Sln("different"); } } } A. The code will compile but not run. B. The code will not compile. C. "different" will be printed out to the console. D. "same" will be printed out to the console. 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.A - - - - 30. Suppose you are writing a class that provides custom deserialization. The class implements .Serializable (and not .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() B - - - - 1. A signed data type has an equal number of non-zero positive and negative values available. A. True B. False F - - - - 2. Choose the valid identifiers from those listed here. (Choose all that apply.) A. BigOlLongStringWithMeaninglessName B. $int C. bytes D. $1 E. finalist F. All of the other choice B, C - - - - 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)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 A, E - - - - 5. Consider the following line of code: int[] x = new int[25]; After execution, which statements are true? (Choose 2) A. x[24] is 0 B. x[24] is undefined C. x[25] is 0 D. x[0] is null E. h is 25 D - - - - 6. Consider the following application: 1. class Q6 { 2. public static void main(String args[]) { 3. Holder h = new Holder(); 4. = 100; 5. (h); 6. Sln(); 7. } 8. } 9. 10. class Holder {11. public int held; 12. public void bump(Holder theHolder) { 13. theH++; } 14. } 15. } What value is printed out at line 6? A. 0 B. 1 C. 100 D. 101

Content preview

PRO 192 FULL EXAM PREP STUDY GUIDE | 100% Correct | Verified | 2024 Version A, B, D - - - - ✔✔Which of the following are valid declarations? Assume java.util.* is imported. (choose 3) A. Vector<Map> v; B. Set<String> s; C. Map<String> m; D. Map<String, String> m; A - - - - ✔✔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 D - - - - ✔✔What keyword is used to prevent an object from being serialized? A ⦁ private B ⦁ volatile C ⦁ protected D ⦁ transient E ⦁ None of the above A - - - - ✔✔An abstract class can contain methods with declared bodies. A ⦁ True B ⦁ False E - - - - ✔✔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 - - - - ✔✔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 D - - - - ✔✔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 - - - - ✔✔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 - - - - ✔✔Which of the following keywords is used to invoke a method in the parent class? A ⦁ this B ⦁ super C ⦁ final D ⦁ static C - - - - ✔✔Given the following code, what will be the outcome? public class Funcs extends java.lang.Math { public int add(int x, int y) { return x + y; } public int sub(int x, int y) { return x - y; } public static void main(String [] a) { Funcs f = new Funcs(); System.out.println("" + f.add(1, 2)); } } A ⦁ The code compiles but does not output anything. B ⦁ "3" is printed out to the console. C ⦁ The code does not compile. D ⦁ None of the above. D - - - - ✔✔Given the following code, what is the expected outcome? public class Test { public static void main(String [] a) { int [] b = [1,2,3,4,5,6,7,8,9,0]; System.out.println("a[2]=" + a[2]); } } A ⦁ The code compiles but does not output anything. B ⦁ "a[2]=3" is printed out to the console. C ⦁ "a[2]=2" is printed out to the console. D ⦁ The code does not compile. E ⦁ None of the above. D - - - - ✔✔What is the value of x after the following operation is performed? x = 23 % 4; A. 23 B. 4 C. 5.3 D. 3 E. 5 C - - - - ✔✔Given the following code, what keyword must be used at line 4 in order to stop execution of the for loop? boolean b = true; for (;;) { if (b) { <insert code> } // do something } A ⦁ stop B ⦁ continue C ⦁ break D ⦁ None of the above B - - - - ✔✔What method call is used to tell a thread that it has the opportunity to run?

Document information

Uploaded on
June 9, 2024
Number of pages
217
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
$16.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Sold
61
Followers
19
Items
2466
Last sold
2 months ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions