Computing Revision

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

The For...EndFor loop:

'draw a square For i = 1 To 4 Turtle.Move(100) Turtle.TurnRight() EndFor

Maths functions:

-Number = Math.Round (5.87) : returns the value 6 -X = Math.Remainder (37,5) :divides the first number by the second and returns the remainder -Math.GetRandomNumber(20) :returns a random number between 1 and 20 -Temperature = Math.GetRandomNumber(21)+11 : generates a random temperature between 12oC and 32oC and assigns it to a variable called Temperature -Math.Min (107, 5) : generate the number 5 -Math.Max(5,107) : generate the number 107

Binary Addition:

0+0=0 0+1=1 1+1=10 1+1+1=11

Comparison operators:

= Equal > Greater than < Less than >= Greater than or equal <= Less than or equal <> Not equal

What is a dictionary:

A dictionary is an associative array that does not support the sequence operation of the sequence data types like strings, tuples and lists. Where we use numbers to "index" into a list (meaning we can use numbers to find out what is in lists e.g - Days [0]), a dictionary uses keys, not position. Syntax: dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}; print ("dict['Name']: ", dict['Name']) print (dict['Age']) This code will produce the following result: dict['Name']: Zara 7

What is a list?

A list is a collection of data items which can be of the same or different data types. We can change individual items in the list. Days [0] >>>Sunday A negative index will return the value at its position from the end of the list Days [-2] >>>Friday

What is the AND gate?

A logic gate that carries out the AND operation is called the AND Gate. When drawing an AND gate, use the following symbol

What is the NOT gate?

A logic gate that carries out the NOT operation is called the NOT Gate or 'Inverter'

What is the OR gate?

A logic gate that carries out the OR operation is called the OR Gate

Arithmetic operators:

Addition + Subtraction - Multiplication * Division /

What are arrays?

An array is a special data structure which contains several items of similar data. Eg: shoes = ["Green", "Pink", "Yellow"] 0 is the 1st term

Selecting individual elements in a dictionary:

By using a key, we can select an item from the dictionary dict['Name'] >>>Zara

What is a function?

Functions are blocks of code that perform specific tasks e.g. print () They can take input and return output We can create our own functions def sum(a, b): return a + b sum(12 , 10) return 22

To change the colour of the pen:

GraphicsWindow.PenColor= "Red"

To randomise the colour of the pen:

GraphicsWindow.PenColor= GraphicsWindow.GetRandomColor()

To change the pen width:

GraphicsWindow.Penwidth=5

What is a network card?

I am a computer hardware component that connects a computer to a computer network. I implement the electronic circuitry required to communicate using a specific physical layer and data link layer standard such as Ethernet cables. I can be wireless to connect to a network or the internet. I may be built into the motherboard or be inserted using a slot onto the motherboard. My speeds are measured in megabits per second or in gigabits per second.

What is RAM?

I am a type of integrated circuit. I am essential for the computer to operate and as I store the commands that are to be collected during the fetch-decode-execute cycle of one of my friends. I am volatile and do not store anything in any particular order. My size is measured in bytes and come in megabytes and gigabytes. I slot into the motherboard of a computer. The more of me that a computer has the faster it can operate as the more commands can be stored at any one time.High quality graphics, such as those in computer games, along with lots of programmes running at the same time uses a huge amount of me.

What is a monitor?

I am an output device. I may also be known as a VDU. I can be TFT-LCD or LED. Older versions of me may even be CRT. I can be HDMI or VGA. I can now even be a television set. I will show you the outcome of the executed cycles of the processor. I will do this using thousands of tiny coloured dots called pixels. The quality of me depends upon the number of pixels that I have and the higher this is, the better quality output. This is called resolution.

What is a keyboard?

I am one of the most commonly used devices of a computer system. I am made up of buttons. These buttons are arranged into sections such as alphabet, function, numeric and arrow keys. I am mostly known as a 'QWERTY' but there are other formats of me available such as a AZERTY. There are also ergonomic versions that are shaped to stop me causing repetitive strain injury to those that use me a lot. I can have a USB or a pin connector. Recent developments are touchscreen and projected.

What is a Graphics Card?

I am the part of the computer that is responsible for the display on the monitor. I can be integrated into the computer or be dedicated and added to the computer to improve the performance. If I am dedicated I will have my own RAM and even my own processor. Without me you wouldn't see the words that you type on the screen or the mouse arrow you use to select the folder icons and you wouldn't be able to play games or create or edit graphics. The type and quality of me will have a massive effect upon the performance of the computer system for games and computer graphics. I generate the images to display on the screen from the computer code. I communicate with the monitor and I have a monitor socket, if you look at the back of the school computers and see where the monitor is connected - it is to me inside the computer.

What is a motherboard?

I hold the main circuitry of the computer. Many other components, such as the processor, the graphics card and the memory are connected to me. I provide the electrical connections to the other components (parts) of the computer system.

What is the CPU?

I manage all of the commands given to the computer by performing a constant command-decode-execute cycle. I can have a number of cores. If I have a high clock speed I can complete my cycles quickly, if I am slow the computer will run slowly, like taking a long time to open up software programmes. My speed is measured in hertz - gigahertz (GHz) or in older computers megahertz (MHz). The higher my hertz are in gigahertz, the faster my clock speed and the faster computer will be and the better it is for creating or editing computer graphics

What is a mouse?

I was first named in 1965. I am a pointing device that functions by detecting two-dimensional motion relative to my supporting surface. Physically, I consist of an object held under one of the user's hands, with one or more buttons. I sometimes feature other elements, such as "wheels", which allow the user to perform various system-dependent operations, or extra buttons or features that can add more control or dimensional input. My motion typically translates into the motion of a pointer on a display, which allows for fine control of a graphical user interface. The speed of my motion and movement direction is measured in Mickeys per second.

What is a hard disk drive?

I was invented by IBM in 1956. I use rapidly rotating discs coated with magnetic material. The faster my discs can rotate the quicker I will operate - this is my spin speed, how many times I go around per minute - this is known as revolutions per minute (rpm). The faster I am the faster your computer can save and open files. I am the filing cabinet of the computer where all of your files are stored. I am not volatile. My size is measured in gigabytes (GB) or terabytes (TB) - terabyte being the biggest available at the moment. My physical size is either 3.5 inches or 2.5 inches - depending on what I am fitted in to.

If...Then...Else:

If (Clock.Hour < 18) Then TextWindow.WriteLine("Good day") Else TextWindow.WriteLine("Good evening") Endif

Conditional Statements:

If (Clock.Hour < 18) Then TextWindow.WriteLine("Good day") EndIf If (Clock.hour>=18) Then TextWindow.WriteLine("Good evening") Endif

Key words fromComputing fundamentals:

Input device =A device that enters data into a computer e.g. mouse, keyboard, scanner Output device =A device that outputs processed data e.g. a monitor, projector, printer CPU =Central Processing Unit RAM =Random Access Memory - volatile memory ROM =Read Only Memory - non volatile memory Hard disk drive =Uses rapidly rotating discs coated with magnetic material to save data. It is not volatile Motherboard =Main circuit board for the computer, other components attach to the motherboard e.g. RAM, CPU Network card =Enables a computer to connect to a network e.g. the internet Graphics card =Produces quality graphics and images on screen Monitor =Otherwise known as a visual display unit. It is an output device. Mouse =A pointing device that is an input device Keyboard =An input device that consists of buttons. The most common type is a QWERTY keyboard. Peripheral device =A device that is external to the main computer and connects into it e.g. webcam, scanner

Reading text and numbers:

Name = TextWindow.Read() Age=TextWindow.ReadNumber() • When data is input to the computer, it has to be stored somewhere • The programmer chooses a name for the location where the computer stores the data • This is called a variable, because its contents will vary • You should choose a name that gives you a clue what is stored there

How to add a Title to the text window:

TextWindow.Title="Using the Text Window"

Code to generate grades:

TextWindow.Write("Enter a mark out of 100: ") Mark=TextWindow.ReadNumber() If (Mark >= 80) Then Grade="Distinction" Elseif (Mark>=60) Then Grade="Merit" Elseif(Mark >=40) Then Grade="Pass" Else Grade="Fail" EndIf TextWindow.WriteLine("") TextWindow.WriteLine("Mark = " + Mark + " Grade = " + Grade) TextWindow.WriteLine("")

How to write Hello, Laura and stay on the same line:

TextWindow.Write("Hello, " + "Laura")

How to go to the next line without writing anything:

TextWindow.WriteLine("")

Simple quiz program:

TextWindow.WriteLine("Question 1. Which county is Bournemouth in?") TextWindow.WriteLine(" (a) Hampshire") TextWindow.WriteLine(" (b) Dorset") TextWindow.WriteLine(" (c) Sussex") TextWindow.Write("Answer a, b or c ") Answer = TextWindow.Read() If (Answer = "b") Then TextWindow.WriteLine ("Correct") Else TextWindow.WriteLine ("Wrong! It's in Dorset") TextWindow.WriteLine ("It used to be in Hampshire") EndIf

How to write Hello and then go to a new line:

TextWindow.Writeline("Hello")

How do you change the size of the graphics window?

To make the window 400 pixels wide and 400 pixels high: GraphicsWindow.Width=400 GraphicsWindow.Height=400

Key words from python:

Variable =A container which holds data Casting =Changing the data type of an item Operator =Changing element in between 2 pieces of data e.g.+ or* Integer =A whole number String =Text, characters etc. Float =Floating point number - Can have a decimal place Boolean =e.g. True/False, Yes/No, On/Off Syntax =The structure and rules something must follow Parameter =A variable representing the value that must be used to run a function Argument =The actual value passed to the function when run Array =A collection of data of the same datatype List = A collection of data of similar but not necessarily the same datatype Dictionary =A collection of associated data that doesn't follow a sequence but is referred to via a key e.g. Marks for each student

Key words from small basic:

Variable =A named place in memory that stores one piece of data Small Basic Environment=The area in which code can be developed in Small Basic Execute=To run a piece of code Co-ordinates X and y values used to plot a location. intellisence = A feature within Small Basic to allow code to be written quickly and accurately Graphics Window =The window that appears in Small Basic to show the output of graphical commands Turtle =An icon used to represent the current location of the "Pen" drawing on the graphic window Text Window =The window that appears within Small Basic which shows text commands being executed. Modelling =A digital model of a real-life thing or scenario e.g. A model of a new kitchen or a business model Arithmetic Operators=Symbols used to do mathematical calculations in Small Basic Comparison Operators =Symbols used to compare values in Small Basic

How to print item in array?

for pair in shoe: print (pair)

What is Intellisence ?

helps us to write code by suggesting possible options

How to check if item is in an array?

if "Pink" in shoe: print ("Stylish!")

How to append array?

shoe.append('Black') print (shoe[3])

What is memory?

• Memory is a device where data and instructions can be stored and retrieved. • Usually, when we talk about memory we are talking about storage in the computer's main memory, this is often the computer's RAM. • RAM is not the only kind of memory though. • There are lots of other kinds of memory.

Uses of computer modelling:

• Model the effects of increasing life expectancy on the national economy • Model the effects of global warming • Model the effects on traffic congestion of building a new motorway • Model a proposed business start up to help determine whether it will be successful

What is RAM? (in comparison to ROM)

• RAM stands for Random Access Memory. • You can read data that is stored in RAM. • You can change (write) data stored in RAM - the contents of RAM can be changed. • You change any part of RAM in any order (randomly) without needing to start at the first memory location. • Not being able to get more memory can make a program crash. • Sometimes a program will slow down if it needs more memory and there is none available. • This is why adding more RAM to your PC can make it run programs faster. Programs are not kept waiting for memory to become available

What is ROM?

• ROM stands for Read Only Memory. • You can read the contents of ROM, but you cannot change them (write to them). • Whatever is stored in ROM cannot be changed. • ROM is non-volatile. Whatever is stored in ROM is not lost when the computer or device is turned off. • Some important programs are sometimes stored in ROM (read only memory) so that they cannot accidentally be erased or changed. • Programs stored in ROM are still kept stored even when the computer is switched off. • After switching on a computer, simple instructions telling it how to load the operating system are read in from a special ROM chip called the BIOS.

Rules for naming Variables:

• The name must start with a letter • It can be any combination of letters, digits and underscores • It should not be a 'reserved' word that is part of Small Basic like For, Read, Writeline

Computer modelling:

• We can use a computer to simulate a real or imaginary scenario • We can see how things work out if different things happen, or if we do things differently • A model can help you to make decisions • Different software is used for different kinds of model

What are logic gates?

Electronic engineers have designed hardware that can carry out the fundamental logic operations (AND, OR, NOT). This hardware is called a 'logic gate'. A logic gate is actually made up of a number of transistor switches arranged in a certain way. But for this syllabus you do not need to concern yourself about the details. It is enough to know that a logic gate carries out a logic operation.


Ensembles d'études connexes

Module 45: Biomedical Therapies and Preventing Psychological Disorders

View Set

Lesson 8.2 - How to Use Context to Determine the Meaning of Words

View Set

Music Appreciation Test 2 Study Guide

View Set

CH 3 Community-Based Nursing Practice: Public Health Nursing

View Set