Programming Flashcards

1
Q

Explain the concept of a data type.

A

Variables have a data type that defines the type of data that will be stored at the memory location and the operations that can be performed on it.

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

Describe how selection is used in programs.

A

Executes the next set of statements depending on the condition.

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

Describe the concept of a data structure.

A

Grouping data items together so they can be treated as a set of data.

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

What are text files?

A

Contain text that is in lines - there is no other structure.

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

Explain the advantages of using subroutines.

A

Programmers can get a large job done quickly by working on individual subroutines at the same time.

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

What are the two different types of subroutines?

A

Procedures and functions.

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

Describe how procedures are used in programs.

A

Makes code shorter, simpler and easier to write.
To create, first give procedure a name - python uses statement def to name a procedure. Once procedure is named and written, it can be called at any point in the program.

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

Describe how functions are used in programs.

A

A function is just like a procedure, except that you wait to see what the result is.
Every function needs, a name, values that it needs to use for calculation, program code to perform the task and a value to return to the main program.

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

Describe how functions return a value.

A

Returns a value using a RETURN statement.

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

Describe how programs should be approached in a structured manner.

A

Modularised approach: Uses subroutines to break down program into manageable chunks of code. Each subroutine should have a clear, well documented interface (parameters + return values).
Only uses the constructs of sequence, selection, iteration and recursion.

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

Explain the advantages of programming in a structured approach.

A

All advantages of subroutines.

Use of just 3 or 4 programming structures makes a program relatively easy to understand, debug and maintain.

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

Describe differences between low-level and high-level language.

A

MC: executable binary code produced by compiler, interpreter or assembler.
AL: translated using assembler, one statement translates into one machine code instruction.
HLl: independent of hardware (portable).
Translated using a compiler or interpreter.
One statement translates into many machine code instructions.
Ll instructions processed speedily than Hl languages, but more difficult for people to read + write.

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

Describe the features of a high-level language.

A

Selection + iteration constructs e.g. if, for and while.
Boolean operators e.g. AND, OR and NOT which enable complex conditional statements to be written.
Identifiers using unlimited number of alphabetic + numeric characters and some special characters means that variable names can be made meaningful.
Data structures e.g. arrays, as well as user-defined data types e.g. records.

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

Explain the main differences between different types of translators.

A
  • Interpreters translate + execute a line at a time, compilers translate the whole program.
  • Interpreters take more time to execute, compilers execute faster as already in machine code.
  • Customers must have interpreter installed on their computer + can see source code. Don’t need compiler installed to run the software.
  • Customer could copy source code (interpreter), can’t see actual source code when program is distributed.
  • Used for program development + when program must be able on multiple hardware platforms. (Compilers) used for software that will be run frequently or copyright software sold to third party.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly