Flashcards
Untitled

Cards in this deck (20)
- 1Explain the difference between a variable and a constant.A constant has a set value whereas a variables holds a value that can change depending on what has previously occurred in the program.
- 2Explain the advantages of using named constants.As the constant is only declared in one place it is easy to change if needed and improves the readability of the code.
- 3Explain the advantages of using subroutines in programs.Allows you to reuse code across multiple programs and it reduces duplicate code within a program.
- 4Describe how parameters are used to pass data within programs.Parameters are the names of the information that we want to use in a function or procedure. The values passed in are called arguments. You call the parameter in the function by using its name.
- 5Explain why it is good practise to use local variables.A local variable only has meaning within the function that it was declared in. This means that you don't have to have a separate variable name for each local variable in your program, and they will not be modified outside of the function they are in.
- 6Explain the difference between local variables and global variables.Local variables only have meaning within the function that they are declared in. A global variable can be used used and altered throughout the whole program.
- 7Explain why it is important to use meaningful identifier names.Meaningful variable names can help programmers to trace bugs in their code more easily.
They also mean that other programmers should find it easier to understand the code. - 8Explain why constants should be used in programs.Since the compiler knows the value can't change, it doesn't need to load the value from memory and can optimise the code to work for only the exact value of the constant
- 9Explain the advantages of the structured approach to programming.It reduces the complexity of the program, logical structures ensure clear data flow and modules can be re-used which saves time and increases reliability.
- 10Give three reasons why the object-oriented paradigm is used.1. Objects created for Object Oriented Programs are modular so they can easily be reused in other programs.
2. Due to the ability to reuse objects, this allows for faster development of programs.
3. The reuse of software also lowers the cost of
development as more effort is spent on analysis and design rather than development. - 11Explain the difference between an object and a class.A class can be defined as a template/blueprint that describes the behaviour/state of the object. An object is a member or an "instance" of a class. An example is a box has side lengths and colour. The side length and colour is the boxes classes and the actual values e.g. 5 cm and red are the objects of the class.
- 12Explain how a class is described in a class diagram.In a UML diagram, a class is graphically described using a rectangle split up into its class name, attributes and operations.

- 13Explain the differences between the different types of access specifiers.Public - The members declared as public are accessible from outside the Class through an object of the class.
Protected - The members declared as protected are accessible from outside the class but only in a class derived from it.
Private - These members are only accessible from within the class. No outside access is allowed. - 14Explain by what is meant by the term encapsulation.Encapsulation is the process of combining data and functions into a class. In encapsulation, attributes of the class are kept private and public getter and setter methods are provided to manipulate these attributes.
- 15Describe the benefits of inheritance in OOP.Inheritance allows the child class to obtain the attributes of its parent class, the benefit of this is reusability as you wont have to declare all of the attributes again.
- 16Show how inheritance is represented in a class diagram.In a class diagram, inheritance is shown by a white arrow going from the subclass to the super class.

- 17Explain the concept of overriding and how it relates to polymorphism.Overriding is when a method defined in a superclass is re-defined by one of its subclasses, which in turn modify's the behaviour of the instance that the superclass provides.
Polymorphism can be achieved through overriding. Polymorphism refers to the ability of an object to provide different behaviours depending on its own nature. - 18Describe the two types of association and the differences between them.Association is a relationship between two objects, e.g. one-to-one is an example of association. Aggregation is a specialised form of association, aggregation implies a relationship where the child can exist independently of the parent. An example is having a Classroom (parent) and a Student (child). Delete the Classroom and the Students still exist.
- 19Show how associations are represented in a class diagram.In a class diagram, associations are shown by a black arrow from one classifier to another to show that instances of classifiers could be linked to each other.

- 20Explain why composition should be favoured over inheritance as a design principleComposition over inheritance is the principle that classes should achieve polymorphic behaviour and code reuse by their composition (by containing instances of other classes that implement the desired functionality) rather than inheritance from a base or parent class. To favour composition over inheritance is a design principle that gives the design higher flexibility. It is more natural to build classes out of various components than trying to find commonality between them and creating a family tree to allow inheritance to work.
Information
- Description
- Flashcards on Untitled, created by Chris Norman on 30/08/2018.
- Created by
- Chris Norman
- Views
- 5
- Rating