What Does This Program Do?
Errors
Guess the Data Structure
Evaluating Expressions
Miscellaneous
100

int a = 5; int b = 12;

int c = b / a;

int d = c + a;

int e = d - a;

System.out.println(c + " " + d + " " + e);

What is

2 7 2

100

Why doesn't this code run?

int a = 14;

if(a % 2 == 0) {

     a++

}

What is

missing semicolon on a++

100

This Data Structure organizes elements in a straight line, allowing easy access to each element by it's index. What is it?

What is an Array?

100

What is the result of the following boolean expression:

boolean result = (5 > 3) && !(10 < 5) || (7 != 7);

What is True

100

What is the name of the first video game ever created?

What is 'Pong'

200

int a = 10; int b = 89;

String name = "ILoveCSHS";

int c = b % a;

System.out.println(a + b + " " + name + " " + c + a);

What is

99 ILoveCSHS 910

200

What is the error in this code?

int[] numbers = new int[5];

System.out.println(numbers[5]);

What is

Array Index Out Of Bounds

200

This Data Structure is similar to an array but allows for dynamic resizing

What is an ArrayList?

200

What is the value of result after the following code runs:

boolean x = true;

boolean y = false;

boolean result = (x && y) || (!x && !y);

What is false

200

How many service hours do you need to be inducted into CSHS?

What is 5

300

int a = 42; int b = 20; int c = 2; int d = 1;

if(a/c > b+d) 

     a /= c;

else

     a -= b;

if(a-b*c < 0)

     c += 2;

else

     b /= 2;

System.out.println(2 * (a-3) / b - b^d / c^3);


What is 

-18

300

Find the error in this code:

ArrayList<String> names = new ArrayList<String>(5);

list.add("Alice");

list.add("Bob");

list.add("Charlie");

System.out.println(names.length());

What is

names.length() cannot be used on ArrayLists, should be names.size()

300

This Data Structure follows the Last-In-First-Out principle.

What is a Stack?

300

What is the value of result after the following Java code is executed?

boolean result = (5 > 3 || 6 < 5) && ((4 + 3 * 2 - 1) % 3 + 7 > 10);

What is false

300

What are the 3 main languages used in web development?

What are HTML, CSS, and JavaScript

400

public static int mystery(int n)
{
    if (n == 0)
        return 1;
    else
        return 3 * mystery (n - 1);
}

Find mystery(4)

What is

81

400

Find the error in this code:

int[] numbers = {1, 2, 3, 4, 5};

for(int i = 0; i <= numbers.length; i++) {

System.out.println(numbers[i]);

What is

i <= numbers.length causes an IndexOutOfBounds Error

400

In Java, a HashMap allows duplicate keys but not duplicate values. True or False?

What is False?

400

If A = 7, B = 9, C = 3, D = 4, E = 6, and F =8, evaluate the following *postfix* expression:

A B C D E A - + * / + F E - +

What is

10

400
What is the term for a type of malware that encrypts files on a victim's computer and demands payment for their release?

What is ransomware?

500

int[][] grid = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; 

int sum = 0; 

for (int i = 0; i < grid.length; i++) 

     for (int j = 0; j < grid[i].length; j++) 

          sum += grid[i][j] * (i + j);

System.out.println("The result is: " + sum);




What is

114

500

Find the error in this code:

int[][] grid = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

for(int i = 0; i < grid.length; i++) 

     for(int j = 0; j < grid[i].length; j++)

          System.out.println(i + j);

          System.out.println(grid[i][j]);


What is

grid[i][j] is outside the loop so i and j cannot be accessed, resulting in a compilation error

500

In a social media platform, users are identified by their *unique* usernames. What Data Structure would be most efficient in retrieving user profiles based on their usernames?

What is a TreeMap?

500

What is the value of y after the following Java code is executed?

int x = 8;

int y = x++  +  ++x  -  3;

What is 15

500

What is the name of the branch of AI that is about enabling computers to understand human language?

Natural Language Processing (NLP)