1/12
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What are the primitive data types in Unit 1 of the CodeHS Nitro course and provide examples?
int (e.g., 5), double (e.g., 3.14), boolean (e.g., true), String (e.g., 'Hello').
What is the rule for naming variables in CodeHS?
Variables must start with a letter, _, or $. They cannot start with numbers or use reserved keywords.
How do you perform type casting from int to double?
Example: double y = (double) x; where int x = 5.
What is the method to get the length of a String in Java?
The .length() method returns the number of characters in the string.
How would you convert a string to uppercase in Java?
Using the .toUpperCase() method, e.g., 'hello'.toUpperCase() results in 'HELLO'.
Which character does the method .charAt(index) return in a String?
It returns the character at the specified index of the string.
What are the comparison operators listed in Unit 3?
What is the syntax of an if statement in Java?
if (condition) { code to execute if true } else { code to execute if false }.
What type of loop is used when you know how many times you want to iterate?
A for loop.
What is the output of the following code: int a = 8; double b = 3.0; System.out.println(a / b);?
c. 2.6666666666666665.
What is the result of true && false?
b. false.
Write a for loop that prints numbers 1 through 5.
for (int i = 1; i <= 5; i++) { System.out.println(i); }.
What should you be cautious of when writing while loops?
Be careful not to create infinite loops that never stop!