Exam 9: Advanced Array Concepts
Exam 1: Creating Your First Java Classes76 Questions
Exam 2: Using Data81 Questions
Exam 3: Using Methods, Classes and Objects79 Questions
Exam 4: More Object Concepts84 Questions
Exam 5: Making Decisions80 Questions
Exam 6: Looping77 Questions
Exam 7: Characters, Strings and the Stringbuilder82 Questions
Exam 8: Arrays77 Questions
Exam 9: Advanced Array Concepts80 Questions
Exam 10: Introduction to Inheritance78 Questions
Exam 11: Advanced Inheritance Concepts78 Questions
Exam 12: Exception Handling79 Questions
Exam 13: File Input and Output78 Questions
Exam 14: Introduction to Swing Components79 Questions
Exam 15: Using Javafx and Scene Builder65 Questions
Select questions type
Match each term with the correct statement below.
Premises:
The size can change during program execution
Responses:
java.util
multidimensional array
static methods
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(27)
import java.util.*;
import javax.swing.*;
public class binary_search
{
public static void main(String[] args)
{
int myNums[]={2, 44, 5, 66, 78, 90, 23, 66};
int point, find = 78;
point = Arrays.binarySearch(myNums, find);
System.out.println("Element found at index " + point);
}
}
Using the above code, what output will be displayed when the program is executed? Describe how the binarySearch() method functions.
(Essay)
4.9/5
(34)
When mathematicians use a two-dimensional array, they often call it a ____.
(Multiple Choice)
4.9/5
(39)
Declare an ArrayList that declares a list of strings with a capacity of 20.
(Essay)
4.9/5
(39)
Match each term with the correct statement below.
Premises:
A data type for which only appropriate behaviors are allowed.
Responses:
two-dimensional array
add() method
Enumerated data type
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(41)
The negative integer returned by the binarySearch() method when the value is not found is the negative equivalent of the array ____.
(Multiple Choice)
4.8/5
(43)
Using the ArrayList add() method, write the statement to insert "July" in the first position of the months ArrayList . Describe what would happen if the position number is invalid for the ArrayList .
(Essay)
4.8/5
(36)
Match each term with the correct statement below.
Premises:
Arrays with more than one dimension
Responses:
type-safe
jagged array
dynamically resizable
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(38)
You can think of the single dimension of a single dimensional array as the height of the array.
(True/False)
4.8/5
(40)
The simplest possible sort involves two values that are out of order.
(True/False)
4.9/5
(35)
import java.util.*;
public class sortArray
{
public static void main(String[] args)
{
double[] lengths = {120.0, 0.5, 0.0, 999.0, 77.3};
Arrays.sort(lengths);
System.out.println(Arrays.toString(lengths));
}
}
Using the above code, what will be the output of the println statement when the code is executed?
(Essay)
4.9/5
(36)
public class EnumExample
{
enum Day {SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY };
Day day;
public EnumExample(Day day)
{
this.day = day;
}
public void giveFeedback()
{
switch (day)
{
case MONDAY:
System.out.println("Mondays are bad.");
break;
case FRIDAY:
System.out.println("Fridays are better.");
break;
case SATURDAY: case SUNDAY:
System.out.println("Weekends are best.");
break;
default:
System.out.println("Midweek days are so-so.");
break;
}
}
public static void main(String[] args)
{
EnumExample firstDay = new EnumExample(Day.MONDAY);
firstDay.giveFeedback();
EnumExample thirdDay = new EnumExample(Day.WEDNESDAY);
thirdDay.giveFeedback();
EnumExample fifthDay = new EnumExample(Day.FRIDAY);
fifthDay.giveFeedback();
EnumExample sixthDay = new EnumExample(Day.SATURDAY);
sixthDay.giveFeedback();
EnumExample seventhDay = new EnumExample(Day.SUNDAY);
seventhDay.giveFeedback();
}
}
Using the above enumeration and code, what will be the output when the program is executed?
(Essay)
4.8/5
(38)
The Arrays class ____ methods are a new feature in Java 8 that makes sorting more efficient when thousands or millions of objects need to be sorted.
(Multiple Choice)
4.9/5
(39)
Match each term with the correct statement below.
Premises:
A package containing the Arrays class
Responses:
one-dimensional array
java.util
two-dimensional array
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(43)
int[][] myVals = {{2, 4, 6}, {1, 3, 5, 7}};
Using the above array, what is the value of myVals.length ?
(Multiple Choice)
4.9/5
(36)
Describe how to visualize the following array. How would you identify the location of the 99 that is stored in the array?
int[][] someNumbers = {{8, 9, 10, 11},
{1, 3, 12, 15},
{5, 9, 44, 99} };
(Essay)
4.8/5
(35)
Match each term with the correct statement below.
Premises:
A two-dimensional array that has rows of different lengths
Responses:
jagged array
two-dimensional array
ascending order
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(41)
What is sorting and how are objects organized as a result of being sorted?
(Essay)
4.8/5
(34)
Showing 41 - 60 of 80
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)