Docsity

A LEVEL computer science - types of programming language, Exams of Applications of Computer Sciences

Toggle sidebar
bg1
A LEVEL computer science:
1.2.4 - types of programming
language
define attribute - ANSvalue held by an object/link to variable
define instantiation - ANScreating an object/a new instance of a class
define method - ANSan action an object performs/link to procedure/function
define object - ANSan instance of a class
define opcode - ANSspecifies the instruction to be performed from list of
mnemonics
define operand - ANSholds a value which is related to the data on which the
instruction is to be performed
discuss the use of OOP and procedural programming to create and
manipulate queue data structures - AO1 - ANS- OOP defines an object as an
independent entity
- OOP defines the attributes of the objects and the methods that could be
applied to it (e.g. enqueue(), dequeue())
- in OOP, attributes could be private to restrict accidental changes
- in procedural programming, the statements are executed line-by-line in the
order they were written
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download A LEVEL computer science - types of programming language and more Exams Applications of Computer Sciences in PDF only on Docsity!

A LEVEL computer science:

1.2.4 - types of programming

language

define attribute - ANSvalue held by an object/link to variable define instantiation - ANScreating an object/a new instance of a class define method - ANSan action an object performs/link to procedure/function define object - ANSan instance of a class define opcode - ANSspecifies the instruction to be performed from list of mnemonics define operand - ANSholds a value which is related to the data on which the instruction is to be performed discuss the use of OOP and procedural programming to create and manipulate queue data structures - AO1 - ANS- OOP defines an object as an independent entity

  • OOP defines the attributes of the objects and the methods that could be applied to it (e.g. enqueue(), dequeue())
  • in OOP, attributes could be private to restrict accidental changes
  • in procedural programming, the statements are executed line-by-line in the order they were written

discuss the use of OOP and procedural programming to create and manipulate queue data structures - AO2 - ANS- OOP allows for an object to be created from the queue

  • many instances of the queue can then be declared in the main program
  • procedural will need each queue to be declared individually
  • procedural will need to make use of subroutines where the queue will need to be sent and returned each time discuss the use of OOP and procedural programming to create and manipulate queue data structures - AO3 - ANS- in OOP, you can create multiple instances of the queue as required by the program without having to rewrite all of the declarations etc.
  • in procedural programming, you would have to write separate code for each new queue
  • OOP reduces the amount of code needed therefore fewer errors are likely as code is written once and then used multiple times
  • OOP can reduce mistakes - because the subroutines are self-contained in procedural, it would need to make sure the correct values are passed and returned, or global variables would need to be used which requires excess memory what are advantages of encapsulation? - ANS- reduces the chance of errors/inconsistencies
  • ensures objects can only be changed in the way intended/ensuring changes are consistent with how the object should behave
  • protecting data/data can't be changed accidentally what are getters - ANSa (special) method used to retrieve the value of a given attribute
  • encapsulation: the source code for an object can be written, tested and maintained independently of the code for other objects
  • once an object is created, knowledge of how its methods are implemented is not necessary in order for a programmer to use it e.g. black box
  • new objects can easily be created with small differences to existing ones through inheritance
  • reusability: objects that are already defined, coded and tested may be used in many different programs
  • OOP provides a good framework for code libraries with a range of software components that can easily be adapted by a programmer
  • software maintenance: an OOP is much easier to maintain than one written in a procedural language because of its modular structure what are the advantages of using assembly language over HLLs? - ANS- allows programmer to choose the exact instructions so can write code that is highly efficient
  • allows them to have direct control of how memory is used via addressing modes
  • allows direct control of hardware although, HLL compilers have optimisers that can also try to do this (and in some cases may outperform a human writing in assembly code) what are the categories of polymorphism? - ANSoverride, overload what are the different modes of addressing memory? - ANSimmediate addressing, direct addressing, indirect addressing, indexed addressing what are the disadvantages of OOP? - ANS- a different style of programming and so requires an alternative style of thinking. this can be difficult for programmers accustomed to other paradigms to pick up.
  • OOP is not suited to all types of problems. where few components are reused, OOP may in fact result in a longer, more inefficient program as there could be a tendency of over abstraction.
  • generally unsuitable for smaller problems what are the generations of programming? - ANSmachine code --> assembly code --> HLL --> declarative what are the mnemonics/3 letter codes used in assembly language - ANSADD SUB STA LDA BRA BRP BRZ DAT HLT INP OUT what does having different address modes allow for? - ANSa much greater number of locations for data to be stored as the size of the operand would otherwise constrain the number of addresses that could be accessed what is assembly language? - ANSthe next level up from machine code and is a part of a family of LLL. this is converted to machine code using an assembler when it is executed

what is immediate addressing? - ANSthe operand is the actual value upon which the the instruction is to be performed, represented in binary what is indexed addressing? - ANSan index register is used, which stores a certain value. the address of the data is determined by adding the operand to the index register. this is necessary to add an offset in order to access data stored contiguously in memory such as in arrays what is indirect addressing? - ANSthe operand gives the address of a data register which holds another address, where the data is located what is information hiding? - ANSwhere a class cannot directly access the attributes of another class when they are declared private what is inheritance? - ANSthe subclass (or derived class) gains all of the public methods and attributes of the superclass (or parent class) and can have its own additional properties. this allows you to modify and add extra functionality to a class (polymorphism). by using inheritance with a logical hierarchy of classes, a project can model the real world more closely. this makes the coding more modular allows programmers to effectively reuse certain components and properties while making some changes what is object-oriented programming? - ANSa programming paradigm which uses classes to model real-world objects. a class is a blueprint design/template for an object which contains public methods, private attributes, and public properties

focuses on making programs that are reusable and easy to update and maintain. therefore is applicable to certain types of problems which use lots of reusable components or similar characteristics e.g Python, Delphi, Java what is overloading? - ANSpassing in different parameters into a method e.g. different number or different type what is overriding? - ANSredefining a method within a subclass and altering the code so that it functions differently and produces a different output what is polymorphism? - ANSobjects can behave/be processed differently depending on their class. this can result in the same method producing different outputs depending on the object involved e.g. a child class can have modified methods to gain extra functionality what is procedural programming? - ANSa type of imperative programming which uses a sequence of instructions which may be contained within procedures. these instructions are carried out in a step by step manner can be applied to a wide range of problems and is relatively easy to write and interpret e.g. Pascal. Python, Logo