What modifier is given to methods in java that do not have a return value?
void
How many more bits are used to store a double than a float?
32
In order to create an instance of an object, every class requires this method.
Constructor method
Describe the time complexity of binary search using bigO notation
O(logn)
List four key words that you should definitely use in creating an algorithm in pseudocode. These words are often capitalized.
GIVEN, FOR, IF, ELSE, WHILE, END, RETURN, BREAK...
The array class is being used in a module. What should the very first line of code be?
*Correct syntax and spelling only
import java.util.*;
integer, character, float and double are all primitive data types. Give another example of a primitive data type.
boolean
also accept (short, long, byte etc..)
A programmer designs a class "Cat" and a class "CatFood". Use one word to describe the arrow drawn to demonstrate the relationship between the Cat and its CatFood.
Aggregation
Ex: 1 Cat has 1 CatFood
A certain method looks at elements in a collection of size n. The method contains a nested loop. What time complexity would you anticipate for this method?
O(n2)
Calculate the output for
X = 10
Z = 2
Repeat (X mod 4) times:
Z = X div Z
Output Z
2
Create code to replace the comment.
String name = "Mr. Considine";
String prefix = "";
// set prefix equal to the correct substring of name
prefix = name.substring(0,3);
An array A has a collection of n names. Write java code that can access the second letter of the name in the middle of the array. Assume n is an odd number.
char c = A[n/2].charAt(1);
What modifier is given to variables that necessitate encapsulation?
private
The traveling salesman problem is a classic problem that is not solvable with any efficient algorithm (Mr. C describes...)
What time complexity would be given to this problem for its "brute-force" solution?
O(2n)
Create pseudocode to sort an array A in descending order.
on the board...