Unit 2 - J276 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Computational thinking is all about the ______ taken to find the best ________ to a complex _________.

A

stages, solution, problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Abstraction - Picking out the _________ bits of information from the ________ whilst _______ the specific ______ that don’t matter

A

important, problem, ignoring, details

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Decomposition - _________ a complex ________ into smaller ________ and ________ each one __________.

A

Splitting/Breaking, problem, problems, solving, individually

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Algorithmic thinking - using a series of ______ steps to find ________ to a ________. - Algorithms can be ______ and ______ to solve ______ problems in the _______.

A

logical, solutions, problem, reused, adapted, similar, future

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The 3 types of Computational thinking are

  • __________
  • D_________
  • ___________ thinking
A

Abstraction
Decomposition
Algorithmic Thinking

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Searches allow a set of ____ to be _______ in order for a specific ____ to be ______.

A

data, examined, item, found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The 2 types of searching ________ are

  • ________ search
  • ________ search
A

algorithms

Binary Search
Linear Search

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Binary search looks for items in an ______ list.

1) Set _______ to the ______ position in the list
2) If the ______ value matches, the search ___
3) Otherwise, if the desired _____ is less than the _______, then the _____-____ of the list is ______ and the search keeps to the _____-___ of the list
4) Or, if the desired _____ is more than the _______, then the _____-____ of the list is ______ and the search keeps to the _____-___ of the list
5) Steps _ to _ are _______ until a ______ is found or there are no more items to be ______.

A

ordered,

counter, midpoint

desired, ends

value, midpoint, upper-half, ignored, lower-half

value, midpoint, lower-half, ignored, upper-half

2-4, repeated, match, found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A binary search is much more _______ algorithm than a _______ search - In an ordered list of every number from 0-100, a linear search would take __ steps to find the number 99, whilst a binary search will find it in just 7 steps

Binary search only works for _______ lists tho ;(

A

efficient, linear, 99 steps

ordered

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A linear search can be used on an ________ list.

Starting at the ________ of the data set, ____ item of data is _______ until a ______ is found or there are no more ______ to find.

A

unordered

beginning, each, examined, match, items

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A way to describe a linear search would be

1) Find out the _______ of the data ___
2) Set _______ to 0
3) ________ value held in the list at the _______ positon
4) ______ to see if the value at that ________ matches the ______ value
5) If it _______, the value is found and the search is ____.
6) If not, ________ the counter by __ and go back to step 3 until there are no more ____ to ______

A

length, set

counter

Examine, counter

Check, position, desired

matches, ended

increase, 1, items, find

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Linear searches are ______ to make due to its ________ and they work on both _______ and ________ lists.

Although, they can be quite _______. - Suppose a list contained 100 items, and the 99th item had to be found, 99 steps would have to be taken to find that single item.

A

easy, simplicity, ordered, unordered

inefficient

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A ______ search in psuedocode might look like this

find = 2
found = Falselength = list.length
counter = 0
while found == False and counter < length
     if list[counter] == find then
          found = True
          print ('Found at position', counter)
     else:
          counter = counter + 1
     endif
endwhile
if found == False then
     print('Item not found')
endif
A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A _______ search in psuedocode might look like this

find = 11
found = False
length = list.length
lowerBound = 0
upperBound = length
while found == False
     midpoint = int((upperBound + lowerBound))/2
     if list[midPoint] == find then
          print('Found at' , midPoint)
          found = True
     else
          if list[midPoint]> item then
               upperBound = midpoint-1
          else
               lowerBound = midpoint+1
          endif
    endif
endwhile
if found == False then
     print('Not found')
endif
A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The 3 methods of sorting are

  • B______ Sort
  • M_____ Sort
  • I________ Sort
A

Bubble Sort
Merge Sort
Insertion Sort

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A bubble sort is the ______ of sorting algorithms. It works like this.

1) Start at the _______ of the list
2) Compare the ____ value in the list with the ____ one up. If the _____ value is bigger, _____ the positions of the ____ values
3) Move on to the ______ value in the list. Again, _______ this value with the next and swap if the value is ______.
4) Keep going until there are no more _____ to ________
5) Go back to the _____ of the list

A

simpliest

beginning

first, next, first, swap, two

second, compare, bigger

items, compare

start

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Each run through the list, from _____ to ______ is known as a _____.

A bubble sort continues until a ____ is made where no ______ have been _______ - This is when the list is completely ______.

A

start, finish, pass

pass, values, swapped

sorted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The advantages of a bubble sort are

  • Easy to ________ due to its simplicity
  • Efficient if the list is in ______
  • Not much _______ is used as all the sorting is done on the ________ list
A

implement

order

memory, original list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The disadvantages of bubble sorts are

  • _________ for large list
  • An extra ____ occurs even if the list is in ______.
A

Inefficient

pass, order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

A psudeocode algorithm for a bubble sort might be

counter = 0
swapped = True
swaps = 0
length = list.length
while swapped == True                   
     while counter < length-1
          if list[counter] > list[counter+1] then
                temp = list[counter]
                list[counter] = list[counter+1]
                list[counter+1] = temp
                swaps = swaps + 1
          endif
          counter = counter + 1
    endwhile
    if swaps == 0 then
         swapped = False
    else:
         swaps = 0
         counter = 0
    endif
endwhile
A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

A merge sort ______ a list apart then ______ it back together in its ______ order. - It is an example of a ______ and _______ algorithm.

A

splits, merges, sorted, divide and conquer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

A merge sort works like this.

1) Split the list in _____ to form ___-____ ( the second sublist should start with the ______ term for odd no. of items)
2) Keep ______ step 1 until each ___-_____ only contains ____ item
3) Merge pairs of ____-____ so that each ___-____ has _____ as many items. Each time you merge ____-____, ____ the items in the correct ______
4) ______ step 3 until you have _____ all ___-____ together

A

half, sub-lists, middle

repeating, sub-list, one

sub-lists, sub-list, twice, sub-lists, sort, order

Repeat, merged, sub-lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The advantages of merge sorting

  • More _______ and _______ than ______ and insertion for ______ lists
  • Very consistent _______ ____ regardless of how the items in a list are ______
A

efficient, quicker, bubble, large

running time, ordered

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The disadvantages of merge sorting

  • Slower than other algorithms for _____ lists
  • Still performs the _____ and _____ process even if the list is already _____.
  • Uses more _______ than other algorithms as it creates ________ lists
A

short

split/divide, merge/conquer, sorted

memory, separate additional

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

An Insertion Sort just takes each item __ ____ and put them in the _____ place using the _____ item in the list as a starting point.

A

in turn, correct, first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

An Insertion Sort works like this

1) Look at the ______ item in a list
2) Compare it to ___ items ______ it and insert the item in the ______ place
3) _______ step 2 until the ____ number in the list has been inserted into the _______ place

A

second

all, before, correct

Repeat, last, correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

The advantages of an Insertion Sort are

  • Can be easily ____
  • Efficient for _____ lists
  • Doesn’t use much _______ as all sorting is done on the _______ list
  • Quick to ___ items to an _______ list
  • Quick at ________ if the list is already _______.
A

coded

small

memory, original

add, ordered

checking, ordered

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

An algorithm is a ______, ____ by ____ process for _______ a problem.

A

logical, step by step, solving

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Algorithms are normally written as one of the following

  • _________
  • _____ diagram

Check BBC for more info

A

Pseudocode

Flow diagram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Psudeocode is a method of writing up a set of _______ in plain ______ that also closely resembles _______ languages.

It has its own _____, some of which is ______ to _________ languages.

Psuedocode itself cannot be ___ by a computer. - They need to be ______ into an actual ______ language

A

instructions, English, programming

syntax, similar, programming

run, converted, programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Here is an example of psuedocode

while answer != 'computer science'
     answer = input ('What is your favourite subject? ')
     if answer == 'computer science' then
          print('Good choice!')
     else
          print('Really? ')
     endif
endwhile
A

yep

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Advantages of psuedocode

  • Can be quickly and easily ______ to _______ language due to them being very ______
  • Fairly easy to ________
  • Doesn’t matter if there are errors in the _____ -
  • _______ to the design can be made quite _____.
A

converted, programming, similar

understand

syntax

Changes, easily

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

The disadvantages of pseudocode are

  • Can be hard to see how the program ____ if there are multiple _____
  • _____ consuming to produce
A

flows, paths

Time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

A flow diagram is a diagram that shows an _______ of a _______.

They use standardised ______ to represent the different types of ________.

These symbols are used to ________ the flowchart and show the ____-__-____ solution to a ______.

Check Bitesize or CGP for the symbols

A

overview, program

symbols, instruction

illustrate, step-by-step, problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

Advantages of flow diagrams

  • Easy to see how a program _____ even with multiple _____
  • Flow diagrams are an _________ standard - can be understood ________.
A

flows, paths

international, worldwide

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

Disadvantages of flow diagrams

  • If the program is large, diagrams can become _____ in size and very _____ to follow
  • Changes are hard to ________ as a lot of the diagram will probably have to be ______.
A

large, hard

incorporate, redrawn

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

The three basic programming constructs are

  • ________ - the _____ in which instructors occur and are ________
  • ________ - determines which ____ a program takes when it is _______
  • ________ - the _______ execution of a _______ of code when a program is ________
A

Sequence, order, executed

Selection, path, running

Iteration, repeated, section, running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

The two types of iteration are

  • _____-________ iteration
  • ________ - _______ iteration
A

Count-controlled

Condition-controlled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

Sequence is the _____ in which lines of ____ are executed. In programming, lines of ____ are executed ___ after ______.

Sequence is important as running instructions in the _______ order will lead to _____ in the program, causing it to function _______ as well.

A

order, code, code, one after another

incorrect, errors, incorrectly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

In this pseudocode program designed to find the average of two whole numbers, the instructions are in the wrong sequence:

total = 0
average = number1/number2
number1 = int(input(“Enter the first number: “))
number2 = int(input(“Enter the second number: “))
print(“The average is “, average)

Running this program would result in an error, because it tries to calculate the average before it knows the values of the numbers.

A

yh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

To correct the previous psuedocode, the _______ average should be ______ after the number1 and _______ have been stated.

total = 0
number1 = int(input(“Enter the first number: “))
number2 = int(input(“Enter the second number: “))
average = number1/number2
print(“The average is “, average)

A

yh man

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

Selection is the process of making a ______. The result of the _______ decides which ____ the program will take next.

A

decision, decision, path

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

For example, a program could tell a user whether they are old enough to learn how to drive a car. If the user’s age meets the required driving age, the program would follow one _____ and execute one ___ of ________. Otherwise, it would follow a ________ path and execute a _______ set of _________.

A

path, set of instructions, different, different, instructions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

Selection works by testing a _______ - The test gives a _______ result which could either be ____ or _____.

If the result is ____, the program follows one ____, otherwise it follows _______.

A

condition, boolean, TRUE or FALSE

TRUE, path, another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Selection is implemented using __ ____ ____ statements.

A

if then else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

age = int(input(“How old are you? “)
if age > 16 then
print(“You are old enough to drive a car!”)
else
print(“Come back when you are older!”)
endif

In the above pseudocode program, the path the program takes depends on the _______. A ______, in this case age, is used to ____ the condition.

If the value age is greater than 16, the result of the tested condition is ____ and the program follows the ___ path, which follows the statement ____. This path informs the user that they are old enough to drive.

If the value of age is less than 16, the result is _____ and the program follows the ______ path, which follows the statement ___. This path informs the user that they are not yet old enough to drive.

The statement _____ ends the selection.

A

condition, variable, test

TRUE, first, then

FALSE, second, else

endif

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

Iteration is the _______ execution of a _______ of ______ within a computer program.

Iteration is also often referred to as ______, since the program “loops” back to _______ sections of _____. Sections of code that are iterated are called ______.

A

repetitive, section of code

looping, earlier, code, loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

Iteration enables programmers to greatly _______ a _______. - _____ lines of code don’t need to be _______ many times, the section can only be written _____, and the program can _______ it _____ times until it is no longer ______.

A

simplify, program,

similar/same, rewritten, once, execute, multiple, needed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

Count-controlled iteration _______ executes a section of ____ for a fixed ______ of _________ times.

It uses statements ____ and _____ to determine what section of _____ is repeated and how many ____.

A

repeatedly, code, number, predetermined times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

For example

This program would also print out a message six times:

for count = 1 to 6
print(“Coding is cool”)
next count

The first line of the program determines how many _____ the code is to be ______. It uses a ______, in this case count, known as the _______ variable, to keep track of how many _____ the code has been _______ so far. The variable is given a ______ value (in this case one) and an ____ value (in this case six).

Every time the code is iterated, the value of count _______ by one. At the end of the iteration, the value of count is _____ to see if it matches the ___ value. If the result is FALSE, the code _____ ____ to the _____ of the iteration and runs again. If it is TRUE, the iteration ____ and the program continues with the next line of code.

A

times, iterated/executed, variable, condition variable, times, executed, start, end,

increased, checked, end, loops back, start, ends

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

By using iteration, a program is simplified, less _____ prone and more ______. This is because

  • There are fewer ____ of ____, meaning fewer ________ for typing _____ to creep in
  • to increase or decrease the number of _______, all the programmer has to do is ______ the loop’s ___ value
A

error, flexible

lines, code, opportunities, errors

iterations, change, end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

While loops test the ________ at the ________ of the loop. if the condition is met, the ____ within the loop is ______ before the program loops ____ to ____ the condition again.

A

condition, beginning, code, executed, back, test

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

This program would print out a message six times:

count = 0
while count < 6
     print(“Coding is cool”)
     count = count + 1
endwhile

The while statement defines the ____ of the loop. The ______ statement declares the ___ of the loop. A ______, in this case count, is used for the _______. The while statement also ____ the condition, in this case to see if the value of count is less than ___. If the result is TRUE, the code within the loop is ______, then the program loops ____ to the condition, which is _____ again.

The iteration continues until the condition test result is _____, at which point the loop ____ and the program executes the next line of code in sequence after the loop.

A

start, endwhile, end, variable, condition, tests, 6, executed, back, tested

FALSE, ends

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

Repeat condition-controlled loops works in the same way as while loops, BUT, the _______ is tested at the ____ of the loop (rather than the start like while loops)

A

condition, end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

Repeat condition -controlled loop example

count = 0
repeat
     print(“Coding is cool”)
     count = count + 1
until count = 10

The repeat statement defines the ____ of the loop. The ____ statement tests the condition. Because the condition is tested at the ___, the code within the loop is always executed at least ____, even if the result of the test is ______.

A

start, until, end, once, FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

Condition-controlled loops can be written to continue forever. This is known as ______ loop.

Infinite loops can be created using either _____ or ______ loops

A

infinite

while, repeat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

his program would run infinitely:

count = 10
repeat
     print(“Coding is cool”)
     count = count + 1
until count = 10

At the end of the loop, the value of the variable count will be 11. Because with each iteration the value of count increases by ___, count will never have the value ___, so the loop will run _______.

A

one, 10, infinitely

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

Nesting occurs when one programming ______ is included within ______.

It ______ the amount of _____ needed, whilst making it simple for a programmer to ______ and _____ the program.

A

construct, another

reduces, code, debug, modify

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

Nested selection

When using selection, the number of possible ____ at a _______ point can be _______ by including one selection within ______.

A

paths, decision, increased, another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

This program uses nested selection:

age = int(input(“How old are you? “)
if age > 16 then
print(“You are old enough to drive a car and ride a moped!”)
else
if age == 16 then
print(“You are old enough to ride a moped!”)
else
print(“Come back when you are older!”)
endif
Endif

Here, there are two ______ that may be tested, resulting in _____ possible paths to follow. The _____ condition is only tested if the result of the first test is ______.

Nested selection can be built up over and over to include ____ possibilities and _____ for a program to follow. It allows for ______ decisions to be made.

A

conditions, three, second, FALSE

many, paths, complex decisions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

This program uses nested selection:

age = int(input(“How old are you? “)
if age > 16 then
print(“You are old enough to drive a car and ride a moped!”)
else
if age == 16 then
print(“You are old enough to ride a moped!”)
else
print(“Come back when you are older!”)
endif
Endif

Here, there are two ______ that may be tested, resulting in _____ possible paths to follow. The _____ condition is only tested if the result of the first test is ______.

Nested selection can be built up over and over to include ____ possibilities and _____ for a program to follow. It allows for ______ decisions to be made.

A

conditions, three, second, FALSE

many, paths, complex decisions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

Iteration can also be nested. This program uses two count-controlled for next loops, one within another, to print out the times table for all numbers from one to ten:

for x = 1 to 10:
      for y = 1 to 10:
           result = y * x
           print(y, " * ", x, " = ", result)
      next y
next x

For every iteration of x, y is iterated ten times.

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

This program uses condition-controlled while endwhile loops, one within another, to print out the times table for all numbers from one to ten:

x = 1
y = 1
while x < 11:
      while y < 11:
            result = y * x
            print(y, " * ", x, " = ", result)
            y = y + 1
      y = 1
      x = x + 1

For every iteration of x, y is iterated ten times.

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

A variable is a ______ ______ _______ that holds a value. The value held in the variable can _______ as the program is running

A

named memory address, change

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q

An identifier is a _____ given to a ____ of a program, such as a _______, constant, function etc.

A

name, part, variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q

Variables make it easy for a programmer to use _______ locations. The computer keeps _____ of which memory ______ the variable refers to. All the programmer has to do is remember the _______ the variable was given.

A

memory, track, location, identifier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

Variables need to be _____ and ______ before a value is assigned to it. - This is known as ________ (ie declaring the variable)

A

created, identified, declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q

Assignment - giving a variable a _____. A variable must be assigned a _____ before it can be ____.

A

value, value, used

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q

A constant allows a _____ to be assigned a _____. The value assigned to a constant can’t be _____ when the program is running

A

value, name, changed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

Constants are useful because they are _______ and _______ once, but can be ______ to over and over again throughout the program.

They are used for values that are unlikely to \_\_\_\_\_\_ for example:
Pi - const PI = 3.142
A

declared, assigned, referred

change

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q

The two types of variables are

  • G_____ variables
  • ______ variables
A

Global variables

Local variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

A global variable is one that can be _______ and _______ throughout the program.

Usually a programmer has to ______ that the variable is a global. For example:

global ID = 75

A

accessed, changed

declare

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

Local variables are confined to a ____ or a _________. This has the advantage of the programmer being able to use the same variable _____ again and again for different ________.

A

loop, program, name, purposes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q

A local variable should not have the same _____ as a global variable. If this happens, the ______ of the global variable will be _______, causing the program to function _______.

A

name, value, changed, incorrectly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q

The 5 types of data types are

  • I______
  • F____
  • C_______
  • S______
  • B______
A
Integer
Float
Character
String
Boolean
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q

Integers are ______ ________,

Eg 27

A

whole numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q

Floats are _______ _______

Eg 27.5

A

decimal numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q

A character is a single _________ _________.

Eg N

A

single alphanumerical character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
79
Q

A string consists of one or more __________ ________.

Eg REVISE EDIOT

A

alphanumerical characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
80
Q

Boolean could either be _____ or ______

Eg heheh not gonna say u tell meh

A

TRUE, FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
81
Q

Different data types have ________

  • ______ and ______ cannot be _____ together
  • numbers held in ______ cannot be subject to _______ operations
A

limitations

Integers, floats, joined

strings, mathematical

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q

Casting is _______ the data ____ of a ________.

str(68) returns “68”
int(“54”) returns 54

A

changing, type, variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
83
Q

String Manipulation

It is usually possible to manipulate a string to provide ______ or to alter the ________ of a string

A

information, contents

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
84
Q

Length

The length of a string can be determined using the ___ statement. This gives the _______ as an _____.

___(wordOne) - would give the answer _____, as there are _____ characters in the word “Computer”

A

len, length, integer

len(wordone), eight, eight

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
85
Q

Character Position

wordOne = "Computer"
wordTwo = "Science"

It is possible to determine which ________ features at a ________ within a string.

wordOne[2] - would give the answer “__, as “__” is the _____ character in the word “Computer” (remember computers start counting at zero)

wordOne[0:2] - would give “____”, the first _____ characters in the string

wordOne[3:3] - would give “____”, the three characters starting from position _____.

A

character/s, position

m, m, third

com, three

put, three

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
86
Q

Character Position

wordOne = "Computer"
wordTwo = "Science"

It is possible to determine which ________ features at a ________ within a string.

wordOne[2] - would give the answer “__, as “__” is the _____ character in the word “Computer” (remember computers start counting at zero)

wordOne[0:2] - would give “____”, the first _____ characters in the string

wordOne[3:3] - would give “____”, the three characters starting from position _____.

A

character/s, position

m, m, third

com, three

put, three

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q

To concatenate strings means to ____ them to form another _____.

wordOne = "Computer"
wordTwo = "Science"

For example

sentence = wordOne + “ “ + wordTwo - would give “_____________”

Alternatively, a string can be lengthened by ______ more ________. For example:

wordOne = wordOne + “ Science” - would result in the value of wordOne becoming “__________ ________”

A

join, string

Computer Science

adding, characters

Computer Science

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
88
Q

An array a set of data _____ of the same ____, stored in a _______ in a computer ________.

Also known as a ____.

A

values, type, sequence, program

list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
89
Q

An array is like a collection of boxes, each of which is called an _______. Each element has a _______ in the array, and can hold a _____. The data in an array must all be of the same ____ ____.

This way, all data is stored under one ________ (name).

A

element, position, value, data type

identifier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
90
Q

Before an array can be used, it must be ______. To declare an array it must be given at least two properties:

- an \_\_\_\_\_\_\_\_
a \_\_\_\_ (the number of \_\_\_\_\_\_\_ it will hold)

For example:

array score[9] - would declare an array with ___ elements (zero to nine)

Once declared, the ______ and ________ of an array cannot be ______.

A

declared

identifier
size, elements

ten elements

name, structure, changed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
91
Q

Values are assigned to an element in an array by referring to the element’s ________. For example:

score[0] = 100 - would assign the value ___ to the ____ element in the array

Values in elements can be ________ at any point, simply by assigning another value to that element.

A

position

100, first

overwritten

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
92
Q

Values are retrieved from an element in the array by again referring to the element’s _______. For example:

print(score[7]) - would display the _____ value held in the array. In the above example, the value would be ___ - Check bitesize

A

position, eight, 98

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
93
Q

A two-dimensional array can hold more than ___ set of ____. This type of array is like a table, with data held in ____ and ________.

A

one, data, rows, columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
94
Q

A two-dimensional array is declared using ___ values- the _______ of ___ and the ________ of _______.

Eg

array score = [1,9] - would give an array with ___ rows and ___ columns

A

two, number of rows, number of columns

two, ten

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
95
Q

Data is _______ or retrieved by referring to an element’s ___ and ______ number.

A

assigned, row, column

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
96
Q

An operator is a _______, or _______, that determine what ______ is to be performed or considered.

The 3 types of operators are;

  • M________ operators
  • L______ operators
  • B______ operators
A

character, characters, action

  • Mathematical operators
  • Logical operators
  • Boolean operators
97
Q

Mathematical operators allow ________ operations to be performed on ______.

Symbol in the middle

Addition - _ - x=x+5
Subtraction - _ - x=x-5
Multiplication - __ - nah
Division - __ - nah

A

mathematical, values

Addition - +
Subtraction _ -
Multiplication - *
Division - /

98
Q

The 3 hard to remember mathematical operators

Power - __ or __
Quotient - ___
Remainder - ___ or __

A

^ or **
DIV
MOD or %

99
Q

The DIV operator returns the _____ _______ part of the division.

The MOD operator simply gives the _______ of the division.

A

whole number

remainder

100
Q

Logical operations allow for ________ and for ________ to be made. They are used in ________ testing.

Symbol mid, check eg cgp or bitesize

Assignment - \_\_ 
Equivalence - \_\_ or \_\_\_
Less than - \_\_
Less than or equal to - \_\_
Greater than - \_\_
Greater than or equal to - \_\_
Does not equal - \_\_ or \_\_
A

assignment, comparisons, condition testing

Assignment - = 
Equivalence - = or ==
Less than - <
Less than or equal to - <=
Greater than - > 
Greater than or equal to - >=
Does not equal - != or <>
101
Q

Boolean operators are used to _______ l______ operators to give more _______ d______.

And - ____
Or - ___
Not - ___

A

combine logical, complex decisions

AND
OR
NOT

102
Q

Programs can use ____ to store ____ and sure it is not lost when the program ends, so data can be _______ again later.

A

files, data, accessed

103
Q

Files have two modes of operation

  • _____ from - File is opened so data can be ____ from the ___
  • _____ to - File is opened so that data can be ______ to the ____.
A

Read from, data can be read from the file

Write to, data can be written to the file

104
Q

Each item of ____ written to or from a file is called a ______.

A

data, record

105
Q

A file must be open before a ______ can be ____ from or ______ to it.

A

record, read, written

106
Q

OPENING AND CLOSING FILES
To open a file, it must be referred to by its _______

file = openRead(“scores.txt”)

This would ____ the file scores.txt and allow its contents to be _____.

file = ________(“scores.txt”)

This would open the file scores.txt and allow it to have data written to it.

file.close() - This _____ the file

A

identifier

open, read

openWrite(“scores.txt”)

closes

107
Q

READING FROM A FILE
Records are read ___ line at a _____ once the file is _____.

The data held in this record can be read into a ______ or an ______.

file = openRead(“scores.txt”)
score = myFile.readLine()
file.close()

An array example is shown below.

file = openWrite("scores.txt")
for x = 0 to 9
     scores[x]=myFile.readLine()
next x
file.close()
A

one, time, opened

variable, array

108
Q
END OF FILE
The \_\_\_\_\_\_\_\_\_\_ () statement checks to see if the last record has already been read. E.g.
file = openRead("scores.txt")
while NOT file.endOfFile()
     scores[x]=myFile.readLine()
     x = x + 1
endwhile
file.close()

The above code would ___ each record and place it into an array scores. The operation _____ when there are no more ____ to read.

A

endOfFile() statement - checks to see if the last record has already been read

read each record. operation ends - when no more files to read

109
Q

WRITING TO A FILE
Data is written to a file ___ ____ at a time, using the _______ statement, for example:

file = openWrite("scores.txt")
for x = 0 to 9
     file.writeLine(scores[x])
next x
file.close()

The above code would ____ the contents of an array scores to the file scores.txt.

A

Written one line at a time - Statement writeLine

write

110
Q

DATABASES

Data is often stored in a _______.
A database is a _______ of data, or information that is stored in an _______ way to make _______ data much easier and more _______.

A

Database - Collection of data - organised - accessing data easier and more efficient

111
Q

DATABASES

Data in a database is stored as _______, which in turn is stored as _____.

A

Stored as records, files

112
Q

An _______ is one item of data.

A

Attribute - One item of data (categorie)

113
Q

_______ usually consist of one or more attributes. For example, a record holding data about a person might have these attributes:

title
_______
______
email address

A

Records

Forename
Surname

114
Q

SQL (________ _____ _______) is a ________ ______ used for _________ a _________.

A

SQL (Structured query language) is a programming language used for interrogating a database.

115
Q

Retrieving data from databases using ____

Data can be retrieved using the commands ______, FROM and ______, for example:

BBC

A

SQL

Commands - SELECT, FROM, WHERE

116
Q
  • in SQL means ___ records.
A
    • all records

e. g. Select * means select all

117
Q

The ____ command can be used to find matches for an incomplete word

e.g. %com returns any value that contains “___”

A

LIKE

%com returns any value that contains com
BBC

118
Q

Boolean operators ____ and ___ can also be used to ______ data in a database.

A

Boolean operators - AND OR

119
Q

Subprograms

Subprograms are small ______ that written within a _____, ____ program.

The purpose of a subprogram is to perform a ______ ____. - This task may need to be carried out ______ times at various ____ of a program.

A

Subprograms - small programs within a larger, main program

Purpose - to perform a specific task

Carried out multiple times - various areas of a program

120
Q

Subprograms

There are two types of subprograms:

  • p________
  • ________
A

2 types of subprograms - Procedures and functions

121
Q

Benefits of using subprograms

  • _____ in size - so easier to ____, test and _____. Also easy for someone to ________ it.
  • Can be saved ________ as _______ and used again in other _______. - Saves ___ because the programmer can use code that has already been written, tested and debugged.
A

Benefits of subprograms

Small in size - easy to write, test & debug. - Easily understandable

Saved separately as modules - used again in other programs - Saves time - no need to write, test and debug another piece of code

122
Q

Benefits of using subprograms

  • Can be used ______ times at various _____ in the main program. - Code only needs to be written ____, so programs are _____ in size.
A

Benefits of subprograms

  • Used multiple times at various points
  • Code written only once - Smaller programs
123
Q

Procedures

A procedure is a subprogram that performs a ______ _____.
When the task is complete, the subprogram ___ and the main program _______ from where it left off.

A

Procedure - Subprogram - specific tasks

Task complete - Subprogram ends - Main program continues

124
Q

Procedures

A procedure is created using the following syntax:

procedure identifier (value to be passed)
procedure code
endprocedure

A

A procedure is created using the following syntax:

procedure identifier (value to be passed)
procedure code
endprocedure

125
Q
procedure clear_screen(x)
    for i = 1 to x: 
    print(" ")
endprocedure

This procedure would ____ the screen by printing x ____ lines

A

clear the screen - prints blank lines

126
Q

Functions

A function works in the same way as a procedure, except that it ________ data and returns a _____ back to the main program.

A

Function - manipulates data - returns a result

127
Q

Example of a function
A function might be written to turn Fahrenheit into Celsius:

function f_to_c(temperature_in_f)
     temperature_in_c= (temperature_in_f –32) * 5/9
     return temperature_in_c
endfunction
A
function f_to_c(temperature_in_f)
     temperature_in_c= (temperature_in_f –32) * 5/9
     return temperature_in_c
endfunction
128
Q

Functions

A function is run by ______ it. To call it, a programmer uses the function’s _______, the ______ to be passed into the function, and a _______ for the function to return a value into, for example:

celsius = f_to_c(32)
This would result in the _____ of Celsius being zero.

A

Function - run by calling it - call by function’s identifier (name), - value to be passed - variable for function to return value to

value

129
Q

Procedures perform a _______ _____. Functions _________ data and return a _____ to the main program.

A

Procedures perform a specific task. Functions manipulate data and return a value to the main program.

130
Q

Built-in functions

Many languages include built-in, ready-made functions:

  • int - coverts ______ or _____ into _______
  • str - converts a ______ into a _____
  • __ - finds the ____ number of a ________
A

Built in functions

int - converts strings or floats into integers
str - converts a number into a string
asc - finds the ASCII number of a character

131
Q

Defensive design

The purpose of defensive design is to ensure that a program ___ correctly and continues to ___ no matter what _______ a user takes.

This is done through planning for ________ (all ______) and anticipating ______ (how a user may _____ or misuse a program)

A

Defensive design - purpose to ensure a program runs correctly - continues to run no matter what actions user do

Done via planning for contingencies (all possibilities)
and anticipating misuse (how a user may exploit or misuse a program)

132
Q

Planning for contingencies

Simply, this is planning for all _______ for a computer _______.

e.g. planning the program’s response if it crashes. For example, it should give an error message to the user and explain what occurred if it just suddenly crashes - it should not just crash and tell no information to the user.

A

Planning for contingencies - Planning for all possibilities for a computer program

133
Q

3 areas of focus for Defensive design

  • Protection against unexpected user _____ or _____, e.g. a user entering a letter instead of a number
  • Maintainability - ensuring code is _______ and ________
  • Minimising/removing ____
A
  • Protection against unexpected inputs or actions
  • Maintainability - ensuring code is readable and understandable
  • Minimising/removing bugs
134
Q

Anticipating and protection of program is done via

  • Input _______
  • Input _______
  • A___________
  • __________
  • Testing
A
Input Validation
Input Sanitisation
Authentication
Maintenance 
Testing
135
Q

Input Validation - Checking input data is _______ and in the right _______.

A

Input Validation - Checking if input data is sensible and in the right format

136
Q

Input validation

Validation applies ____ to inputted data. If the data does not follow the rules/criteria, it is ______, reducing the risk that incorrect input data may ____ a program.

A

Validation - Applies rules to data - Data is rejected if it doesn’t follow rules - Reduces risk of program crashing from incorrect inputs

137
Q

Types of Input Validation

  • R_____ check
  • L_____ check
  • P_______ check
  • F______ check
  • ______ check
A
Range check
Length check
Presence check
Format check
Type check
138
Q

TYPES OF INPUT VALID
Range check - the input must fall within a specified ______. - Usually applied to numbers and ____, but can be applied to ________.

E.g. When making a payment to someone, the amount to be entered might be set to be greater than zero and not greater than the funds available.

A

Range check - input within a specified range - applied to numbers, dates and maybe also characters

139
Q

TYPES OF INPUT VALID
Length check - the input must not be too ____ or to _____.

For example, a surname will require at least one letter, but is unlikely to require more than 40.

A

Length check - Input not too long or too short - Checks if the input is of the correct length

140
Q

TYPES OF INPUT VALID
Presence check - Checks if any data has been _______. A data value must be ______.

For example, entering a quantity when placing an order.

A

Presence check - If data has been inputted. Data values must be inputted.

141
Q

TYPES OF INPUT VALID
Format check - Checks if the data is in the correct ______. The data must be in the correct ______.

e.g. DD/MM/YYYY

A

Format check - Checks if data is in the correct format. Data must be in the correct format.

142
Q

Many programs use one or more of these validation checks. For example, when signing up for a user account on a website, the validation might include:

presence check - a ______ must be entered
length check - a password must be at least ____ characters long
range check - age restrictions may require the user’s date of birth to be before a certain ___
format check - the user’s date of birth must be entered in the specified ______
type check - the password may need to have a mixture of _____ and lower case letters, a number and a ______ character

A

.presence check - a username must be entered
length check - a password must be at least eight characters long
range check - age restrictions may require the user’s date of birth to be before a certain date
format check - the user’s date of birth must be entered in the specified format
type check - the password may need to have a mixture of upper and lower case letters, a number and a special character

143
Q

Validation does not ensure that the data entered is ______, just that it is possible and _______.

A user may accidentally enter a date of birth that is possible and sensible, but incorrect. The program has no way of knowing that the date has been entered incorrectly.

A

Validation - ensure data is possible and sensible, not if it’s correct.

144
Q

Validation does not ensure that the data entered is correct, just that it is possible and sensible.

To get around this, many programs include ________ checks - they _______ the entered data to the user and ask them to ______ if this data is correct. If the user confirms the data, the program then assumes it to be _______.

A

Verification checks - Repeat entered data to user - Asks them to confirm it’s correct - If yes, program assumes it’s correct

145
Q

Validation can be very simple. This program will _____ until the user enters a correct response:

response = “”
while response != “y” and response != ‘n’
response = input(“Do you want to proceed? y/n”)
response.lower
endwhile
print(“Okay, let’s continue…”)

A

iterate

146
Q

Data sanitisation - The process of ______ or protecting data so it cannot be ____ or ________.

A

Input sanitisation - Hiding or protecting data so it cannot be seen or disclosed

147
Q

Ways of data sanitisation

Masking - Hides _____ data by ________ it with something else.

Example - When typing passwords, the characters are replaced by ___ or asterisks, one for each ________ entered. - This prevents the actual password from being revealed to those looking at the _______.

A

Masking - Hides visible data by replacing it with something else

dots, character, screen

148
Q

Input sanitisation - The process of checking data ______ and removing anything that may be _________ and can cause ____ to a program.

E.g. Removing malicious SQL commands that is entered into a website, to prevent unauthorised access.

A

Input sanitisation - Checking inputted data - removes dangerous data. - that could harm a program——————————————————————————-

149
Q

Authentication is the _________ of the ________ of a user.

________ and _________ are commonly used in networks as forms of authentication.

A

Authentication - Verification of the identity of a user

Usernames and passwords - common authentication for networks

150
Q

3 main groups of authentication

  • Something you ___ - username, bank account no. or anything that identifies the user _________
  • Something you ____ - password, ___, secret answer to a question
  • Something you have - swipe card, ______, any other _______ identifying device
A

You have - identifies user uniquely (e.g. username)

You know - password, pin etc

You have - Biometrics - physical identifying devices

151
Q

Maintainability - Process of ensuing a program is easy to u________, _______ and _______.

A

Maintainability - Ensuring programs are easy to understand, modify and update

152
Q

Why is maintainability important

Programmer may need to _____ back to a program to improve it, _____ errors or add new _________.

Maintainability ensures it is easy to _______, ______ and _______, so programmers can very ____ understand and perform these actions with minimal _______.

A

return back, improve performance, debug errors, add new features

Maintainability - Easy to understand, modify and update - Programmers can easily understand, perform modifications and updating with minimal struggle and at ease

153
Q

Maintainability methods

  • C______
  • Sensible ________ names
  • ________
A

comments
sensible variable names
indentation

154
Q

Comments - Lines of ___ in programs that provide _______ about what different ____ of a program ___.

Are not _______ when program is run - program _____ them and moves to next ___ of code.

In python - comments are written using the ____ symbol

A

Comments - Text that provides info on what different sections of a program does

Not executed when program runs - ignored by program - moves to next line of code

  • Hash symbol - Python
155
Q

Sensible variable names

The variable name should reflect the ______ of the variable and the ____ it is intended to _____

e.g. height instead of h

This makes the program’s and variables easier to _________ and identify its ________

A

Variable name - reflect purpose of variable - and the data it is intended to hold/store

Makes variables and programs easier to understand and identify it’s purpose

156
Q

Indentation

Code within ________ or _______ should be indented. This allows the programmer to easily see which ____ falls within the _______ or ________, and where it ____.

A

Selections and indentations - should be intended

Easily see which code are selections or indentations - and where it ends

157
Q

Programming errors

The two types are

  • ________ errors
  • _______ errors
A

Syntax Errors

Logical Errors

158
Q

Syntax error - Occurs when ____ written does not follow the ____ of the programming _______.

The program will not ____ with syntax errors.

Good ____ will usually point out syntax errors to the programmer.

A

Syntax error - When code doesn’t follow the rules of the programming language

Program no run with syntax errors

IDEs point out these errors to programmers (good ones)

159
Q

Syntax errors examples

Misspelling a _______, eg writing pint instead of print

Using a variable before it has been ________

Missing _______, eg opening a bracket but not closing it

A

Syntax error examples

Misspelling statements

Using variables before its declared

Missing brackets

160
Q

Logic errors - an error in the way a program _____. The program simply does not do what it is _______ to ___.

A

An error in the way a program works. The program simply does not do what it is expected to do.

161
Q

Causes of logic errors

incorrectly using _____ operators, eg expecting a program to stop when the value of a variable reaches 5, but using <5 instead of <=5

incorrectly using ______ operators

unintentionally creating a situation where an ______ loop may occur

incorrectly using ________ in calculations

unintentionally using the same variable ____ at different points in the program for different _______

referring to an _______ in an array that falls _______ of the scope of the array

A

Incorrect use of logical and Boolean operators

Unintentional infinite loops

Incorrect use of brackets in calculations

Accidentally using same variable names at different points for different purposes

Refer to an elements outside of a scope of the array

162
Q

Syntax and logical error difference

Syntax error stops a program _______, logical errors ____. With logical, the program will ___, but not perform or function as _______.

A

Syntax no run, Logical yes run

Logical run - but program no perform or function as intended/expected

163
Q

Testing

When first written, programs may contain ____. Syntax errors can easily be _______, but logical errors are harder to ___ and _____.

Testing is used to _____ a program for errors - it is used to remove ____ and ensure the program ________ as intended.

A

Code first written - have bugs
Syntax easy to fix, Logical harder to find and solve

Testing - Checks program for errors - Purpose to remove bugs, and ensure program functions as intended

164
Q

Types of testing

  • I_______ testing
  • F____/________ testing
A

Iterative testing

Final/terminal testing

165
Q

Iterative testing is carried out while a program is being ________.

_______ (sections of code) are written and then _____. The programmer will amend or ___ the code if there are _____, and ____ it again.

The process _______ (iterates) until the _______ works as intended.

A

Iterative testing - testing a program whilst it’s developed

Modules (sections of code) written and then tested.
Code fixed if errors present, and module is tested again

Process is repeated until the module works as intended

166
Q

Final/terminal testing is carried out when the program is _______ and is tested as a ____ to ensure that it ________ as it should.

A

Final/terminal testing - Done when program is completed - tested as a whole - purpose to ensure that it functions as it should

167
Q

Test data is data that is used to ____ whether or not a program is ________ correctly.

Test data should cover a range of possible and impossible ____, each designed to prove how a program ____ or highlight any types of _____.

A

Test data - date used to test whether or not a program is functioning correctly

Test data - should have range of possible and impossible inputs - prove how a program works or highlight flaws

168
Q

Types of test data

  • _____ data
  • E________ data
  • _______/_________ data
A

Types of test data

Valid date
Extreme data
Invalid/erroneous data

169
Q

Valid data - sensible, _______ data that the program should ______ and be able to _______.

A

Valid data - sensible, possible data that the program should accept and be able to process

170
Q

Extreme data - ____ data that falls at the _______ of any possible _____

A

Extreme data - valid data that falls at the boundary of any possible ranges

171
Q

invalid (________) data - data that the program cannot ______ and should not ______

A

invalid (erroneous) data - data that the program cannot process and should not accept

172
Q

Testing requires a ___ plan

Test plan - This is a ___ of all the ___ that the programmer intends to use to ensure the program _____ as intended.

It should include several examples of ____, extreme and ______ data.

A

Test plan - List of all tests needed to ensure a program functions as intended

Should include multiple valid, invalid and extreme data as part of test.

173
Q

Testing tables

Test are laid out in a ________ table, which indicates:

  • The test ______
  • A ________ of what the test intends to _____
  • The test ____ being used
  • The ____ of test (valid, _______ or invalid)
  • Expected _______
  • _____ outcome
A

Tests - laid out in testing tables –> includes….

Test number
Description of what test intend to check
Test data being used
Type of test (valid, extreme or invalid)
Expected Outcome
Actual Outcome
BBC
174
Q

Tests

Ideally, a programmer should run as many ____ as is sensible. Many ____ programs, especially games, contain bugs simply because it may not be ______ to test every possible _____ or action.

A

Run many tests as is sensible. Large programs - contain bugs - coz not possible to test every possible input or action

175
Q

Trace tables

Trace tables is a way to test ____ programs.

Trace tables are used when _______ a program to record ______ in ______ values as code _______.

A

Trace tables - test short programs

Used when testing program to record changes in variable values as code executes.

176
Q

Trace tables Check BBC

Contain all _______ a program has

Trace tables records _____ in ______ of the variable.

A

Trace tables

Has all variables
Records changes to variable values

177
Q

Benefit of Trace tables Check BBC

Helps a programmer determine the _____ in a program where a _____ _____ has occurred.

A

Helps the programmer determine the point in a program where a logical error has occurred,

Finds where logical error has occurred in the program

178
Q

Logic errors - an error in the way a program _____. The program simply does not do what it is _______ to ___.

A

An error in the way a program works. The program simply does not do what it is expected to do.

179
Q

Benefit of Trace tables continued

Extremely useful because they enable a programmer to ______ what the value of each ______ should be against what a program actually produces. Where the two _____ is the point in the program where a _____ error has occurred.

A

Programmers can compare expected value vs actual value

Where the two values differ is the point where logical error has occured.

180
Q

Why data is usually in Binary form
A computer is a collection of _______ and circuits. These components have two states:

__ - a ______ is flowing through the component
___ - a ______ is not flowing through the ________

These two states can easily be represented in ______.
1 = __ (_____)
_ = __ (______)

A

Computer - collection of transistors and circuits
Two states;
ON - Current is flowing through the component
OFF - Current is not flowing through the component

181
Q

State is the _______ of a circuit.

If a circuit has one _____ and one ______, and the input and output each have two states - ___ and ____ - this gives two combinations of state:

input off, _______ ___
input on, ______ ___

A

State - Output of a circuit/logic gate

One input and one output - each have two states (on and off) - two combinations of state

Input off, Output OFF
Input on, Output ON

182
Q

Logic gates

A logic gate is a series of _______ connected together to give one or more _______, each output being based on the ____ or ___________ of inputs supplied to it.

A

Logic gate - Series of transistors connected together to give one or more outputs,
each output based on input or combination of inputs

183
Q

The 3 types of logic gates

  • A___ gate
  • __ gate
  • ____ gate

Each type of gate can be represented either as a _____, in _______ form, or as a _____ table.

A

AND gate
OR gate
NOT gate

Gate can be represented by a diagram, algebraic form, or as a truth table

184
Q

Truth table

A table to list the _______ for all possible _____ combinations into a _____ gate.

A

Truth table - table to list the output for all possible input combinations into a logic gate

185
Q

Boolean algebra

A form of _____ which only works with ___ values, _____ or _____. It is a notation used to represent _____.

A

Boolean algebra - Algebra that only works with 2 values - TRUE or FALSE. Notation used to represent logic

186
Q

Boolean algebra

Boolean algebra is a notation used to represent logic. For example:
Q = A AND B
Q = A OR B
Q = NOT A
This notation can also be represented using symbols:
Q = A \_\_ B, or as A_B
Q = A \_\_ B, or as A_B
Q = _ A
A

A AND B = A/\B or A.B
A OR B = A\/B or A+B
NOT A = ¬ A

187
Q

AND gates

An AND gate, also called a ________, uses ___ inputs to generate one ______. The output is 1 (TRUE) only if both of the _____ are _ (______).

A

AND Gate - Conjunction - 2 inputs to make one output.

Output is 1 (TRUE) only of both inputs are 1 (TRUE)

188
Q

AND gates Check BBC for diagram

This AND gate is represented in Boolean algebra as one of:
A AND B
A __ B
A_B

A

This AND gate is represented in Boolean algebra as one of:

A AND B
A /\ B
A.B

189
Q
AND gate truth table
A	B	Q
0	0	_
0	1	_
1	0	_
1	1	_

A represents ____ input, B is ______ ____, and Q is the _______.

A
AND gate truth table
A	B	Q
0	0	0
0	1	0
1	0	0
1	1	1
A - First input 
B - Second input 
Q - Output
190
Q

OR gates

An OR gate, also called a _______, uses ___ inputs to generate one output. The output is 1 (TRUE) only if either or both of the inputs are 1 (TRUE).

A

OR

OR gate - disjunction - 2 inputs to make one output,
Output is 1 TRUE only if either or both inputs are 1 TRUE

191
Q
OR gate truth table
A	B	Q
0	0	_
0	1	_
1	0	_
1	1	_

A represents ____ input, B is ______ ____, and Q is the _______.

A
Or gate truth table
A	B	Q
0	0	0
0	1	1
1	0	1
1	1	1
A - First input 
B - Second input 
Q - Output
192
Q

OR gates Check BBC for diagram

This OR gate is represented in Boolean algebra as one of:

A OR B
A __ B
A_B

A

This OR gate is represented in Boolean algebra as one of:

A OR B
A \/ B
A+B

193
Q

NOT gates

A NOT gate, also called the ______, uses ___ input to generate one output. A NOT gate _____ the input - the output is 1 (TRUE) if the input is _ (_____), and the output is 0 (FALSE) if the input is _ (_____).

A

NOT gates - negation - ONE input to give one output
Reverses/inverts the input (output is always opposite of input)
Input - 1 Output - 0
Input - 0 Output - 1

194
Q

NOT gate truth table
A Q
0 _
1 _

A

NOT gate truth table
A Q
0 1
1 0

195
Q

NOT gate Check BBC for diagram
This NOT gate is represented in Boolean algebra as one of:

NOT A
_A
_A
Ā

A

This NOT gate is represented in Boolean algebra as one of:

NOT A
¬ A
~A
Ā

196
Q

Combining gates

Logic gates can be combined to form more ______ inputs and ______.
These combinations are known as _____ _____
AND, ___ and NOT gates can be used in any ________ to generate the desired _____.

A

Logic gates - combined for more complex inputs and outputs - Logic circuits

AND, OR and NOT can be used in any combination to get desired output

197
Q

Combining two AND gates Check BBC for diagram

Here, the output Q is 1 (TRUE) only if inputs __ and D are _ (____). D is only 1 (TRUE) if inputs __ and __ are 1 (TRUE).

A

Here, the output Q is 1 (TRUE) only if inputs C and D are 1 (TRUE). D is only 1 (TRUE) if inputs A and B are 1 (TRUE).

198
Q
Truth table for two AND gates 
A	B	C	D = A /\ B	Q
0	0	0	     0	                _
0	0	1	     0	                _
0	1	0	     0	                _
0	1	1	     0	                _
1	0	0	     0	                _
1	0	1	     0	                _
1	1	0	     1	                _
1	1	1	     1	                _

Note - D is not strictly necessary in the table, but it helps in understanding Q.

A
Truth table for two AND gates 
A	B	C	D = A /\ B	Q
0	0	0	     0	                0
0	0	1	     0	                0
0	1	0	     0	                0
0	1	1	     0	                0
1	0	0	     0	                0
1	0	1	     0	                0
1	1	0	     1	                0
1	1	1	     1	                 1
199
Q

Combining two AND gates
In Boolean algebra, this circuit is represented as one of:

Q = (\_\_\_\_\_\_\_\_) AND C
Q = (A\_\_B) \_\_ C
Q = (A_B)_C
A

Combining two AND gates
In Boolean algebra, this circuit is represented as one of:

Q = (A AND B) AND C
Q = (A/\B) /\ C
Q = (A.B).C
200
Q

Combining OR and NOT gates Check BBC for diagram

Here, the output Q is 1 (TRUE) only if inputs __ and __ are both _ (_____).

A

Combining OR and NOT gates

Here, the output Q is 1 (TRUE) only if inputs A and B are both 0 (FALSE).

201
Q
Truth table for OR and NOT gates combined
A	B	C	Q
0	0	0	_
0	1	1	_
1	0	1	_
1	1	1	_
A
Truth table for OR and NOT gates combined
A	B	C	Q
0	0	0	1
0	1	1	0
1	0	1	0
1	1	1	0
202
Q

Combining OR and NOT gates
In Boolean algebra, this circuit is represented as one of:

Q = NOT (\_\_\_\_\_)
Q = ¬ (A \_\_ B)
Q = NOT (A _ B)

Note - This is sometimes called the ___ gate, ie a NOT OR gate. In the same way, a NOT AND gate can be referred to as the ____ gate.

A

Combining OR and NOT gates
In Boolean algebra, this circuit is represented as one of:

Q = NOT (A OR B)
Q = ¬ (A \/ B)
Q = NOT (A + B)

Note - This is sometimes called the NOR gate, ie a NOT OR gate. In the same way, a NOT AND gate can be referred to as the NAND gate.

203
Q
Mathematical operators
Addition --> +
Subtraction --> -
Multiplication --> _
Division --> _
\_\_\_\_\_\_\_ division --> \_\_\_\_
R\_\_\_\_\_\_\_ --> \_\_\_
E\_\_\_\_\_\_\_\_ --> _
A
Addition --> +
Subtraction --> -
Multiplication --> *
Division --> /
Integer division --> DIV
Remainder --> MOD
Exponentiation --> ^
204
Q

Mathematical operators allow _______ to be performed on va_____.

A

Mathematical operators allow arithmetic to be performed on values

205
Q

Addition
Addition uses the ‘_’ symbol:

6 + 6 = __

x + y

x = x + 2

x = x + y

A

Addition uses the ‘+’ symbol

6+6=12

206
Q

Subtraction
Subtraction uses the ‘_’ symbol:

8 - 6 = 2

x - y

x = x - 2

x = x - y

A

Subtraction uses the ‘-‘ symbol

8-6=2

207
Q

Multiplication
Multiplication uses the ‘_’ symbol:

5 * 5

x * y

x = x * 5

x = x * y

A

Multiplication uses the ‘ * ‘ symbol

5*5 = 25

208
Q

Division
Division uses the ‘_’ symbol:

6 / 2

x / y

x = x / 2

x = x / y

A

Division uses the ‘/’ symbol:

6 / 2 = 3

209
Q

Modulus
Modulus gives the _______ from a d_____ calculation:

7 MOD 3 = 1 (7 / 3 = 2 remainder 1)

Many programming languages, such as Python, use the ‘__’ character to represent modulus:

6 % 2

x % y

x = x % 2

x = x % y

A

Modulus
Modulus gives the remainder from a division calculation:

7 MOD 3 = 1 (7 / 3 = 2 remainder 1)

Many programming languages, such as Python, use the ‘%’ character to represent modulus

210
Q
Integer division
Integer division (also known as \_\_\_\_\_ division) discards the \_\_\_\_\_\_\_:

7 DIV 3 = 2 (7 / 3 = 2 remainder 1 – the remainder is discarded) so it’s just __

Some programming languages, such as Python, use ‘__’ to represent integer division:

6 // 3

x // y

x = x // 2

x = x // y

A
Integer division
Integer division (also known as floor division) discards the remainder:

7 DIV 3 = 2 (7 / 3 = 2 remainder 1 – the remainder is discarded) so the answer is 2

Some programming languages, such as Python, use ‘//’ to represent integer division:

211
Q

Exponentiation
Exponentiation uses powers represented by the symbol ‘_’:
2 ^ 3

= _ x _ x _

= _

Some programming languages, such as Python, use ‘__’ to represent integer division:

2 ** 2

x ** 2

x ** y

A

Exponentiation
Exponentiation uses powers represented by the symbol ‘^’

Some programming languages, such as Python, use ‘**’ to represent integer division

212
Q

Use of brackets
Calculations within brackets are performed f___. If there are no brackets, ________ is performed first, then division, addition and finally, ________

Where multiple brackets exist, the inside brackets are dealt with first:

((4 / 2) + (3 * 3)) + 2

= (2 + 9) + 2

= 11 + 2

= 13

A

Use of brackets
Calculations within brackets are performed first. If there are no brackets, multiplication is performed first, then division, addition and finally, subtraction

213
Q

High level languages - languages that are close to the _____ and ______ language of the programmer.

A

High level languages - languages that are close to the spoken and written language of the programmer.

214
Q

Why use high level languages

Programmers find machine code difficult to learn, program and ____ in.
So they use ___ level languages to ____ code instead

These languages are close to the _____ and ______ language of the programmer.
For example, Python uses ‘____’, ‘if’, ‘input’ and ‘____’ statements - all words from the _____ language - to form ________.

A

Machine code difficult to learn, program and debug in.
High level language used instead - close to spoken and written language

Python “print” “if” “while” - statements - English words - form instructions

215
Q

Why write in high level languages (Advantages)

  • Easier to ______ and less ______ than machine code
  • Allow programmer to focus on the ____, rather than how the computer actually _______.
A

Advantages of high level languages

  • Easier to understand and less complex than machine code

Allow the programmer to focus on what needs to be done, rather than on how the computer actually works.

For example, in many high level languages, to place a message on the screen, a programmer would use the statement ‘print’. The programmer might not know how the computer actually generates the message. They just need to know how to use the ‘print’ statement.

216
Q

Disadvantages of high level languages

  • _______ to the number of statements built into them.

If the programmer wants a program to do something, but a statement does not exist to do so, the task cannot be done.

A

Disadvantages of high level languages

  • Restricted to no. of statements built into them
217
Q

Commonly used high level languages
Many types of high level language exist and are in common use today, including:

Python
Java
C++
C#
Visual Basic
JavaScript
A
Python
Java
C++
C#
Visual Basic
JavaScript
218
Q

Source code - The code behind a computer _______, written in a ___- level _______ _______.
Source code must be _______ into machine code before the computer can understand and _____ it.

A

Source code - Code behind a program, written in a high level programming language
Must be translated into machine code in order to be executed and understood by computer

219
Q

Each high level _______/instruction is _______ into many ______ ____ instructions.

High level languages are known as ___ - ___ - _____ languages because of this.

A

Each high level instruction/statement is translated into many machine code instructions.

High level languages are known as one-to-many languages

220
Q

Low level languages - Programming languages that closely resemble the computer’s ________ ___.

An instruction set is a set of instructions that the _________ understands.

A

Low level languages - closely resemble the computer’s instruction set

Instruction set - set of instructions that the processor understands

221
Q

Low level languages

  • More difficult to ________ than high-level languages
  • But, instructions execute _______.
A

Low level languages

Difficult to understand

Instructions and code executes faster

222
Q

Examples of low level languages

  • ________ code
  • _________ language
A

Examples of low level languages

  • Machine code
  • Assembly language
223
Q

Low level language - Machine code

Machine code is the _______ that a _______ understands and can act upon

A

Low level language - Machine code

Machine code is the instructions that a processor understands and can act upon.

224
Q

Advantages of using machine code

  • More ______ - machine code can do stuff high level languages can’t e.g. change screen refresh rate
  • More _______ - Uses ____ instead of sentences - so they can build their own ______ sentences or keep programs very ____ and ________
A

Advantages of using machine code

  • More control - Machine code can do more tasks e.g. change screen refresh rate
  • More flexibility - Words instead of sentences - Own complex sentences can be made or programs can be kept very short and simple
225
Q

Disadvantages of using machine code

  • Difficult to ____ in, understand and _____ because it contains _____ or ________ numbers.

So instead, when programmers need direct control, thy use another type of low level language called _______ ______.

A

Disadvantages of using machine code

  • Difficult to code in, understand and debug coz its in binary or hexadecimal

For direct control, assembly language is used instead

226
Q

Assembly language

Assembly language uses _______ (short _______) instead of statements.
Each mnemonic directly corresponds with a _______ code ________. - So it is a ___-__-___ language

A

Assembly language

Uses mnemonics (short abbreviations) instead of statements.
Each mnemonic directly corresponds with a machine code instruction. - One-to-one language
227
Q

Assembly language

Programs are written as a series of ________.
Mnemonics are much easier to ________ and ____ than machine code.

A

Assembly language

Code is a series of mnemonics
Mnemonics - easier to understand and debug than machine code

228
Q

Assembly language

Writing in mnemonics is ea___ - brief representations of actual _______.
Quicker to write than ______ or ________ and is easier to spot ________.

A

Assembly language
Mnemonics - easier to write - brief representations of actual commands
Quicker to write than binary or hexadecimal
Easier to spot mistakes

229
Q

Many machine code and assembly instructions contain two parts:
- Opc___ - The actual ________

  • ______ - A _____ that the instruction ____ or ________
A

Many machine code and assembly instructions contain two parts:
- the opcode - this is the actual instruction

  • the operand - this is a value that the instruction uses or manipulates
230
Q

Both opcode and operand are represented in either ______ or _______

A

Opcode and operand - represented in either binary or hexadecimal

231
Q

Why Hexadecimal is popular

  • Represents larger _____ with fewer ______. - Therefore it is easier to ____ and ________ by humans.
A

Why Hexadecimal is popular

  • Represents larger values with fewer characters. - Therefore it is easier to read and understand by humans.
232
Q

Consider this simple machine code program:

901 - inputs a value

306 - stores it in memory address 06

5A1 - loads into the accumulator the value held in memory address A1

Each of these instructions has an opcode and an operand:

Machine code instruction Opcode Operand
901 9 01
306 3 __
5A1 5 __

A

Consider this simple machine code program:

901 - inputs a value

306 - stores it in memory address 06

5A1 - loads into the accumulator the value held in memory address A1

Each of these instructions has an opcode and an operand:

Machine code instruction Opcode Operand
901 9 01
306 3 06
5A1 5 A1

233
Q

Need for translators

The ___ level language code used to make programs is known as ______ code.
Source code can’t be ______ by the computer, so it needs to be translated into ______ code which the computer understands.

A

Source code - High level language code used to make programs
Source code no executed
So it need to be translated into object code which the computer understands

234
Q

Translator - A program that converts _____ code into ______ code.

The three types are…

  • C______
  • I________
  • _________
A

Translator - A program that converts source code to object code

3 types are

  • Compilers
  • Interpreters
  • Assemblers
235
Q

Compilers - Takes all of the source code as a _____ and translates it into ______ go in ___ go.

Once converted, the _____ code can run ______ at any time.

This process is called _______.

A

Compiler - Whole source code translated into object code all in one go

Converted object code can run unassisted at any time

Process called compilation

236
Q

Advantages of compilers

  • Compiled programs run ______, since they have already been _______.
  • Compilers _______ code. Optimised code can run _____ and take up less ______ space.
A

Advantages of compilers

Compiled programs run quicker - already translated

Compilers optimise code - code runs quicker and takes up less memory.

237
Q

Advantages of compilers continued

  • A compiled program can be supplied as a ____ file, which is ready to be ______. .exe files cannot be easily ______, so programmers prefer to supply them instead of ______ code.
A

Advantages of compilers continued

  • Can be supplied as .exe files - ready to run - preferred over source as they can’t easily be modified
238
Q

Disadvantages of compilers

  • Compilers usually don’t spot _____ - the program has to be ______ and ___ before errors are encountered. This makes it ______ to see where the errors lie.
  • The source code must be __-______ every time the programmer changes the program.
A

Disadvantages of compilers

  • Don’t usually spot errors, program has to be compiled and run before errors can be found - Hard to find errors
  • Source code re-complied every time the programmer changes the program