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
Why doesn't this code run?
int a = 14;
if(a % 2 == 0) {
a++
}
What is
missing semicolon on a++
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?
What is the result of the following boolean expression:
boolean result = (5 > 3) && !(10 < 5) || (7 != 7);
What is True
What is the name of the first video game ever created?
What is 'Pong'
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
What is the error in this code?
int[] numbers = new int[5];
System.out.println(numbers[5]);
What is
Array Index Out Of Bounds
This Data Structure is similar to an array but allows for dynamic resizing
What is an ArrayList?
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
How many service hours do you need to be inducted into CSHS?
What is 5
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);
-18
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()
This Data Structure follows the Last-In-First-Out principle.
What is a Stack?
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
What are the 3 main languages used in web development?
What are HTML, CSS, and JavaScript
public static int mystery(int n)
{
if (n == 0)
return 1;
else
return 3 * mystery (n - 1);
}
Find mystery(4)
What is
81
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
In Java, a HashMap allows duplicate keys but not duplicate values. True or False?
What is False?
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
What is ransomware?
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
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
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?
What is the value of y after the following Java code is executed?
int x = 8;
int y = x++ + ++x - 3;
What is 15
What is the name of the branch of AI that is about enabling computers to understand human language?
Natural Language Processing (NLP)