Code HS
Latest uploads at Code HS. Looking for notes at Code HS? We have lots of notes, study guides and study notes available for your school.
-
207
- 0
-
14
All courses for Code HS
-
Code HS 1
-
Code HS 207
-
Code-HS 3
Latest content Code HS
What is an object in Java? An object is something that contains both state and behavior. 
 
What is the difference between a class and an object? Objects are instances of classes. The 
class is the general template, and the object is the specific version. 
 
What does it mean to be a client of a class? Being a client of a class means that we can use 
its methods and functionality without necessarily understanding how it works. 
 
What is a constructor in Java? A constructor allows us to create a...
- Exam (elaborations)
- • 4 pages's •
-
Code HS•Code HS
Preview 1 out of 4 pages
Getting your document ready...
What is an object in Java? An object is something that contains both state and behavior. 
 
What is the difference between a class and an object? Objects are instances of classes. The 
class is the general template, and the object is the specific version. 
 
What does it mean to be a client of a class? Being a client of a class means that we can use 
its methods and functionality without necessarily understanding how it works. 
 
What is a constructor in Java? A constructor allows us to create a...
Why are parameters useful? They allow us to tailor functions to be used in multiple 
situations 
 
How many parameters can we use in each function? As many as we need 
 
What is the default starting value of i in a for loop? 0 
 
What will the values of i be at each iteration of the loop below? 
 
For i in range(3): 0, 1, 2 
 
What will happen when the value of i reaches 5 in the loop below? 
 
for i in range(5): 
left(i)
- Exam (elaborations)
- • 2 pages's •
-
Code HS•Code HS
Preview 1 out of 2 pages
Getting your document ready...
Why are parameters useful? They allow us to tailor functions to be used in multiple 
situations 
 
How many parameters can we use in each function? As many as we need 
 
What is the default starting value of i in a for loop? 0 
 
What will the values of i be at each iteration of the loop below? 
 
For i in range(3): 0, 1, 2 
 
What will happen when the value of i reaches 5 in the loop below? 
 
for i in range(5): 
left(i)
Comments are written for... Humans to read and to understand 
 
What symbol is used at the beginning of an in-line comment? # 
 
What punctuation is used to begin a multi-line comment? """ 
 
What name follows all naming rules? make_square 
 
If I am creating a function that makes two squares, what would be the best name option? 
draw_squares 
 
What is not a way functions make our code more readable? Each function only contains one 
command 
 
What two things must be included in your functio...
- Exam (elaborations)
- • 3 pages's •
-
Code HS•Code HS
Preview 1 out of 3 pages
Getting your document ready...
Comments are written for... Humans to read and to understand 
 
What symbol is used at the beginning of an in-line comment? # 
 
What punctuation is used to begin a multi-line comment? """ 
 
What name follows all naming rules? make_square 
 
If I am creating a function that makes two squares, what would be the best name option? 
draw_squares 
 
What is not a way functions make our code more readable? Each function only contains one 
command 
 
What two things must be included in your functio...
For Loop for(var i = 0; i < COUNT; i++){ 
} 
 
While Loop while(boolean expression){ 
/* Repeat code betweeen brackets while 
* 'boolean expression' is true */ 
} 
 
If Statement if(BOOLEAN_EXPRESSION){ 
// code to execute if true 
} 
 
If/Else if(BOOLEAN_EXPRESSION){ 
// code if true 
 
} else { 
// code if false
- Exam (elaborations)
- • 7 pages's •
-
Code HS•Code HS
Preview 2 out of 7 pages
Getting your document ready...
For Loop for(var i = 0; i < COUNT; i++){ 
} 
 
While Loop while(boolean expression){ 
/* Repeat code betweeen brackets while 
* 'boolean expression' is true */ 
} 
 
If Statement if(BOOLEAN_EXPRESSION){ 
// code to execute if true 
} 
 
If/Else if(BOOLEAN_EXPRESSION){ 
// code if true 
 
} else { 
// code if false
Suppose you have a function that computes the area of a diamond. Which of the following 
comments would be the best yo use? 
 
//This is a function 
// This function computes the area 
// Computes and returns the area of a diamond using the parameters height and width 
The function doesn't need a comment // Computes and returns the area of a diamond using 
the parameters height and width 
 
The following if statement should check that an object will fit on the screen. The variables height 
and ...
- Exam (elaborations)
- • 6 pages's •
-
Code HS•Code HS
Preview 2 out of 6 pages
Getting your document ready...
Suppose you have a function that computes the area of a diamond. Which of the following 
comments would be the best yo use? 
 
//This is a function 
// This function computes the area 
// Computes and returns the area of a diamond using the parameters height and width 
The function doesn't need a comment // Computes and returns the area of a diamond using 
the parameters height and width 
 
The following if statement should check that an object will fit on the screen. The variables height 
and ...
Which of these is a valid Karel command? 
 
move; 
 
MOVE 
 
move(); 
 
move() move(); 
 
What is a street in a Karel world? 
 
A row 
 
A column
- Exam (elaborations)
- • 35 pages's •
-
Code HS•Code HS
Preview 4 out of 35 pages
Getting your document ready...
Which of these is a valid Karel command? 
 
move; 
 
MOVE 
 
move(); 
 
move() move(); 
 
What is a street in a Karel world? 
 
A row 
 
A column
4.1.4: Fix This Program brought_food = True 
brought_drink = False 
print(brought_food) 
print(brought_drink) 
# These lines don't work! Fix them so that they do. 
print(type ("Did the person bring food? " + str(brought_food))) 
print(type ("Did the person bring a drink? " + str(brought_drink))) 
 
4.1.5: Plants needs_water = True 
needs_to_be_repotted = False 
print("Needs water: " + str(needs_water)) 
print (str(needs_to_be_repotted)) 
print(needs_water) 
 
4.2.5: Fix This Program can_j...
- Exam (elaborations)
- • 6 pages's •
-
Code HS•Code HS
Preview 2 out of 6 pages
Getting your document ready...
4.1.4: Fix This Program brought_food = True 
brought_drink = False 
print(brought_food) 
print(brought_drink) 
# These lines don't work! Fix them so that they do. 
print(type ("Did the person bring food? " + str(brought_food))) 
print(type ("Did the person bring a drink? " + str(brought_drink))) 
 
4.1.5: Plants needs_water = True 
needs_to_be_repotted = False 
print("Needs water: " + str(needs_water)) 
print (str(needs_to_be_repotted)) 
print(needs_water) 
 
4.2.5: Fix This Program can_j...
What is an object in Java? An object is something that contains both state and behavior. 
 
Which of the following best describes the relationship between a class and an object? A class 
definition specifies the attributes and behavior of every object that will be made. 
 
Every class definition has each of the following EXCEPT 
A name 
Defined attributes 
Defined behaviors to manipulate the state of the objects 
Defined objects as copies of the class Defined objects as copies of the class 
 
Co...
- Exam (elaborations)
- • 32 pages's •
-
Code HS•Code HS
Preview 4 out of 32 pages
Getting your document ready...
What is an object in Java? An object is something that contains both state and behavior. 
 
Which of the following best describes the relationship between a class and an object? A class 
definition specifies the attributes and behavior of every object that will be made. 
 
Every class definition has each of the following EXCEPT 
A name 
Defined attributes 
Defined behaviors to manipulate the state of the objects 
Defined objects as copies of the class Defined objects as copies of the class 
 
Co...
For Loop for(var i = 0; i < COUNT; i++){ 
} 
While Loop while(boolean expression){ 
/* Repeat code betweeen brackets while 
* 'boolean expression' is true */ 
} 
If Statement if(BOOLEAN_EXPRESSION){ 
// code to execute if true 
} 
If/Else if(BOOLEAN_EXPRESSION){ 
// code if true 
} else { 
// code if false
- Exam (elaborations)
- • 7 pages's •
-
Code HS•Code HS
Preview 2 out of 7 pages
Getting your document ready...
For Loop for(var i = 0; i < COUNT; i++){ 
} 
While Loop while(boolean expression){ 
/* Repeat code betweeen brackets while 
* 'boolean expression' is true */ 
} 
If Statement if(BOOLEAN_EXPRESSION){ 
// code to execute if true 
} 
If/Else if(BOOLEAN_EXPRESSION){ 
// code if true 
} else { 
// code if false
Who creates the look and feel of a website? A web designer 
 
Who writes the HTML and CSS that brings the site to life? A web developer 
 
Who thinks about the best way to display information on the site? A web designer 
 
True or False: The majority of the world has access to the Internet. False 
 
Which of the following is related to the issue of censorship on the Internet? A government 
filtering search results to limit the access of information and suppress discussion amongst its 
citizens 
...
- Exam (elaborations)
- • 38 pages's •
-
Code HS•Code HS
Preview 4 out of 38 pages
Getting your document ready...
Who creates the look and feel of a website? A web designer 
 
Who writes the HTML and CSS that brings the site to life? A web developer 
 
Who thinks about the best way to display information on the site? A web designer 
 
True or False: The majority of the world has access to the Internet. False 
 
Which of the following is related to the issue of censorship on the Internet? A government 
filtering search results to limit the access of information and suppress discussion amongst its 
citizens 
...