Types of Programming Languages Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are Programming Paradigms

A

Different ways of using a programming language to solve a problem

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

Describe the Programming Paradigms Diagram

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

What is an Imperative Programming Paradigm

A

Uses code that clearly specifies the actions to be performed

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

What is a Procedural Paradigm

A
  • Easy to write and interpret since it provides traditional data types and data structures
  • Written as a sequence of instructions
  • Widely-used paradigms as it can be applied to a wide range of problems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an Object-Oriented Paradigm

A
  • Based on objects formed from classes which have attributes and methods
  • Focuses on making programs that are reusable and easy to update and maintain
  • Suited to problems which can be broken into reusable components with similar characteristics
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Declarative Programming Paradigm

A
  • States the desired result and the programming language determines how best to obtain the result
  • Details about how result is obtained are abstracted from the user
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a Functional Paradigm

A
  • Functions form the core of the program
  • Function calls are often combined within each other
  • Closely linked to mathematics
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a Logic Paradigm

A
  • A set of facts and rules based on the problem is defined
  • Queries are used to find answers to problems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the four main structures used in structured programming

A
  • Sequence - code is executed line-by-line
  • Selection - a certain block of code is run if a specific condition is met
  • Iteration - a block of code is executed a certain number of times or while a condition is met
  • Recursion - functions are expressed in terms of themselves. Functions are executed, calling themselves, until the base case is reached
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Assembly Language

A
  • A low level language that uses mneomincs to represent instructions
  • Each line in assembly language is equivalent to one line of machine code
  • The instruction is divided up into operand and opcode
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe the List of Mnemonics used in Assembly Language

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

What is Machine Code split up into

A
  • Opcode - specifies the instruction to be performed and the addressing mode
  • Operand - holds a value related to the data on which the instruction is to be performed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are Addressing Modes

A
  • Addressing Modes specifies how the operand should be interpreted
  • Addressing Modes are better because they allow for more address locations to be acessed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the four Addressing Modes

A
  • Immediate Addressing - the operand is the actual data upon which the instruction is to be performed
  • Direct Addressing - the operand gives the address which holds the value upon which the instruction is to be performed (used in Little Man Computer)
  • Indirect Addressing - the operand gives the address of a register which holds another address, where the data is located
  • Indexed Addressing - an index register is used, which stores a certain value. The address of the operand is determined by adding the operand to the index register (this is necessary in order to access data stored continguously/ togther in arrays)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a class

A

A template for an object which defines the attributes and methods of the object

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

What are the Components of Object-Oriated Languages

A
  • Attributes - an object’s properties
  • Methods - the actions it can perform
  • Classes - templet for objects
  • Object - a particular instance of a class
  • Setter - a method that sets the value of a particular attribute
  • Getter - a special method used in object-oriated langauges which retrieves the value of a given attribute
  • Constructor - a method which allows a new object to be created
17
Q

Explain the advantage of using Encapsulation in code

A
  • Encapsulation allows the user to make attributes private
  • These private attributes are only accessible through public methods
  • This resticts other users from changing the value of these private attributes
18
Q

What are the two properties of an object-oriented language

A
  • Inheritance
  • Polymorphism
19
Q

What is Inheritance and Polymorphism

A
  • Inheritance - a class can inherit from another class The subclass will possess all of the methods and attributes of the superclass (or parent class) and can have its own additional properties. This allows programmers to effectively reuse certain components and properties while making some changes
  • Polymorphism - objects can behave differently depending on their class. This can result in the same method producing different outputs depending on the object involved.
20
Q

What are the advantages of object-oriented programming

A
  • Designs - this type of programming forces designers to go through extensive planning phase, which makes for better designs
  • Resuability - objects that are already defined, coded and tested can be used in many different programs
  • Encapsulation - the source code of an object can be written, tested and maintained indepedent of the code for other objects
  • Abstraction - it is not necessary for programmers to know details about how code is implemented. Once classes have been created and tested, they can be reused as a black box which saves time and effort
  • Maintence - this type of programming is much easier to maintain because of it’s modular structure
21
Q

What are the disadvantages of object-oriented programming

A
  • This is a different style of programming and so requires an alternative style of thinking. This can be difficult for programmers accustomed to other paradigms to pick up.
  • OOP is not suited to all types of problems. Where few components are reused, OOP may in fact result in a longer, more inefficient program
  • Generally unsuitable for smaller problems
22
Q

What are the two different categories of Polymorphism

A
  • Overriding - when a method is redefined within a subclass so that it functions differently and produces a different output
  • Overloading - passing in different parameters into a method to produce a different output