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

Descrição

Quiz sobre Tercer Set de Preguntas Java OCA Exam (1z0-803), criado por webmasterMyJavaZone em 23-06-2014.
webmasterMyJavaZone
Quiz por webmasterMyJavaZone, atualizado more than 1 year ago
webmasterMyJavaZone
Criado por webmasterMyJavaZone quase 10 anos atrás
33605
2

Resumo de Recurso

Questão 1

Questão
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);
Responda
  • 1 0 1 0 0
  • 0 0 0 0 0
  • 1 0 1 1 -1
  • 0 -1 0 1 -1

Questão 2

Questão
Which of the following string classes create mutable strings? (Choose all that apply.)
Responda
  • String
  • StringBuffer
  • StringBuilder

Questão 3

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

Questão 4

Questão
Which of the statements are correct? (Choose all that apply.)
Responda
  • 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.

Questão 5

Questão
What literal values are acceptable to use with the boolean primitive?
Responda
  • true and false
  • true, false, and null
  • true, false, TRUE, and FALSE
  • TRUE and FALSE

Questão 6

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

Questão 7

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

Questão 8

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

Questão 9

Questão
What are the wrapper classes for the primitives boolean, char, short, int, and double?
Responda
  • Boolean, Char, Short , Int , Double
  • Boolean, Char, Short, Integer, Double
  • Boolean, Character, Short, Int, Double
  • Boolean, Character, Short, Integer, Double

Questão 10

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

Questão 11

Questão
What is the correct way to initialize a variable declared as a Penguin as a new Penguin object?
Responda
  • Penguin p;
  • Penguin p = new Penguin();
  • Penguin p = new Penguin[];
  • Penguin p = Penguin();

Questão 12

Questão
Which of the following are primitive data types? (Choose all that apply.)
Responda
  • int
  • boolean
  • char
  • Float
  • String

Questão 13

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

Questão 14

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

Questão 15

Questão
What statement about local variables is true?
Responda
  • 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.

Semelhante

Noções Gerais de Direito Administrativo
Alynne Saraiva
PSICOLOGIA DO DESENVOLVIMENTO E DA APRENDIZAGEM
vanessasenez
Tecnologia na Sala de aula
Alessandra S.
Combate a incêndio - Capítulo dois
willian reis
Interpretação de Texto
GoConqr suporte .
Decore as Vitaminas
replaybr
Mapa Conceitual - Engenharia - Empreendedorismo e Inovação
Nathan Kaiser
Plano de estudos ENEM - Parte 2 *Exatas/Biológicas
GoConqr suporte .
Vestibular - Guia de Estudos
Alessandra S.
1ª Guerra Mundial
Daniel Lima
Grécia antiga: formação
jacson luft