What is programming paradigms?
Different approaches to using a programming language to solve a problem.
What are the Two Broad categories of programming paradigms?
imperative and declarative
What does the imperative Paradigm contain?
Procedural and Object orientated paradigms
What does the Declarative Paradigm contain?
logic and functional paradigms
What type of code does imperative programming paradigms use?
use code that clearly specifies the actions to be performed.
What type of code does procedural programming paradigms use?
Uses a sequence of instructions which may be contained within procedures. These instructions are carried out in a step-by-step manner.
What are benefits of procedural programming paradigms?(2)
Can be applied to a wide range of problems
And is relatively easy to write and interpret
What is OOP paradigms?
OOP is built on entities called objects, formed from classes which have
certain attributes and methods. OOP focuses on making programs that are reusable and easy to update and maintain.
When is OOP mainly used?
Certain types of problem with lots of reusable components which have similar
characteristics.
What is declarative programming?
The language states what is required but not how to do it and The statements do not have to be in a specific order
Where is declarative language commonly used?
This type of programming is common in expert systems and artificial intelligence
What is functional programming?
It’s a programming style that builds programs by combining reusable functions, similar to how math works. Functions are the main building blocks.
What is Logic programming?
A style of programming where you define facts and rules, and use queries to find answers. The computer figures out how to solve the problem for you.
What is recursion in programming?
Recursion is when a function calls itself . It keeps calling itself until it reaches a base case, which stops the recursion.
What type of language is assembly code?
Assembly code is a low-level language that is closely related to machine code
Why is assembly language easier to use then machine code?
Assembly language uses mnemonics rather than binary,
What is a class?(3 marks)
A template defining methods and attributes used to make objects
What is inheritance?(3 marks)
Inheritance is when a class takes on the methods and attributes of a parent class .
What is special about and inherited class?(2 marks)
The inheriting class may override some of these methods/attributes and
may have additional extra methods and attributes of its own .
What is the main class sometime called?
The base class.
Describe three features of an object-oriented language.
1.They have classes which contains methods and attributes.
2.Uses encapsulation to hide data within objects,
3.Has inheritance where there are sub classes and superclass’s.
What happens when an attribute is private?
It cant be directly accessed and therefore public methods are used to change/read
the attributes value.
How would we initialise this class?
class video
private name
private views
private starrating
public procedure new(newname)
name = NewName
views = 0
starrating = 3
end procedure end classvideo1= new video(“Macbeth”)
How would we use inheritance (Show the line of code)
Class (newclass) inherits(main class)