Developing software (chapter 4) Flashcards

(21 cards)

1
Q

Varibles

A

Variables are methods of storing data so that they can be retrieved later within a program. e.g. strfruit = apple

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

Operators

A

Used in code to perform tasks

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

Operators - Arithmetic

A

Arithmetic operators are used to perform mathematical operations. They are similar to the operations performed in basic mathematics and are used to manipulate numerical values. e.g. +,-,*,/,%

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

Conditional operators - Logical

A

Logical operators are used to perform logical operations, primarily in selection statements, to determine the truthfulness of an expression. They are used to combine or invert Boolean values (true or false). e.g. AND, OR

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

Conditional operators - conditional

A

Conditional operators are used to compare two values or expressions. e.g. <, >, ==, !=

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

Control structures

A

There are three fundamental control structures in programming: sequences, conditional statements and iterations. They run a program.

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

Control structures - Sequence

A

A sequence is a set of instructions that executes line by line, a little bit like a recipe; every line of code in the sequence is run in the order that it is written.
e.g:
ALGORITHM askName()
BEGIN
PRINT “What is your name?”
INPUT name
PRINT “Hello, “ + name + “. Nice to meet you.”
END

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

Control structures - Selection

A

Selective control structures (selections) allow the application to make decisions during runtime, dependent on given conditions. Based on the result of a condition in true or false.
e.g.
ALGORITHM printPositive()
BEGIN
INPUT intNumber

       IF intNumber > 0 THEN       
                   PRINT “The number is positive.”     
       ENDIF END
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Control structures - Statements and iterations

A

A iteration is another name for a loop, which runs code until a condition is met. There are 4 main types of loops: WHILE, DO/WHILE, FOR, REPEAT UNTIL
e.g.
ALGORITHM readFromFile()
BEGIN
INPUT fileName

        fileObject ← open filename for reading        
        WHILE end of file is not reached DO         
                     nextLine ← read one line from fileObject           
                     PRINT nextLine        
         ENDWHILE END
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Functions

A

A function is a block of code that is intended to be used repeatedly within an application. The code within a function executes an algorithm, and typically provides a return value as a result.

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

OOP

A

Stands for object oriented programing. A way of organizing code that uses objects and classes to represent real world entities and their behavior.

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

OOP - abstraction

A

Abstraction is the process of hiding complex internal details (code), and only showing essential features of a object or method.

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

OOP - encapsulation

A

Encapsulation is the bundling of data (attributes) and method (functions) within a class, restricting access to some component to control interactions. e.g.
Public Members = self.strName, Accessible from anywhere
Protected Members = self._strName, Accessible from within a class and subclasses
Private Members = self.__strName, Accessible from only within the class

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

OOP - class

A

Classes are blueprints/templates for creating objects.

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

OOP - object

A

An object represents a real world entity. e.g. a dog or cat. They have properties/attributes linked to them

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

OOP - method

A

A method is the same as a function, when called it will print something related to its original code with a user input variable

17
Q

Naming convection

A

A naming convention is a set of rules that is used when creating variables, subroutines, functions, methods, objects, classes. e.g. Hungarian notation, camel case

18
Q

Internal documentation benefits

A

Internal documentation are just footnotes in code. They provide context and understanding for what code does

19
Q

Validation techniques

A

Validation is the process of checking that input data is reasonable. Validation does not and cannot check that inputs are accurate.
Existence check: an existence checks if the user has put in any data at all. This is useful to ensure all feild have been filled.
Type checking: Checks to see if the correct data type has been input. e.g. checks if a integer has been put into a string format textbox
Range checking: Checks if the input value is between acceptable limits. e.g. IF intNum > 0, the input number must be greater than zero, if below or equal to zero there would be an error

20
Q

Testing and debugging

A

When coding and running a program errors can appear. The main errors are: syntax errors, runtime errors or logic errors.
Syntax errors: If a character in a variable that does not follow that programs syntax rules, missing brackets or quotes and this error will appear
Runtime errors: No syntax errors but something unexpected happened, that caused the program to crash. e.g. Dividing by zero, using a variable that doesn’t exist
Logic errors: When syntax is correct and the programs runs well, but the outcome is unexpected or wrong.

21
Q

Testing tables

A

A table that shows the expected results and real results: Test Case, Test data, Expected result, Actual result, Pass/fail. class notes -> Ex8 Home loan calculator -> bottom of page