Exam 7: Arrays and Array Lists
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
Consider the following code snippet:
Int[][] arr =
{
{ 13, 23, 33 },
{ 14, 24, 34 }
};
Identify the appropriate statement to display the value 24 from the given array?
(Multiple Choice)
4.8/5
(39)
Babbage's machine for automatically producing printed tables was called
(Multiple Choice)
4.9/5
(29)
Which one of the following is the correct code snippet for calculating the largest value in an integer array list arrList of size 10?
(Multiple Choice)
4.9/5
(38)
Assume the method createSomething has been defined as follows:
Int [] createSomething (int start, int size)
{
Int [] result = new int[size];
For (int i = 0; i < result.length; i++)
{
Result[i] = start;
Start++;
}
Return result;
}
What is printed by the statement below?
System.out.print (Arrays.toString(createSomething(4, 3)));
(Multiple Choice)
4.8/5
(38)
Which one of the following is a correct declaration for a method named passAList that has as arguments an array list myList of size 10 and an integer array intArr of size 20, and that modifies the contents of myList and intArr?
(Multiple Choice)
4.7/5
(38)
Consider using a deck of cards as a way to visualize a shuffle algorithm. When two cards shuffle their position, what has to happen to the size of the array holding them?
(Multiple Choice)
4.9/5
(35)
How many elements can be stored in an array of dimension 2 by 3?
(Multiple Choice)
4.8/5
(41)
If a programmer confuses the method required for checking the length of a string and uses size() instead of length(), what will happen?
(Multiple Choice)
4.9/5
(42)
In a partially filled array, the number of slots in the array that are not currently used is
(Multiple Choice)
5.0/5
(41)
What is the value of myArray[1][2] after this code snippet is executed?
Int count = 0;
Int[][] myArray = new int[4][5];
For (int i = 0; i < 5; i++)
{
For (int j = 0; j < 4; j++)
{
MyArray[j][i] = count;
Count++;
}
}
(Multiple Choice)
4.7/5
(34)
The binary search is faster than the linear search, providing
(Multiple Choice)
4.9/5
(40)
What is the output of the following code snippet? ArrayList<Integer> num;
Num)add(4);
System.out.println(num.size());
(Multiple Choice)
4.8/5
(37)
Consider the following code snippet, where the array lists contain elements that are stored in ascending order: ArrayList<Integer> list1 = new ArrayList<Integer>();
ArrayList<Integer> list2 = new ArrayList<Integer>();
) . .
Int count = 0;
For (int i = 0; i < list1.size() && i < list2.size(); i++)
{
If (list1.get(i) == list2.get(i))
{
Count++;
}
}
Which one of the following descriptions is correct for the given code snippet?
(Multiple Choice)
5.0/5
(34)
Why is the following method header invalid? public static int[5] meth(int[] arr, int[] num)
(Multiple Choice)
4.9/5
(33)
Assume the following variable has been declared and given a value as shown:
Int[][] data = {
{9, 17, -4, 21 },
{15, 24, 0, 9},
{6, 2, -56, 8},
};
Which is the value of data[0].length?
(Multiple Choice)
4.9/5
(29)
Assume the array of integers values has been created and process is a method that has a single integer parameter. Which of the following is equivalent to the loop below? for (int val: values)
{
Process (val);
}
(Multiple Choice)
4.8/5
(38)
Assume the variable numbers has been declared to be an array that has at least one element. Which is the following represents the last element in numbers?
(Multiple Choice)
4.9/5
(39)
Which one of the following code snippets accepts the integer input in an array list named num1 and stores the even integers of num1 in another array list named evennum?
(Multiple Choice)
4.8/5
(40)
Why is the use of physical objects helpful in algorithm design?
(Multiple Choice)
4.8/5
(32)
Which statement(s) about the size of a Java array, array list, and string are true?
I. The syntax for determining the size of an array, an array list, and a string in Java is consistent among the three
II. The string uses s.size(), while the array list uses a.length()
III. The array uses a.length, which is not a method call
(Multiple Choice)
4.8/5
(28)
Showing 41 - 60 of 118
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)