webmasterMyJavaZone
Quiz von , erstellt am more than 1 year ago

Quiz am Tercer Set de Preguntas Java OCA Exam (1z0-803), erstellt von webmasterMyJavaZone am 23/06/2014.

33616
2
0
Keine Merkmale angegeben
webmasterMyJavaZone
Erstellt von webmasterMyJavaZone vor mehr als 10 Jahre
Schließen

Tercer Set de Preguntas Java OCA Exam (1z0-803)

Frage 1 von 15

1

Given the following code segment, what would be the output?

int a = 0;
int b = 0;
int c = 0;
System.out.println(a++ + " " + --b + " " + c++ + " " + a + " " + b);

Wähle eine der folgenden:

  • 1 0 1 0 0

  • 0 0 0 0 0

  • 1 0 1 1 -1

  • 0 -1 0 1 -1

Erklärung

Frage 2 von 15

1

Which of the following string classes create mutable strings? (Choose all that apply.)

Wähle eine oder mehr der folgenden:

  • String

  • StringBuffer

  • StringBuilder

Erklärung

Frage 3 von 15

1

Choose the simplest data structure to use to store multiple like variables that could then be accessed by an index.

Wähle eine der folgenden:

  • Primitive

  • Object

  • Array

  • Enumeration

Erklärung

Frage 4 von 15

1

Which of the statements are correct? (Choose all that apply.)

Wähle eine oder mehr der folgenden:

  • 3.0 is a valid literal for an int.

  • 3.0 is a valid literal for a float.

  • 3 is a valid literal for an int.

  • 3 is a valid literal for a float.

  • 3f is a valid literal for an int.

  • 3f is a valid literal for a float.

Erklärung

Frage 5 von 15

1

What literal values are acceptable to use with the boolean primitive?

Wähle eine der folgenden:

  • true and false

  • true, false, and null

  • true, false, TRUE, and FALSE

  • TRUE and FALSE

Erklärung

Frage 6 von 15

1

Which code segments related to enumerations will result in a compiler error? (Choose all that apply.)

Wähle eine der folgenden:

  • enum Coin {PENNY, NICKEL, DIME, QUARTER}
    Coin coin = Coin.NICKEL;

  • enum Coin {PENNY, NICKEL, DIME, QUARTER}
    Coin coin;
    coin = Coin.NICKEL;

  • enum Coin {PENNY, NICKEL, DIME, QUARTER}
    Coin coin = NICKEL;

  • enum Coin {penny, nickel, dime, quarter}
    Coin coin = Coin.NICKEL;

Erklärung

Frage 7 von 15

1

Consider the following declarations. Which declaration has an element name that does not conform to standard naming conventions?

Wähle eine der folgenden:

  • static final int varName;

  • Integer IntName;

  • void getName () {…}

  • public class Name {…}

Erklärung

Frage 8 von 15

1

Java 7 added the allowance of a special character to indentify places. Which declaration is correct?

Wähle eine der folgenden:

  • int investment = 1x000x000;

  • int investment = 1_000_000;

  • int investment = 1^000^000;

  • int investment = 1-000-000;

Erklärung

Frage 9 von 15

1

What are the wrapper classes for the primitives boolean, char, short, int, and double?

Wähle eine der folgenden:

  • Boolean, Char, Short , Int , Double

  • Boolean, Char, Short, Integer, Double

  • Boolean, Character, Short, Int, Double

  • Boolean, Character, Short, Integer, Double

Erklärung

Frage 10 von 15

1

Which of the following statements contain literal values?

Wähle eine oder mehr der folgenden:

  • int maxHorsePower = 170;

  • float currentHorsePower = (float) maxHorsePower;

  • float idleHorsePower = ((float) currentHorsePower) / 10);

  • System.out.println("Current HP: " + currentHorsePower);

Erklärung

Frage 11 von 15

1

What is the correct way to initialize a variable declared as a Penguin as a new Penguin object?

Wähle eine der folgenden:

  • Penguin p;

  • Penguin p = new Penguin();

  • Penguin p = new Penguin[];

  • Penguin p = Penguin();

Erklärung

Frage 12 von 15

1

Which of the following are primitive data types? (Choose all that apply.)

Wähle eine oder mehr der folgenden:

  • int

  • boolean

  • char

  • Float

  • String

Erklärung

Frage 13 von 15

1

Which code example makes use of arrays without producing a compiler or runtime error?

Wähle eine der folgenden:

  • public class Actor {
    String[] characterName = new String[3];
    {
    characterName[0] = "Captain Video";
    characterName[1] = "Quizmaster";
    characterName[2] = "J.C. Money";
    characterName[3] = "Jersey Joe";
    }
    }

  • public class Actor {
    String[] characterName = new String[1..4]
    {
    characterName[0] = "Captain Video";
    characterName[1] = "Quizmaster";
    characterName[2] = "J.C. Money";
    characterName[3] = "Jersey Joe";
    }
    }

  • public class Actor {
    String characterName = new String[4];
    {
    characterName[0] = "Captain Video";
    characterName[1] = "Quizmaster";
    characterName[2] = "J.C. Money";
    characterName[3] = "Jersey Joe";
    }
    }

  • public class Actor {
    String [] characterName = new String[4];
    {
    characterName[0] = "Captain Video";
    characterName[1] = "Quizmaster";
    characterName[2] = "J.C. Money";
    characterName[3] = "Jersey Joe";
    }
    }

Erklärung

Frage 14 von 15

1

Class variables, also known as static fields, have only one instance in existence. Following standing naming conventions, which answer represents a class variable?

Wähle eine der folgenden:

  • variableName

  • VariableName

  • ClassName:variableName

  • ClassName.variableName

Erklärung

Frage 15 von 15

1

What statement about local variables is true?

Wähle eine der folgenden:

  • Local variables are declared outside of methods and are initialized with a default value.

  • Local variables are declared inside of methods and are initialized with a default value.

  • Local variables are declared outside of methods and are not initialized with a default value.

  • Local variables are declared inside of methods and are not initialized with a default value.

Erklärung