In the following code, which line will produce an error?
public class Answer { int[] nums = new int[5]; // Line 1 nums[0] = 1000000; //...
Searching for: value
In the following code, which line will produce an error?
public class Answer { int[] nums = new int[5]; // Line 1 nums[0] = 1000000; //...
Write a Java statement to declare an integer variable with the name hours
that has an initial value of 7.
The method below takes in a map of integer key/value pairs. Create a new map and add each key from the original map into the new map,...
For function addOdd(n)
write the missing recursive call. This function should return the sum of all postive odd numbers less than or...
Write a recursive function that returns true if there is a node in the given binary tree with the given value, and false otherwise. Note...
Consider the following class definition:
class Link{
Object data;
Link next;
}
Write a while loop to make q refer successively to each...
What would be the Big O Complexity for the following method?
public static void arrayDoubleValue(int[] nums, int[][] nums2) { for (int i...
What is the value of variable donuts after the following code executes?
int donuts = 6; donuts = donuts + 3; donuts = donuts * donuts;
Complete the function countNegatives()
so that it counts of negative values in the array numbers
. You may assume that the array has some...
Consider the following class definition:
class Link{
Object data;
Link next;
}
List L has a reference to the first node. Given a...
Consider the following class definition:
class Link{
Object data;
Link next;
}
List L has a reference p to the first node. Write code...
Consider the following class definition:
class Link{
Object data;
Link next;
}
List L has a reference p to the first node. Write code...
Consider the following class definition:
class Link{
Object data;
Link next;
}
List L has a reference p to the first node. Write code...
Given an array of integers numbers
, return a new array with just the values in numbers
that are odd. The new array should just be of the...
Consider the following class definitions:
public class LinkedChain<T> { private Node<T> firstNode; private int...
Consider the following class definitions:
public class LinkedChain<T> { private Node<T> firstNode; private int...
Consider the following class definitions:
public class LinkedChain<T> { private Node<T> firstNode; private int...
Given an integer called value
and an array of three integers called list
, the boolean found
should be true
if value
is is within list
one...
For this question, you will need to both write the method and add in the correct parameter.
This method needs to take in a List of any...
The method below takes in an ArrayList called arr
. You can assume this ArrayList will only ever hold integers.
This method needs to...
The method below takes in a List
called list
. You can assume this list only holds integer values. Implement the method so that it returns...
The following method takes in an int
called size
and an int
called value
. Create an array of integers of size size
, and set every slot in...
Create a 5x10 array of doubles and set the last location in the third row to 25.3. Return that array.
Given an array of int
s, return the first value in the array. You may assume the array has at least one value.
Given an array of int
s, return the last value in the array. You may assume the array has at least one value.