Languages And Environments Flashcards

1
Q

What is the purpose and main characteristics of a declarative programming language. Give an example.

A

Code defines a set of logical statements - facts and rules - rather than carrying out instructions in a sequence.
Searches logical statements for conclusions as it is run.
Example - Prolog, used for artificial intelligence applications. It defines sets of unordered rules and facts known as a knowledge base.

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

What is the purpose and main characteristics of object-oriented programming? Give an example.

A

Classes are defined which include variables and methods (special procedures which define how the object behaves)
Each object created during the execution of an o-o program is called an instance of a class.
New objects will have a copy of the data required to define the object and may inherit data defined in other classes.
Example - Game programming and to model real-life situations (due to easy creation and deletion of objects)

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

Why do programs need to be translated into binary?

A

All processors have their own instruction set. Before execution on a specific processor, programs must be translated into binary which correspond to the processors instruction set.

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

Demonstrate the relationship between a computers instruction set and its program code.

A

-Low level languages like Assembly language have a 1:1 relationship between commands and binary machine code.

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

What is meant by ‘High level language programs are described as platform independent, whereas binary programs are platform specific’?

A

HLL programs are compiled to run on different processors with different instruction sets.
Binary programs must be written according to the platform in which they are to be run on - on only one computer with a single instruction set.

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

Which programming language would be best for writing a touch screen phone application? Why?

A

Object oriented because different objects to be selected or dragged by touch are used.

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

Why does every programming language have a strict set of rules defining how lines of code should be formatted?

A

So it is possible for a compiler to be created to translate the code as users would be prevented from entering instructions in any way they like.

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

Why do most assembly languages instructions still need to be translated into binary?

A

The computers hardware is built to store and process only binary and so all data and instructions must be stored and processed as binary.

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

What is the purpose and main characteristics of a procedural language program? Give an example.

A

Written out in blocks of code called subroutines, procedures or functions.
Program carries out instructions one at a time
Examples include - Visualbasic, TrueBASIC,

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

Why are low-level languages used?

A

Allow for the optimisation of code because of a one to one relationship to machine code

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

Architecture/Platform dependent language

A

Low level language

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

Architecture/Platform independent language

A

High level language

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

Parameter

A

Data value which can be passed to a subroutine at run time.

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

Declarative Languages contain

A

Facts and rules

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

Feature of a declarative language and what is it used for?

A

Pattern matching

rules - join existing facts together using :- ( if ) and logic operators ( AND, OR )

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

State

A

The value of an attribute/instance variable at any given time within the context of object oriented programming

17
Q

Inheritance and maintenance

A
Errors fixed in a super class/sub class get reflected automatically in sub classes/instances when using object oriented languages
This saves time
18
Q

Translator

A

Required for the creation of executable code
Software held in RAM translates source code into executable code
Uses interpreter/compiler

19
Q

Operation/Method (Object-oriented)

A

Code which changes the state of an object’s attribute in object oriented environment

20
Q

Instruction Set

A

The built in instructions processors are manufactured with
Before a program can be executed on a specific processor is must be translated into binary which corresponds to the processors instruction set

21
Q

Why is it unlikely for a programmer to write LLL instructions in binary?

A

Code is difficult to read

Hard to find any mistakes when inputting long lists of 1s and 0s

22
Q

Assembly Language

A

Used to write LLL instructions
Consists of codes that represent each instruction from the instruction set
Must still be translated into binary equivalent before program can be run

23
Q

High Level Language

A

Written in English, using a strict syntax
Completed HLL instructions translated into a separate binary program using a compiler
Simpler way to program
Not as efficient as LLL code

24
Q

Types of high level language

A

Procedural, declarative, object-oriented

25
Q

Procedural language

A

Written in blocks of code - Procedures, functions, subroutines
Instructions carried out one at a time

26
Q

Declarative

A

Not written as a sequence of instructions
Code defines a set of logical statements
These are searched for conclusions

27
Q

Object-Oriented

A

Classes defined which include;
Variables - Store information on the object
Methods - Special Procedures which define how an object behaves
Object created during program execution is known as an instance of a class

28
Q

What do new objects (Instances) in object-oriented programming have?

A

A copy of the data required to define the object
Data defined in other classes
Often used in programs which model real life situations
Objects can be created, destroyed and modified just as they would in reality

29
Q

Ideal scenario for object-oriented code to be used

A

Game programming as objects in games are regularly created and destroyed during gameplay

30
Q

Low Level Language Features

A

Processor specific

There is a one to one relationship between language commands and machine instructions

31
Q

Declarative Language feature

A

Uses a knowledge base of facts and rules and matches these with a query to provide a solution to a problem

32
Q

An object-oriented programming language can be described as

A

A language where the programmer defines both the data and the operations which can be carried out on it