GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Quiz

OCP Chapter 2

Jack Hughes 10 Fragen

Quiz starten

Fragen in diesem Quiz (10)

  1. 1Which of the following are valid Java Identifiers?
    1. A_
    2. B_helloWorld$
    3. Ctrue
    4. Djava.lang
    5. EPublic
    6. F1980_s
    7. G_Q2_
  2. 2What lines are printed by the following program?Bild zu Frage 2
    1. ALine 8 generates a compiler error
    2. BLine 9 generates a compiler error
    3. CEmpty =
    4. DEmpty = false
    5. EBrand =
    6. FBrand = null
    7. GCode = 0.0
    8. HCode = 0f
  3. 3Which of the following code snippets about var compile without issue when used in a method?
    1. Avar spring = null;
    2. Bvar fall = "leaves";
    3. Cvar evening = 2; evening = null;
    4. Dvar night - new Object();
    5. Evar day = 1/0;
    6. Fvar winter = 12, cold;
    7. Gvar fall = 2, autumn = 2;
    8. Hvar morning = "", morning = null;
  4. 4Which of the following statements about the code snippet are true?
    4. short numPets 5L;
    5. int numGrains = 2.0;
    6. String name = "Scruffy";
    7. int d = numPets.length();
    8. int e = numGrains.length;
    9. int f = name.length();
    1. ALine 4 generates a compiler error
    2. BLine 5 generates a compiler error
    3. CLine 6 generates a compiler error
    4. DLine 7 generates a compiler error
    5. ELine 8 generates a compiler error
    6. FLine 9 generates a compiler error
  5. 5Which statements about the following class are true:Bild zu Frage 5
    1. ALine 3 generates a compiler error
    2. BLine 6 generates a compiler error
    3. CLine 7 generates a compiler error
    4. DLine 10 generates a compiler error
    5. EThe program prints 3 on line 10
    6. FThe program prints 4 on line 10
    7. GThe program prints 50.0 on line 11
    8. HThe program prints 49.0 on line 11
  6. 6Which are the following are correct
    1. AAn instance var of type float defaults to 0
    2. BAn instance var of type char defaults to null
    3. CAn instance var of type double defaults to 0.0
    4. DAn instance var of type int defaults to null
    5. EAn instance var of type String defaults to null
    6. FAn instance var of type String defaults to the empty string "".
    7. GNone of the above
  7. 7Which of the following are correct
    1. AA local variable of type boolean defaults to null
    2. BA local variable of type float defaults to 0.0f
    3. CA local variable of type double defaults to 0
    4. DA local variable of type Object defaults to null
    5. EA local variable of type boolean defaults to false
    6. FA local variable of type float defaults to 0.0
    7. GNone of the above
  8. 8Which of the following class statements are true
    1. AA class variable of type boolean defaults to 0
    2. BA class variable of type boolean defaults to false
    3. CA class variable of type boolean defaults to null
    4. DA class variable of type long defaults to null
    5. EA class variable of type long defaults to 0L
    6. FA class variable of type long defaults to 0
    7. GNone of the above
  9. 9Which of the following statements about garbage collection are true?
    1. ACalling System.gc() is guaranteed to free up memory by destroying objects eligible for garbage collection
    2. BGarbage collection runs on a set schedule
    3. CGarbage collection allows the JVM to reclaim memory for other objects
    4. DGarbage collection runs when your program has used up half the available memory
    5. EAn object may be eligible for garbage collection but never removed from the heap
    6. FAn object is eligible for garbage collection once no references to it are accessible in the program
    7. GMarking a variable as final means its associated object will never be garbage collected
  10. 10Which statements about the following class are correct?Bild zu Frage 10
    1. AIt prints Q1=blue
    2. BIt prints Q2 = 1200
    3. CIt prints P1 = null
    4. DIt prints P2 = 1400
    5. ELine 4 does not compile
    6. FLine 12 does not compile
    7. GLine 13 does not compile
    8. HNone of the above

Informationen

Beschreibung
Quiz am OCP Chapter 2, erstellt von Jack Hughes am 10/03/2021.
Sprache
English
Aufrufe
0
Schlagwörter
asd
Bewertung
Noch keine Bewertungen
Bewerte dieses Quiz
Bewerte dieses Quiz

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck