Principles of Programming Flashcards
Define a Boolean value in Backus-Naur form
<Boolean> ::= "True" | "False"
</Boolean>
Define the primary colours in Backus-Naur form
<PrimaryColours> ::= "red" | "yellow" | "blue"
</PrimaryColours>
Define the seasons of the year in Backus-Naur form
<Seasons> ::= "Spring" | "Summer" | "Autumn" | "Winter"
</Seasons>
Define the digits(0-9), both
<Digits> ::= [0-9]
or
<Digits> ::= "0" | "1" | "2" | ...
</Digits></Digits>
Define a Programming paradigm
It is an approach to solve problems by using programming languages
Name four common programming paradigms
Procedural/Imperative
Object-Oriented
Declarative
Functional
Describe Procedural/Imperative
A program that can be split into procedures or subroutines
Describe Object-Orientated
Classes are used to define objects in order to model the problem to be solved
Describe Declarative Languages
Use commands to set the goal and all outcomes for a task, doesn’t involve code, or instructions on how to complete the task
Describe Functional Languages
Emphasizes the composition of functions and the avoidance of side effects
Define a Class
A blueprint or template for creating objects
What are attributes in relation to OOP
Attributes are the data members of a class.
They represent the characteristics or properties of objects created from the class
What are Methods in relation to OOP
Methods are the functions defined within a class. They define the behavior/actions that objects created from the class can perform
What do methods operate on
The class’s attributes
What are objects in relation to OOP
An object is an instance of a class, it is an entity created based on the class blueprint.