Chapter 26 Further programming Flashcards
What do we mean by programming paradigm? Give some examples.
It is a style of programming. A way of approaching the programming goal. Examples: Low-level programming paradigm Imperative programming paradigm Object oriented programming paradigm Declarative programming paradigm
A programming paradigm is linked to one program?
No it is not linked, a program can support several programming paradigms.
Describe low level programming paradigm.
It will modify directly the memory addresses of a given processor. Each different type of processor has it’s own programming language. Processor families can use similar programming languages (for example Intel family).
Describe Imperative programming paradigm.
Imperative means kötelező.
The programmer will write a sequence of steps that are then executed by the processor.
Examples: Pascal, C, Basic.
What is the main difference between Imperative programming paradigm and Declarative programming paradigm?
The approach is different, the Imperative programming paradigm tells the computer how to get to the desired result, Declarative programing will describe what the desired result should be.
Describe Object oriented programming paradigm
It is based on objects that are interacting with each other.
Python, Java were built from the beginnig as object oriented, Basic, Pascal, evolved to be object oriented.
Describe Declarative programming paradigm
Are described as formal logic instructions. It is common with database handling programs (SQL, Prolog).
What is a random file?
A file that stores records in specific addresses and can be accessed directly.
What is the pseudocode for:
- Create a file and open int for writing
- Open file for reading
- Open file for random access
- Close file
- Write a record to a file
- Read a record from a file
- Move to a specific disc address with the file
- Test for end of file
- OPENFILE FOR WRITE
- OPENFILE FOR READ
- OPENFILE FOR RANDOM
- CLOSEFILE
- PUTRECORD ,
- GETRECORD ,
- SEEEK , <address>
- EOF () </address>
What is the difference between Arrays and records
Arrays are built-in structures, the programmer chooses only the dimensions when declaring a variable of type array.
Records are user defined variable types. The programmer will first declare the record type (structure), then he will declare the variable with this record type.
Present the 2 methodes to write data in a file. Name the files types based on the methode
- Serialised files: data is written in one after the other in the file, que.
- Random file: data is linked to the memory addresses of the file, acces is also through the addresses.
Name 2 different Methode library. Which is the more widley used and why
Pickle, JSON.
JSON is more used because:
- the generated file is human readable
- is not platform dependante. Pickle can be used only with Python.
What are records?
User-defined types
Which are the ways in which you can save records?
Serial
Sequential
Random
Why is exceptional handling used?
To avoid run-time errors