NEW
Font size
Worksheetssoftware dev 1
Total questions: 45
Worksheet time: 23mins
block comments, which the computer doesn't read, and begin programs with infortion
//
..
/**
*
**/
uppercase letters
Which means wild card, or 'all the things'?
//
!
*
wc
if - else statement
a loop that iterates, or repeats, until a condition is met
a loop that iterates, or repeats, for a set number of times
decision structure
creates spaces in memory that holds elements all of the same types
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
This prints if none of the other cases in a switch statement print:
case final:
case default:
default:
error: case not found
The switch statement is
a decision structure that runs only part of our code based on input
an iterative structure that repeats or loops
getting user input: a single word
String response = input.next()
String response = input.nextLine();
int num = input.nextInt();
type a single word, do as I say,
I am the programmer
getting user input: a number
String response = input.next()
String response = input.nextLine();
int num = input.nextInt();
type a single word, do as I say,
I am the programmer
iterate
loop or repeat
choose
dance!
sing!
Every opening { needs a
}
)
]
friend
&&
both things need to be true
at least one needs to be true
none should be true
I've never seen those, are you sure you taught them?
a for loop
an iterative structure that loops at least once
a decision structure that repeats until a condition is changed
an iterative structure that loops a certain number of times
a decision structure that repeats until a condition is met
||
both things need to be true
at least one needs to be true
none should be true
I've never seen those, are you sure you taught them?
!
AND
OR
NOT
RANDOM
an error that's a typo, like a misspelled word or a missing { or ;
logical
syntax
runtime
What does an iterative structure do?
repeat, loop
decided which code should run
what it wants
KungFu
What does a decision statement do?
what it wants
repeat
decide which code should run
Which means 'OR'?
||
&&
==
!
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 = 2
b = 2
if a == b or a < c:
print('dog')
else:
print('cat')
dog
cat
nothing
smallest to largest
KB
MB
GB
TB
PB
EB
EB
PB
TB
GB
MB
KB
KB
GB
PB
MB
PB
EX
PB
EB
TB
GB
KB
MB
Which file size is used for measuring the size of a movie file? ( .mov )
KB
MB
GB
TB
Which file size is used for measuring the size of a modern hard drive?
KB
MB
GB
TB
Which will print 5?
print(22/4)
print(22//4)
print(22%4)
Which will print 5.5?
print(22/4)
print(22//4)
print(22%4)
Which will print 2?
print(22/4)
print(22//4)
print(22%4)
int cats = 2;
System.out.print("cats");
What will print?
cats
2
A bit is
not too much work, just a few problems
The smallest unit of information, can be a 1 or a 0, on or off, true or false
a small amount of dessert
something teeny
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
for(int i = 0; i < 4; i++){
System.out.print(i);
}
18. What will be the last value of i?
6
3
4
5
