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

Beschreibung

Quiz am Tercer Set de Preguntas Java OCA Exam (1z0-803), erstellt von webmasterMyJavaZone am 23/06/2014.
webmasterMyJavaZone
Quiz von webmasterMyJavaZone, aktualisiert more than 1 year ago
webmasterMyJavaZone
Erstellt von webmasterMyJavaZone vor mehr als 10 Jahre
33616
2

Zusammenfassung der Ressource

Frage 1

Frage
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);
Antworten
  • 1 0 1 0 0
  • 0 0 0 0 0
  • 1 0 1 1 -1
  • 0 -1 0 1 -1

Frage 2

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

Frage 3

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

Frage 4

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

Frage 5

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

Frage 6

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

Frage 7

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

Frage 8

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

Frage 9

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

Frage 10

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

Frage 11

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

Frage 12

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

Frage 13

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

Frage 14

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

Frage 15

Frage
What statement about local variables is true?
Antworten
  • 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.
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Wärmelehre Teil 1
Peter Kasebacher
Die Reformation (Karteikarten)
AntonS
Folien: Systemtheorie
tschiggli
EVA - Vorbereitung MC Teil
hans urst
Forschungs- und Anwendungsfelder der Soziologie Teil 3
stelly Welly
BM13 Swertz 2018 Quiz 1
Daniel Martinovic
Vetie Radiologie Fragen VL 2013
Cedric-Bo Lüpkemann
Vetie - Immuno Wdh 2012
V R
Vetie Repro 2020
Franziska Piepho
Vetie - Allgemeine Pathologie 21
Till S
Vetie - Lebensmittelkunde 2021
Valerie Nymphe