Flashcards in Programming Paradigms Deck (41):
What are the three basic control structures?
Describe the features of Imperative Programming
Set of commands which can be called by name
Pass parameters between blocks of code
Give two advantages of modular coding
- Can be tested independently of the main program
- Can be re-used within the program
- Split up large programming problems
- Makes code more readable
List the main features of Object Orientated Programming
What can be used to describe a class?
What is Instantiation?
Creating an object from a class(blueprint) that is already defined
Give a benefit of inheritance
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
What is the ability to redefine methods in object orientated programming?
Describe what happens in Concurrent Programming
Several streams of operations may execute simultaneously
Describe a 'race condition'
When two threads both try to change the value of a variable simultaneously resulting in unpredictable results
What is it called when two threads are competing for the same resource resulting in neither of them completing their operations?
What is done to prevent race conditions occurring?
Placing a lock on shared data so only one thread can access it at a time
What is resource starvation?
Priority is constantly given to one thread, preventing other lower priority threads accessing the data needed for completion
What is resource starvation caused by?
What is concurrency control?
Ensuring operating happens in the correct order and access to resources is co-ordinated so they are shared among threads according to their priority
State some advantages of concurrent programming
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
Concurrent programming is a feature in what type of languages?
Give examples of languages designed with concurrent programming in mind
The role of setting up groups of program instructions as threads to run concurrently is managed by?
In what environment is concurrent programming particularly relevant to?
Multi Core Processor Architecture
What can the three main control structures be combined to form?
More powerful computational constructs
What does imperative programming focus on?
Describing how a program operates
One command is executed followed by another
If a condition is true then one command is executed else if the condition is not true then another command is executed
What is the difference between formal and actual parameters?
Formal - In the subroutine definition
Actual - In the subroutine call
What is declarative programming?
Programming paradigm that describes the desired results without listing the steps to be performed
What is Object Orientated Programming?
A style of programming allowing a program to be separated into blocks of related data, and the operations which apply to that data
What is a Class?
Definitions for the data format and the avaliable procedures for a given type of object
(Blueprint for an object)
What is an Object?
Instance of a class, block of related data and the operations which apply to that data
Who can access the data in an object?
Associated Operations of the Class
What is Inheritance?
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
What is Encapsulation?
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
What is a benefit of encapsulation?
Allows you to change part of the code without affecting other parts
Prevents unintended changing of data
What is Polymorphism?
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.
What is a stream of data called in concurrent programming?
What is a disadvantage of concurrent programming?
Code is difficult to write and debug
What are scripting languages typically used to do?
Add extra functionality or automate an application program/operating system
What is a macro?
Sequence of operations that can be invoked as a single task
What are Domain Specific Languages?
Subset of procedural languages that have been designed with one specific type of task in mind