Programming - All Flashcards

1
Q

State the definition of an algorithm

A

A series of steps to solve a problem which can be expressed in structured English, pseudocode or as a system flowchart.

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

State the features of machine code language

A

Processor specific: one language per processor architecture, won’t work on another machine.
Designed with hardware in mind.
One assembly language command will be translated into one binary instruction in machine code.
Translated using an assembler

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

Describe what is meant by a variable.

A

An identifier in a program that names a location in memory where data is stored while being used in a program. Its value can be changed as the program runs.

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

How do you know if you’re making an error?

A

You know by the different colour coded text, and also by the error it gives you when you begin to run your program

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

State what is meant by a syntax error, giving an example.

A

An error in the code where it does not meet the grammar rules for that language.
For example, “While x=3” without the word “do” at the end or a misspelt keyword like “wriet” instead of “write”.

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

What is an integer variable?

A

A whole number.

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

What is a real number variable?

A

A number that can have decimals or fractions.

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

What is a constant?

A

A set number that is programmed into the code, different to a variable that can change and be changed in the program.

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

What is assembly language?

A

To write code at the processor level we use assembly language, which is also known as second generation language. There are lots of different assembly languages; one for every different processor architecture. The code is written in mnemonics, abbreviated text commands such as LOAD, STORE, ADD.

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

What are mnemonics?

A

Abbreviated text commands such as LOAD, STORE, ADD, used in assembly language.

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

What is machine code?

A

Program code in binary is referred to as machine code and is known as the first generation of programming languages.

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

What are higher level programming languages?

A

Human beings find it easier to write programs in languages that are suited to the type of problem and languages that look more like normal languages. 3rd generation languages were invented for this, otherwise known as high level languages. There are lots of different programming languages to suit different types of problem. Examples are Python, C++, Javascript.

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

What are assemblers?

A

Converts assembly language into machine code. A simple conversion as every assembly language instruction is translated into a single machine code instruction.

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

What are compilers and interpreters?

A

Converts a high level programming language into machine code. This is a more complex translation as a single instruction in Delphi, for example, can result in many machine code instructions.

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

What is a string?

A

Zero or more characters. A string can be null (empty), just one character or several characters. Most programming languages have a limit of 255 characters if the programmer does not specify the maximum size.

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

What is a boolean?

A

A boolean variable has the value True or False.

17
Q

What is a syntax error?

A

Some common syntax errors include:
• Mistyping a key word: WRIET instead of WRITE
• Missing key words out of constructs such as starting a
REPEAT loop but not writing UNTIL anywhere
• Opening brackets but not closing them
• Not having the right number of parameters inside brackets for functions, for example:
Answer=round(TheNumber) will give a syntax error if the language expects another
parameter to state the number of decimal places: Answer=round(TheNumber,2)

18
Q

What is a logic error?

A

Once the code is written correctly, with no syntax errors, the program will compile. The program can then be run. Just because the program will run does not mean that it is working correctly though!
Often we run the program and it doesn’t do quite what we expected. This is called a logic error.
Typical logic errors that you have probably coded already include:
• Missing brackets from mathematical calculations:
NetPay=GrossPay-TaxFreePart x TaxRate
Is not the same as:
NetPay=(GrossPay-TaxFreePart) x TaxRate
• Loops that do not execute the correct number of times
because a condition states X>10 instead of X>=10.
• Variables have not been initialised, or have been initialised in the wrong place (often incorrectly initialised inside the loop instead of just before it).
• Flawed algorithms that just don’t do what they were intended to do. Capturing all of the complexities of real‐life scenarios in code is difficult and users always manage to do something to the input that you didn’t cater for!

19
Q

What is an IDE?

A

When you create a program you will be using a software package that helps you write the code more easily. This is called an Integrated Development Environment or IDE.

20
Q

What are the common features of an IDE?

A

Line numbering.
Colour coding.
Autocompleting.
Error messages.