wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

array review

Total questions: 60

Worksheet time: 36mins

Name
Class
Date
1.

What is this for loop doing to ints[]?

a)

filling with 'i'

b)

searching for 'i'

c)

printing values of 'i'

d)

celebrating the last period of the day before the freakin' weekin'

2.

What is this for loop doing to running[]?

a)

filling with 'i'

b)

searching for 'i'

c)

printing 'i'

d)

living his gd life

3.

What is this for loop doing to numbers[]?

a)

filling it with values of 'i'

b)

searching for 'i'

c)

printing 'i'

d)

hustling and shining

4.
A variable that holds a whole number
a)
String
b)
boolean
c)
int
d)
float
5.
A variable that holds words
a)
String
b)
boolean
c)
int
d)
float
6.
A variable that holds true or false
a)
String
b)
boolean
c)
int
d)
float
7.
A variable that holds a decimal number
a)
String
b)
boolean
c)
int
d)
float
8.
A variable that holds a character
a)
String
b)
boolean
c)
int
d)
char
9.
while loop
a)
a loop that iterates, or repeats, until a condition is met
b)
a loop that iterates, or repeats, for a set number of times
c)
makes a decision based on input
d)
creates spaces in memory that holds elements all of the same types
10.
for loop
a)
a loop that iterates, or repeats, until a condition is met
b)
a loop that iterates, or repeats, for a set number of times
c)
makes a decision based on input
d)
creates spaces in memory that holds elements all of the same types
11.
if - else statement
a)
a loop that iterates, or repeats, until a condition is met
b)
a loop that iterates, or repeats, for a set number of times
c)
makes a decision based on input
d)
creates spaces in memory that holds elements all of the same types
12.
array
a)
a loop that iterates, or repeats, until a condition is met
b)
a loop that iterates, or repeats, for a set number of times
c)
makes a decision based on input
d)
creates spaces in memory that holds elements all of the same types
13.
single line comments, which the computer doesn't read, start with
a)
//
b)
..
c)
**
d)
uppercase letters
14.
pseudocode is:
a)
order of events
b)
instruction given to a computer by a programmer
c)
paragraphs
d)
writing out a program in regular language before translating it into actual code
15.

An array is declared with the type written first, then which two symbols?

a)

( )

b)

{ }

c)

[ ]

d)

| |

16.

An empty spot in an array prints out as:

a)

null

b)

empty

c)

zip

d)

public

17.
Which of these leaves the cursor on the same line as the printed output: 
a)
System.out.print("Hello world.");
b)
System.out.println("Hello world.");
18.
Which of these moves the cursor to the next line beneath the printed output: 
a)
System.out.print("Hello world.");
b)
System.out.println("Hello world.");
19.
Which of these iterates (loops)
a)
if(...){
b)
char[] myArray = ...
c)
while(...){
d)
switch(...)
20.

What is returned by nums[5]?

a)

9

b)

12

c)

6

d)

8

21.

What is the value of nums.length?

a)

0

b)

5

c)

6

d)

7

22.

The 1st space in an array is

a)

0

b)

1

c)

42

d)

infinite

23.
Create an array of 12 strings called months.
a)
String[] months = new String[12];
b)
String months = new String[12];
c)
String[] months = new String[];
d)
String[12] months = new String[];
24.
Based on the statement below, which of the following statements gives the length of the data array?
double[ ] data = new double[10];
a)
data.size()
b)
data.length
c)
data.size
d)
data.length()
25.

What is the error in the following code fragment?

double[ ] data = new double[20];

data[20] = 15.25;

a)

Out-of-bounds error

b)

Double doesn't hod decimal numbers

26.

We are use Scanner Library in java for...

a)

Give permissions to the user

b)

Correcting software errors

c)

Allows user to read data

d)

Allows the user to enter data

27.

We use For loops ..........

a)

To repeat a specified number of operations.

b)

To repeat a unspecified number of operations.

c)

All answers are correct

28.

When a programmer ____________, they find and remove any of the three kinds of errors.

a)

debugs

b)

fixes

c)

parses

d)

compiles

29.
  Which of the following operators is the logical 'not' operator?
a)
||
b)
&&
c)
!
d)
%
30.

Arrays can change size.

a)

true

b)

false

c)

if they try hard enough

31.

Arrays can hold Strings and ints together.

a)

true

b)

false

c)

When danger is nigh and the ints need protection.

32.

int[] nums = {1, 2, 3, 4, 5};

System.out.print( nums[2] );

a)

1

b)

2

c)

3

d)

out of bounds error

33.

int[] nums = {1, 2, 3, 4, 5};

System.out.print(nums[5]);

a)

1

b)

2

c)

3

d)

out of bounds error

34.
What is the output of an OR gate if the inputs are 1 and 0?
a)
0
b)
1
c)
OFF
d)
2
35.
What kind of gate is this?
a)
AND
b)
NAND
c)
OR
d)
XAND
36.
What kind of gate is this?
a)
OR
b)
XOR
c)
NOR
d)
AND
37.
What do all strings need in an array?
a)
[] - square brackets
b)
{} - curly brackets
c)
"" - quotation marks
d)
; - a semi colon
38.

What is the first index of an array?

a)

1

b)

0

c)

2

d)

3

39.
What is the correct way to create an array with these three numbers: 12  8  15
a)
int[] = {12, 8, 15};
b)
int[] nums = {12  8  15};
c)
int[] nums = {12, 8, 15}
d)
int[] nums = {12, 8, 15};
40.

String[] glasses = {"Miranda", "Chris", "Leena"};

How would you get Miranda to print?

a)

System.out.print( glasses[ 1 ] );

b)

System.out.print( glasses[ 0 ] );

c)

System.out.print( glasses[ 2 ] );

d)

System.out.print( glasses.find( "Miranda" ));

41.
Binary uses electrical signals
a)
True
b)
False
42.
Binary uses 1’s & 0’s to represent data
a)
True
b)
False
43.
What is 12 in binary?
a)
0010
b)
1010
c)
1100
d)
1111
44.
What is 3 in binary?
a)
0100
b)
0001
c)
0101
d)
0011
45.
What is the point of binary?
a)
It represents how computers interpret electrical signals
b)
Because we like to make you do extra maths ;-D
c)
For the lulz
d)
Because it describes star systems
46.

comparing two ints

a)

==

b)

this.equals(that)

47.

comparing two strings

a)

==

b)

this.equals(that)

48.

All cases of a switch statement print if:

a)

you forget break statements

b)

you forget a closing curly bracket

c)

you forget a semicolon

d)

you forget a period

49.

A bit is

a)

An agreed upon set of rules or guidelines for doing things.

b)

A single unit of information, it can be a 1 or a 0.

c)

Number of bits that are conveyed or processed per unit of time

d)

Time it takes for a bit to travel from its sender to its receiver

50.

int i = 1;

while( i < 3){

System.out.println(i);

i++;

}


What will the printout be?

a)

0

1

2

3

b)

1

2

c)

123

d)

012

51.

int a = 4, b = 3, c = 5;

if( a == b || a < c ){

System.out.println(“star”);

}

else{

System.out.println(“moon”);

}

a)

star

b)

moon

c)

sky

52.

int grade = 78;

grade = grade/10;

switch(grade){

case 8:

System.out.println(“Friday”);

break;

case 7:

System.out.println(“Saturday”);

break;

default:

System.out.print(“Sunday”);

}

What will print?

a)

Saturday

b)

Friday

c)

Sunday

d)

Thursday

53.

for(int i = 0; i <= 4; i++){

System.out.println(i);

}


What will the printout be?

a)

012345

b)

01234

c)

0

1

2

3

4

d)

0

1

2

3

4

5

54.

Which means 'OR'?

a)

||

b)

&&

c)

==

d)

!

55.

Which means 'AND'?

a)

||

b)

&&

c)

==

d)

!

56.

String[] nightCrusaders = {"Liz", "Luke"};

Is this array initialized?

a)

yes

b)

no

c)

sometimes

57.

String[] nightCrusaders = new String[2];

Is this array initialized?

a)

yes

b)

no

c)

sometimes

58.

What is this for loop doing?

for(int i = 0; i < 3; i++){

System.out.print(thisCoolArray[i]);

}

a)

printing the array

b)

filling the array

c)

searching the array

d)

becoming best friends with the array

59.

What is this for loop doing?

for(int i = 0; i < 3; i++){

System.out.println("Enter a number: ");

thisCoolArray[i] = input.nextInt();

}

a)

printing the array

b)

filling the array

c)

searching the array

d)

becoming best friends with the array

60.

iterative structures

a)

if, switch

b)

for, while, do-while, recursion

c)

python, java, c++, ruby, c#, html

d)

Jalen, Lantz, Justice