Programming Flashcards

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

What is a variable

A

Any value that will change unless it’s a constant

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

Variables must be declared with

A

In python one statement that includes the data type

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

Different data types ares

A
Integer- whole number 
Boolean- two choices 
Character - symbol on keyboard (single)
String- zero or several symbols 
Float/Real- fractional number
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Constant variable

A

A variable that is the same throughout the program

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

Benefits of constant variables are

A

Easy to debug program

Easy to change value as it only needs to be changed once eg VAT

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

2 types of operations

A

Arithmetic and comparison do stuff to specific pieces of data

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

Num1=input
Num2=input
Num3=Num1+Num2
prints”the same is “,Num3)

What will happen and why

A

It’s will join the numbers together (concatenation) because it hasn’t been changed to int

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

Sequence-

A

Series of steps in specific order

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

Selection

A

Choice , IF THEN ELSE

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

Nested iteration and selection

A

A loop within a loop

Choices made within the process of making a choice

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

A robust code is

A

A code that will not crash and will anticipate unexpected user inputs

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

Arrays

A

A list with only one data type

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

Benefits of arrays

A

Easily debugged

Easily processed

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

Iteration

A

For is definite
While is indefinite
Repeat….until is indefinite

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

Data structure

A

Grouping data items together so are treated as a set

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

Subroutine

A

A named self contained section of the code that performs a specific task.
Def()

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

Benefits of subroutines

A

Makes the program structure easy to read

Each subroutine can be tested separately

18
Q

2 types of subroutine

A

Procedures and function

19
Q

Procedures

A

Just carry out instructions nothing is returned

20
Q

Functions

A

Carry out instructions but always return a statement

21
Q

A global variable is used. Whereas a local variable is

A

All throughout the program whereas a local variable is is only in a certain part of the program eg subroutine

22
Q

A structured program

A

Breaks a program into chunks of subroutines which will be more manageable

23
Q

Advantages of structured programs

A

Decomposing the program
Each data structure can be tested separately
Different programmers can work on different data structures at the same time hence making it quicker to complete

24
Q

Validating input data

A

Validation will only check if a data is reasonable not correct, if they are prompted to write date of birth it can check if the year and age makes sense but not if you entered November instead of December

25
Q

Different types of validation

A

Range check - a number is within a sensible range
Type check- data is the right type ie integer
Length check - text entered us not too long or short
Presence check- checks that some form of data has been entered
Format check- checks the format of ie a postcode is appropriate

26
Q

When doing a length check remember that python

A

Counts including 0 ie a=0, b=1

27
Q

How to check if data is correct

A

Verification. Ie asking data to be inputted twice and comparing them

28
Q

Maintainability

A
Makes your code understandable 
Ie use comments 
Subroutines 
Meaningful variables 
Constants appropriately 
Clarity rather than clever code
29
Q

Authentication authentication routines

A

Biometrics eg optical facial or fingerprint

30
Q

Trace tables are used to help show us

A

The purpose of algorithms

31
Q

Syntax errors

A

Mistyping key words or forgetting brackets are syntax errors basically bad grammar this means a program will not compile

32
Q

Logic errors

A

The program will compile but may not do what you want it to. For example
Missing brackets from mathematical equations
Loops with incorrect parameters
Flawed algorithms
Incorrect initialisation of variables

33
Q

Testing a program

A

Make a plan test with sample data so you already work out what you want it to do and see if it works
Trace tables make it clearer to see logic errors as it is more contained

34
Q

High level programming language and def

A

Translated using a compiler as it is written in basic English
Python
Java
C plus plus

35
Q

Low level language

A

Processor specific assembly code often in mnuemonics that make it hard for humans to understand.
Or
Machine code in binary

36
Q

Advantages of high level programming language

A

Easy to learn.
Faster to program in
Easier to read so easier to debug and maintain

37
Q

Advantages of low level language - assembly language

A

Often used in embedded systems such as washin machines or robots
Gives programmer complete control over system components so it can be used to manipulate hardware components
Very efficient code specific to processor do less memory but executed faster

38
Q

Assemblers…..

A

Convert assembly language back into machine code

39
Q

Compilers….

A

Translates high level language into machine codes. Source code(written by programmer ) compiled, object code (machine code)

40
Q

Interpreters also ….

A

Translate high level programming language into machine code

41
Q

Difference between compilers and translators are

A

Compilers translates the whole program to produce an executable object code whereas interpreters translates and executes line by line
Compiled excuses faster due to this
Customers do not need to install compiler bug interpreter must be installed
Customers using interpreters can see actual source code and copy it
Interpreters are used fro program read compilers are used for software that will be run frequently