Advanced Computer Science 1: Semester 1 Study Guide

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/12

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:45 PM on 12/10/24
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

13 Terms

1
New cards

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').

2
New cards

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.

3
New cards

How do you perform type casting from int to double?

Example: double y = (double) x; where int x = 5.

4
New cards

What is the method to get the length of a String in Java?

The .length() method returns the number of characters in the string.

5
New cards

How would you convert a string to uppercase in Java?

Using the .toUpperCase() method, e.g., 'hello'.toUpperCase() results in 'HELLO'.

6
New cards

Which character does the method .charAt(index) return in a String?

It returns the character at the specified index of the string.

7
New cards

What are the comparison operators listed in Unit 3?

==, !=, >,
8
New cards

What is the syntax of an if statement in Java?

if (condition) { code to execute if true } else { code to execute if false }.

9
New cards

What type of loop is used when you know how many times you want to iterate?

A for loop.

10
New cards

What is the output of the following code: int a = 8; double b = 3.0; System.out.println(a / b);?

c. 2.6666666666666665.

11
New cards

What is the result of true && false?

b. false.

12
New cards

Write a for loop that prints numbers 1 through 5.

for (int i = 1; i <= 5; i++) { System.out.println(i); }.

13
New cards

What should you be cautious of when writing while loops?

Be careful not to create infinite loops that never stop!