1.2 Software and software development Flashcards

1
Q

What is meant by the term multitasking?

A
  • When you have more than one program open and running at the same time
  • The processor allocates a small amount of time to each process and cycles between them
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is file management?

A
  • Data is stored in files
  • An extension to the filename tells the OS which application to load the file into
  • The OS may present a logical structure of files in folders and allow the user to rename, delete, copy and move files
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is user management?

A
  • Allows multiple users to log into the same computer.
  • The OS will retain settings for each user such as icons, desktop, backgrounds etc.
  • Each user may have different access rights to files and programs
  • A client-server network may impose a fixed or roaming profile for a user and manage login requests to the network
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 2 methods of dividing memory into smaller sections?

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

Describe paging

A
  • Pages are fixed size
  • Pages are made to fit sections of memory
  • Pages are physical divisions
  • Programs are split to fit into a given number of pages
  • Paging takes no account of how it splits the program, only that it splits it into fixed-sized pages
  • It could separate the instructions inside a looping condition so they are in different pages, but that wouldn’t be efficient
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe segmentation

A
  • Segments are different sizes
  • Segments are complete sections of programs
  • Segments are logical divisions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Virtual memory?

A
  • Using parts of the HDD to store programs that can’t be stored in primary memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an interrupt?

A
  • While the processor does the FDE cycle other devices and applications may require the processor’s attention.
  • They need a way to signal to the processor that they require attention - this is what’s called an interrupt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the ISR?

A
  • Interrupt Service Routine
  • A program with a set of instructions that need to be fetched, decoded and executed to carry out the operations of the interrupt
  • That means that the contents of the PC need to be changed to point to the address for the first instruction of the interrupt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What happens when an interrupt is received?

A
  • The values held in the registers are copied into a data structure in memory known as the stack
  • These values are pushed onto the stack in a stack frame, effectively saving them for later retrieval
  • The interrupt can now be executed
  • Once the interrupt is complete, we pop the frame off the top of the stack.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does popping the frame of the stack allow us to do?

A
  • Retrieve the previous values for the original program
  • Load them back into the processor registers
  • Carry on executing the original program where we left off
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What happens when a high-priority interrupt comes along while an interrupt is being executed?

A
  • The stack system handles it by:
    • Suspending ISR A
    • Pushes register contents onto the top of the stack
    • Starts executing ISR B
    • Once ISR B has completed executing, we pop the frame off the top of the stack to retrieve the value for ISR A, load them back into the processor registers and carry on executing ISR A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are some examples of hardware interrupts?

A
  • Power supply failure
  • Power/reset button pressed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are some examples of user interrupts?

A
  • Moving the mouse
  • Keyboard presses
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are some examples of software interrupts?

A
  • Illegal instructions encountered
  • Arithmetic overflow
  • New log on request
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are some examples of timer interrupts?

A
  • Screen recording application
  • Data-logging program reading an input-sensor every second
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are some examples of I/O devices interrupts?

A
  • Buffer nearly empty
  • Printer ink supply notification
  • Signal the completion of a data transfer to/from a device
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does a scheduler do?

A
  • Manages which process to execute next
  • Manages the length of time the next process can execute for
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Explain the process of scheduling using Process A as an example

A
  • Process A is a new process
  • The number indicates the length of time before it finishes
  • It enters the ready queue
  • When the currently executing process finishes or is blocked or suspended, process A can move into a running state
  • From here it will either:
    • Finishing executing completely and leave the system
    • Get blocked as it requires an input or output commands, meaning it can’t continue until more data is received
    • Run out of time - each process is allocated a certain amount of time after which it is suspended and moved to the back of the ready queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is an FCFS algorithm?

A
  • First come First Served
  • Processes are executed in the order they arrive
  • If a process takes a long time, the others behind it have to wait
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is a SJF algorithm?

A
  • Shortest Job First
  • Picks the processes that take the shortest amount of time and runs them until they finish
  • The scheduler needs to know how long each process will take
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is a RR algorithm?

A
  • Round Robin
  • Each process is allocated a fixed amount of time, known as a time slice or quantum
  • If the process isn’t complete by the end of its time slice, it returns to the back of the ready queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is a SRT algorithm?

A
  • Shortest Remaining Time
  • Similar to SJF
  • Pre-emptive algorithm, meaning processes can be suspended if a higher priority process joins the queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is a MLFQ algorithm?

A
  • Multi Level Feedback Queue
  • This algorithm builds upon these standard algorithms with the following design principles:
    • Separates processes into multiple ready queues based on their processing needs.
    • Gives preference to processes with high I/O bursts
    • I/O bound processes will sleep in a wait queue to give other processes CPU time
  • This algorithm allows for processes to be shifted between queues
  • If a process has too much CPU time, it will be moved to a lower priority queue
  • If a process is I/O bound or an interactive process, it will be moved to a higher priority queue
  • If a process is waiting too long in a low-priority queue, it will be moved to a higher priority queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are the 5 types of OS?

A
  • Distributed
  • Multi-User
  • Real-Time
  • Embedded
  • Multi-tasking
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What is a multi-tasking OS?

A
  • An OS that handles many processes at the same time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What is a multi-user OS?

A
  • An OS that allows more than one person to access a single computer at the same time
  • The computer will manage the user’s various permissions and access rights when they log on
  • Server operating system software will handle the requests of multiple people using different computers on a network at the same time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is a distributed OS?

A
  • An OS which can combine the processing power of multiple computers across a network for a single task
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What happens in distributed computing?

A
  • The operating system controls and coordinates system controls and coordinates the computers, presenting them to the user as if they were a single system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What are embedded OS?

A
  • They run on dedicated hardware so they run with maximum efficiency, using low powered processor and very little memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What is a real-time OS?

A
  • An OS that executes processes within a known time frame
  • Plenty of redundancy is built into these systems so they can handle sudden increases in input
  • As such, processors in real-time OS rarely run at capacity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What is the BIOS responsible for?

A
  • Responsible for loading the OS when the computer first turns on
  • It first checks that the hardware it needs is connected and working using a POST
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What is a bootloader used for?

A
  • Used to load the OS kernel into memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Where are BIOS settings stored and why?

A
  • Stored in flash memory
  • So that they can be changed and retained when the power if switched off
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

What is a device driver?

A
  • Software that tells the OS how to communicate with a peripheral device
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What does a device driver do?

A
  • The device driver translates the OS’ instructions into a series of instructions that a specific piece of hardware will understand
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

What is a virtual machine?

A
  • A program that has the same functionality as a physical computer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What do emulators do?

A

-Trick a program into thinking it’s running on its native hardware when it’s running on an entirely different machine

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

What is an advantage of virtual servers?

A
  • If one server stops working, the others can pick up the load and continue working as if nothing happened
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

Give one example of intermediate code running on a virtual machine.

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

Why is Java good for running on virtual machines?

A
  • Because other programming languages would either have to use a specific language of each device or use a suitable compiler.
  • Java gets around this by compiling its code into a half-way code known as bytecode or intermediate code
  • This code is then translated by a Java Virtual Machine (JVM) running on a target device which then translates it into specific machine code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

Why is one advantage of the JVM process?

A
  • Makes the code highly portable between devices.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

What are the 2 types of software?

A
  • System software
  • Application software
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

What are the 2 types of system software?

A
  • Operating Systems
  • Utility software
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

What are some examples of Operating Systems?

A
  • Windows
  • Linux
  • Windows
  • macOS
  • iOS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

What are some examples of utility software?

A
  • Antivirus
  • Defragmentation
  • Backup
  • Compression
  • Firewalls
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

What are some examples of application software?

A
  • Presentation
  • Word processor
  • Web browser
  • Games
  • Email
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

What is a generic application?

A
  • A word processor is an example of one. It does not have a specific or narrow purpose
  • You can use it to carry out different tasks and meet multiple needs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

What is a specific application?

A
  • Database software is an example of one.
  • Being highly specific and bespoke, however, makes it almost essential for creating serious database application
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

Where does specific application software tend to be installed?

A
  • On systems where there is a direct need
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

What is utility software?

A
  • Software designed to:
    • Keep your computer safe
    • Keep it running efficiently
    • Provide you with useful tools to manage your files and applications
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

Utility software: What is file repair used for?

A
  • Files can become corrupt or damaged for a number of reasons
  • File repair attempts to correct these issues and restore the file to its original working state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

Utility software: What is backup software used for?

A
  • Backups can be set up to be manual, automatic or scheduled
  • There are 2 types: Full backups or incremental backup
  • Backup software often comes with your OS but an also be purchased separately
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

Utility software:
What is compression software used for?

A
  • To reduce the size of a file so it takes up less space and downloads faster over the internet
  • Compressed files must be extracted before they can be read
  • Depending on the algorithm used data is either lost, reducing the quality of an image or audio file, or represented in a different way using binary, retaining the original data in a new, compressed format (e.g. ZIP)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

What is defragmentation software used for?

A
  • To re-organise files on a hard disk, putting fragments of files and free space back together
  • The process reduces the movement of the read/write head across the surface of the disk, which speeds up file access
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

Why shouldn’t SDDs be defragmented?

A
  • Unnecessary as it has no moving parts
  • Reduces the drive’s lifespan
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

What is anti-malware software used for?

A
  • Helps keep your computer and files safe from many types of malware including:
    • Viruses
    • Trojans
    • Worms
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

What are some characteristics of Open-Source software?

A
  • Users can modify and distribute the software
  • Can be installed on any number of computers
  • Support provided by the community
  • Users have access to the source code
  • May not be fully tested
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

Open source: What are some benefits and drawbacks for the user?

A

Benefits:
- Software is free
- Wide community
modification
Drawbacks:
- Can be poorly supported
- Some features might not
be well tested

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

Open source: What are some benefits and drawbacks for the creators?

A

Benefits:
- Gets their software out
there to a wider
community
Drawbacks:
- Little-to-no financial gain

61
Q

What are some characteristics of Closed-Source software?

A
  • Protected by the Copyright Design and Patents Act
  • Users cannot modify the software
  • Usually paid for and licensed per user or per computer
  • Supported by developers who do not release source code
  • Tested by developer prior to release, although it may run beta programs
62
Q

Closed source: What are some benefits and drawbacks for the users?

A

Benefits:
- Well supported, tested and professional built product
Drawbacks:
- Cost or ongoing subscription fee

63
Q

Closed source: What are some benefits and drawbacks for the creators?

A

Benefits:
- They receive an income for their product
Drawbacks:
- Constant demand from community for more features and improvements
- Piracy issues

64
Q

What is meant by translation?

A
  • The process of converting source code to machine code
65
Q

What are the 3 types of translators?

A
  • Assemblers
  • Interpreters
  • Compilers
66
Q

What does an assembler do?

A
  • Translates assembly code into machine code
  • Takes basic commands and operations from assembly code and converts them into binary code that can be recognised by a specific type of processor
67
Q

What does an interpreter do?

A
  • Translates source code into machine code
  • Takes one line, translates it, then executes it
  • Once it discovers an error, it will output it, but it will keep running
68
Q

What does a compiler do?

A
  • Translates source code into object code and then machine code
  • Takes the whole source code and converts it into machine code
  • Won’t run unless all errors are corrected first
69
Q

What are some advantages and disadvantages of assemblers

A

Advantages:
- Memory efficient
- Speed of execution is
faster
- Hardware-oriented
Disadvantages:
- Long programs written in
such languages cannot be
executed on small
computers
- Difficult to remember the
syntax

70
Q

What are some advantages and disadvantages of compilers?

A

Advantages:
- No need for translation at
run-time
- Speed of execution is
faster
- Code is usually optimised
Disadvantages:
- Code needs to be re-
compiled when the code is
changed.
- Designed for a specific
type of processor

71
Q

What are some advantages and disadvantages of interpreters?

A

Advantages:
- Easy to write source code, as the programs will always run, stopping when it finds a syntax error
- Code does not need to be recompiled when code is changed
Disadvantages:
- Translation software is required at run-time
- Speed of execution is slower
- Code is not optimised
- Source code is required

72
Q

What happens during a compilation process?

A
  • A compiler runs through a series of parses
  • With each parse, the compiler performs different actions on the source code
  • Each parse is designed to carry out set tasks and prepare the code for the next stage of compilation
73
Q

What is an algorithm?

A
  • A sequence of steps designed to perform a task
74
Q

What is assembly language?

A

Assembly language is a programming language where mnemonics are used to represent instructions

75
Q

What are the 2 methods of dividing memory into smaller sections?

A
  • Paging
  • Segmentation
76
Q

Describe paging

A
  • Pages are fixed size
  • Pages are made to fit sections of memory
  • Pages are physical divisions
  • Programs are split to fit into a given number of pages
  • Paging takes no account of how it splits the program, only that it splits it into fixed-sized pages
  • It could separate the instructions inside a looping condition so they are in different pages, but that wouldn’t be efficient
77
Q

Describe segmentation

A
  • Segments are different sizes
  • Segments are complete sections of programs
  • Segments are logical divisions
78
Q

What is Virtual memory?

A
  • Using parts of the HDD to store programs that can’t be stored in primary memory
79
Q

What is an interrupt?

A
  • While the processor does the FDE cycle other devices and applications may require the processor’s attention.
  • They need a way to signal to the processor that they require attention - this is what’s called an interrupt
80
Q

What is the ISR?

A
  • Interrupt Service Routine
  • A program with a set of instructions that need to be fetched, decoded and executed to carry out the operations of the interrupt
  • That means that the contents of the PC need to be changed to point to the address for the first instruction of the interrupt
81
Q

What happens when an interrupt is received?

A
  • The values held in the registers are copied into a data structure in memory known as the stack
  • These values are pushed onto the stack in a stack frame, effectively saving them for later retrieval
  • The interrupt can now be executed
  • Once the interrupt is complete, we pop the frame off the top of the stack.
82
Q

What does popping the frame of the stack allow us to do?

A
  • Retrieve the previous values for the original program
  • Load them back into the processor registers
  • Carry on executing the original program where we left off
83
Q

What happens when a high-priority interrupt comes along while an interrupt is being executed?

A
  • The stack system handles it by:
    • Suspending ISR A
    • Pushes register contents onto the top of the stack
    • Starts executing ISR B
    • Once ISR B has completed executing, we pop the frame off the top of the stack to retrieve the value for ISR A, load them back into the processor registers and carry on executing ISR A
84
Q

What are some examples of hardware interrupts?

A
  • Power supply failure
  • Power/reset button pressed
85
Q

What are some examples of user interrupts?

A
  • Moving the mouse
  • Keyboard presses
86
Q

What are some examples of software interrupts?

A
  • Illegal instructions encountered
  • Arithmetic overflow
  • New log on request
87
Q

What are some examples of timer interrupts?

A
  • Screen recording application
  • Data-logging program reading an input-sensor every second
88
Q

What are some examples of I/O devices interrupts?

A
  • Buffer nearly empty
  • Printer ink supply notification
  • Signal the completion of a data transfer to/from a device
89
Q

What does a scheduler do?

A
  • Manages which process to execute next
  • Manages the length of time the next process can execute for
90
Q

Explain the process of scheduling using Process A as an example

A
  • Process A is a new process
  • The number indicates the length of time before it finishes
  • It enters the ready queue
  • When the currently executing process finishes or is blocked or suspended, process A can move into a running state
  • From here it will either:
    • Finishing executing completely and leave the system
    • Get blocked as it requires an input or output commands, meaning it can’t continue until more data is received
    • Run out of time - each process is allocated a certain amount of time after which it is suspended and moved to the back of the ready queue
91
Q

What is an FCFS algorithm?

A
  • First come First Served
  • Processes are executed in the order they arrive
  • If a process takes a long time, the others behind it have to wait
92
Q

What is a SJF algorithm?

A
  • Shortest Job First
  • Picks the processes that take the shortest amount of time and runs them until they finish
  • The scheduler needs to know how long each process will take
93
Q

What is a RR algorithm?

A
  • Round Robin
  • Each process is allocated a fixed amount of time, known as a time slice or quantum
  • If the process isn’t complete by the end of its time slice, it returns to the back of the ready queue
94
Q

What is a SRT algorithm?

A
  • Shortest Remaining Time
  • Similar to SJF
  • Pre-emptive algorithm, meaning processes can be suspended if a higher priority process joins the queue
95
Q

What is a MLFQ algorithm?

A
  • Multi Level Feedback Queue
  • This algorithm builds upon these standard algorithms with the following design principles:
    • Separates processes into multiple ready queues based on their processing needs.
    • Gives preference to processes with high I/O bursts
    • I/O bound processes will sleep in a wait queue to give other processes CPU time
  • This algorithm allows for processes to be shifted between queues
  • If a process has too much CPU time, it will be moved to a lower priority queue
  • If a process is I/O bound or an interactive process, it will be moved to a higher priority queue
  • If a process is waiting too long in a low-priority queue, it will be moved to a higher priority queue
96
Q

What are the 5 types of OS?

A
  • Distributed
  • Multi-User
  • Real-Time
  • Embedded
  • Multi-tasking
97
Q

What is a multi-tasking OS?

A
  • An OS that handles many processes at the same time
98
Q

What is a multi-user OS?

A
  • An OS that allows more than one person to access a single computer at the same time
  • The computer will manage the user’s various permissions and access rights when they log on
  • Server operating system software will handle the requests of multiple people using different computers on a network at the same time
99
Q

What is a distributed OS?

A
  • An OS which can combine the processing power of multiple computers across a network for a single task
100
Q

What happens in distributed computing?

A
  • The operating system controls and coordinates system controls and coordinates the computers, presenting them to the user as if they were a single system
101
Q

What are embedded OS?

A
  • They run on dedicated hardware so they run with maximum efficiency, using low powered processor and very little memory
102
Q

What is a real-time OS?

A
  • An OS that executes processes within a known time frame
  • Plenty of redundancy is built into these systems so they can handle sudden increases in input
  • As such, processors in real-time OS rarely run at capacity
103
Q

What is the BIOS responsible for?

A
  • Responsible for loading the OS when the computer first turns on
  • It first checks that the hardware it needs is connected and working using a POST
104
Q

What is a procedural language? How is it laid out?

A
  • A language that focuses on telling a computer exactly what to do by way of step-by-step instructions
  • It’s laid out as a series of statements such as: Iteration, Sequence and Selection
105
Q

What are the 3 programming constructs?

A
  • Sequence
  • Selection
  • Iteration
106
Q

What is sequence?

A
  • Executing one instruction after another
107
Q

What is selection?

A
  • Allows a program to branch and follow a different direction depending on the outcome of a condition
108
Q

What is iteration?

A
  • Repeating sections of code
109
Q

What is nesting?

A
  • The process of putting one statement inside another - which can be achieved through both iteration and selection statements
110
Q

What is a variable?

A
  • A pointer to a memory address that we are able to give a user-friendly label/name
111
Q

What is a constant?

A
  • A value which remains fixed and doesn’t change while the program is running, it must be set when the program is first written
112
Q

What is casting?

A
  • Converting one data type to another
113
Q

What is a subroutine?

A
  • A block of code given an unique identifiable name within a program
114
Q

Why do we use subroutines?

A
  • To break down a larger problem into a series of smaller, more manageable problems, making them easier to code, debug and reuse.
115
Q

What are the 2 types of subroutines?

A
  • Procedures
  • Functions
116
Q

What is a procedure?

A
  • Blocks of code that carry out a set task
117
Q

What is a function?

A
  • Blocks of code that carry out a set task and return a value
118
Q

What are the advantages of using subroutines?

A
  • Programs are easier to write
  • Programs are easier to debug
  • Creates reusable components
  • Functions can be grouped in a library for easy reuse across multiple programs
119
Q

What is the pseudocode for a procedure?

A

procedure Game(Value1, Value 2)
Statements…
endprocedure

120
Q

What is the pseudocode for a function?

A

function Game(Value1, Value2)
Statements
return Value3
endfunction

121
Q

What is the difference between a DIV operator and a / operator?

A
  • The / operator will return a float value (e.g. 7/2 = 3.5)
  • The DIV operator will return a whole number (e.g 7 // 2 = 3)
122
Q

What are the 3 ways that ‘not equal to’ could be represented?

A

!=
<>
~=

123
Q

What is string manipulation?

A
  • The act of manipulating, extracting or changing the characters in a string variable
124
Q

How can you get the length of a string?

A
  • By using the .length function
125
Q

How can you separate characters within a string?

A

By using the substring function

126
Q

Consider the line
text = ‘water’
print(text.substring(1,2))
What will the output be?

A

at

127
Q

How do you change a string from lower case to upper case?

A

print(variablename.upper())

128
Q

How do you converts a string from upper case to lower case?

A

print(variablename.lower())

129
Q

How do you check if a string is upper case/lower case?

A

print(variable.isupper())
print(variable.islower())

130
Q

How do you return an ASCII value for a character?

A

ascii = ord(‘character’)

131
Q

How do you return a character from an ASCII value?

A

char = chr(charactervalue)

132
Q

What is the process of writing data to a file?

A
  • Open the file for creating/overwriting or appending
  • Write the data to a file
  • Close the file
133
Q

What is the process of reading/searching data from a file?

A
  • Open the file for reading data
  • Assign a Boolean variable to false to indicate the end of file is not reached.
  • While the end of file is false and the search item is not found
    • Read the data from the file
    • If the data matches what is being searched for, assign the data to variables or output
    • Check if the end of file has been reached and assign the Boolean variable to true
  • Close the file
134
Q

What is data dependency?

A
  • When the program requires the items from the text file to be in a specific order
135
Q

How do you open a file?

A

f = open(‘filename.txt’, ‘r’)
r stands for what e want to do with the file (e.g. r = read)

136
Q

How do you read a line from a text file?

A

variablename = f.readLine().strip()

137
Q

How do you close a file?

A

f.close()

138
Q

How do you write to a text file?

A

f.write(variablename)

139
Q

What is the LMC mnemonic for the instruction add?

A

ADD

140
Q

What is the LMC mnemonic for the instruction subtract

A

SUB

141
Q

What is the LMC mnemonic for the instruction store?

A

STA

142
Q

What is the LMC mnemonic for the instruction load?

A

LDA

143
Q

What is the LMC mnemonic for the instruction branch always?

A

BRA

144
Q

What is the LMC mnemonic for the instruction branch if zero?

A

BRZ

145
Q

What is the LMC mnemonic for the instruction branch if positive?

A

BRP

146
Q

What is the LMC mnemonic for the instruction input?

A

INP

147
Q

What is the LMC mnemonic for the instruction output?

A

OUT

148
Q

What is the LMC mnemonic for the instruction halt?

A

HLT

149
Q

What is the LMC mnemonic for the instruction data location?

A

DAT