Languages And Environments Flashcards
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.
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)
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.
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.
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.
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.
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.
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.
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,
Why are low-level languages used?
Allow for the optimisation of code because of a one to one relationship to machine code
Architecture/Platform dependent language
Low level language
Architecture/Platform independent language
High level language
Parameter
Data value which can be passed to a subroutine at run time.
Declarative Languages contain
Facts and rules
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 )