0% found this document useful (0 votes)
69 views22 pages

Copy of Walheim - CSA Unit 6 Guide (2023-2024)

AP CSA Unit 6 Guide for studying following code.org

Uploaded by

kkeenan245
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views22 pages

Copy of Walheim - CSA Unit 6 Guide (2023-2024)

AP CSA Unit 6 Guide for studying following code.org

Uploaded by

kkeenan245
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

CSA Unit 6 Guide

Lesson 1: Project Planning


Natural Language Processing

Term Definition Example / Picture / Code

natural language The ability of a computer program to


processing (NLP) understand human language

What are some other examples of where you have seen or experienced NLP?

What are some examples of where you think NLP could be useful?

Documentation
Based on our experiences with writing and reading each other's code, what are some best practices we should
follow when writing and documenting code?

1
CSA Unit 6 Guide

Term Definition Example / Picture / Code

Written descriptions of the purpose


documentation
and functionality of code

A documentation tool for java that is

created by writing comments


Javadocs
inside /** */ and using @ tags

Stands for hypertext markup


<h1> AddNumbers </h1>
HTML
language and <p> Adds two integers </p>

Javadocs Tags

@param
Adds a parameter with the specific description

@return
Adds a returns section with the description

2
CSA Unit 6 Guide
Lesson 2: Substrings
Smart Assistants
When we ask Siri questions, it performs a specific task or gives a response based on our question or
statement. But how does it know what task to perform or how to respond?

The substring() Method

String substring(int beginIndex)

String substring(int beginIndex, int


endIndex)

3
CSA Unit 6 Guide
String objects are immutable, meaning the contents of the

String cannot be changed after it is created.

String methods do not change the original String object.

Reflection
Question of the Day: How can I analyze parts of a String object?

On a scale of 0 to 5, how confident are you in your ability to do the following:

● Use the substring() method in the String class to retrieve a substring of a String object
● Use the indexOf() and substring() methods in the String class to find and replace specific characters

(circle one)

1 2 3 4 5

What needs to happen to increase that number?

4
CSA Unit 6 Guide

Lesson 3: Integer and Double Objects


Primitive and Reference Types
What are some differences between primitive and reference types?

Video Notes: Wrapper Classes - Part 1

Three Things You Learned Two Interesting Ideas

1 1

2 2

3 One Question or Wonder

5
CSA Unit 6 Guide
Integer and Double Classes

Integer Double

Term Definition Example / Picture / Code

parsing

Integer Ranges

6
CSA Unit 6 Guide

Consider each of the following statements and determine if they are true or false. If it is false, explain why. If
you are unsure, explain why.

1. _______ Adding 1 to MAX_VALUE will not change the value, because the value has already met its
maximum limit and cannot increase.

Reasoning:

2. _______ An underflow error occurs when an operation makes an integer value less than its minimum.

Reasoning:

Term Definition Example / Picture / Code

Automatically converts a

______________ to a
int x = 64;
autoboxing
_______________ of the Integer y = x;

corresponding wrapper class

7
CSA Unit 6 Guide

Automatically converts an

_____________ of a wrapper class


Integer x = new
into its corresponding
unboxing Integer(64);
int convertedInt = x;
_____________________________

____

Reflection
Question of the Day: Why would I want to represent primitive values as objects?

What is the relationship between wrapper classes, integers, double values, and overflow/underflow?

8
CSA Unit 6 Guide

Lesson 4: ArrayLists
Storing User Input in a List
The Joyful Pastries Food Truck owner wants cashiers to enter customer orders into a list as they are received
so the baker can complete the orders from the list.

What if we don't know how many orders the owner needs to enter into the program? What would we need to
change in our solution?

Video Notes: The ArrayList Class


Follow along with the video and use the table below to create an ArrayList. Annotate it as you watch.

9
CSA Unit 6 Guide

Term Definition Example / Picture / Code

static data structure

dynamic data
structure

mutable

ArrayList

Parameters:

Methods:

10
CSA Unit 6 Guide
Reflection
Question of the Day: Why would I use an ArrayList instead of an array?

What are two big ideas about ArrayLists that you think will appear again in our lesson next class?

11
CSA Unit 6 Guide

Lesson 5: Manipulating Elements


Accessing Elements
How do we get an individual element from an array?

How can we do this with an ArrayList based on what we know about its structure?

Video Notes: Working with ArrayList Data


True or False? Consider each of the following statements and determine if they are true or false. If it is false,
explain why. If you are unsure, explain why.

1. _______ Dot notation and a method are used to access values in an ArrayList.

Reasoning:

2. _______ add() is a static method.

Reasoning:

12
CSA Unit 6 Guide
Reflection
Question of the Day: How am I able to work with the data stored in an ArrayList?

Which parts or terms from today's class were new to you? Which parts do you recognize?

13
CSA Unit 6 Guide

Lesson 6: Comparing Strings


Term Definition Example / Picture / Code

A B C D E F G H
lexicographical order
I J K L M N O P
Q R S T U V W X
Y Z

1 String firstWord = "Hello";


2 String secondWord = "HELLO";
3 String thirdWord = "Java";
4 System.out.println(firstWord.compareTo(thirdWord
));
5 System.out.println(firstWord.compareTo(secondWor
d));
6 System.out.println(thirdWord.compareTo(firstWord
));

int compareTo(String string2)

14
CSA Unit 6 Guide
Reflection
Question of the Day: How can I determine if a list of String objects are in alphabetical order?

How have your software engineering skills improved in this unit?

15
CSA Unit 6 Guide

Lesson 7: Lists of Objects


When you hear the phrase "generic type", what do you think that means? What do you think of?

Term Definition Example / Picture / Code

Allows a ____________, or

__________, to be used as the

_______________________ to an
generic type
ArrayList and is indicated by

____________

Reflection
Question of the Day: Why would I use generic types?

What is one goal you have for yourself in the next class?

16
CSA Unit 6 Guide

Lesson 8: Removing Elements


The Social Media Dilemma
You are writing an algorithm for your favorite social media app. This algorithm uses an array to store the
names of every user someone is following. We know that people sometimes “break up” with friends for
whatever reason. Therefore, the user needs the ability to unfollow or remove a friend from their list.

How is the remove() method different from how we would remove items from an array?

Similar Different

● ●

● ●

17
CSA Unit 6 Guide
Removing with an Enhanced for Loop

Enhanced for Loop: Arrays Enhanced for Loop: ArrayList

for(int price : prices) { for(Integer price : prices)


{
System.out.println(price);
} System.out.println(price);
}

WORD BANK

ConcurrentModificationException enhanced loop ArrayList array

Using an ______________________ while adding or removing elements from an ArrayList may cause

a __________________________________.

___________________s are immutable, which means the size cannot change.

Using remove() with an ___________________ completely removes the element, shifting the rest of the

items.

18
CSA Unit 6 Guide
Reflection
Question of the Day: How is removing data from an ArrayList different from removing data from an array?

How does the idea of removing elements connect with what you already know?

19
CSA Unit 6 Guide

Lesson 9: ArrayList and String Algorithms


ArrayLists Review Concept Map
How do ArrayLists make it easier to work with data in our programs?

Create a concept map that illustrates the concepts and their relationships in response to this prompt.

20
CSA Unit 6 Guide

Term Definition Example / Picture / Code

text segmentation

What steps would our programs need to take to obtain a word from a sentence?

What about a sentence from a paragraph?

Term Definition Example / Picture / Code

stop word

Removing commonly used words


stop word removal from a list before or after processing
text

21
CSA Unit 6 Guide
Reflection
Question of the Day: How can I use what I know about object-oriented programming and ArrayLists to
plan and implement algorithms?

How do you see String manipulation being used in software or apps that you use?

22

You might also like