Hex, Binary, and other Math Headaches
String Things
I Deserve Arrays
The Scariest Variables (Booooooleans)
3RR0R!
100

Convert 32 to binary

100000

100

String s = "hello";

System.out.println(s.charAt(0));


What will print?

h

100

To access the first element of an array use this command.

array[0]

100

What does this statement evaluate to?

!(true && false) || ((false || false) && true)

true

100

What type of error prevents the code from compiling?

Syntax Error

200

Convert 10011001 to decimal

153

200

How do we find out how long a String variable called  word is?

word.length()

200

An array of length 7 would have positions for elements up to #_.

6

200

When will this statement evaluate to true?

!B && A

When A is true and B is false

200

What type of error prevents the code from running successfully?

Runtime Error

300

Convert 26 to hexadecimal

1A

300

If we wanted to separate only the first three characters from String word for some coding purpose, we could call:

word.substring(0,3);
300

To find out how many elements are contained in an array, we call

array.length

300

!(a <= b) && (a * b > 0)

This statement will always evaluate to true if what condition is also true?

A) a = b

B) a > b

C) a < b

D) a > b and b > 0

E) a > b and b < 0

a > b and b > 0

300

What type of error results in unexpected or incorrect output?

Logic Error

400

There are 10 types of people in the world. Those who understand binary and ???

those who don't.

400

Consider this code:

String x = "abcdefg";

int y = x.indexOf(d);

What is the value of y?

3

400

To access the last element of an array without knowing how many elements are in an array, we would call

array[array.length - 1]

400

If boolean variables A,B, and C are all true, what will this statment evaluate to?

!(!A && !B && !C)

true

400

What type of error is shown here:

String[] array = {"hi", "hey there", "hello"};

array[3] = "salutations";

Runtime Error

500

Convert 8D to binary

10001101

500

Consider this code:

String x = "hello";

String y = new String("hello");

boolean z = x == y;

What is the value of z?

false

500

To access the second to last element of an array without knowing how many elements are in an array, we would call

array[array.length - 2]

500

Create a truth table for the following statement:

(A && !B) || C

500

What type of error is shown below (Disregard any unintialized variables)?

int n = kb.nextInt();

while(n >= 0){

   System.out.println("That's a nonnegative number!");

}

Logic Error

M
e
n
u