NEW
Font size
S
M
L
XL
WorksheetsProgramming 2 - Arrays
Total questions: 17
Worksheet time: 10mins
Name
Class
Date
1.
Which of the following is NOT an advantage of an array?
a)
Each value in the array is identified by a unique variable.
b)
Any item in an array can be efficiently obtained by its index.
c)
It is easy to iterate over the items in an array.
d)
Data is stored in an organized way.
2.
_________________ is a collection of elements used to store the same type of data.
a)
Array
b)
Switch
c)
Case
d)
Loop
3.
________________________ are used to create a multi dimensional array.
a)
Single round brackets
b)
Single square brackets
c)
Multiple squares brackets
d)
Single angled brackets
4.
___________ is an array that can increase in size during program execution.
a)
Single-dimensional array
b)
Two-dimensional array
c)
Multi-dimensional array
d)
Dynamic array
5.
How can you fetch data from the array?
a)
using index
b)
using value
c)
using arrayname
d)
using operator
6.
How will you identify a single array?
a)
single curly brackets
b)
single square brackets
c)
multiple squares brackets
d)
single angled brackets
7.
java.util.ArrayList is a_________.
a)
method
b)
class
c)
package
d)
object
8.
Which is the correct way to create a new Arraylist?
a)
ArrayList ArrayListName = new ArrayList ();
b)
ArrayList ArrayListName = ArrayList ();
c)
ArrayList ArrayListName = new Array ();
d)
ArrayList ArrayListName = Array ();
9.
The _____ method makes a copy of an existing Arraylist.
a)
add
b)
copy
c)
clone
d)
size
10.
Which method do you use to find how many items are in an arraylist?
a)
remove()
b)
count()
c)
size()
d)
add()
11.
How do you insert a value in the ArrayList at a specific location?
a)
add()
b)
get()
c)
fix();
d)
get();
12.
The result of listing (D, E, A, C, B) in ascending order will be _______________.
a)
A, B, C, D, E
b)
A, E, B, C, D
c)
D, E, A, B, C
d)
E, D, C, B, A
13.
The ____________works by evaluating each item in the collection list with the item next to it, and swapping.
a)
Bubble Sort
b)
Selection Sort
c)
insertion Sort
d)
Merge Sort
14.
___________ is one that sorts a set of items by inserting item into an existing list of sorted items.
a)
Insertion Sort
b)
Merge Sort
c)
Bubble Sort
d)
Selection Sort
15.
In ________, two sets of sorted items are combined into a third.
a)
Insertion Sort
b)
Bubble Sort
c)
Selection Sort
d)
Merge Sort
16.
What type of search would be most appropriate for a short list of unsorted data?
a)
linear
b)
binary
17.
If the following set of data were in a list, what type of search would be best?
8,9,28,13,22,4,10,12,57,34
8,9,28,13,22,4,10,12,57,34
a)
linear
b)
binary
Reset
