CS november mock

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/198

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

199 Terms

1
New cards

object-oriented programming

a programming paradigm that uses objects, that have thier own attributes and methods

objects interact with each other

processing is done by objects

2
New cards

Class

a blueprint for an object

defines attributes and methods that capture the charecteristics of the object

3
New cards

Constructor

a method which allows new objects in the class to be created, runs automatically

4
New cards

Abstraction

removing unecessary details that do not contribute to the overall problem

*The London underground is a good example of abstraction

5
New cards

Encapsulation

All data and methods of each objects are wrapped up into a single entity

Involves hiding the implementation of an object from the rest of the application

*Necessary as Client code is not meant to change values of an objects atrributes

6
New cards

Private vs public

*By default an objects methods and attributes are public - They can be directly accessed by the client

*a double underscore is used to indicate it's attributes and methods are private, This is an example of encapsulation - can only be accessed by methods of the object itself

7
New cards

Instantiation

a statement for creating an object belonging to a particuclar class

8
New cards

Inheritance

Inheritance is when a child class (or subclass) inherits the attributes and methods from the parent class (or superclass)

*The functionality of the child class can be changed by adding additional methods or changing pre-existing methods inherited from the parent class (This is known as overriding)

*based on a "is a" relationship

9
New cards

Polymorphism

redefining a class method defined in a superclass, using the same method name it is altered to behave differently through overriding

10
New cards

Overiding

where a method in the subclass takes precedence over the method with the same name in the base class

11
New cards

Class diagram

A way of representing the relationship between classes

*Hierarchal in structure - superclass at top with subclasses beneath

*inheritance is represented using arrows

*defines data type and whether they are protected, private or public

<p>A way of representing the relationship between classes</p><p>*Hierarchal in structure - superclass at top with subclasses beneath</p><p>*inheritance is represented using arrows</p><p>*defines data type and whether they are protected, private or public</p>
12
New cards

Public, Private and Protected (Class diagrams)

Public methods are represented using a "+"

- visible to all classes

private methods are represented using a "-"

- Can only be used in that class

Protected methods are represented using "#"

- can be used by subclasses of the class

13
New cards

Association

*Is a "has a" relationship between two classes, meaning they can be created and deleted independantly

*Is a method of creating new objects that contain existing objects, based on the way which objects are related

14
New cards

Association Composition

Creating an object that contains other objects, and will cease to exist if the containing object is destroyed

*represented by a filled in diamond

<p>Creating an object that contains other objects, and will cease to exist if the containing object is destroyed</p><p>*represented by a filled in diamond</p>
15
New cards

Aggregation Association

Creating an object that contains other objects, which can continue to exist even if the containing object is destroyed

*represented by a diamond that is not filled in

<p>Creating an object that contains other objects, which can continue to exist even if the containing object is destroyed</p><p>*represented by a diamond that is not filled in</p>
16
New cards

OOP three design principles

*Favour composition over inheritance

- Allows greater flexibility

- Composition is less rigid than inheritance relationships

*Encapsulate what varies

- if something varies it should be put into it's own class

- done in order to reduce testing and aid in maintanence

*Program to interfaces not implementation

- Focusing design on what code is doing, not how

- To solve this we can program and interface, which is a collection of abstract methods

- Remember an interface is purely a declaration of capability, there is no actual implementation of code

17
New cards

Adavantages of three principles

*Forces designers to go through an extensive planning, phase which makes for better designs with less weaknesses

*through Encapsulation classes can contain all the data and procedures needed

*Once an object is created, knowledge of how it's methods are implemented is necessary for programming

18
New cards

Recursion

Is a function that calls itself while running

<p>Is a function that calls itself while running</p>
19
New cards

Characteristics of recursion

*Stopping condition (base) must be included - means routine will not call itself when a condition is met and will "unwind"

*For input values other than the stopping condition, the routine must call itself

*The stopping condition must be reached under a finite number of calls

<p>*Stopping condition (base) must be included - means routine will not call itself when a condition is met and will "unwind"</p><p>*For input values other than the stopping condition, the routine must call itself</p><p>*The stopping condition must be reached under a finite number of calls</p>
20
New cards

Recursion stack overflow

Every time a subroutine is called, the return address (the line after CALL statement) is put on the call Stack

*Even with a Stopping Condition, The recursive routine can be called a limited number of times before it will overflow the maximum memory capacity of the stack

21
New cards

State reasons why many programmers follow the design principle ‘favour composition over inheritance.’

If using inheritance, there can be unintended side-effects for the derived classes if a method in the base class is altered.

Composition is more flexible as if a new class is developed it can easily be used instead of the class that is currently used in the composition

22
New cards

Describe the relationships aggregation and composition, making it clear what the difference between the two is

Composition and aggregation are both ‘has a’ relationships - when an object contains another object

With composition if the containing object is destroyed so are the objects it contains, this is not the case with aggregation

23
New cards

Explain the circumstances when it would be more appropriate to use an adjacency matrix instead of an adjacency list

when the graph is more dense

when you have to change edges more often

24
New cards

Adding an item to a circular queue

Check if queue is not full.

Compare rear pointer with max array size.

If equal, set rear pointer = 0 (or first index).

Else, increment rear pointer by 1.

Insert new item at position of rear pointer.

25
New cards

Removing item from circular queue

  1. Check if the queue is not already empty.

  2. Compare the value of the front pointer with the maximum size of the array.

  3. If equal, set front to 1 (or the first position index if one-based).

  4. Otherwise, increment front by one.

  5. Return/remove the item at the old front position.


26
New cards

Describe the extra steps with adding an item to a priority queue that isn’t required with linear

Starting with the item at the rear of the queue move each item back one place in the array;

Until you (reach the start of the queue or) find an item with the same or higher priority than the item to add;

Add the new item in the position before that item;

27
New cards

intractable problem

a problem that can be solved but cannot be solved in polynomial time 

28
New cards

Two advantages of normalised representation in floating point

Maximises accuracy for a given number of bits

unique representation of each number

29
New cards

Two reasons why Unicode was introduced as an alternative to ASCII

To enable the representation of a greater range of characters

Improved portability of documents with Unicode

30
New cards

Explain how majority voting works

majority voting sends the same bit in groups of 3, so that if a corruption occurs, the receiver sees they are not all the same and assumes the one it received most copies of is the correct value for the bit

31
New cards

Explain what is meant by a character code

a character code is a unique number to represent each character

32
New cards

what is a pixel

a picture element

33
New cards

describe how an ADC converts analogue signals to digital

The ADC takes samples of the signal at regular intervals

The amplitude of samples are measured

Each sample is assigned a binary value

34
New cards

digital camera

light passes through the camera lens and is refracted

to reach a grid of light sensors which measure light intensity.

the light sensors pass through

colour filters to block out any other light such as red light

passing through a red filter will block out blue light. this is

then detected by a light sensor of that colour which

generates a voltage signal to be converted to a pixel creating

the image. this conversion is done by an ADC converting the

measurement of light intensity into binary

35
New cards

RFID

RFID tag is a passive device which contains circuitry and an antenna

Memory on the tag stores data. The RFID reader which is an active device

sends a signal to the RFID tag which activates it. The RFID tag sends data

by radio to the RFID reader which converts the radio wave back into binary data

36
New cards

Barcode scanner

The user moves the barcode scanner across the barcode which flashes a light towards the barcode.

The areas of black colour absorb the light whilst the areas of white colour reflect the light back towards the barcode scanner. Light

sensors in the barcode scanner absorb the amount of reflected light and convert it into binary.

37
New cards

Laser printer

A laser is shone onto the surface of the spinning disk and focussed on a spot on the spiral track. Some light is reflected back and detected by a light sensor. The amount of reflected light varies depending on whether it hits a land or a pit. Lands reflect light, while pits scatter it. The disc spins at a constant linear velocity. A transition between land and pit represents a 1, while a continuation of land or pit represents a 0.

38
New cards

four types of system software

utility software

translators

operating system software

library programs

39
New cards

Operating system software

Operating system software provides a user interface between the user and hardware and runs application programs 

40
New cards

Utility software

Utility software is designed to help maintain the computer. Examples include disk defragmenter, virus scanner and file managers 

41
New cards

Library programs

Library programs are collections of resources used to develop software. They include prewritten code and subroutines 

42
New cards

define Imperative language

Instructions are executed in a programmer defined order

Imperative high level languages describe how to solve a problem

43
New cards

low level language

A language that is based upon the instruction set of the computer 

44
New cards

What is an example where harvard architecture is used

digital signal processing

45
New cards

Explain how a SSD works

Uses NAND flash memory

data is stored using floating gate transistors

this is a type of transistor that does not lose state when power is no longer applied

cannot write individual bits

46
New cards

State 2 components of an SSD

NAND flash memory

Controller

Interface

47
New cards

Arrays

A data structure storing an ordered set of data of the same type

48
New cards

Boolean

Data type with two possible values (e.g., TRUE or FALSE)

49
New cards

Character

Data type for storing a letter, number, or special character

50
New cards

Data Type

Attribute determining the type of data stored in a program

51
New cards

Date/Time

Data type for storing date or time values

52
New cards

Integer

Data type for storing whole number values without decimals

53
New cards

Language-Defined Data Types

Primitive data types provided by a programming language

54
New cards

Pointer/Reference

Data type storing memory addresses of objects created at runtime

55
New cards

Real/Float

Data type for storing numbers with decimal or fractional parts

56
New cards

Records

Data structure storing related data items in fields

57
New cards

String

Data type for storing a sequence of alphanumeric characters or symbols

58
New cards

User-Defined Data Types

Custom data types designed by users for specific program needs

59
New cards

Assignment

Statement assigning a value to a variable consistent with its data type

60
New cards

Constant Declaration

Statement creating a constant in a program

61
New cards

Iteration

Repeating a set of statements a fixed number of times or until a condition is met

62
New cards

Nested Iteration

Placing iteration loops within other iteration loops

63
New cards

Nested Selection

Placing selection statements within other selection statements

64
New cards

Selection

Deciding which statements to perform based on a condition

65
New cards

Subroutines (Procedures/Functions)

Named code section performing a specific task in a program

66
New cards

Variable Declaration

Statement creating a variable defined by a name and sometimes a data type

67
New cards

Addition

Operator returning the sum of two numeric values

68
New cards

Arithmetic Operator

Operator manipulating numeric values to return a numeric result

69
New cards

Exponentiation

Operator raising a value to the power of another value

70
New cards

Integer Division

Operator dividing values to return an integer quotient

71
New cards

Modulo

Operator dividing values to return the remainder

72
New cards

Multiplication

Operator returning the product of two numeric values

73
New cards

Real/Float Division

Operator dividing values to return a Real/Float result

74
New cards

Rounding

Converts a real number to a more approximate representation by adjusting decimal places.

75
New cards

Subtraction

Returns the difference between two numeric values.

76
New cards

Truncation

Reduces the number of digits in a real number by cutting off decimals.

77
New cards

Relational Operators

Operators that compare values and return TRUE or FALSE.

78
New cards

Boolean Operators

Operators that compare boolean values and return TRUE or FALSE.

79
New cards

Constants

Retains the same value throughout the program run.

80
New cards

Variables

Used as a temporary memory container with values that can change.

81
New cards

Character Code

Binary representation of a character in a character set.

82
New cards

Concatenation

Merging two strings into a single longer string.

83
New cards

Length

Returns the number of characters in a string.

84
New cards

Position

Returns the index to locate a character in a string.

85
New cards

Random Number Generation

Process of generating a random number using a seed value.

86
New cards

Exception Handling

Dealing with exceptional events by informing users of errors.

87
New cards

Functions

A subroutine always returning a value, callable in an expression.

88
New cards

Procedures

A subroutine called by name, not required to return a value.

89
New cards

Parameters

Data type and characteristics passed when calling a subroutine.

90
New cards

Local Variables

Variables existing and usable only within a subroutine.

91
New cards

Global Variables

Variables declared in the main program, accessible throughout.

92
New cards

Stack Frames

Data collection related to an ongoing subroutine call.

93
New cards

Recursive Technique

A subroutine that refers to itself in its definition.

94
New cards

Programming Paradigms

Computation style chosen based on the problem.

95
New cards

Structured Programming

Programming approach based on assignment, sequence, selection, and iteration.

96
New cards

Aggregation

Creating an object from further objects that persist independently.

97
New cards

Composition

Creating an object from further objects that depend on its existence.

98
New cards

Encapsulation

Maintaining data integrity by restricting access to object attributes.

99
New cards

Inheritance

Subclasses inheriting methods and attributes from a parent class.

100
New cards

Instantiation

Creating an object from a class.