Skills101
← Java — Beginner

Java Beginner — Test 1

15 questions15 minPass: 60%+20 XP on first passFree sample test

15 questions · 15 minutes · beginner level, with an explanation for every answer.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What is the size of an int in Java?

  2. Question 2

    What is the output?

    char c = 'A';
    c += 2;
    int n = c;
    System.out.println(c + " " + n);
    
  3. Question 3

    What does the JVM run?

  4. Question 4

    What is the output?

    int[] a = new int[3];
    double[] d = new double[2];
    String[] s = new String[1];
    System.out.println(a[0] + " " + d[1] + " " + s[0]);
    
  5. Question 5

    How do you correctly compare the text of two Strings a and b?

  6. Question 6

    What is the output?

    int a = 7, b = 2;
    System.out.println(a / b + " " + a % b + " " + (double) a / b);
    
  7. Question 7

    What is the output?

    String s = "Java";
    System.out.println(s.length() + " " + s.charAt(2) + " " + s.toUpperCase());
    
  8. Question 8

    Which method signature starts a Java program?

  9. Question 9

    What is the output?

    int day = 3;
    switch (day) {
        case 1: System.out.print("Mon ");
        case 3: System.out.print("Wed ");
        case 4: System.out.print("Thu ");
            break;
        default: System.out.print("Other");
    }
    
  10. Question 10

    What is the output?

    System.out.println(1 + 2 + "3" + 4 + 5);
    
  11. Question 11

    What is the output?

    int[] arr = {3, 6, 9};
    int sum = 0;
    for (int v : arr) sum += v;
    System.out.println(sum + " " + arr.length);
    
  12. Question 12

    Which keyword makes a variable's value unchangeable after it is set?

  13. Question 13

    What is the output?

    int x = 5;
    int y = x++ + ++x;
    System.out.println(x + " " + y);
    
  14. Question 14

    What is the output?

    int i = 0;
    do {
        i += 3;
    } while (i < 0);
    System.out.println(i);
    
  15. Question 15

    What is the output?

    boolean a = true, b = false;
    System.out.println((a && b) + " " + (a || b) + " " + (!a ^ b));
    
🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →