[go: up one dir, main page]

0% found this document useful (0 votes)
237 views1 page

AP Computer Science A Cram Chart 2021

This document provides a cram chart for the AP Computer Science A exam, summarizing key topics covered in the course. It outlines primitive data types, using objects, boolean expressions and if/else statements, arrays, 2D arrays, and exam tips. Primitive types covered include String, boolean, int, double, and final. Using objects explains the basics of classes, objects, and methods. Boolean expressions and control flow cover logical operators and if/else/while statements. Arrays and 2D arrays explain declaration and traversal. Exam tips encourage commenting code, taking time, and writing method headers.

Uploaded by

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

AP Computer Science A Cram Chart 2021

This document provides a cram chart for the AP Computer Science A exam, summarizing key topics covered in the course. It outlines primitive data types, using objects, boolean expressions and if/else statements, arrays, 2D arrays, and exam tips. Primitive types covered include String, boolean, int, double, and final. Using objects explains the basics of classes, objects, and methods. Boolean expressions and control flow cover logical operators and if/else/while statements. Arrays and 2D arrays explain declaration and traversal. Exam tips encourage commenting code, taking time, and writing method headers.

Uploaded by

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

 

​ 💻​ AP COMPUTER SCIENCE A CRAM CHART // ​@thinkfiveable​ /​ /​ h​ ttp://fiveable.me   

Boolean Expressions 
Primitive Types  Using Objects  and if Statements +  Arrays  2D Arrays  Exam Tips 
Unit 1 ↓​   Unit 2 ​↓  Iteration  Unit 6 + 7 ↓
​   Unit 8 ​↓  FRQ/MCQ ↓
​  
Unit 3 + 4 ​↓ 
● System.out.println(String  ● An object is an instance of a class,  ● ==: equality, !=: inequality 
textToPrint): ends with line break  which provides the attributes and  ● </>: less/greater than, <=/>=, 
● System.out.print(String textToPrint):  methods (functions) that the object will  less/greater than or equal to 
no line break  have  ● Comment the code you see! This 
● if (condition) {  way if you ever have to go back 
● System.out.printf: allows for easy  ● methodName(dataTypeOne 
doThis;  you don’t have to fully reread 
formatting and concatenation of  parameterOne, dataTypeTwo 
strings  parameterTwo, ...) is the method  } else if (condition) {  the code each time! 
● String - in “”, text, not primitive  signature, which can be overloaded by  doThis;  ● Don’t Rush! You might miss 
} else {  something that way! 
data type  having different versions of the  ● dataType[] arrayName = new  ● 2D arrays are stored 
● boolean - true/false (no  parameter list  doThis;  ● If there's a large chunk of code 
dataType[numItems]  as arrays of arrays.   you don’t understand, break it 
capitalization), represents truth  ● This is call by value, initializes  }  ● fixed number of items  ● Arr[rows][columns] is  down! 
value  parameters with copy of actual  ● &&: and, ||: or  ● initialized with 0, 0.0, false,  how to access them 
● int - represents an integer value  ● me(parameterListIfNecessary)) make a  ● Don’t be afraid to take some 
● == only refers to the same  or null  ● To traverse, you use  time beforehand to write some 
with 4 bytes of storage between  new object, if parameter list empty, all  object, equals method for 
Integer.MIN_VALUE and  instance variables set to null   ● index from 0 to  nested loops  pseudocode so that you can 
equivalent objects  arrayName.length - 1  ● Everything you do with  code faster! 
Integer.MAX_VALUE  ● Method declaration: scope (static if 
● while  ● enhanced f  a normal array can be  ● Write Method Header: 
● double - represents a decimal up to  necessary) returnType 
about 15 places of accuracy (but  methodName(parameterList)  (conditionThatIsNotMet) {  ● or loop uses header  applied to 2D arrays  Remember scope, (static if 
take care for rounding/overflow  ● Scope is public or private (depends on  ● (dataType name: arrayName)  ● When searching, each  needed), return type, and proper 
thingThatWillRunUntilCondM parameters with input data 
when practically coding)  if you want the method to be  where name will be each  row must be accessed 
● final - cannot change  accessible by other classes)  et;  types 
item in the array  then searched.  ● Identify: Just say what is needed 
● +, -, and * work how you expect  ● Static means that the method is not  ● } 
to be added 
them to  keyed to any instantiation (object) of  ● for (initialization; condition,; 
● / returns a decimal only if one of  the class, while non-static methods are  ● Describe: Add depth to your 
increment) {  identifications, with features, 
the values is a double, else it gives  ● The returnType can be void, which  ●
the whole number answer, while %  means that the method does not return  characteristics, type and scope, 
thingThatWillRunUntilCondM input types, and return types 
gives the remainder  anything, if the method returns 
et; 
● Order of operations: (), %*/, +-  something, you must state its type in 
from left to right, just like PEMDAS  the declaration  ● } 
● = is assignment, == is equality  ● Calling a static method of the same  ● Usually header (int 
● +=, -=, *=, /=, %= perform the  class: methodName(parameters)  i=0;i<timesToRun;i++) 
operation on a number type and 
reassigns the variable value 
● Calling a non static method of the 
same class: 
ArrayList:​ ​Unit 7 ↓
​   Inheritance:​ ​Unit 9​↓  Recursion:​ ​Unit 10​↓ 
(compound assignment)  objectName.methodName(parameters) 
● ++ and —— allow you to add or  ● If the method comes from another  ● A class hierarchy can be created
subtract a variable value by 1 and  class, put ClassName. before the  ● import java.util.ArrayList  by putting classes under a 
stores the value after  method call 
● ArrayList<E> name = new  single superclass and classes 
● (int) (double x) and (double) (int x)  ● String methods do not change the  Writing Classes  ArrayList<E>();  below that being subclasses 
can convert between number types  String object 
● (int) will lose precision while  ● Can concatenate string objects and  Unit 5 ​↓  ● variable number of items  ● subclasses, can draw upon the 
● Recursive methods 
(double) will add precision  primitive objects using += or +, if  ● only contains objects  existing attributes and 
contain at least one 
● Rounding (int)(x+0.5) if pos,  concatenating non-primitive object,  ● int size(): size  behaviors of the superclass 
● scope ClassName {  base case, which halts 
(int)(x-0.5) if neg  implicitly calls toString()  ● boolean add(int index  ● Using “extends” you can create 
private instVarType instVar  the recursion, and at 
● Integer and Double wrapper classes  ● String indices from 0 to length-1  (optional), E obj), adds obj to  this hierarchy 
part of java.lang  ● String(String str): makes a new string  public  least one recursive 
end if no index, else at index  ● Constructers have to be created
● Integer(int value): makes a new  with same characters  ClassName(parameterList) {  call. 
constructor; //can be  value and shifts items at  under each subclass(using 
Integer object from an int value  ● int length(): returns length of string  ● Each call has its own 
overridden, if no parameter list,  index and higher to the right,  “super” you can call the 
● int intValue(): returns the value of  ● String substring(int from, int to  local variables 
set to default  returns true  superclass) 
an Integer as an int  (optional)): returns substring from  ● Binary search can be 
this.instVar = instvar;  ● E get(int index): gets element  ● Any method that is called must 
● Double has corresponding methods  index from to one before index to, if to  more efficient and 
to Integer  not present, then to end of string  }  at position index  be defined within its own class 
public instVarType getVar() {  starts in the middle of 
● Autoboxing: primitive -> wrapper  ● int indexOf(String str): returns index of  ● E set(int index, E obj):  or its superclass. 
return instVar;  a sorted array 
● Unboxing: wrapper -> primitive  first occurrence of str, -1 if not found  replaces and returns former  ● Overidering occurs when a 
}  ● MergeSort is a 
● Math.lang contains all static  ● boolean equals(String other): returns  object at index with obj  subclass method signature is 
public void setVar(instVarType  recursive method and 
methods  true if strings =  ● E remove(int index): removes  the same as the superclass 
● int abs(int x): absolute value (also  ● int compareTo(String other): returns  newInstVar) {  can be used on 
and returns item at index,  ● Using super can be used to call 
double abs(double x))  the “difference” between 2 strings  instVar = newInstVar;  ArrayList 
}  shifts rest of items to left  methods in the superclass 
● double pow(double base, double  ● substring(index,index+1) returns the  ● traverse like arrays  ● Changes in the superclass 
exponent)  character at index  } 
● double random() RNG between 0,    ● don’t add or removed while  reflect onto the subclasses 
inclusive, to 1, exclusive, can be  traversing 
manipulated for rand in range 
 

You might also like