1
0
mirror of https://gitlab.com/magicalsoup/Highschool.git synced 2025-01-23 16:11:46 -05:00
highschool/Grade 9/Computer Science.md
2019-01-16 12:39:53 -05:00

2.0 KiB

Computer Science Review Sheet

Exam Layout

Part Description Marks
A True / False 10
B Multiple Choice
- All java code learnt, selection, loops, methods, Arrays, methods, strings
38
C Short & Long Answers
- Compare and contrast short code, methods, problem solving
20
Total 68

Intro To Programming

Comments: are used to explain and clarify program ocde for human reader

Operator Uses Description
+ a + b Addition
- a- b Subtraction
* a * b Multiplication
/ a / b Division
% a % b Mod, the Remainder

BEDMAS rules still apply

Strings

String: means a group of many characters
String Concatenation: means that two strings are combined into one using the “r” sign

Varaibles

Holder for data
We can use words instead of just a single letter - can store more than just numbers
a place in memory (RAM: random access memory) where it can be stored or referred to
- Name, type, value

To declare a variable 1. Name 2. Data Type

A variable is the name of a reserved memory location
A varaible name is called an identifier
Reserved words cannot be used as an identifier

Java Primitives

Variables can be created for any of the data types listed
The chart shows examples of how to create a new variable for each primitive

Type Range Size Variable Declaration
byte -128 to 127 8 bits bits_8 byte bits_8;
short -32768 to 32767 16 bits TALL short TALL;
int -2 billion to 2 billion 32-bits sum int sum;
long -9 quintillion to 9 quintillion(huge) 64 bits mile long mile;
float -3.4e+/-38 to 3.4e+/-38 32 bits pi float pi;
double -1.7e+/-308 to 1.7+/-308 64 bits stuff double stuff;
char Single (unicode) characters 16 bits letter char letter;