extraa Flashcards

1
Q

Why close files?

A

When a file is “opened,” the operating system marks the file as locked, generally so it can’t be deleted by other processes while it’s being used. myFile.close() undoes the lock, allowing the operating system and other processes to do what it wishes with the file. It also releases any system resources associated with the stream.

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

What happens if a parameter is passed by value?

A

a copy of the variable is passed to the subroutine where it is treated as a local variable thus protecting it from being changed by the subroutine but also using additional memory space. It is destroyed when the subroutine has completed.

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

What happens if a parameter is passsed by reference

A

the reference to the memory location of the variable itself is passed Therefore if the value of the variable is changed, it remains changed after the subroutine ends. A literal value can’t be passed by reference obviously as it has no reference (more applicable to recursive subroutines).

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

If it is not stated will parameters be passed by value or by reference

A

By value

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

How do you do by value and by ref?

A

procedure calculateTotal(x:byVal, y:byRef)

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

What is encapsulation?

A

All of the object’s attributes are contained and hidden in the object by giving them the private access modifier. They are accessed through public getter and setter methods.

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

What is instantiation?

A

The process of creating an instance of a class.

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

What is a class?

A

A blueprint for creating an object.

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

What is an access modifier?

A

For example public and private which can be applied to attributes and methods in the class. Private means the attribute or method can not be accessed by code in another class while public means it can.

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

What is an atribute?

A

A specific piece of data representing a particular characteristic of an object.

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

What is a constructor?

A

A method that is called when creating an instance (object) of a class.

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

What is an object?

A

Instance of a class

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

What is OOP?

A

A programming paradigm which classifies real world objects into classes and encapsulates the object’s attributes and behaviours.

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

What are methods?

A

for example getters and setters and other subroutines that define the behaviour of the object.

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

What is inheritance?

A

A mechanism that allows an instance of a class to inherit attributes and methods from another class (the superclass/parent class). It can also have methods/attributes of its own.

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

Subclass

A

A class that inherits from another class is called a subclass (also a derived class, extended
class, or child class).

17
Q

Superclass

A

The class from which the subclass inherits from is called a superclass (or parent class).

18
Q

What is polymophism?

A

(many forms) The ability of an entity such as a variable, operator, method or object to have more than one form. There are multiple types of polymorphism. In OOP, the ability for classes that share a common superclass to have different implementations of a method with the same name is one example. This is called overriding.

19
Q

What are the advantages of inheritence?

A

reusability and readability. When child class inherits the properties and functionality of parent class, we do not need to write the same code again in child class. This makes it easier to reuse the code, makes us write the less code and the code becomes much more readable

20
Q

What are the disadvantages of inheritence?

A

When you choose to inherit from another class, you have coupled the two classes. What will happen if someone extends the base class? What will happen if someone changes the base class to inherit from another class? Your class may now have acquired attributes and methods that you are not aware of.

21
Q

What is the idea of an insertion sort?

A

Repeat the following for each item in the list, excluding the first
Remember the current item as the key
Move every item before the key that is bigger than it forward
Place the key item before these larger items

22
Q

Advantages of insertion sort?

A

Advantages
Easy to implement
Good for small data sets that are almost sorted
Insertion sort generally performs quicker than bubble sort and is therefore preferable

23
Q

Disadvantages of insertion sort

A

Disadvantages
Does not scale well so is not good for large data sets

24
Q

What is a bit shift?

A

An operation that moves the bits in a byte, nibble etc by a determined number of places to either the left or right.

25
Q

Bitwise AND operator

A

A operation that takes two equal-length binary representations and performs the logical AND operation on each pair of the corresponding bits.

26
Q

Bitwise OR operator

A

A operation that takes two equal-length binary representations and performs the logical OR operation on each pair of the corresponding bits.

27
Q

Bitwise XOR operator

A

A operation that takes two equal-length binary representations and performs the logical XOR operation on each pair of the corresponding bits.

28
Q

Mask/bitmask

A

Data that is used with a bitwise operator. Using a mask, bits in a byte, nibble, etc. can be set either on or off, or inverted in a single bitwise operation

29
Q

Left shift

A

When shifting left, the most-significant bit is lost and a 0 * fills the least significant bit.

30
Q

Right shift

A

When shifting right, the least significant bit is lost, and a 0 * fills the most significant bit.

31
Q

What is a bit mask?

A

A bit mask is data that is used with a bitwise operato

32
Q

What is second normal form

A

Non-key fields must depend on every part of the primary key

33
Q

What is third normal form?

A

There are no non-key fields that depend on another non-key field

34
Q

First principle of the misuse act?

A
  1. Unauthorised access to computer material.
35
Q

Second principle of the computer misuse act?

A
  1. Unauthorised access with intent to commit or facilitate commission of further offences.
36
Q

Third principle of the misuse act?

A
  1. Unauthorised acts with intent to impair, or with recklessness as to impairing, operation of computer, etc.
37
Q

name some principles of the data protection act

A

Storage Limitation - personal data must be kept for no longer than is necessary
Lawful, fair and transparent - processing must be lawful, fair and transparent; For example, a speeding ticket - not unfair. Asking for consent to use photographs is lawful
Accuracy - personal data must be accurate and kept up to date
Purpose limitation - purposes of processing must be specified, explicit and legitimate

Minimisation of data - personal data must be adequate, relevant and not excessive
Integrity & Confidentiality - personal data must be processed in a secure manner
Accountability - the controller shall be responsible for, and be able to demonstrate compliance