ICS3U Grade 11 Computer Science Exam

Grade 11 University Computer Science Exam Study Notes

Object Oriented Programming: programming technique that uses classes and modules that can be used over and over again within a program

Classes: Instruction that creates an object

Object: an instance of a class

Statements: sets of instructions ending with a “;” or sometimes in curly brackets

Controlling Class: the program’s starting point which could link to other classes

Method: a set of statements that perform a single, well defined task

Comments: descriptive lines that are excluded during compilation to better inform other programmers about the details of the code

-/*  */ used to enclose multiline comments in the beginning to describe a program

-// used to enclose single line comments used to debug a comment or comment a block of code

-/**  */ used for documentation describing a class or method.

Output Stream: a class that sends data to the output device to be displayed

Argument: data passed to a method to process

String: set of characters enclosed in quotation marks

Escape Sequences: backslash followed by a symbol to represent a character or command

Format(): system.out method that can format the output with spacing and decimal places

System.out.format(“%-10s %8s $8s”, “Teams”, “Wins”, “Lossesn”);

Bytecode: compile Java source code

Algorithm: a set of steps that outline how to solve a problem

Encapsulation: hiding objects and data in one object from another object

Inheritance: the way where super class methods can be used by lower level classes

Java VM: Java bytecode interpreter

Machine Code: the most basic computer language consisting of 1s and 0s.

Identifier: the name of a variable when it’s declared

Concatenation: to combine strings together

Data Type: declares what kind of data a variable will store

Instantiation: creation of an abstract variable to create an object

<class> <variable name> = new class(<arguements>);

Scanner Input Stream: use to receive input from the computer. Java.util.Scanner; must be imported

Scanner input = new Scanner();  <— used to declare that abstract variable

Truncate: (type casting): to convert one datatype to another datatype

Numberformat(): allows correct formatting for specific types of numbers. Java.text.NumberFormat; must be imported.

NumberFormat money = NumberFormat.getCurrencyInstance();

System.out.println(“Total: “ + money.format(<variable>));

Constants: a variable in a program that never changes throughout the program, distinguished by all caps

-Java keywords are all lower case and have meanings, which cannot be use as variable names

Flow Charts

Rectangle: process

Oval: Start/End

Parallelogram: output/Input

Diamond: Decision structure, Yes will go to the side, no will keep going down

If Statements: tests a condition to see if it’s true then does statements accordingly

If (<condition>) {



Switch Statement: uses the result of an expression to determine which statements to execute

switch(<integer expression>) {

case x:







Random Numbers: the Java.lang.Math; must be imported

(high num – low num + 1)*Math.Random()+ lowNum

Infinite Loops:

Caused by: Syntax error (semi-colon), logic error

Do-While Loop: does some statements first then runs through the iterations

Do {


} while (<conditions>);

Overflow: when there isn’t enough bits in a data type to store a particular number

Counters: each time a statement executes, one is added to this variable

Accumulator: each time a statement is execute, a value is added to the current value of the variable

Sentinel Flags: constant in the loop where once activated, will break the loop and end the cycles

For loops: does iterations knowing how many times the loop will run

For (int i = 1; 1<=10; i++) {



Scope: the place within the code where the variable will be actively usable

Debugger: to select points in the program where execution will be halted

Breakpoints: points at which the program will be suspended for error checking

Variable Trace: using paper and pencil, the value of the variable will be written out after every operation

Additional println(): print out the value of the variables to pin-point what the variable is holding

Commenting Out Code: disabling lines of code to see if the error still occurs

String class: methods that allow manipulation of strings can be found in java.lang.String

Manipulating Strings

<string>.length(): returns the length of the string

<string>.isEmpty(): returns true if length is 0

<string>.substring(int start, int end): returns the string at start position and one character before the end

<string>.substring(int start): returns from start to the end of the string

<string>.toLowerCase() / toUpperCase(): returns the string to all lower or upper case

<string>.trim(): returns a copy of the string without the leading and ending spaces

<string>.replaceFirst(String str, String str2): replaces first instance of str with str2

<string>.replaceAll(String str, String str2): replaces all instances of str with str2

Immutable: a string that cannot be changed

Null: a string variable before it’s assigned a string

Comparing Strings

<string>.equals(String str): returns true if string is equal to str

<string>.equalsIgnoreCase(String str): returns true if string is equal to str ignore cases

<string>.compareTo(String str): returns 0 if str is the same as string, a negative number if str comes alphabetically before string, and a positive number if str comes alphabetically after a string. Case sensitive method

<string>.indexOf(String str): returns integer of str’s location in the string. Returns -1 if it does not exist

<string>.lastIndexOf(String str): returns the location of the last occurrence of str

<string>.startsWith(String str): returns true when the string begins with str

<string>.endsWith(String str): returns true when string ends with str

Top-Down Development: breaking down tasks into smaller sub tasks until it’s complete

Procedural Abstraction: separating steps into methods to accomplish a greater task

Access Level: determines if other classes can call this method

Access Modifier: keywords that define the access level (public, private)

Visibility: the method as seen through the access level

Class Method: can be called in that class, if not, it must be called from other classes and be instantiated (static)

Void: return type that doesn’t return anything after the method is complete

Naming Conventions:

Variables: alexLee

Methods: AlexLee

Class: AlexLee

Local Scope: variables, constants, and objects that are limited to being accessed only through that method

Arguments: variables passed into a method

Pass by value: passing the raw information

Pass by reference: stores that value in a variable and passing reference to that variable, allows for modification later

Parameter: specific pieces of data that a method must require for it to function

Method Overloading: when 1 or more methods have the same name. They can work, but cannot have the same parameters

Documenting Methods: Pre-post to declare what is required to go in, and what’s expected to come out

Event-Driven Application: executes code in response to actions by the user

Event Handler: GUI event triggers the event handler method to carry out the code

Javax.swing: package that’s imported to create the frames and labels

Frames: window with borders, titles, and buttons for minimizing, maximizing, and closing the window

Content Frame: holds and displays all other components

Labels: text lines that can be tied onto the GUI

JPanel: object that is used to hold GUI elements such as buttons, combo boxes etc.

JButton: adds an event listener that listens for when this button is triggered

This: Tells the GUI to use the command that was created w whatever was triggered

Borders: adds invisible elements with padding to space things out

FlowLayout: places them next to each other in rows

BoxLayout: places them one after another in a column

GridLayout: places them in columns and rows in cells

contentPane.setLayout(new GridLayout(<rows>,<columns>,<# pix between columns>,<# pix between rows>)

Alignment: the placement of components within a layout. 0 can be used to automatically fill make as many rows/col

Java.lang.Double/Java.lang.Integer: ability to convert datatypes of user input from one type to another

parseDouble/parseInteger: converts to Doubles or Integers

Integer.toString(int num): converts num to string

JTextField: opens a box for users to input text, then passes data to trigger an event

JComboBox: prompts user to a list of selectable items in a drop down menu. Each item triggers a different event