Test
Tercer Set de Preguntas Java OCA Exam (1z0-803)
Preguntas del test (15)
1Given 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);- A1 0 1 0 0
- B0 0 0 0 0
- C1 0 1 1 -1
- D0 -1 0 1 -1
2Which of the following string classes create mutable strings? (Choose all that apply.)
- AString
- BStringBuffer
- CStringBuilder
3Choose the simplest data structure to use to store multiple like variables that could then be accessed by an index.
- APrimitive
- BObject
- CArray
- DEnumeration
4Which of the statements are correct? (Choose all that apply.)
- A3.0 is a valid literal for an int.
- B3.0 is a valid literal for a float.
- C3 is a valid literal for an int.
- D3 is a valid literal for a float.
- E3f is a valid literal for an int.
- F3f is a valid literal for a float.
5What literal values are acceptable to use with the boolean primitive?
- Atrue and false
- Btrue, false, and null
- Ctrue, false, TRUE, and FALSE
- DTRUE and FALSE
6Which code segments related to enumerations will result in a compiler error? (Choose all that apply.)
- Aenum Coin {PENNY, NICKEL, DIME, QUARTER}
Coin coin = Coin.NICKEL; - Benum Coin {PENNY, NICKEL, DIME, QUARTER}
Coin coin;
coin = Coin.NICKEL; - Cenum Coin {PENNY, NICKEL, DIME, QUARTER}
Coin coin = NICKEL; - Denum Coin {penny, nickel, dime, quarter}
Coin coin = Coin.NICKEL;
- Aenum Coin {PENNY, NICKEL, DIME, QUARTER}
7Consider the following declarations. Which declaration has an element name that does not conform to standard naming conventions?
- Astatic final int varName;
- BInteger IntName;
- Cvoid getName () {…}
- Dpublic class Name {…}
8Java 7 added the allowance of a special character to indentify places. Which declaration is correct?
- Aint investment = 1x000x000;
- Bint investment = 1_000_000;
- Cint investment = 1^000^000;
- Dint investment = 1-000-000;
9What are the wrapper classes for the primitives boolean, char, short, int, and double?
- ABoolean, Char, Short , Int , Double
- BBoolean, Char, Short, Integer, Double
- CBoolean, Character, Short, Int, Double
- DBoolean, Character, Short, Integer, Double
10Which of the following statements contain literal values?
- Aint maxHorsePower = 170;
- Bfloat currentHorsePower = (float) maxHorsePower;
- Cfloat idleHorsePower = ((float) currentHorsePower) / 10);
- DSystem.out.println("Current HP: " + currentHorsePower);
11What is the correct way to initialize a variable declared as a Penguin as a new Penguin object?
- APenguin p;
- BPenguin p = new Penguin();
- CPenguin p = new Penguin[];
- DPenguin p = Penguin();
12Which of the following are primitive data types? (Choose all that apply.)
- Aint
- Bboolean
- Cchar
- DFloat
- EString
13Which code example makes use of arrays without producing a compiler or runtime error?
- Apublic class Actor {
String[] characterName = new String[3];
{
characterName[0] = "Captain Video";
characterName[1] = "Quizmaster";
characterName[2] = "J.C. Money";
characterName[3] = "Jersey Joe";
}
} - Bpublic class Actor {
String[] characterName = new String[1..4]
{
characterName[0] = "Captain Video";
characterName[1] = "Quizmaster";
characterName[2] = "J.C. Money";
characterName[3] = "Jersey Joe";
}
} - Cpublic class Actor {
String characterName = new String[4];
{
characterName[0] = "Captain Video";
characterName[1] = "Quizmaster";
characterName[2] = "J.C. Money";
characterName[3] = "Jersey Joe";
}
} - Dpublic class Actor {
String [] characterName = new String[4];
{
characterName[0] = "Captain Video";
characterName[1] = "Quizmaster";
characterName[2] = "J.C. Money";
characterName[3] = "Jersey Joe";
}
}
- Apublic class Actor {
14Class variables, also known as static fields, have only one instance in existence. Following standing naming conventions, which answer represents a class variable?
- AvariableName
- BVariableName
- CClassName:variableName
- DClassName.variableName
15What statement about local variables is true?
- ALocal variables are declared outside of methods and are initialized with a default value.
- BLocal variables are declared inside of methods and are initialized with a default value.
- CLocal variables are declared outside of methods and are not initialized with a default value.
- DLocal variables are declared inside of methods and are not initialized with a default value.
Información
- Descripción
- Test sobre Tercer Set de Preguntas Java OCA Exam (1z0-803), creado por webmasterMyJavaZone el 23/06/2014.
- Autor
- webmasterMyJavaZone
- Idioma
- Español
- Visitas
- 33.648
- Valoración
- 5,0 de 5 · 1 valoración Valora este test