¡GoConqr estrena diseño! Cuéntanos qué te parece.

Test

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

webmasterMyJavaZone 14 preguntas 33.972 visitas 4,0 (1 valoración)

Hacer el test

Preguntas del test (14)

  1. 1Which conditional statement would be best suited for determining the flow of code based on an int that may have a value between 1 and 10? The program must react differently for each value.
    1. Aif-else statement
    2. Bif-else-if statement with multiple if-elses
    3. Cmultiple if statements
    4. Dswitch statement
  2. 2What Java code is used for declaring and initializing a null object?
    1. AObject object = new Object();
    2. BObject object = new Object(null);
    3. CObject object = null;
    4. DObject object = null();
  3. 3Given the following code segment, what would be the output?

    int value1 = 5;
    int value2 = 7;
    boolean bool1 = true;
    boolean bool2 = false;
    if (bool1 && (( value1 < value2 )|| bool2 ) && !(bool2)) {
    System.out.println("Result set one");
    }
    else {
    System.out.println("Result set two");
    }
    1. AResult set one
    2. BResult set two
  4. 4What is the output for the following Java code segment? The text in parentheses is meant to describe the whitespace and is not part of the output.

    String fiveSpaces = " ";
    String SCJA = "SCJA";
    String lineToDisplay = "fiveSpaces + SCJA + fiveSpaces";
    System.out.println(lineToDisplay.trim());
    1. ASCJA (no trailing and leading spaces)
    2. B SCJA (five leading and trailing spaces)
    3. C SCJA (four leading and trailing spaces)
    4. DfiveSpaces + SCJA + fiveSpaces
  5. 5Given:

    public class StringModifier {
    public static void main (String[] args) {
    String a = "Supercalifragilisticexpialidocious!";
    String b = a.substring(x,y);
    char [] c = {a.charAt(u), a.charAt(v)};
    System.out.print(b + String.valueOf(c));
    }
    }

    What integer declarations are needed to print the string fragile!?
    1. Aint x = 8; int y = 14; int u = 2; int v =33;
    2. Bint x = 10; int y = 16; int u = 4; int v =35;
    3. Cint x = 8; int y = 15; int u = 5; int v =32;
    4. Dint x = 9; int y = 15; int u = 3; int v =34;
  6. 6You want to remove all leading and trailing whitespace from a string.Which method invocation will allow this to occur?
    1. AstringName.trim();
    2. BstringName.trim(' ');
    3. CstringName.trim(" ");
    4. DstringName.trimWhiteSpace();
  7. 7From highest precedence to lowest, which list of operators is ordered properly?
    1. A*, +, &&, =
    2. B*, &&, +, =
    3. C*, =, &&, +
    4. D+, *, &&, =
  8. 8Given the following code that uses the modulus operator, what will be printed? System.out.print((24 % 8) + (10 % 7) + (100 % 99) + (38 % 6));
    1. A5
    2. B6
    3. C0312
    4. D0302
  9. 9Given the following code segment testing the equality of two strings, what will be printed?

    1. String string = "Dollar bill";
    2. string.replace("Dollar bill","Silver dollar");
    3. if ("Dollar bill".equals(string)) {
    4. System.out.println ("I have a dollar bill.");
    5. } else {
    6. System.out.println ("I have a silver dollar.");
    7. }
    1. AI have a dollar bill.
    2. BI have a silver dollar.
    3. CThe code will not compile because of an error at line 2.
    4. DThe code will not compile because of an error at line 3.
  10. 10Which append declaration does not exist in Java 7?
    1. Apublic StringBuilder append (short s) {…}
    2. Bpublic StringBuilder append (int i) {…}
    3. Cpublic StringBuilder append (long l) {…}
    4. Dpublic StringBuilder append (float f) {…}
    5. Epublic StringBuilder append (double d) {…}

Información

Descripción
Test sobre Segundo Set de Preguntas Java OCA Exam (1z0-803) , creado por webmasterMyJavaZone el 18/06/2014.
Idioma
Español
Visitas
33.972
Valoración
4,0 de 5 · 1 valoración
Valora este test
Valora este test

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?