PRO192 Chapter 1-3 Practise Question Reviews
Chapter 1
Which of the following are valid declarations? Assume
.*
is imported.
A.
Vector<Map> v;
B.
Set<String> s;
C.
Chapter 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;
(3 answer) ** Answ** a,b,d
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. ** Answ** a
What keyword is used to prevent an object from being serialized?
A.
private
B.
volatile
C.
protected
D.
transient
E.
None of the above ** Answ** d
,An abstract class can contain methods with declared bodies.
A.
True
B.
False ** Answ** a
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 ** Answ** e
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 ** Answ** c
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. ** Answ** d
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 ** Answ** a
Which of the following keywords is used to invoke a method in the parent class?
A. this
B. super
C. final
D. static ** Answ** b
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. ** Answ** c
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];
Voordelen van het kopen van samenvattingen bij Stuvia op een rij:
√ Verzekerd van kwaliteit door reviews
Stuvia-klanten hebben meer dan 700.000 samenvattingen beoordeeld. Zo weet je zeker dat je de beste documenten koopt!
Snel en makkelijk kopen
Je betaalt supersnel en eenmalig met iDeal, Bancontact of creditcard voor de samenvatting. Zonder lidmaatschap.
Focus op de essentie
Samenvattingen worden geschreven voor en door anderen. Daarom zijn de samenvattingen altijd betrouwbaar en actueel. Zo kom je snel tot de kern!
Veelgestelde vragen
Wat krijg ik als ik dit document koop?
Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.
Tevredenheidsgarantie: hoe werkt dat?
Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.
Van wie koop ik deze samenvatting?
Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper smartchoices. Stuvia faciliteert de betaling aan de verkoper.
Zit ik meteen vast aan een abonnement?
Nee, je koopt alleen deze samenvatting voor €10,13. Je zit daarna nergens aan vast.