PREDICT THE OUTPUT

Cards (19)

  • int x = 10;
    double y = 5.5;
    double result = x + y;
    System.out.println(“The operation results to: ”result);
    Error, no operator used in print()
  • int a = 7;
    int b = 3;
    int result1 = a / b;
    double result2 = (double) a / b;
    System.out.println(result1);
    System.out.println(result2);
    OUTPUT:
    2
    2.3333333333333335
  • int num = 10;
    num += 5;
    num -= 3;
    num *= 2;
    num /= 4;
    num--;
    System.out.println(num);
    OUTPUT:
    5
  • int count = 3;
    int result1 = count-- * 2;
    double result2 = ++count + 5;
    System.out.println(result1);
    System.out.println(result2);

    OUTPUT:
    6
    8.0
  • int num = 15;
    num %= 7;
    num++;
    float last = (float) num/4;
    System.out.println(num);
    OUTPUT:
    2
  • int num = 10;
    num += 5;
    num -= 3;
    num *= 2;
    num /= 4;
    num--;
    System.out.println(“The final number is: ” + num);
    OUTPUT:
    The final number is: 5
  • int x = 20;
    double y = 11;
    double result = x + y;
    System.out.println(result);
    OUTPUT:
    31.0
  • int a = 14;
    int b = 6;
    int result1 = a / b;
    double result2 = (double) a / b;
    System.out.println(result1);
    System.out.println(result2);
    OUTPUT:
    2
    2.3333333333333335
  • int count = 6;
    int result1 = count-- * 4;
    double result2 = ++count + 10;
    System.out.println(result1);
    System.out.println(result2);
    OUTPUT:
    24
    16.0
  • int num = 30;
    num %= 14;
    num++;
    float last = (float) num/8;
    System.out.println(num);
    OUTPUT:
    3
  • int num1 = 45;
    double num2 = 3.692;
    System.out.println(num1 + (int)num2);
    48
  • int x = 25;
    x += 5;
    System.out.println(x);
    x -= 12;
    System.out.println(x);
    x *= 5;
    System.out.println(x);
    x /= 18;
    System.out.println(x);
    x--;
    System.out.println(x);
    30
    18
    90
    5
    4
  • int a = 36;
    int b = 12;
    System.out.println(a % b != 0 || a > b);
    true
  • int a = 10;
    double b = 3.5;
    double result = a/b;
    System.out.println("This operation results to: " + result);
    This operation results to: 2.85
  • int x = 10, y = 8;
    int z = x % 10;
    System.out.println(z);
    0
  • int num1, num3;
    num1 = 12;
    double num2 = 5;
    num3 = (int) (num1/num2);
    System.out.println(num3);
    2
  • double num1 = 10.8;
    int num2 = 3;
    double result = num1/num2;
    int intResult = (int) (result + 0.5)
    System.out.println(intResult);
    Error, no semicolon
  • int p = 8, q = 8;
    boolean result1 = p > q, result 2 = p <= q;
    System.out.println(result1);
    System.out.println(result2);
    Error, there's space in variable
  • int m = 25, n = 30;
    boolean result1 = (m < 20) && (n > 25);
    boolean result 2 = (m == 25) || (n != 30);
    System.out.println(result1);
    System.out.println(result2);
    Error, there's space in variable