p2 Notes 3
p2 Notes 3
Number that contains a decimal point ● ASCII values can take many forms:
Referred to as singles and doubles depending upon numbers, letters (capitals and lower case
number of bytes used to store are separate), punctuation, nonprinting
Character: A character is any letter, number, commands (enter, escape, F1)
punctuation or space Takes up a single unit of 2.3 Unicode
storage (usually a byte). ASCII allows few number of characters; good for
English
String: Unicode allows others too: Chinese, Greek, Arabic
● Combination of alphanumeric characters etc.
enclosed in “ ” Different types of Unicode:
● Each character stored in one byte using o UTF-8: compatible with ASCII, variable-width
ASCII code encoding expand to 16, 24, 32, 40, 42
● Each character stored in two bytes using o UTF-16: 16-bit, variable-width encoding can
Unicode expand to 32 bits
● Max length of a string limited by available o UTF-32: 32 bit, fixed-width encoding, each
memory. character exactly 32 bits
● Incorrect to store dates or numbers as
strings
● Phone no. must be stored as string else
initial 0 lost
Boolean:
Can store one of only two values; “True” or “False”
Stored in 1 byte: True = 11111111, False =
00000000
Date:
Dates are stored as a ‘serial’ number
Equates to the number of seconds since January Pseudocode:
1st, o 1-D Array: A[1:n]
1904 (thus they also contain the time) Initialize an array
Usually take 8 bytes of storage For Count <- 1 TO N
Displayed as dd/mm/yyyy or mm/dd/yyyy Array[count] <- 0
Array: NEXT count
Data structure consisting of a collection of Input in Array
elements For Count <- 1 TO N
Identified by at least one array index (or key) OUTPUT “Enter element” & count
File: INPUT Array[count]
Object that stores data, information, settings or NEXT count
commands Output from an Array
Can be opened, saved, deleted & moved For Count <- 1 TO N
Transferable across network connections OUTPUT Array[count]
NEXT count
2.2 ASCII Code
● Uses 1 byte to store a character
● 7 bits available to store data and 8th bit is a
check digit
● 2^7 = 128, therefore 128 different values
PAPER 2 : SUMMARY AND NOTES Minahil Hassan Tariq
Search in 2D array
3 PROGRAMMING
Programming is a transferable skill
Transferable skill: skills developed in one situation
which can be transferred to another situation.
3.1 Variables
Declaring a variable:
o Pseudocode: DECLARE <identifier> : <data type
Assigning variables:
<identifier> ← <value> or <expression>
PAPER 2 : SUMMARY AND NOTES Minahil Hassan Tariq
PROCEDURE <identifier>
<statement(s)>
ENDPROCEDURE
Extracting a character:
PAPER 2 : SUMMARY AND NOTES Minahil Hassan Tariq
Examples:
o Division by 0
o Infinite loop – will not produce error message,
program will just not stop until forced to
Logic errors:
Integration testing:
4.6 Adaptive Maintenance Taking modules that have been tested on
Making amendments to: individually and testing on them combined together
o Parameters: due to changes in specification This method allows all the code snippets to
o Logic: to enhance functionality or more faster or integrate with each other, making the program
both work.
o Design: to make it more user friendly
Alpha testing:
4.7 Testing Strategies This is the testing done on software ‘in-house’,
meaning it is done by the developers
Black box testing: Basically another term for ‘first round of testing’
Use test data for which results already calculated &
compare result from program with expected results Beta testing:
Testing only considers input and output and the This is the testing done on the software by beta
code is viewed as being in a ‘black box’ users, who use the program and report any
problems back to the developer.Basically another
term for ‘second round of testing’
White box testing:
● Examine each line of code for correct logic Acceptance testing:
and accuracy. A test carried out by the intended users of the
● May record value of variables after each line system: the people who requested the software.
of code The purpose is to check that the software performs
● Every possible condition must be tested exactly as required. The acceptance criteria should
completely be satisfied for the program to be
Stub testing: released.
Stubs are computer programs that act as
temporary replacement for a called module and Features that support modular programming:
give the same output as the actual product or ⦁ The use of functions and procedures
software. Important when code is not completed ⦁ The use of local and global variables
however must be tested so modules are replaced ⦁ The use of parameters and arguments
by stubs.
Advantages of using subroutines:
Dry run testing: 1) Subroutines step wise refinement of a program.
A process where code is manually traced, without 2) Subroutines are used when tried and tested
any software used library routines have to be re-used.
PAPER 2 : SUMMARY AND NOTES Minahil Hassan Tariq