Languages And Environments Flashcards Preview

Higher Computing (SDD) > Languages And Environments > Flashcards

Flashcards in Languages And Environments Deck (32):
1

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

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.

2

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

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)

3

Why do programs need to be translated into binary?

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.

4

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

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

5

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

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.

6

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

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

7

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

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.

8

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

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

9

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

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

10

Why are low-level languages used?

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

11

Architecture/Platform dependent language

Low level language

12

Architecture/Platform independent language

High level language

13

Parameter

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

14

Declarative Languages contain

Facts and rules

15

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

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

16

State

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

17

Inheritance and maintenance

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

18

Translator

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

19

Operation/Method (Object-oriented)

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

20

Instruction Set

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

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

Code is difficult to read
Hard to find any mistakes when inputting long lists of 1s and 0s

22

Assembly Language

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

High Level Language

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

Types of high level language

Procedural, declarative, object-oriented

25

Procedural language

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

26

Declarative

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

27

Object-Oriented

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

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

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

Ideal scenario for object-oriented code to be used

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

30

Low Level Language Features

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

31

Declarative Language feature

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

32

An object-oriented programming language can be described as

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