Help shape GoConqr. What should we add next?

Quiz

Java Practice 2

Ummm No 200 questions 1,263 views

Take the quiz

Questions in this quiz (200)

  1. 1To add a value 1 to variable x, you write (Choose all that apply.)
    1. Ax += 1;
    2. Bx = 1 + x;
    3. Cx := 1;
    4. Dx = x + 1;
    5. E1 + x = x;
  2. 2An overloaded method is one that
    1. Ahas a different name than another method, but the same parameters.
    2. Bhas the same name as another method, but different parameters (by number, types or order of the types).
    3. Chas the same name and parameters as a method defined in another class.
    4. Dhas the same name and parameters, but a different return type as another method.
  3. 3In Java, the word true is ________.
    1. Asame as value 0
    2. Bsame as value 1
    3. Ca Boolean literal
    4. Da Java keyword
  4. 4The ________ method parses a string s to a double value.
    1. Adouble.parseDouble(s);
    2. Bdouble.parse(s);
    3. CDouble.parsedouble(s);
    4. DDouble.parseDouble(s);
  5. 5Suppose variable gender is MALE and age equals 60, how is the expression
    ( gender == FEMALE ) && ( age >= 65 )
    evaluated?
    1. AThe condition ( gender == FEMALE ) is evaluated first and the evaluation stops immediately.
    2. BThe condition ( age >= 65 ) is evaluated first and the evaluation stops immediately.
    3. CBoth conditions are evaluated, from left to right.
    4. DBoth conditions are evaluated, from right to left.
  6. 6Will the following program terminate?

    int balance = 10;

    while (true) {
    if (balance < 9) continue;
    balance = balance - 9;
    }
    1. AYes
    2. BNo
  7. 7What is the output of the following code?

    boolean even = false;
    System.out.println((even ? "true" : "false"));
    1. Atrue
    2. Btrue false
    3. Cfalse
    4. Dnothing
  8. 8Which command compiles the Java source code file Welcome.java?
    1. Acd Welcome.java
    2. Bjavac Welcome.java
    3. Cjava Welcome.java
    4. Dcompile Welcome.java
  9. 9The following code fragment reads in two numbers: (Choose all that apply.)

    Scanner input = new Scanner(System.in);
    int i = input.nextInt();
    double d = input.nextDouble();

    What are the correct ways to enter these two numbers?
    1. AEnter an integer, an Enter key, a double value, and then the Enter key.
    2. BEnter an integer, a space, a double value, and then the Enter key.
    3. CEnter an integer, two spaces, a double value, and then the Enter key.
    4. DEnter a numeric value with a decimal point, a space, an integer, and then the Enter key.
  10. 10Suppose s1 and s2 are two strings. Which of the following statements or expressions is incorrect? (Choose all that apply.)
    1. Aboolean b = s1.compareTo(s2);
    2. Bchar c = s1[0];
    3. Cchar c = s1.charAt(s1.length());
    4. DString s3 = s1 - s2;

Information

Description
Practice quiz for Java 1 at Gwinnett Tech College.
Author
Ummm No
Language
English
Views
1,263
Tags
javapracticequiz
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What should we add next?