Monday, 28 November 2016

Arrays

In computer science, an array data structure, or simply an array, is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula.

In computer science, an associative array, map, symbol table, or dictionary is an abstract data type composed of a collection of (key, value) pairs, such that each possible key appears just once in the collection. Operations associated with this data type allow: the addition of a pair to the collection.

Image result for computer science array



A disk array is a hardware element that contains a large group of hard disk drives (HDDs). It may contain several disk drive trays and has an architecture which improves speed and increases data protection. The system is run via a storagecontroller, which coordinates activity within the unit.

An array is an aggregate data structure that is designed to store a group of objects of the same or different types. Arrays can hold primitives as well as references. The array is the most efficient data structure for storing and accessing a sequence of objects.

MIDI

MIDI (Musical Instrument Digital Interface) is a protocol designed for recording and playing back music on digital synthesizers that is supported by many makes of personal computer sound cards. Originally intended to control one keyboard from another, it was quickly adopted for the personal computer.

MIDI (Musical Instrument Digital Interface) is a protocol developed in the 1980's which allows electronic instruments and other digital musical tools to communicate with each other. MIDI itself does not make sound, it is just a series of messages like "note on," "note off," "note/pitch," "pitch-bend," and many more.

Image result for MIDIA MIDI interface is a device that provides MIDI In/Out to and from a computer or MIDI-equipped hardware via standard 5-pin MIDI jacks. There are standalone MIDI interfaces, virtually all of which connect to a computer via USB.

Thursday, 17 November 2016

Programming- Arrays

Arrays

An Array is a data structure that stores many items using a single variable.
An Array is like lots of boxes held together in a named variable. Each box has a position:

Dim Numbers(4) As Integer

the number 4 indicates the size of the Array.

Dim Exammarks(5) As single

Exammarks(0)= console.readline()
Exammarks(1)= console.readline()
...

It is useful to make use of For loops to easily imput the data into the Array.

Representing Sound in a computer

Analogue-  Analog refers to audio recorded using methods that replicate the original sound waves.


 Many times, digital audio companies try to hide this fact with fancy words like “Uncompressed” and “Lossless”. These words are very misleading as all digital audio features some compression and loss of the original signal. However, even the best trained human ear may not be able to tell the difference between a high quality digital signal and an analog audio signal.
An easy way to visualize digital audio is to consider the difference between a regular light bulb and a strobe light (Those lights designed to flash on and off very quickly. Commonly found at concerts or Halloween displays). In this example, an analog audio signal is comparable to a regular light bulb, whereas a digital audio signal would be similar to a strobe light. A strobe light can flash so fast that you hardly notice the moments when it is off.


Analog, Digital Audio Diagram

Digital-

Digital sound is broken down into thousands of samples per second. Each sound sample is stored as binary data.

Digital audio quality

Factors that affect the quality of digital audio include:

Sample rate - The sample rate is how many samples, or measurements, of the sound are taken each second. The more samples that are taken, the more detail about where the waves rise and fall is recorded and the higher the quality of the audio. Also, the shape of the sound wave is captured more accurately.

Each sample represents the amplitude of the digital signal at a specific point in time. The amplitude is stored as either an integer or a floating point number and encoded as a binary number.


Bit depth - the number of bits available for each clip

Bit rate - the number of bits used per second of audio
Sound waves coming out of a CD and VOIP. CD wave is smoother as is better quality


Monday, 14 November 2016

MetaData and File compression

Metadata- This is data that goes alongside a photo and has info on it like where it was taken, what format it is in, and the resolution.

Compression

Compression is the act of reducing the number of bits used to represent data.

PNG is a lossless type
often used when the image might be changed by another person. It retains a high quality while still have a reasonable file size.

Cameras often use their own format to store an image however it is often quite large due to it having a large resolution. 
Jpeg is often used because it is still a fairly high quality for a relatively small file size.

Gif's use 8 bits and are used for small animations.


Lossless compression- compressed image is as accurate as the original.

uses RUN LENGTH ENCODING. This means it shortens the number of bits needed to represent data by grouping it together.
b=blue
b,b,b,b,b,b,b,b can be shortened to 8b.

Lossy- there is more deg in the data.

Thursday, 10 November 2016

Glossary

Binary- a number system that uses base 2 and is the way computers process data.

Denary- The normal numbering system that uses base 10.

Integer- a whole number that can be positive or negative. Including 0.

Real Number- Any positive or negative number without a fractional part.

Ordinal number- any numbers which follow an order e.g 1-2-3-4.

Byte- 8 bits

Nibble- 4 bits

Bits- the smallest representative value for a computer to process. Can be a 1 or 0.

Metadata- data accompanies the image and has information on it.

Data types;
JPEG
PNG
GIF

Compression- the way of reducing the number the number of bits to represent data.

Lossless Compression- A way of compressing the data without losing any quality or accuracy.

Parity system- A way of checking if data is accurate and that it is complete and has not been tampered with.

Pixel- The smallest

Bit mapped graphics- Used pixels to display an image
Vector graphics- uses shapes and mathematical formula to construct an image

Trace table- A table that how numbers change when a program or code is followed.

Floating point number- A number r

2's Complement- a way of representing a negative number in a binary.

Mantissa- This is the main number. standard form has the decimal between a 0 and a 1.

Exponent- Tells us how far the decimal point is moved left or right.

RLE- Run length encoding,
A form of lossless compression in which a sequence is shortened. b,b,b,b=4b

Precision- how accurate something is.

Hexadecimal Representation- a way of representing numbers using 0-9 than letters for the numbers 10+. E.g 11=b

Bubble sort- a way of sorting numbers by comparing and swapping. each pass brings the largest number to the top each time until they are in order.


Hardware- The real physical/electrical components of the computer.

Software- Software is the

Application software-

Utility program- These help the computer by keeping the computer in an efficient state. They are in charge of the 'house keeping' such as deleting old files.

Library programs-

Translators-

Compiler-

Assembler-

Interpreter-

Operation system- This manages the system hardware and creates the 'virtual machine' for the user.

Virtual machine-

Resource management-

Processor-

Scheduling-

Memory management-

File management-

Peripheral-

Pseudo Code


Pseudocode


Most programs are developed using programming languages. These languages have specific syntax that must be used so that the program will run properly. Pseudocode is not a programming language, it is a simple way of describing a set of instructions that does not have to use specific syntax.


Common pseudocode notation

There is no strict set of standard notations for pseudocode, but some of the most widely recognised are:

INPUT – indicates a user will be inputting something

OUTPUT – indicates that an output will appear on the screen
WHILE – a loop (iteration that has a condition at the beginning)
FOR – a counting loop (iteration)
REPEAT – UNTIL – a loop (iteration) that has a condition at the end
IF – THEN – ELSE – a decision (selection) in which a choice is made
any instructions that occur inside a selection or iteration are usually indented

Example

 Set total to zero
Set grade counter to one
While grade counter is less than or equal to ten

    Input the next grade

    Add the grade into the total
Set the class average to the total divided by ten
Print the class average.

Trace Tables


Trace table


Trace tables are used to allow programmers to trace the value of variables as each line of code is executed. The values of the variables are displayed in a table and assist the programmer in identifying any potential errors.

Image result for Trace tablesImage result for Trace tables

Wednesday, 9 November 2016

2' Complement Binary


Representing negative integers


Negative numbers can also be represented in binary. The name of the system most commonly used to represent and handle negative numbers is '2s Complement'. There are two common methods used to figure out how a negative number is stored using 2s complement.
2's Complement

The first technique involves three steps:

Find the positive value

Switch 1s and 0s
Add 1



To represent -116, the following steps would be followed:

1. Find positive 116
128  64   32   16   8   4   2   1
   0    1     1     1    0   1   0   0




2. Switch 1s and 0s
128   64   32   16   8   4   2   1
 0       1     1     1    0   1   0   0
 1       0     0     0    1   0   1   1




3. Add 1

To add one, it is necessary to start at the right hand side of the number. If the number on the right is a 1, move to the next number. Keep moving from right to left until you find a 0.

In this example there is a 0 underneath the number 4. This 0 would become a 1. The 1s that are to the right of the 0 that was found first need to change from being a 1 to a 0:

128   64   32   16   8   4   2   1
  1      0     0     0    1   0   1   1
  1      0     0     0    1   1   0   0




10001100 = -116

Saturday, 5 November 2016

Graphics Exam Questions

1. (a) Figure 1 shows some of the drawing objects available with a vector graphics drawing software package.

Figure 1

(i) Name two properties which are common to Object 1 and Object 2.                    
1 Have the same line colour
2 Have the same fill colour   (2)

 (ii) When a designer creates a drawing, the size of various objects is often increased/decreased/moved as the drawing is being developed. Explain why no distortion occurs in vector graphics when the size of various objects is changed.

This is because vector graphics are stored using mathematical data and not lots of small dots, or pixels, so vector graphics can be scaled and moved without distortion.(2)

(iii) With vector graphics software, each new drawing is created as a set of vectored objects. Each drawing is created and saved in a file format specific to that brand of software. The software has an ‘export’ facility so that a bitmapped version of any drawing can be produced which can then be used as appropriate e.g. included in a word processed document. Why is this arrangement preferable to bitmapped-based software which only creates and saves a bitmapped file?
It allows you to do more with the graphics so it is more versatile. (1)

(b) Bitmapped software saves the picture as pixels, with a range of different possible colour resolutions as shown in Figure 2.    

  Figure 2


(i) If the graphic is saved as shown as a ‘256 color bitmap’, how many bytes will be used to store each pixel? 1 byte will be used (1)

 (ii) A picture is downloaded from a camera-phone and saved as a ‘256 color bitmap’. The picture has a width of 1280 pixels and height 768 pixels. What is the file size in Kilobytes? 983.04 (1)

 (iii) The same picture as in part (ii) is later loaded into bitmapped software on a PC and saved to a new file as a ‘16 color bitmap’. What is the size of this file in Kilobytes? 491.52  (1) (Total 8 marks)

2. (a) Figure 1 shows a number of drawing objects from the toolbox of a vector graphics drawing program. Figure 1 Object 1 Object 2 Basic Flowchart Shapes Process Data Internal storage Line-curve connector Decision Predefined process Sequential data Line connector Document Stored data Direct data Wavy connector

(i) For object 1 and object 2, state two properties common to both types of object, which would be recorded when used in a drawing.
1 Same line colour
2 Same fill colour    (2)

(ii) State one other property for object 1 which would be recorded when used in a drawing. Dimensions (1)

(iii) Graphics can be created with either vector graphics software or bit-mapped software. If the graphic is enlarged it may become distorted if created with bit-mapped software but show no distortion if created with vector graphics software. Explain this statement.
Bit mapped graphics software uses pixels instead of the mathematical ratios that that the vector graphics software does so when it is enlarged it will enlarge the pixels because that is the base type it uses. (2)

 (b) Figure 2 below shows the file type options available when saving a file with bit-mapped graphics software. Figure 2 File name: Save as type: Save Monochrome Bitmap (*.bmp;*.dib) 256 Color Bitmap (*.bmp;*.dib) 24-bit Bitmap (*.bmp;*.dib) JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF) GIF (*.GIF) TIFF (*.TIF;*.TIFF) PNG (*.PNG) 16 Color Bitmap (*.bmp;*.dib) Cancel This Picture 16 Color Bitmap (*.bmp;*.dib)

 (i) How many bits are used to store each pixel if the resolution selected is as shown (‘16 color bitmap’)?’ 4 (1)

 (ii) ‘256 color’ images are stored with 1 byte per pixel. Explain this statement.
Each pixel takes 8 bits to reperesent all 256 colours and 8 bits is a byte. (1)

(iii) Read again the statement in part (ii). A picture with size 1024 by 768 pixels is saved as a ‘256 color’ image. Calculate the picture size in Kilobytes.  
786.432Kb (1)

 (iv) Black and white (monochrome) bit-mapped files store each pixel with a single bit. A black and white image of size 512 by 256 pixels has a calculated file size of 16 Kilobytes. The actual file size is larger than this calculated size as the bitmap file contains other data. What is this other data?
The file name and format type (1) (Total 9 marks)

 3. Bit patterns can be interpreted in a number of different ways. A computer word contains the bit pattern 0011 0100. (a) What is its decimal value if it represents: a pure binary integer;
52. (1)

 (b) (i) The ASCII value for the character ‘0’ (zero) is 48. What character is represented by 0011 0100?
the number 4 (1)

 (ii) Name one other standard coding system for coding information expressed in character or text-based form.
Unicode (1)

(c) One method of representing graphics in a computer system is as bit mapped graphics.
 The black line on the left might be represented as (i) Describe how a coloured line might be represented. ............................................................................................................................ ............................................................................................................................ ............................................................................................................................ (2)

 (ii) Describe how a line would be stored using vector graphics. ............................................................................................................................(3) (Total 8 marks)

Progress Assessment one Corrections

Q4) D) There can be a loss of precision when a denary number is stored using this floating point system. The closest possible representation of 6.9 is

0.1101110    0011

By converting this bit pattern back into denary we can see that the actual number is 6.875, not 6.9.
Calculate the absolute error that has occurred.
6.9-6.875=0.025

ii) Calculate the relative error that has occurred.
0.025/6.9=0.0036

Q5) For each of the following, name a suitable data type and give a reason for your choice.
a) The number of books a student has out on loan from the college libary.
Integer - Need to store whole numbers and add or subtract them as he takes is or brings back books.

b)A students average mark to two decimal places.
Single - can handle calculations and numbers with decimals in.

c) Telephone number such as 01223123456.
String - needs to be string and not single or integer so beginning 0 does not disappear.

Q8) This question is based around the pre-released code.

a)Give a line of code where a relational operator is used.
If num < num2 then

d) Give a line of code in which an assignment statement is used.
num1=console.readine

Vector Grapics


What are vector graphics?


Vector graphics are created in graphics packages and consist of shapes called objects.

It is possible to edit each object separately, for example, change the shape, colour, size and position.

Even if an object in a vector graphic is quite large, it doesn't need a lot of computer memory. Therefore the file size of a vector graphic is often very small.

Vector graphics are scalable - ie. when you resize them, they do not lose quality.


Because vector-based images are not made up of a specific number of dots, they can be scaled to a larger size and not lose any image quality. If you blow up a Bitmap graphic, it will look blocky, or "pixelated." When you blow up a vector graphic, the edges of each object within the graphic stay smooth and clean. This makes vector graphics ideal for logos, which can be small enough to appear on a business card, but can also be scaled to fill a billboard. Common types of vector graphics include Adobe Illustrator, Macromedia Freehand, and EPS files. Many Flash animations also use vector graphics, since they scale better and typically take up less space than bitmap images.

What is a vector in animation?

Vector animation is a term used to refer to animation in which the art or motion is controlled by vectors rather than pixels. Vector animation often allows cleaner, smoother animation because images are displayed and resized using mathematical values instead of stored pixel values.

Tuesday, 1 November 2016

VB Loops

Summary

Use a For ... Next loop if we know before entering the loop how many times we want to repeat the group of statements.

Use Do While ... Loop if the group of statements is only to be executed under certain conditions.

Use a Do ... Loop Until when we want to execute a group of statements at least once.

An infinite loop is one that never stops running.

Bits and Byte Prefixes

Nibble = 4 bits
x2 Nibbles = 1 byte = 8 bits
Kb= Kilobit = 1000 bits = 125 bytes
Mb = Megabit = 1,000,000 bits

KB = Kilobyte = 10^3 = 1000 bytes
MB = Megabyte = 10^6 = 1,000,000 bytes
GB = Gigabyte = 10^9 = 1000 MB
TB= Terabyte = 10^12 = 1000 GB

Ki (KiB) = Kibibyte = 2^10 = 1024 bytes
Mi (MiB) = Mebibyte = 2^20 = 1,048,576
Gi (GiB) = Gibibyte = 2^30 = 1024 Mi
Ti (TiB) = Tebibyte = 2^40 = 1024 Gi