U1T1 - Factfiles Flashcards

1
Q

What is a computer program?

A

Specific set of ordered instructions to be performed by a computer. It represents a solution to the program. Written in high + low level programming languages.

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

Give some examples of high level programming languages.

A

C#, Java, Visual Basic + Python. Can be read + understood by humans.

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

Give some examples of low level programming languages.

A

Machine Code + Assembly Language. Can be read + understood by machines.

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

Source Code/Program

A

Series of language statements written to solve a problem. Machine code/assembly language. Can’t be executed unless it’s fully compiled.

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

How is program code created?

A

Using a text/code editor. Is then translated into machine code.

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

How must a program be compiled if a text editor is used?

A

Using program software.

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

Why might an IDE be used?

A

Provides programmers with all facilities required to complete development of application from coding to testing. Application can be fully developed within one application.

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

What are the main components of an IDE?

A

Source code editor, compiler, debugger, GUI builder with associated toolbox of controls + solution explorer.

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

What is a source code editor?

A

Basic window for entering source code.

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

What are the main things a source code editor provides?

A

Clipboard, code outlining, code suggestion (IntelliSense), line numbering + syntax error assistance.

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

What does a compiler do?

A

Where IDE can remember last number of items copied. Programmers can rotate through list of copied items + choose one to paste into current file. Attempts to convert whole program into machine code before executing.

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

What is code outlining?

A

Programmers can collapse/expand selected regions of code under their first lines. This means long programs can be viewed in small logical sections.

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

What is the point in code suggestion (IntelliSense)?

A

As you enter a function/statement in code editor its complete syntax + arguments are shown in a ToolTip. When items are needed to complete a statement, it provides popup insertion lists of available functions/statements/constants/values to choose from. Called IntelliSense in Microsoft Visual Studio.

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

What is line numbering?

A

Line numbers help programmers to distinguish between lines in lengthy coding sections.

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

What does syntax error assistance do?

A

As code entered, code editor places wavy lines beneath wrong code. Sometimes errors are colour coded.

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

In Microsoft Visual Studio, what are the colour codes for each error type?

A
Red = Syntax Error.
Blue = Semantic Error (Mistyped Class Name)
Green = Warning.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does a compiler do?

A

Produces executable (.exe) file. Code written by programmer is compiler with additional libraries to create machine code version of program which can be executed by processor. Core translation process. Program can’t be successfully compiled unless it’s error free.

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

What does a GUI builder with associated toolbox of controls do?

A

Allows programmer to create windows applications by positioning controls on screen. Controls (Textboxes, combo-boxes, radio buttons) can be added to forms by dragging them from toolbox. 2 views, graphical design + code view.

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

What does design view allow?

A

Allows programmers to specify location of controls + other items on user interface.

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

What does a solution explorer do?

A

Graphical representation of entire solution. Window displays solutions, their projects + items in projects. Usually files can be opened for editing, new files added + item properties viewed.

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

What are debugging + break points?

A

Programs can contain logic problems which become apparent at run-time. This is where code, although syntactically correct, isn’t providing correct results. Debugger detects + corrects these issues. Programmers can set breakpoints where program stops during execution + allows them to examine value of diff variables.

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

Give 3 examples of translators.

A

Compilers, interpreters + assemblers.

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

What does an assembler do?

A

Translates assembly language into machine code. Low level language (AC) Each processor has a diff assembly code.

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

What does an interpreter do?

A

Translates source code one line at a time. Processor executes a line of code before proceeding to translate next line. No version of machine code stored. Generated each time program is run.

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

Describe the process of translating a program (Compiler)

A

During first stage, syntax of each statement checked, if wrong, error list made. Source code can’t be fully compiled until all errors removed. Compiled using language compiler + result is object program.

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

What does an object program contain?

A

String of 0s + 1s (machine/native code). Executable.

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

What 6 things might a compiler perform?

A

Lexical analysis, pre-processing, parsing/syntax analysis, semantic analysis, code generation + code optimisation.

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

What is lexical analysis?

A

Converts incoming source code into fixed length binary code items called tokens.

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

What is pre-processing?

A

Includes library code for classes + methods used within source code.

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

What is parsing/syntax analysis?

A

Checking statements within code to ensure they conform to rules of grammar for language.

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

What is semantic analysis?

A

Includes checking to see variables declared before use + type checking.

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

What is code generation?

A

Creating machine code version of source code.

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

What is code optimisation?

A

Making executable program as efficient as possible.

34
Q

What do some language implementations create?

A

Intermediary versions of code + machine code generated at run time.

35
Q

C#:

What does compiling do?

A

Translates source program into common intermediate language + generates required metadata. Stored as an assembly.

36
Q

C#:

What happens at execution time?

A

A just-in-time compiler translates CIL into native code. During this compilation, code must pass verification process which examines CIL + metadata to find out whether code can be determined to be type safe.

37
Q

C#:

What does CLR enable?

A

Common Language Runtime. Enables execution to take place, code to be executed is converted to processor-specific native code.

38
Q

What is bytecode?

A

Computer code which is processed by program, usually referred to as virtual machine rather than by computer’s processor. Python + Java are converted into bytecode before executed.

39
Q

What does the virtual machine do?

A

Converts each generalised machine instruction into specific machine instruction which this computer’s processor will understand.

40
Q

Give some pros of a compiler.

A

Fast, creates executable file which runs directly on CPU. Easier to protect intellectual property as machine code is difficult to understand.

41
Q

Give some cons of a compiler.

A

Debugging more difficult. 1 error causes many spurious errors. More likely to crash computer as machine code runs directly on CPU. Uses more memory as all execution code must be loaded into memory although tricks like dynamic link libraries lessen this issue. Unauthorised modification to code more difficult, executable in machine code so hard to understand program flow.

42
Q

Give some pros of an interpreter.

A

Debugging easier, each code line analysed + checked before execution. Less likely to crash as instructions carried out on interpreter’s command line/within virtual machine environment which protects computer from being directly accessed by code. Uses less memory, source code only has to be present one line at a time in memory. Easier to modify as instructions are at high level so program flow easier to understand + change.

43
Q

Give some cons of an interpreter.

A

Slower, interprets code one line at a time. Weaker intellectual property as source code/bytecode must be available at runtime e.g. write flash actionscript application, easy to get de-compilers which convert pseudocode into actionscript source code unless using encryption.

44
Q

What is an algorithm?

A

Set of rules/steps that represent solution to problem. Used to help design solution to given problem + order of steps is important. Help create solutions when program is required.

45
Q

Algorithm:
Get
Put

A

Represents info input from file/screen.

Represent info output to file/screen.

46
Q

What is syntax?

A

Rules governing how statements should be structured. How commands should be used to create statements. Source code compiled + statements checked to ensure they follow these rules.

47
Q

What is a statement?

A

Single line of code which performs task/calculation. Can contain many aspects of language (keywords, variables + assignment statements) If they don’t follow syntax rules, list of compile-time errors are generated by compiler. Programmer must correct errors before compilation.

48
Q

What is a variable?

A

Named location in computer’s memory which is used to hold a data value whilst program running. Can take on diff values during course of program executed + accessed by referring to name. Must declare all variables at start.

49
Q

Explain data types.

A

When designing solution, programmer must decide on name + data type for each variable. Types vary between languages but there is a facility for storing variables with diff data types.

50
Q

Explain this data type:

Numeric

A

Used to store numeric values (integer signed + unsigned, decimal fixed + floating point) 4 - 16 bytes.

51
Q

Explain this data type:

Character

A

Stores single unicode character. 2 bytes.

52
Q

Explain this data type:

String

A

Stores sequence of zero or more characters.

53
Q

Explain this data type:

Boolean

A

Stores values which are interpreted as True/False.

54
Q

Explain this data type:

Date

A

Stores date + time info. 8 bytes.

55
Q

What is sequence?

A

Normally, instructions contained in program/solution are performed in order they’re listed. Simplest control structure. Sequence of instructions can contain any number of actions + none omitted.

56
Q

What is selection?

A

In many programs, statement execution sequence is determined by input data. Decisions must be made based on values of certain variables as to which sequence of statements is to be performed. These require evaluation of a condition. Result of eval determines which statements are to be executed next.

57
Q

What is a condition?

A

Particular relationship between pair of variables/variable + constant.

58
Q

What are some relational operators used in conditions?

A
= (Equal to)
<> / != (Not equal to)
< (Less than)
> (More than)
<= (Less than/equal to)
>= (More than/equal to)
59
Q

When is the value of a condition true?

A

If specified relationship holds for current variable values, otherwise it’s false. True = 1, False = 0.

60
Q

How can conditions be combined?

A

Using logical operators (And, Or, Not)

61
Q

What do truth tables tell us?

A

AND rule requires all input to be true to produce output of True/1.
OR rule requires 1 input to be true to produce output of True/1.

62
Q

How are decisions implemented in programming?

A

Using IF - THEN - ELSE.

63
Q

Describe an If-Then statement.

A

If condition evaluates to true, statement(s) following THEN will be executed.

64
Q

Describe an IF-Then-Else statement.

A

Program provides alt statements to be executed if initial condition is false.

65
Q

How is repetition achieved?

A

Loops. Can be count-controlled or condition-controlled.

66
Q

Describe count-controlled loops.

A

Form of unconditional repetition. Instructions inside loop are executed set num of times. Loop counter used + initial value for loop counter set at start. Each time loop executed, loop counter incremented. Increment can be set to any value, default is 1. e.g. for loop

67
Q

Describe condition-controlled loops.

A

Loop repeats until condition is true/while true. Until = tested at loop end. While = Tested at loop start e.g. while loop. Condition must change within loop.

68
Q

When is a loop required?

A

When we wish to execute a certain task more than once.

69
Q

What is a flowchart?

A

Diagrammatic rep of algorithm, reps solution to problem. Contains symbols which rep control + action flow specified in algorithm.

70
Q

What does object-oriented programming use?

A

Uses objects when designing + building aplications.

71
Q

What is an object?

A

Instance of a class. Element of a program which can perform actions + interact with other elements of program. When designing program/application, objects considered first. During design process, objects formally defined. Describe real world elements using methods + properties.

72
Q

When can an application build begin?

A

Once all objects have been defined.

73
Q

What is a class?

A

Basic building block of object-oriented programming. Specifies attributes, methods + behaviours relating to object. Template/plan/blueprint describing object details. Object constructed from class. Defined by name, data members + member functions. Encapsulates/hides these elements. Can be re-used within num of applications, access to data provided through member functions.

74
Q

What is a method?

A

Section of code/procedure contained within class which defines action that object of class can perform. Class can have num of methods. Methods only have data access within own class.

75
Q

What is inheritance?

A

Fundamental feature of OOP. New class can inherit attributes + behaviours of existing class. New class = derived/child/sub class. Existing class = base/parent/super class. Sub class inherits attributes + behaviours of base class, these can be defined for derived class + base class can be re-used to define new more specialised classes.

76
Q

Define inheritance.

A

Means by which properties + methods from class are copied to another class so only differences must be reprogrammed.

77
Q

Give some pros of object oriented approach:

Inheritance

A

Classes + objects created for one object oriented application can be reused in other programs + apps. Objects can be extended to include other behaviours + attributes. Re-use enables faster development + lowers overall cost.

78
Q

Give some pros of object oriented approach:

Encapsulation

A

Once object is created, can be used without knowledge of how implemented/coded. Objects can hide aspects of themselves from programmers which means certain parts of code can’t be altered.

79
Q

Give some pros of object oriented approach:

Modular

A

Due to modular nature of OOP, designers go through extensive planning phase. Better designs with fewer flaws + less time spent on program maintenance.

80
Q

Give some pros of object oriented approach:

Software Quality

A

OO approach improves quality. Class tested in isolation, away from app which it’s intended to be used in. Using inheritance, derived class testing can assume base class is correct + focus on additional attributes + behaviours.

81
Q

Give 2 cons of object oriented approach.

A
Inheritance + encapsulation difficult to understand as steep learning curve. Programmers must learn extensive class libraries before beginning programming.
OOPs can incur run time cost due to dynamic dispatching. Process selects which version of method to call (polymorphism)