100% tevredenheidsgarantie Direct beschikbaar na betaling Zowel online als in PDF Je zit nergens aan vast
logo-home
PRO192 Chap 4 Questions and Answers 2024 €8,71   In winkelwagen

Tentamen (uitwerkingen)

PRO192 Chap 4 Questions and Answers 2024

 5 keer bekeken  0 keer verkocht
  • Vak
  • Instelling

PRO192 Chap 4 Questions and Answers 2024 Which of the following statements is correct? (Choose one.) A. Only primitives are converted automatically; to change the type of an object reference, you have to do a cast. B. Only object references are converted automatically; to change the type of ...

[Meer zien]

Voorbeeld 2 van de 5  pagina's

  • 11 augustus 2024
  • 5
  • 2024/2025
  • Tentamen (uitwerkingen)
  • Vragen en antwoorden
avatar-seller
PRO192 Chap 4 Questions and Answers 2024

Which of the following statements is correct? (Choose one.)
A. Only primitives are converted automatically; to change the type of an object
reference, you
have to do a cast.
B. Only object references are converted automatically; to change the type of a primitive,
you
have to do a cast.
C. Arithmetic promotion of object references requires explicit casting.
D. Both primitives and object references can be both converted and cast.
E. Casting of numeric types may require a runtime check. ** Answ** d

Which one line in the following code will not compile?
1. byte b = 5;
2. char c = '5';
3. short s = 55;
4. int i = 555;
5. float f = 555.5f;
6. b = s;
7. i = c;
8. if (f > b)
9. f = i;
A. Line 1
B. Line 2
C. Line 3
D. Line 4
E. Line 5
F. Line 6
G. Line 7
H. Line 8
I. Line 9 ** Answ** f

Will the following code compile?
1. byte b = 2;
2. byte b1 = 3;
3. b = b * b1;
A. Yes
B. No ** Answ** b

In the following code, what are the possible types for variable result? (Choose the most
complete
true answer.)

, 1. byte b = 11;
2. short s = 13;
3. result = b * ++s;
A. byte, short, int, long, float, double
B. boolean, byte, short, char, int, long, float, double
C. byte, short, char, int, long, float, double
D. byte, short, char
E. int, long, float, double ** Answ** e

Consider the following class:
1. class Cruncher {
2. void crunch(int i) {
3. System.out.println("int version");
4. }
5. void crunch(String s) {
6. System.out.println("String version");
7. }
8.
9. public static void main(String args[]) {
10. Cruncher crun = new Cruncher();
11. char ch = 'p';
12. crun.crunch(ch);
13. }
14. }
Which of the following statements is true? (Choose one.)
A. Line 5 will not compile, because void methods cannot be overridden.
B. Line 12 will not compile, because no version of crunch() takes a char argument.
C. The code will compile but will throw an exception at line 12.
D. The code will compile and produce the following output: int version.
E. The code will compile and produce the following output: String version. ** Answ**
d

Which of the following statements is true? (Choose one.)
A. Object references can be converted in assignments but not in method calls.
B. Object references can be converted in method calls but not in assignments.
C. Object references can be converted in both method calls and assignments, but the
rules
governing these conversions are very different.
D. Object references can be converted in both method calls and assignments, and the
rules
governing these conversions are identical.
E. Object references can never be converted. ** Answ** d

Consider the following code. Which line will not compile?
1. Object ob = new Object();
2. String[] stringarr = new String[50];

Voordelen van het kopen van samenvattingen bij Stuvia op een rij:

√  	Verzekerd van kwaliteit door reviews

√ 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

Snel en makkelijk kopen

Je betaalt supersnel en eenmalig met iDeal, Bancontact of creditcard voor de samenvatting. Zonder lidmaatschap.

Focus op de essentie

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 €8,71. Je zit daarna nergens aan vast.

Is Stuvia te vertrouwen?

4,6 sterren op Google & Trustpilot (+1000 reviews)

Afgelopen 30 dagen zijn er 81849 samenvattingen verkocht

Opgericht in 2010, al 14 jaar dé plek om samenvattingen te kopen

Start met verkopen
€8,71
  • (0)
  Kopen