1.2.4 Types of programming language - b + e DONE Flashcards

(24 cards)

1
Q

What is a programming paradigm?

A

Programming paradigms are established conventions and practices that dictate how computer programs are structured and developed.

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

Define a low-level language

A

A low-level language is a type of computer language that is closely aligned with the basic instructions that a computer’s hardware understands.

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

What are the features of low-level languages?

A
  • They allow programmers to work directly with the hardware
  • They can be more complex
  • Less flexible than high-level languages.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define a high-level language

A

A high-level programming language is a programming language that uses English-like words, making it easier for humans to read, write and understand.

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

What are the features of high-level languages?

A
  • They are portable because they are independent of specific hardware
  • They must be translated into machine code using a compiler or interpreter
  • They provide abstraction from hardware details, include built-in libraries and advanced features
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe procedural programming languages

A

Languages that carry out code a sequence of instructions step-by-step and organise code into reusable blocks (procedures) which perform specific tasks.

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

What are the advantages of procedural programming languages?

A
  • Calling subroutines reduces the amount of repeated code
  • Large programs can be worked on by a team of programmers who develop individual subroutines concurrently
  • Simple to implement
  • Suited to problems that can easily be expressed as a series of instructions using the sequence, selection, iteration and recursion constructs
  • Can be applied to a wide range of problems
  • Relatively easy to write and interpret
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the disadvantages of procedural programming languages?

A
  • Not possible to solve all problems with these languages and can be inefficient to do so
    -It struggles when attempted to be used to reuse classes or make them inherit from one another.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How are procedural languages used?

A

They are commonly used for software development, data processing and teaching programming fundamentals as they emphasise logical structure and modular design.

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

Describe object oriented programming languages

A

They organise code around objects, which combine data (attributes) and behaviour (methods) into reusable units.

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

Describe how classes are used in Object Oriented programming Languages

A

Classes are templates from which objects are created. They define both attributes and methods.

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

How do you define a class in Python?

A

e.g.
class Dog:
def __init__(self, name,
breed, height, weight):
self.name = name
self.breed = breed
self.height = height
self.weight = weight

self.__variable is used to indicate that the variable is private

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

What is the difference between private and public attributes and methods?

A

If an attribute/method is public it can be called by a class. If it’s private it can only be called by the current class.

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

What is a getter?

A

A method which retrieves the value of a given attribute

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

What is a setter?

A

A method that sets the value of a given attribute

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

Describe how Encapsulation is used in Object Oriented Programming Languages

A

Classes can be encapsulated by making attributes private and providing public access methods. This allows for the private attributes to only be able to be edited by public methods. This allows data to be protected.

17
Q

Describe how get and set methods are used to access private attributes

A

Getters and setters are used to make sure attributes can’t be directly accessed and edited by users.

18
Q

What is a constructor?

A

It allows a new object to be created

19
Q

Describe inheritance in Object Oriented programming

A

It enables a child class to be created which can reuse or extend the classes of the parent class. This promotes the reuse of code.

20
Q

Describe polymorphism in Object Oriented Programming

A

It means that objects can behave differently depending on their class​. This can result in the same methods producing different outputs.

21
Q

Describe overriding as a form of polymorphism

A

Redefining a method within a subclass and altering the code so that it functions differently and produces a different output.

22
Q

Describe overloading as a form of polymorphism

A

Passing different parameters into a method.

23
Q

What are the advantages of Object Oriented Programming?

A

-It has an advantage in security as encapsulation protects attributes from being directly accessed.
-It is efficient as classes can be reused and inherit from one another.
-The separation of components into classes make programs easy to update and maintain
-It is flexible due to polymorphism

24
Q

What are the disadvantages of Object Oriented programming?

A
  • It is not suited to problems where few components are reused as it may result in a longer and more inefficient program.
  • Generally unsuitable for smaller problems
  • Requires an alternative style of thinking and advanced planning to determine how a problem will be broken down into classes.