Programming Paradigms Flashcards

1
Q

What are the three basic control structures?

A

Sequence
Selection
Iteration

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

Describe the features of Imperative Programming

A

Set of commands which can be called by name
Pass parameters between blocks of code
Modularity

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

Give two advantages of modular coding

A
  • Can be tested independently of the main program
  • Can be re-used within the program
  • Split up large programming problems
  • Makes code more readable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

List the main features of Object Orientated Programming

A
Classes
Objects
Methods
Encapsulation
Instance Variables
Inheritance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What can be used to describe a class?

A

Class Diagram

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

What is Instantiation?

A

Creating an object from a class(blueprint) that is already defined

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

Give a benefit of inheritance

A
Once a class has been defined and tested, sub-classes can then be created which share the main characteristics of parent class
-Saves testing and development time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the ability to redefine methods in object orientated programming?

A

Polymorphism

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

Describe what happens in Concurrent Programming

A

Several streams of operations may execute simultaneously

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

Describe a ‘race condition’

A

When two threads both try to change the value of a variable simultaneously resulting in unpredictable results

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

What is it called when two threads are competing for the same resource resulting in neither of them completing their operations?

A

Deadlock

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

What is done to prevent race conditions occurring?

A

Placing a lock on shared data so only one thread can access it at a time

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

What is resource starvation?

A

Priority is constantly given to one thread, preventing other lower priority threads accessing the data needed for completion

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

What is resource starvation caused by?

A

Poor scheduling

Prioritizing

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

What is concurrency control?

A

Ensuring operating happens in the correct order and access to resources is co-ordinated so they are shared among threads according to their priority

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

State some advantages of concurrent programming

A

A user can interact with applications while other tasks are running
Long running tasks need not delay short running ones
Complex programs can make better use of multiple resources in multi core processors

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

Concurrent programming is a feature in what type of languages?

A

Declarative

Object Orientated

18
Q

Give examples of languages designed with concurrent programming in mind

A

Java, Salsa

19
Q

The role of setting up groups of program instructions as threads to run concurrently is managed by?

A

Translation software

20
Q

In what environment is concurrent programming particularly relevant to?

A

Multi Core Processor Architecture

21
Q

What can the three main control structures be combined to form?

A

More powerful computational constructs

22
Q

What does imperative programming focus on?

A

Describing how a program operates

23
Q

Define ‘Sequence’

A

One command is executed followed by another

24
Q

Define ‘Selection’

A

If a condition is true then one command is executed else if the condition is not true then another command is executed

25
Q

Define ‘Iteration’

A

Repetition

26
Q

What is the difference between formal and actual parameters?

A

Formal - In the subroutine definition

Actual - In the subroutine call

27
Q

What is declarative programming?

A

Programming paradigm that describes the desired results without listing the steps to be performed

28
Q

What is Object Orientated Programming?

A

A style of programming allowing a program to be separated into blocks of related data, and the operations which apply to that data

29
Q

What is a Class?

A

Definitions for the data format and the avaliable procedures for a given type of object
(Blueprint for an object)

30
Q

What is an Object?

A

Instance of a class, block of related data and the operations which apply to that data

31
Q

Who can access the data in an object?

A

Associated Operations of the Class

32
Q

What is Inheritance?

A

Sharing of characteristics between a super class and a newly created subclass, where subclass inherits all the methods and variables from super class and can add it’s own as well

33
Q

What is Encapsulation?

A

Bundling of data with methods that operate on that data

Hides the values of data within class, can only be accessed by methods of that object

34
Q

What is a benefit of encapsulation?

A

Allows you to change part of the code without affecting other parts
Prevents unintended changing of data

35
Q

What is Polymorphism?

A

When you can treat an object as a generic version of something, but when accessing it, the code determines which exact type it is and calls the associated code.

36
Q

What is a stream of data called in concurrent programming?

A

Thread

37
Q

What is a disadvantage of concurrent programming?

A

Code is difficult to write and debug

38
Q

What are scripting languages typically used to do?

A

Add extra functionality or automate an application program/operating system

39
Q

What is a macro?

A

Sequence of operations that can be invoked as a single task

40
Q

What are Domain Specific Languages?

A

Subset of procedural languages that have been designed with one specific type of task in mind

41
Q

Give an example of a domain specific language and what is was designed for?

A

SQL which was designed to formulate database queries