NEW
Font size
Worksheetsarray review
Total questions: 60
Worksheet time: 36mins
What is this for loop doing to ints[]?
filling with 'i'
searching for 'i'
printing values of 'i'
celebrating the last period of the day before the freakin' weekin'
What is this for loop doing to running[]?
filling with 'i'
searching for 'i'
printing 'i'
living his gd life
What is this for loop doing to numbers[]?
filling it with values of 'i'
searching for 'i'
printing 'i'
hustling and shining
An array is declared with the type written first, then which two symbols?
( )
{ }
[ ]
| |
An empty spot in an array prints out as:
null
empty
zip
public
What is returned by nums[5]?
9
12
6
8
What is the value of nums.length?
0
5
6
7
The 1st space in an array is
0
1
42
infinite
double[ ] data = new double[10];
What is the error in the following code fragment?
double[ ] data = new double[20];
data[20] = 15.25;
Out-of-bounds error
Double doesn't hod decimal numbers
We are use Scanner Library in java for...
Give permissions to the user
Correcting software errors
Allows user to read data
Allows the user to enter data
We use For loops ..........
To repeat a specified number of operations.
To repeat a unspecified number of operations.
All answers are correct
When a programmer ____________, they find and remove any of the three kinds of errors.
debugs
fixes
parses
compiles
Arrays can change size.
true
false
if they try hard enough
Arrays can hold Strings and ints together.
true
false
When danger is nigh and the ints need protection.
int[] nums = {1, 2, 3, 4, 5};
System.out.print( nums[2] );
1
2
3
out of bounds error
int[] nums = {1, 2, 3, 4, 5};
System.out.print(nums[5]);
1
2
3
out of bounds error
What is the first index of an array?
1
0
2
3
String[] glasses = {"Miranda", "Chris", "Leena"};
How would you get Miranda to print?
System.out.print( glasses[ 1 ] );
System.out.print( glasses[ 0 ] );
System.out.print( glasses[ 2 ] );
System.out.print( glasses.find( "Miranda" ));
comparing two ints
==
this.equals(that)
comparing two strings
==
this.equals(that)
All cases of a switch statement print if:
you forget break statements
you forget a closing curly bracket
you forget a semicolon
you forget a period
A bit is
An agreed upon set of rules or guidelines for doing things.
A single unit of information, it can be a 1 or a 0.
Number of bits that are conveyed or processed per unit of time
Time it takes for a bit to travel from its sender to its receiver
int i = 1;
while( i < 3){
System.out.println(i);
i++;
}
What will the printout be?
0
1
2
3
1
2
123
012
int a = 4, b = 3, c = 5;
if( a == b || a < c ){
System.out.println(“star”);
}
else{
System.out.println(“moon”);
}
star
moon
sky
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?
Saturday
Friday
Sunday
Thursday
for(int i = 0; i <= 4; i++){
System.out.println(i);
}
What will the printout be?
012345
01234
0
1
2
3
4
0
1
2
3
4
5
Which means 'OR'?
||
&&
==
!
Which means 'AND'?
||
&&
==
!
String[] nightCrusaders = {"Liz", "Luke"};
Is this array initialized?
yes
no
sometimes
String[] nightCrusaders = new String[2];
Is this array initialized?
yes
no
sometimes
What is this for loop doing?
for(int i = 0; i < 3; i++){
System.out.print(thisCoolArray[i]);
}
printing the array
filling the array
searching the array
becoming best friends with the array
What is this for loop doing?
for(int i = 0; i < 3; i++){
System.out.println("Enter a number: ");
thisCoolArray[i] = input.nextInt();
}
printing the array
filling the array
searching the array
becoming best friends with the array
iterative structures
if, switch
for, while, do-while, recursion
python, java, c++, ruby, c#, html
Jalen, Lantz, Justice
