Programming Flashcards

1
Q

Explain the need for meaningful identifiers

A

It allows people who are quickly skimming through your code, to see which areas of code correspond to which outputs instead of reading the whole code.

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

Define character

A

A character is a unit of information

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

What are assemblers used for?

A

To turn assembly language into machine code

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

Define integer

A

A data type that represents numerical values such as 10 or 15

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

Give some characteristics of high-level languages

A

One instruction represents many instructions of machine code
The same code will work for many different machines and processors
The programmer can easily store data in lots of different structures without knowing about the memory structure
Code is easy to read, understand and modify
Must be translated into machine code before a computer is able to understand it
You don’t have much control over what the CPU actually does so programs will be less memory efficient and slower

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

Explain a nested structure

A

One structure of code written inside another structure of code as a member of that structure

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

Define Boolean

A

The Boolean data type is a data type that has one of two possible values (usually true or false)

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

Give some characteristics of compilers

A

Translates all of the source code at the same time and creates one executable file
Only needed once to create the executable file
Returns a list of errors for the entire programs once compiling is complete
Once compiled, the program runs quickly but compiling can take a long time

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

Give some characteristics of low-level languages

A

One instruction of assembly code usually only represented one instruction of machine code
Usually written for one type of machine or processor and won’t work on any others
The program are needs to know about the internal structure of the CPU and how it manages the memory
Code is very difficult to read, understand and modify
Commands in machine code can be executed directly without the need for a translator
You control exactly what the CPU does and how it uses memory so programs will be more memory efficient and faster

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

Define real

A

Real numbers are numbers that include fractions/values after the decimal point

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

Give some characteristics of interpreters

A

Translates and runs the source code one instruction at a time, but doesn’t create one executable file
Needed every time you want to run the program
The interpreter will return the first error it finds and then stop - this is useful for debugging
Programs will run more slowly because the code is being translated as the program is running

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

What are the three types of translators?

A

Assemblers
Compilers
Interpreters

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

What are compilers and interpreters used for?

A

To turn high-level code into machine code

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

Explain indefinite iteration

A

This repeatedly executes a selection of code until a certain condition is met

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

Describe what is meant by data type?

A

A particular kind of data item, as defined by the values it can take, the programming language used or the operations that can be performed on it

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

Explain definite iteration

A

A set of instructions repeated a specific number of times

17
Q

Define string

A

A string is traditionally a sequence of characters either as a constant or some kind of variable

18
Q

Describe selection

A

It is a programming contract where a section of code is run only if a condition is met

19
Q

Define the term “subroutine”

A

A set of instructions designed to perform a frequently used operation within a program

20
Q

Advantages of using a subroutine:

A

Code is easier to read and maintain

Test procedures and functions separately

Increases the reusability of code

21
Q

Purpose of parameters:

A

They allow us to pass information or instructions into functions and procedures

22
Q

Difference between global and local variables?

A

Local variables are declared within a function whereas global variables are described outside the function

Local variables are only accessible within the function.

Global variables can be accessed from anywhere within the code

23
Q

Advantages of subroutine

A
  • Decomposes the problem
  • they are re-useable so take less lines of code
  • Easier to read code
  • Each one can be tested individually for better debugging
24
Q

Advantages of local variables

A
  • save memory. As it only exist when the subroutine is running.
  • less bugs as it can only be altered by the subroutine it is in, marking it easier to debug
  • global variable are harder to trace as they are manipulated by many subroutines