GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Quiz

CS151 Midterm

blank space 98 Fragen

Quiz starten

Fragen in diesem Quiz (98)

  1. 1What is the output of the following code:

    double x = 5.5;
    int y = (int)x;
    System.out.println("x is " + x + " and y is " + y);
    1. Ax is 5.5 and y is 5
    2. Bx is 6 and y is 6
    3. Cx is 5.5 and y is 5.0
    4. Dx is 5 and y is 6
    5. Ex is 6.0 and y is 6.0
  2. 2Math.pow(4, 1 / 2) returns ________.
    1. A1.0
    2. B0
    3. C1
    4. D2
    5. E2.0
  3. 3Suppose a Scanner object is created as follows:

    Scanner input = new Scanner(System.in);

    What method do you use to read a real number?
    1. Ainput.double();
    2. Binput.Double();
    3. Cinput.nextDouble();
    4. Dinput.nextdouble();
  4. 4The following code fragment reads in two numbers:

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

    What is the incorrect way to enter these two numbers?
    1. AEnter a numeric value with a decimal point, a space, an integer, and then the Enter key.
    2. BEnter an integer, a space, a double value, and then the Enter key.
    3. CEnter an integer, an Enter key, a double value, and then the Enter key.
    4. DEnter an integer, two spaces, a double value, and then the Enter key.
  5. 5The expression (int)(76.0252175 ∗ 100) / 100 evaluates to ________.
    1. A76.03
    2. B76.02
    3. C76
    4. D76.0252175
  6. 6According to Java naming convention, which of the following names can be variables?
    1. ATOTAL_LENGTH
    2. BfindArea
    3. CtotalLength
    4. Dclass
    5. EFindArea
  7. 7Which of the following is a valid identifier?
    1. Aclass
    2. B9X
    3. Cradius
    4. D$343
    5. E8+9
  8. 8Which of the following are the same as 1545.534?
    1. A0.1545534e+4
    2. B1545534.0e-3
    3. C154553.4e-2
    4. D1.545534e+3
  9. 9What is y displayed?

    public class Test {
    public static void main(String[] args) {
    int x = 1;
    int y = x + x++;
    System.out.println("y is " + y);
    }
    }
    1. Ay is 1.
    2. By is 2.
    3. Cy is 3.
    4. Dy is 4.
  10. 10The ________ method returns a raised to the power of b.
    1. AMath.power(a, b)
    2. BMath.pow(b, a)
    3. CMath.exponent(a, b)
    4. DMath.pow(a, b)

Informationen

Beschreibung
Computer Science Quiz am CS151 Midterm, erstellt von blank space am 09/10/2023.
Sprache
English
Aufrufe
2
Schlagwörter
computer science
Bewertung
Noch keine Bewertungen
Bewerte dieses Quiz
Bewerte dieses Quiz

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck