What is most important to know when attempting to retrieve an element from an array list?
Search Results
Searching for: multiple
Individual Exercises
When the index is known, what is the time complexity for accessing an element in an array list?
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
What type of error found on line 3?
public static int minVal(int[] y, int first, int last) { int bestSoFar = y[first]; // line 1 for (int...
Suppose you try to perform count on items in this array {1, 4, 3, 7, 15, 9, 24} for item ‘4’. What position is item 4 in this array?
What datatype should you use to store a Middle initial?
What is the value of y after this code has run?
int y = 2; y = 10;
What is the value of variable donuts after the following code executes?
int donuts = 6; donuts = donuts + 3; donuts = donuts * donuts;
Which lines contain the fields?
public class Test { private final int SHIRTS = 24; private int numPants= 14; private int tanks =0; public...
Which lines contain the constructor?
public class Test() { private final int SHIRTS = 24; private int numPants= 14; private int tanks =0;...
What is the scope of the variable spicy?
int peper = 7; int cumin = 17; if ((pepper>5) && (cumin < 20)) { int spicy = 10;...
What is the scope of the variable cumin?
int peper = 7; int cumin = 17; if ((pepper>5) && (cumin < 20)) { int spicy = 10;...
What loop would you use to increase the adult years once the age reaches 18?
What value is stored in myInt
after casting happens during the assignment in the second line of code.
double myDouble = 9.55; int myInt =...
What value is stored in myDouble
after casting happens during the assignment in the second line of code?
int myInt = 9; double myDouble =...
Finish the for loop below. This method should return a string containing the first n
multiples of 3 concatenated together. use a loop...
Given an integer num
, return the sum of the multiples of num
between 1 and 100. For example, if num
is 20, the returned value should be...
Given two integers size
and num
, return an array that can hold size
integers and is filled with multiples of num
, starting with num
. For...
Surround the appropriate lines of code with a try catch block so that first, an exception is caught when the String index is out of...
Complete the code so that the variable polarity is -1 when adding first and second is negative, but polarity is 1 when adding first and...
You wrote the following statements when first learning about Jeroo
methods--they move the Jeroo
forward 3 steps. Now that you've found...