Show Menu
Cheatography

Computer Science ICS 3U Cheat Sheet by

This is a cheat sheet for ICS3U. A computer science course (for g11) in Ontario Canada

Computer Components and Calcul­ations

General process for all languages. Appear­ances may vary

Computer Components in Excution

CPU + RAM = Program. CPU = 1 billion execut­ion­s/sec. Steps called Machine Cycle.
CPU = Ctrl unitinstru­ctions+ Logic(ALU)math
Calcul­ating a single instru­ction:
1. Fetch 2. Decode 3. Execute 4. Store
internal clock: sync computer operations

Machine Cycle

Progra­mming Languages & Developing Process

C.S: Math + Engine­ering + Science
Skill 1: Problem Solving
C.S: what can be computed? Solution -> Algorithm
High level Language User intrep­retable (s.c)
Low level Language Machine interp­ret­ative
Processing High Level Languages:
1. Interp­reting: (read and execute)
2. Compiling (translate comple­tely)
Compiling VS Interp­reting:
Once compiled, execute over and over
Interp­reted program lets the user know bugs
Outcome Applic­ations Software & OS
 

Inform­ation processing cycle

1: input 2: processing 3:output 4.storage

Error Types

Run-Time Errors:
occurs when the program is running (e.g division by 0)
or using a undefined variable
Exception Handling:
detect cases where r.t errors would occur
Specific Exception Handling:
specifying the error type
argument of an exception:
you can capture an except­ion's argument by supplying a variable in the except clause
e.g
    answer = raw_in­put­("choose a, b, or c:")

    if answer != "­a" and answer !="b­" and answer !="c­":

        raise ValueE­rro­r("Q­uestion 1: Invalid Input: please enter a, b, or c")

    else:

        print "­thank you"

except ValueE­rror, errorvar:

    print errorvar

Varibles

anything in quotes are assigned as a string
pure numbers are assigned as integers
decimal is assigned as float
Rules
Case sensitive
_use_u­nde­rsc­ore­_fo­r_s­paces
must begin wiht letter
Using input input(­"­tex­t") lets user input what they want for the variable

Data Types

int = integer
float = decimal
str = strings (words, letters, symbols)
Python Math
/ is for divide
** exponent
* multiply
+ add
- subtract
Use \" for double quotes in print statement
\t for tab
\n for line feed
\\ for backslash
# for comment
 

IPO CHARTS

Gather input data
Process data
Output data

T and F

x = 4
y = 5
z = x > y
print "The result of",­x,">­"­,y,­"­is",z
result : False

Calcul­ating Totals

Functions and Libraries

int(<expr) convert to integer
float(­<ex­pr> convert an expression to float
abs(<e­xpr­>) return absolute value
round(­<ex­pr>) round off expression
pow(x,y) same as x**y
math.s­qrt­(c_­sqrd)
Rounding off
round(­pi,2) = 3.14
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.