That's Basic! (Not VisualBasic)
Strings
Loops
Reading Code
Common Errors
100
Given an array, nums, the first element is...
What is nums[0]?
100
String[] words = {"cat", "dog"};
words.length;
What is 2?
100
double[] nums = {3, 7.0, 2.6, 5.1};
for (int x = 0; x < nums.length; x++)
System.out.println(nums[x]);

Given the following code, the output is...
What is every value in the array, or 3 7.0 2.6 5.1
100
int x = 5;
x+= 2;
x+= 2;

What is x's final value?
What is 9?
100
What is the issue?
double[] array = new double[3];
for (int a: array)
System.out.print(a);
"array" is an array of doubles, and the for loop is trying to access it as an array of ints.
200
This method determines the amount of elements in an array.
What is .length?
200
String[] words = {"ape", "cat", "dog"};

What would words[0].charAt(2) be?
What is e?
200
double[] nums = {3, 7.0, 2.6, 5.1};
for (int x = 0; x < nums.length; x+=2)
System.out.println(nums[x]);

Given the following code, the output is...
What is every odd value in the array, or 3 2.6
200
Given the following method header, what will be returned by the header?
public static double nums (int[] arrs)
What is double?
200
What prints...?
int[] vals = new int[5];
for (int x = 0; x < vals.length; x++)
System.out.print(x);
The code prints out 0 through 4.
300
Given int[] arrs = new int[7];
the last position is …
What is 6?
300
String[] words = {"ape", "cat", "dog"};
What would words[1].indexOf("a") be?
What is 1?
300
String[] words = {"apple, "dog", "yes"};
for (String w: words)
System.out.print(w.charAt(0));
What is the first letter of every word, or ady
300
public static int nums(int[] arrs)
The name of the method given is...
What is nums?
300
What is the issue?
public static void print(int[] vals) {
for (int v: vals)
return v; }
The code does not compile.
400
Given an array vals, of unknown size, access the last element.
What is vals[vals.length-1];
400
String[] food = {"apple", "watermelon", "chocolate"};
What would food[1].substring(6) be?
What is elon?
400
int[] vals = {3, 2, 5, 9, 5, 5};
int count = 0;
for (int v: vals) {
if (v == 5)
count++; }
System.out.print(count);
What is going to be printed out?
What is 3?
400
public static int nums(int[] arrs)
The name of the array is...
What is arrs?
400
What is the issue?
public static int first6(int[] nums) {
if (first6[0] == 6)
return true;
else
return false; }
What is this uses the name of method instead of the name of array in code
500
Given an array arrs, find the middle element.
What is arrs[arrs.length/2];
500
String[] words = {"sad","mad","happy"};
System.out.print(words[1].substring(0,2));
System.out.print(words[2].substring(2));

What would be printed out by this code?
What is mappy?
500
int[] vals = {3, 2, 5, 9, 5, 5};
int total = 0;
for (int v: vals)
total+=v;
System.out.print(total);
What is going to be printed out?
What is 29?
500
The output is..
int [] nums = new int[5];
for (int i = 0; i < nums.length;i++)
nums[i]= i*4;
System.out.println(nums[3]);
What is 12
500
This method doesn't compile. What's the issue?
public static int amountThrees(int [] vals){
for (int i = 0; i < vals.length;i++)
if( vals[i] ==3) count ++
return count;
What is count has not been declared and initialized? ex. int count = 0;