Match each term with the correct statement below Numbered be
Match each term with the correct statement below.
Numbered beginning with 0
An array field
An enhanced for loop
Declared in the same way you declare any simple variable
A nonprimitive object
A primitive type
Represent computer memory addresses
A statement used to return an array from a method
Hold memory addresses where values are stored
array variable
reference type
elements
int
Java object names
length
foreach loop
reference types
return
int[][] myVals = {{2, 4, 6, 8},
{20, 40, 60, 80} };
Using the above two-dimensional array, what is the value of myVals[1][2]?
a.
60
b.
4
c.
40
d.
6
Which Java statement creates a ragged array with six rows?
a.
double [][] sales = new double[][6]
b.
double [][] sales = new double[6][4]
c.
double [][] sales = new double[6][]
d.
double [][] sales = new double[4][6]
How would you create an array named someNumbers that holds three rows and four columns?
a.
int[][] someNumbers = new int[3][4]
b.
int[][] someNumbers = new int[4][3]
c.
int[] someNumbers = new int[3][4]
d.
double[][] someNumbers = new int[3][4]
In Java, you create an enumerated data type in a statement that uses the keyword ____.
a.
collection
b.
new
c.
enum
d.
sequence
Comparing a variable to a list of values in an array is a process called ____ an array.
a.
using
b.
checking
c.
validating
d.
searching
When you declare an array name, no computer memory address is assigned to it. Instead, the array variable name has the special value ____, or Unicode value ‘\\u0000’.
a.
empty
b.
null
c.
false
d.
zero
If you do not provide values for the elements in a two-dimensional numeric array, the values default to null.
True
False
An ArrayList’s ____ is the number of items it can hold without having to increase its size.
a.
capacity
b.
size
c.
buffer
d.
length
A ____ array is one with the same number of elements as another, and for which the values in corresponding elements are related.
a.
property
b.
parallel
c.
cloned
d.
two-dimensional
The bubble sort is the fastest and most efficient sorting technique.
True
False
|
|
Solution
Match each term with the correct statement below.
Answer
Numbered beginning with 0 length
An array field elements
An enhanced for loop foreach loop
Declared in the same way you declare any simple variable Java object names
A nonprimitive object reference types
A primitive type int
Represent computer memory addresses reference type
A statement used to return an array from a method return
Hold memory addresses where values are stored array variable
int[][] myVals = {{2, 4, 6, 8},{20, 40, 60, 80} }; Using the above two-dimensional array, what is the value of myVals[1][2]?
Answer 60
e.g.
#include <iostream>
int main()
{
int myVals[][4] = {{2, 4, 6, 8},{20, 40, 60, 80}};
std::cout <<myVals[1][2];
}
Which Java statement creates a ragged array with six rows?
Answer OPTION C
double [][] sales = new double[6][]
How would you create an array named someNumbers that holds three rows and four columns?
Answer OPTION - A
int[][] someNumbers = new int[3][4]
In Java, you create an enumerated data type in a statement that uses the keyword ____.
Answer OPTION - C
e.g.
public enum Season { WINTER, SPRING, SUMMER, FALL }
Comparing a variable to a list of values in an array is a process called ____ an array
Answer OPTION - D
While searching in array, we compare the each element of array to the variable needed.
When you declare an array name, no computer memory address is assigned to it. Instead, the array variable name has the special value ____, or Unicode value ‘\\u0000’.
Answer OPTION - B
null
If you do not provide values for the elements in a two-dimensional numeric array, the values default to null.
Answer FALSE, It must be 0.
Example Code
import java.util.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
int arr[][]=new int[2][2];
System.out.println(arr[0][1]);
}
}
An ArrayList’s ____ is the number of items it can hold without having to increase its size.
Answer OPTION - A capacity
A ____ array is one with the same number of elements as another, and for which the values in corresponding elements are related.
Answer OPTION - B
a parallel array is a data structure for representing arrays of records. Values located at the same index in each array are implicitly the fields of the same record.
The bubble sort is the fastest and most efficient sorting technique.
Answer FALSE
In bubble sort for worst Case scenario where data list is in deascending order which makes it time complexity higher.




