Additional 2.2 Flashcards

1
Q

Records

A

Unlike arrays, records can store data of different data types.

Each record is made up of information about one person or thing.

Each piece of information in the record is called a field (each row name).

Records should have a key field - this is unique data that identifies each record. For example Student ID is a good key field for a record on students as no two students can have the same Student ID

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

what is sql

A

SQL (structured query language) is a language that can be used to search for data in a database.

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

format of an sql satement

A

SELECT field1, field2, field3…

FROM table

WHERE criteria

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

in sql what is a wild card

A

SQL uses wildcards which are symbols used to substitute characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  • MEANING IN SQL
A

The * symbol represents ALL fields.

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

WHAT IS AN ARRAY

A

An array is a static data structure that can hold a fixed number of data elements. Each data element must be of the same data type i.e. real, integer, string.

The elements in an array are identified by a number that indicates their position in the array. This number is known as the index. The first element in an array always has an index of 0.

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

2d ARRAY

A

The data in a two dimensional array must still all be of the same data type, but can have multiple rows and columns.

Each value in the array is represented by an index still, but now the index has two values. For example [3] [0] is ‘Daphne’. We measure row first, then column.

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

TYPES OF SUB PROGRAMS

A

Procedures

Carry out a task

Provide structure to code

Functions

Carry out a task AND …

… return a value

Create reusable program components

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

ADVANTAGES OF USING SUB PROGRAMS

A

The program is easier to write

The program is easier to debug

We are creating reusable components

Functions could be gathered together into a library for easy reuse across multiple programs

An example is import random

This imports the “random” library of functions into our program so we can use them.

The program is easier to test (if we block our program into sub programs, - this is because we can test each procedure or function individually on its own and when we know it works, we can put it into a larger overall program)

Each sub-program can easily be tested

Sub-programs can be saved into libraries and reused in other programs.

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

HOW CAN LARGER PROGRAMS BE DEVELOPED

A

Larger programs are developed as a set of sub-programs called subroutines

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

advantages of function

A

Functions return values and create reusable program components

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

advantages of procedures

A

Procedures create a modular structure to a program making it easier to read

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

Examples of situations where you need to create a program required to generate a random number:

Examples of situations when you might want to generate a random number

A

Simulating the roll of a dice

Generating a random set of co-ordinates

Gambling simulations

National lottery program

Quiz programs (selection a random question from a list of questions)

Cryptography

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