Classes, Objects, Variables, and Strings
Conditionals
Loops
Arrays/ArrayLists
OOP Concepts
100
These variables are declared before the constructor and usually are declared private.
What is a field/instance variable?
100
Java will not crash with the following statement because of this particular feature. boolean val = false; if (val && 10/0 == 0) { //some code}
What is lazy/short circuit evaluation?
100
This type of loop is a ____ for (int val : arr) { //some code}
What is a for each loop?
100
Arraylists use .size() while Arrays use _____.
What is .length?
100
This class inherits traits from the parent class.
What is a child class/subclass?
200
This method is used to determine if two strings are "equal."
What is .equals() or .compareTo()?
200
Because of these rules, not (a and b) is the same as (not a) or (not b).
What is DeMorgan's Laws?
200
"i" in the following code is referred to as this. for(int i = 0; i <= 5; i++) { //some code}
What is a loop control variable?
200
To retrieve the second element in an ArrayList called arr, this call would be used.
What is arr.get(1)?
200
A car object and wheel object share a ___ relationship rather than a "is-a" relationship.
What is a "has-a" relationship?
300
String str = new String("Florida International University"); The output of str.substring(0,6).
What is "Florid?"
300
With respect to the following code, a student who scores a 93 will always receive a C without this Java keyword. if (score >= 93) grade = "A"; if (score >= 84) grade = "B"; if (score >=75) grade = "C"; if (score < 75) grade = "F";
What is else if?
300
The amount of stars outputted when the following code runs. for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) System.out.println("*"); }
What is 25?
300
Instantiation of an ArrayList of integers called ints.
What is ArrayList ints = new ArrayList()?
300
You cannot create objects of this class type.
What is an abstract class?
400
Java would output this if System.out.println(Integer.MAX_VALUE + 1) was called in main.
What is -2147483648 or Integer.MIN_VALUE
400
The following code is equivalent to this simple one-line assignment of x. if (x > 0) x = -x; if (x < 0) x = 0;
What is x = 0?
400
An instance of a program will not terminate with the following code. This type of loop is referred to as this. int i = 0; char arr[]; while (i < s.length()){ arr[i+1] = "i"; }
What is an infinite loop?
400
A student's grade was inserted repeatedly at the 5th and 6th index in an ArrayList called grades that looks like this (81, 92, 68, 82, 73, 73, 86.) The teacher wants to remove the repeated grade. She uses grades.remove(4). She is worried about null values. This value is now at grades[4].
What is 73?
400
A two dimensional point is represented as a class Point2D. A three dimensional point Point3D subsumes most of the features of Point2D. If point2D's constructor is the following: public Point2D(int x,int y) { this.x = x; this.y = y; } Then Point3D's constructor would be _____.
What is... public Point3D(int x, int y, int z) {super(x,y); this.z = z;}
500
Because of this Java feature, after mod(itemArray, val) is called with the following code, itemArray is changed to {0,1,2,3} and val is still 5. int[] itemArray = {9, 8, 7, 6}; int val = 5; public static void mod(int[] a, int value) { for (int i=0; i < a.length; i++) { a[i] = i; } value = a[a.length-1]; }
What is pass by reference?
500
This will be returned by check("Aaron Barret") with respect to the following code. public boolean check(String s) { return s.length() >= 2 && (s.charAt(0) == s.charAt(1) || check(s.substring(1))); }
What is true?
500
The running time of the following code is this. for (int j = 1; j <= n; j++) { for (int k = 1; k <= n; k = k * 2) System.out.println(j + " " + k); }
What is O(n log n)?
500
Part 1: Nums will contain these integers if it initially contains {5, 3, 1} and the following code is executed. nums.add(6); nums.add(0,4); nums.remove(1); Part 2: In a seating chart of students in a class implemented as a 2D array, this statement would be used to retrieve the student in the last column of the last row (use seatingChart as the 2D array.)
What is [4, 3, 1, 6] and what is seatingChart.length-1[(seatingChart.length-1).length-1]?
500
The differences between these two types of classes are: 1) _____ can have non-constant fields whereas _____ only has constants. 2) _____ can have implementations of certain methods whereas ______ cannot.
What are abstract classes and interfaces?