COP2800 Final Review Questions to Learn
A 2-d array with different number of cols in each row.
A ragged array is
procedure
A set of programming language statements that perform a specific task is a(n)
try-catch
A(n) ________ contains one or more statements that are executed and can potentially throw an exception.
public
All methods specified by an interface are
Multi-catch
Beginning with Java7, you can use ________ to reduce a lot of duplicated code in a try statement needs to catch multiple exceptions, but performs the same operation for each one.
(0, 479)
Given a window that is 640 (width) by 480 (height), which of the following represents the lowest position on the left side?
1
How many times will the following do-while loop be executed? int x = 11; do { x + = 20; } while (x > 100);
will cut the portion of the array being searched in half each time it fails to locate the search value.
The binary search algorithm
sequentially steps through an array
The sequential search algorithm
scale factors
To animate a node with the ScaleTransition class, you specify starting and ending
setInput()
To combine several effects, use the Effect class's ________ method.
Use the toString() method
To get the name of a calling enum constant
the variable name followed by a colon and the data type.
To indicate the data type of a variable in a UML diagram you specify
getItems().setAll()
To replace a ListView control's existing items with a new list of items, use the ________ method.
-
Which symbol indicates that a member is private a UML diagram?
x = 33, y = 9
What will be the values of x and y as a result of the following code? int x = 25, y = 8; x += y++;
FileWriter fwriter = new FileWriter("MyFile.txt", true);PrintWriter outFile = new PrintWriter(fwriter);
Which of the following statements opens a file named MyFile.txt and allows you to append data to its existing contents?
myComboBox.setEditable(true);
Which of the following statements will allow a user to type input into a field of a ComboBox named myComboBox?
with an accompanying integer variable that holds the number of items that are actually stored in the array
A partially filled array is normally used
The region will not appear in the GUI.
If a BorderPane region does not contain anything,
Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes
If a subclass constructor does not explicitly call a superclass constructor
With a dashed line that has an open arrowhead at one end
In a UML diagram you show a realization relationship by connecting a class and an interface with a
456
What will be displayed after the following code is executed? String str = "abc456"; for (int i = 0; i < str.length(); i++) { char chr = str.CharAt(i); if (!Character.isLetter(chr)) System.out.print(Character.toUpperCase(chr)); }
true
What will be displayed after the following code is executed? boolean matches; String str1 = "The cow jumped over the moon."; String str2 = "moon"; matches = str1.endsWith(str1); System.out.println(matches);
long[]
To return an array of long values from a method, which return type should be used for the method?
writeObject
To serialize an object and write it to the file, use the ________ method of the ObjectOutputStream class.
No value, syntax error.
What will be the value of ans after the following statements are executed? int x = 40; int y = 40; if (x = y) ans = x + 10;
0.0
What will be the value of discountRate after the following statements are executed? double discountRate; char custType = 'B'; switch (custType) { case 'A': discountRate = 0.08; break; case 'B': discountRate = 0.06; case 'C': discountRate = 0.04; default: discountRate = 0.0; }
20
What will be the value of x after the following statements are executed? int x = 10; switch(x) { case 10: x += 15; case 12: x -= 5; default: x *= 3; }
Direct recursion
When recursive methods directly call themselves, it is known as
nextLine()
Which Scanner class method reads a String?
ColorAdjust
Which effect class do you use to increase an image's brightness?
TextArea textArea = new TextArea();
Which of the following statements creates an empty TextArea?