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

Descripción

Test sobre Tercer Set de Preguntas Java OCA Exam (1z0-803), creado por webmasterMyJavaZone el 23/06/2014.
webmasterMyJavaZone
Test por webmasterMyJavaZone, actualizado hace más de 1 año
webmasterMyJavaZone
Creado por webmasterMyJavaZone hace alrededor de 10 años
33613
2

Resumen del Recurso

Pregunta 1

Pregunta
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);
Respuesta
  • 1 0 1 0 0
  • 0 0 0 0 0
  • 1 0 1 1 -1
  • 0 -1 0 1 -1

Pregunta 2

Pregunta
Which of the following string classes create mutable strings? (Choose all that apply.)
Respuesta
  • String
  • StringBuffer
  • StringBuilder

Pregunta 3

Pregunta
Choose the simplest data structure to use to store multiple like variables that could then be accessed by an index.
Respuesta
  • Primitive
  • Object
  • Array
  • Enumeration

Pregunta 4

Pregunta
Which of the statements are correct? (Choose all that apply.)
Respuesta
  • 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.

Pregunta 5

Pregunta
What literal values are acceptable to use with the boolean primitive?
Respuesta
  • true and false
  • true, false, and null
  • true, false, TRUE, and FALSE
  • TRUE and FALSE

Pregunta 6

Pregunta
Which code segments related to enumerations will result in a compiler error? (Choose all that apply.)
Respuesta
  • 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;

Pregunta 7

Pregunta
Consider the following declarations. Which declaration has an element name that does not conform to standard naming conventions?
Respuesta
  • static final int varName;
  • Integer IntName;
  • void getName () {…}
  • public class Name {…}

Pregunta 8

Pregunta
Java 7 added the allowance of a special character to indentify places. Which declaration is correct?
Respuesta
  • int investment = 1x000x000;
  • int investment = 1_000_000;
  • int investment = 1^000^000;
  • int investment = 1-000-000;

Pregunta 9

Pregunta
What are the wrapper classes for the primitives boolean, char, short, int, and double?
Respuesta
  • Boolean, Char, Short , Int , Double
  • Boolean, Char, Short, Integer, Double
  • Boolean, Character, Short, Int, Double
  • Boolean, Character, Short, Integer, Double

Pregunta 10

Pregunta
Which of the following statements contain literal values?
Respuesta
  • int maxHorsePower = 170;
  • float currentHorsePower = (float) maxHorsePower;
  • float idleHorsePower = ((float) currentHorsePower) / 10);
  • System.out.println("Current HP: " + currentHorsePower);

Pregunta 11

Pregunta
What is the correct way to initialize a variable declared as a Penguin as a new Penguin object?
Respuesta
  • Penguin p;
  • Penguin p = new Penguin();
  • Penguin p = new Penguin[];
  • Penguin p = Penguin();

Pregunta 12

Pregunta
Which of the following are primitive data types? (Choose all that apply.)
Respuesta
  • int
  • boolean
  • char
  • Float
  • String

Pregunta 13

Pregunta
Which code example makes use of arrays without producing a compiler or runtime error?
Respuesta
  • 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"; } }

Pregunta 14

Pregunta
Class variables, also known as static fields, have only one instance in existence. Following standing naming conventions, which answer represents a class variable?
Respuesta
  • variableName
  • VariableName
  • ClassName:variableName
  • ClassName.variableName

Pregunta 15

Pregunta
What statement about local variables is true?
Respuesta
  • 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.
Mostrar resumen completo Ocultar resumen completo

Similar

Capítulo II. Ciclo de vida del proyecto
molo544
7 Técnicas para Aprender Matemáticas
maya velasquez
Freud: Esquema del Psicoánalisis
Cesar_Adolfo
Romanticismo literario del S. XIX
maya velasquez
Examen de Lengua Castellana de Selectividad
maya velasquez
Mi Entorno Personal de Aprendizaje (PLE)
Martín López Barrientos
Mapa Conceptual
Laura Laguna
Compás de 4/4
mariajesus camino
Anatomía del Corazón
65951
Repaso de Trastornos hidroelectroliticos
Claudia Genoveva Perez Cacho