webmasterMyJavaZone
Quiz por , criado more than 1 year ago

Quiz sobre Tercer Set de Preguntas Java OCA Exam (1z0-803), criado por webmasterMyJavaZone em 23-06-2014.

33607
2
0
Sem etiquetas
webmasterMyJavaZone
Criado por webmasterMyJavaZone quase 10 anos atrás
Fechar

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

Questão 1 de 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);

Selecione uma das seguintes:

  • 1 0 1 0 0

  • 0 0 0 0 0

  • 1 0 1 1 -1

  • 0 -1 0 1 -1

Explicação

Questão 2 de 15

1

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

Selecione uma ou mais das seguintes:

  • String

  • StringBuffer

  • StringBuilder

Explicação

Questão 3 de 15

1

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

Selecione uma das seguintes:

  • Primitive

  • Object

  • Array

  • Enumeration

Explicação

Questão 4 de 15

1

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

Selecione uma ou mais das seguintes:

  • 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.

Explicação

Questão 5 de 15

1

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

Selecione uma das seguintes:

  • true and false

  • true, false, and null

  • true, false, TRUE, and FALSE

  • TRUE and FALSE

Explicação

Questão 6 de 15

1

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

Selecione uma das seguintes:

  • 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;

Explicação

Questão 7 de 15

1

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

Selecione uma das seguintes:

  • static final int varName;

  • Integer IntName;

  • void getName () {…}

  • public class Name {…}

Explicação

Questão 8 de 15

1

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

Selecione uma das seguintes:

  • int investment = 1x000x000;

  • int investment = 1_000_000;

  • int investment = 1^000^000;

  • int investment = 1-000-000;

Explicação

Questão 9 de 15

1

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

Selecione uma das seguintes:

  • Boolean, Char, Short , Int , Double

  • Boolean, Char, Short, Integer, Double

  • Boolean, Character, Short, Int, Double

  • Boolean, Character, Short, Integer, Double

Explicação

Questão 10 de 15

1

Which of the following statements contain literal values?

Selecione uma ou mais das seguintes:

  • int maxHorsePower = 170;

  • float currentHorsePower = (float) maxHorsePower;

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

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

Explicação

Questão 11 de 15

1

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

Selecione uma das seguintes:

  • Penguin p;

  • Penguin p = new Penguin();

  • Penguin p = new Penguin[];

  • Penguin p = Penguin();

Explicação

Questão 12 de 15

1

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

Selecione uma ou mais das seguintes:

  • int

  • boolean

  • char

  • Float

  • String

Explicação

Questão 13 de 15

1

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

Selecione uma das seguintes:

  • 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";
    }
    }

Explicação

Questão 14 de 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?

Selecione uma das seguintes:

  • variableName

  • VariableName

  • ClassName:variableName

  • ClassName.variableName

Explicação

Questão 15 de 15

1

What statement about local variables is true?

Selecione uma das seguintes:

  • 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.

Explicação