Font size
WorksheetsA2 CS PPE Prep Dec23 mmd
Total questions: 150
Worksheet time: 2hrs 31mins
CISC processors...
Are physically larger
Are better at complex tasks
Use more electricity than RISC
Expect more work from the compiler to generate more code
Not as good at pipelining
An example of where you would find CISC processors:
Tablets
Smartphones
Laptops
Desktop Computers
Smartwatches
An example of where you would find RISC processors:
Tablets
Smartphones
Laptops
Desktop Computers
Smartwatches
RISC Processors...
Minimise the number of clock cycles per instruction
Have a larger instruction set
Tend to run at a lower clock speed
Make use of pipelining
Use less power and generate less heat
Pipelining means...
Running the fetch-decode-execute cycle more efficiently
Waiting for a full fetch-decode-execute cycle to complete before starting the next
Fetches the next instruction while the previous instruction is still decoding
CISC processors can run more efficiently
RISC processors can run more efficiently
Serial processing is...
instructions which are done one after the other to complete a task
instructions which are run concurrently to complete a task
Always possible
Not always possible
Parallel processing is...
instructions which are done one after the other to complete a task
instructions which are run concurrently to complete a task
Always possible
Not always possible
Distributed processing...
Shares tasks to multiple processors through networked computers
Uses the processor more efficiently by splitting up the task
Is another name for parallel processing
Select the true statements about operating systems:
A computer can only have one OS
The OS manages memory, storage, security, printing and other useful functions of the system
The OS provides a user interface
All OSes allow you to use multiple programs at once
This image shows...
Memory paging
Memory segmentation
Distributed processing
Virtual memory
This image shows...
Memory paging
Memory segmentation
Distributed processing
Virtual memory
Select the true statements about memory paging:
Processes are split into equal sized frames
A page table is used to record all the pages
Unused pages are swapped out of main memory and into virtual memory
Processes are split into variable sized frames
Segmentation:
Splits processes into variable sized pieces
Splits processes into set sized pieces
Keeps processes together in RAM
Places processes wherever there is space in RAM
Can cause stack overflows
The role of scheduling is...
To make sure tasks get as much time as they need on the CPU
To make sure that all tasks get time on the processor and respond in a reasonable time
To make sure that the user does not have to wait for processes to run
To prevent the user from crashing the computer
An OS which you would use in day-to-day life on a normal school computer is a...
Embedded
Real Time
Distributed
Multi-Tasking
Multi-User
For a very large and complex system which needs multiple processors, you would use a _______________ OS:
Embedded
Real Time
Distributed
Multi-Tasking
Multi-User
For a system which needs a guaranteed response rate, you would use a _______________ OS:
Embedded
Real Time
Distributed
Multi-Tasking
Multi-User
For a simple system with very limited processing power, you would use a _______________ OS:
Embedded
Real Time
Distributed
Multi-Tasking
Multi-User
To share one processor's power between multiple people, you would use a _______________ OS:
Embedded
Real Time
Distributed
Multi-Tasking
Multi-User
The BIOS allows you to:
Change the computer's time/date settings
Change the order in which drives are booted from
Change the computer's operating system
Change the user's login details
Device drivers...
allow peripherals to communicate with the OS
allow users to communicate with the OS
allow peripherals to work directly with the CPU
allow users to change settings of their peripherals
A virtual machine...
uses secondary storage instead of RAM when the computer runs out of space on the main memory
allows software to act as hardware, running code or an operating system within another OS.
can only be used through the internet
relies on cloud storage
Closed Source software is...
Always bug free
Sometimes very expensive
Generally well-tested
A good choice for large organisations
Usually well-supported by the developer
The correct order of the stages of compilation is:
Lexical Analysis, Syntax Analysis, Code Generation, Code Optimisation
Lexical Analysis, Syntax Analysis, Code Optimisation, Code Generation
Syntax Analysis, Lexical Analysis, Code Optimisation, Code Generation
Syntax Analysis, Lexical Analysis, Code Generation, Code Optimisation
Removing whitespace is in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
Token creation is in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
Symbol table is created in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
The code is checked against the rules in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
The syntax tree is created in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
The user will first be alerted to errors found in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
The syntax tree is converted into object code in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
Redundant code is removed in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
The code is improved to run as fast as possible in:
Lexical Analysis
Syntax Analysis
Code Generation
Code Optimisation
Iterative development methodology which values end-user input:
XP
Agile
Waterfall
Spiral
RAD
Select the real methodologies:
Agile
XP
XD
Spiral
Waterfall
Iterative development methodology which values code quality:
XP
Agile
Waterfall
Spiral
RAD
Iterative development methodology which values speed of development:
XP
Agile
Waterfall
Spiral
RAD
Iterative development methodology which focuses on risk-management:
XP
Agile
Waterfall
Spiral
RAD
Sequential development methodology which focuses on comprehensive documentation:
XP
Agile
Waterfall
Spiral
RAD
A small start-up who want to get a prototype onto the market for testing should use:
XP
Agile
Waterfall
Spiral
RAD
A large company who want to develop their software so people actually want to use it should use:
XP
Agile
Waterfall
Spiral
RAD
A processor company who need to develop high-quality code with minimal errors should use:
XP
Agile
Waterfall
Spiral
RAD
Most software companies use:
XP
Agile
Waterfall
Spiral
RAD
Very large projects which require a lot of paperwork and documentation should use:
XP
Agile
Waterfall
Spiral
RAD
A company who need to manage a lot of risk should use:
XP
Agile
Waterfall
Spiral
RAD
This methodology is:
XP
Agile
Waterfall
Spiral
RAD
This methodology is:
XP
Agile
Waterfall
Spiral
RAD
A programming mechanism that binds together code and the data it manipulates, and that keeps both safe from outside interference and misuse.
Polymorphism
Inheritance
Encapsulation
Object-Oriented Programming
Is the process by which one object can acquire the properties of another object.
Polymorphism
Inheritance
Encapsulation
Object-Oriented Programming
Characteristics of OOP.. (Tick all)
Data types
Encapsulation
Inheritance
Polymorphism
algorithm
Which paradigm makes use of methods and attributes to encapsulate data in classes.
Declarative
Imperative
Object oriented
Low level
Refer to the shark class. Which of the following is an instance variable?
age
region
sharkAge
Shark
Why is OOP a powerful programming technique?
Because it's fun
Because it's easy to learn
Because it allows for reusability
It isn't
How many classes can be defined in a single program?
As many as you want
Only 1
Only 100
Only 999
A user-defined name of a program element, such as a variable or constant.
Pseudocode
Data Type
Identifier
Container
What is the advantage of a distributed OS?
the programmer can control the distribution of the task as the operation is entirely handled by the OS
there is a hardware redundancy
no need for training or writing programs differently, may result in better performance
when there is a fault in the hardware, as soon as the OS detects it then responds appropriately
What are the key reasons for compressing data?
Less space needed for storage
Less time to transmit
Higher quality files
Reduced amount of processing power
Limited RAM
Lossless compression...
Is used when not all the information is needed
Is not as effective as lossy compression
Can fully regenerate the original file
Includes files such as .ZIP
Would be a sensible choice for a music download site
Lossy compression...
Permanently removes data from a file
Always leads to a noticeable loss of quality
Aims to remove redundant data
Can return the original file to its original quality
Would be a sensible choice for a music download site.`
Dictionary based compression...
Is a lossless compression format
Creates a dictionary of common letter combinations to encode words with fewer characters
Creates a dictionary of smaller letters so less space is used
Sends the dictionary with the data
Doesn't need to send the dictionary with the data
Run-length encoding...
is Lossless
is Lossy
Can only be used for text
Records the number of repeats of an individual element
Can be used for a wide variety of file types
Encryption...
Uses at least one key to cipher data
Is only used on text
Can be symmetric or asymmetric
Is impossible to break
Has developed a lot as processing power has increased
Symmetrical encryption techniques...
Are the most secure types of encryption
Use a single key to encode/decode
Use multiple keys to encode/decode
Include XOR, Caesar and Route
Include RSA, Diffie-Hellman and DSS
Asymmetrical encryption techniques...
Are the most secure types of encryption
Use a single key to encode/decode
Use multiple keys to encode/decode
Include XOR, Caesar and Route
Include RSA, Diffie-Hellman and DSS
Asymmetrical encryption...
Often requires considerable processing power
Is impossible to break
Is being threatened by the possibility of quantum computing
Can be brute-force attacked
Is very widely used, even in small businesses
In a hospital system, the relationship between a consultant to a patient would be:
One-to-One
One-to-Many
Many-to-Many
Many-to-One
In a hospital system, the relationship between a nurse to a ward would be:
One-to-One
One-to-Many
Many-to-Many
Many-to-One
In a hospital system, the relationship between a patient to a surgeon would be:
One-to-One
One-to-Many
Many-to-Many
Many-to-One
In a hospital system, the relationship between a consultant to a student would be:
One-to-One
One-to-Many
Many-to-Many
Many-to-One
In a school system, the relationship between a teacher to a pupil would be:
One-to-One
One-to-Many
Many-to-Many
Many-to-One
In a school system, the relationship between a teacher to a department would be:
One-to-One
One-to-Many
Many-to-Many
Many-to-One
Which field is likely to be a foreign key?
Sales ID
Item ID
Item Name
Address
Payment Complete?
What will be returned by the SQL query:
SELECT * FROM Sales WHERE Sales ID = "00113"
00112 1151213215 Keyring 123 Example Ln 1
00112 65465654688 Pencil 123 Example Ln 1
00112 87954121321 Bag 123 Example Ln 1
00113 65465654688 Pencil 77 Bay St 0
00114 65465654688 Pencil 999 Letsbey Ave 1
Which of the following SQL statements will return the Sales ID of all sales which involve a pencil?
SELECT * FROM Sales WHERE Item Name = "Pencil"
SELECT * FROM Sales WHERE Item Name = Pencil
SELECT Sales ID FROM Sales WHERE Item Name = "Pencil"
SELECT Sales ID FROM Sales WHERE Item Name = Pencil
SELECT "Sales ID" FROM Sales WHERE Item Name = "Pencil"
Which of the following SQL statements will return the address of anyone who has ordered a pencil and has paid.
SELECT Address FROM Sales WHERE Item Name = "Pencil" and Payment Complete? = TRUE
SELECT Address FROM Sales WHERE Item Name = "Pencil" and Payment Complete? = "TRUE"
SELECT Address FROM Sales WHERE Item Name = Pencil and Payment Complete? = TRUE
SELECT Address FROM Sales WHERE Item Name = "Pencil" or Payment Complete? = TRUE
SELECT Address FROM Sales WHERE "Item Name" = "Pencil" and "Payment Complete?" = TRUE
Select the things which are true for a database in 1NF:
Each entity has a unique identifier
Each attribute is atomic (divided as small as possible)
Each attribute has a single value
There is no repetition
There are no transitive relationships
Select the things which are true for a database in 2NF:
The database is in 1NF
All attributes depend on the primary key
There is no dependence
There is no repetition
There are no transitive relationships
Select the things which are true for a database in 3NF:
The database is in 2NF
There are at least 4 tables in the database
There is no dependence
All attributes have a separate table
There are no transitive relationships
What normal form is this table in?
1NF
2NF
3NF
What normal form is this table in?
1NF
2NF
3NF
What normal form is this table in?
1NF
2NF
3NF
The buses involved in the Fetch-Decode-Execute system are...
Data Bus
Information Bus
Address Bus
Control Bus
Process Bus
Which of the tag is used to create a numbered list?
<L> </L>
<LI> </LI>
<li> </lo>
<ol> </ol>
Web pages start with which of the following tags?
<form>
<HTML>
<body>
<Title>
Choose the correct HTML element for the largest heading:
<head>
<h1>
<heading>
<h6>
What defines the beginning and ending of the visible part of a webpage?
<head> main part of the document </body>
<body> main part of the document </html>
d) </body> main part of the document <html>
<body> main part of the document </body>
What is the correct syntax for defining a hyperlink in HTML?
<a href=”url”> Link text </a>
<a href=”url”> Link text <a>
<a=”url”> Link text <a>
<ref=”url”> Link text <a>
Which of the following is a valid CSS rule?
h1 {
color: blue;
}
<h1> {
color: blue;
}
h1 {
color="blue";
}
h1 {
color=blue;
}
Which CSS property can be used to change the font?
font-size
text-align
font-famiy
text-decoration
What symbol should you use to target a class name in css?
#
()
.
class
What is not incuded in a packet?
Sender IP address
Checksum
Router ID
Packet number
Which protocol is used to send packets
IP
FTP
SMTP
TCP
Which is not a layer in the TCP/IP model?
Application
Transmission
Internet
Network
Which are not one of the application layer protocols?
DNS
FTP
SMTP
FNP
Which is the first layer of the TCP/IP model?
Network
Application
Transport
Internet
How many octets is an IPv4 address made up of?
1
2
3
4
What is name of the protocol that matches domain names to IP addresses?
SMTP
TCP
IP
DNS
What kind of address is made up of hex pairs and stored on each device's NIC?
MAC
TCP
IP
DNS
Which of the TCP/IP model layers is responsible for breaking down the message into packets?
Network
Application
Transport
Internet
Before a web browser makes a request to a DNS server / resolver, it will check it's...
DNS root server
HTTP protocol
DNS Cache
RAM
How many DNS root server IP addresses exist?
13
1,000,000
1
5,600
IP addresses and MAC addressed can be falsified, which is a risk to cyber security. This is known as...
Pharming
Cross-site scripting
Identity theft
Spoofing
When the Network layer adds an IP address to the port number added by the Transport layer, it creates a...
link
error
MAC address
socket
Assume that there is a recursive binary search function find(). If a sorted list has a data structure with indices 0 to 50 and the item being searched for happens to be at location 6, write each call of find() that would occur while searching for that item. The first is find(0,50).
find(0, 25) find(0, 12) find(0, 6)
find(0, 25) find(0, 12)
find(0, 25)
find(0, 25) find(0, 12) find(0, 6) find(0, 3)
Which is the best way to debug recursive functions?
Adding print statement of what that line of code does.
Adding output statements by keeping all the statements left aligned
Adding output statements with an indent to print statements at every iteration.
Adding output statements by keeping all the statements equally indented
While adding output statements to debug recursive functions, _____ the print statements to show the current depth of recursion.
left align
indent
right align
center align
Which of the following is a good candidate for using recursive functions?
To solve the greatest common divisor (GCD) problem
To solve problems that have a true and false solution
To solve problems that require excessive memory allocation
To solve logarithmic problems
Which code calculates the power of a number raised to another (a^b)?
def power(a,b):
if b == 1:
return a
else:
return a**power(a,b-1)
def power(a,b):
if b == 1:
return a
else:
return a*power(b-1,a)
def power(a,b):
if b == 1:
return a
else:
return a**power(b-1,a)
def power(a,b):
if b == 1:
return a
else:
return a*power(a,b-1)
Identify the error in the code that scrambles a word’s letters in all the possible ways..
def scramble(r_letters, s_letters):
if len(r_letters) == 0:
print(s_letters)
else:
for i in range(len(r_letters)):
scramble_letter = r_letters[i]
remaining_letters = r_letters[:i] + r_letters[i-1:]
scramble(remaining_letters, s_letters + scramble_letter)
scramble('abc','')
scramble_letter = r_letters[i]
remaining_letters = r_letters[:i] + r_letters[i-1:]
scramble(remaining_letters, s_letters + scramble_letter)
if len(r_letters) == 0
How do you modify elements in a nested array in Python?
Use the 'remove' method to delete the element from the nested array.
Use the 'pop' method to remove and return the element from the nested array.
Use the 'append' method to add a new value to the nested array.
Access the element using indexing and assign a new value to it.
Select ALL the situations that a Queue data structure would be used?
Printer in a room full of computers
Characters typed on a keyboard
Back Button
Undo Button
Which is the correct operation for:
"Add a item to the rear of the queue."
enQueue(item)
Append.Queue(item)
enQueue()
AddItem(EnQueue())
Which is the correct operation for:
"Remove the front item from the queue and return it"
dQueue()
de.Queue(Item)
deQueue()
item.remove()
Cant be performed on a Queue Data Structure.
Which is the correct operation for:
"Remove the rear item from the queue and return it"
dQueue()
de.Queue(Item)
deQueue()
item.remove()
Cant be performed on a Queue Data Structure.
Which is the correct operation for:
"Add a item to the front of the queue."
enQueue(item)
Append.Queue(item)
enQueue()
AddItem(EnQueue())
Cant be performed on a Queue.
Select operations that can be performed on a Queue Data Structure...
isEmpty()
pop()
push()
isFull()
Append(Item)
What would happen if...
deQueue()
enQueue(Hanna)
enQueue(Steve)
enQueue(Jack)
front = 1 rear = 0
*and Steve would be unable to be added to position 0.
front = 1 rear = 5
*and Jack would be unable to be added to position 0
front = 0 rear = 5
front = 0 rear = 4
front = 1 rear = 4
The following circular queue can accommodate a maximum six elements with the following data
front = 2 rear = 4
queue = ____; L ; M; N; ___; ___
What will happen after ADD O operation takes place?
front = 2 rear = 5
queue = ______; L, M, N, O, ___
ront = 3 rear = 5
queue = L, M, N, O, ___
front = 3 rear = 4
queue = ______; L, M, N, O, ___
ront = 2 rear = 4
queue = L, M, N, O, ___
If I want to find out if an item is in a queue or a stack - what do I call?
Contains(item)
IsContains(item)
Peek(item)
Find(item)
What is the reason for using a circular queue instead of a regular queue?
running time of enqueue is improved
reuse empty space
you can traverse the elements more efficiently
none of the above
Consider Stack is implemented using the array.
#define MAX 10
struct STACK
{
int arr[MAX]
int top = ___________;
}
What will be the initial value with which top is initialized.
0
-1
garbage
1
In linked list implementation of a queue,the important condition for a queue to be empty is?
REAR is NULL
FRONT is 1
REAR is 1
FRONT is NULL
A stack is implemented in Python using the built-in list data structure. Complete this code of function peek() within the Stack class.
class Stack:
def __init__(self):
self.items = [ ]
def peek(self):
…………………
return self.items[len(self.items)]
return self.items[stack.length]
return self.items[stack.length-1]
return self.items[len(self.items)-1]
The following operations are performed on a Stack.
s=Stack()
s.push(‘a’)
s.push(‘b’)
s.pop()
s.push(‘c’)
s.peek()
What is the top of the Stack s when these operations are complete?
'a'
'b'
'c'
Stack is empty
stack colours=(‘Red’, ‘Green’, ‘Blue’)
colours.push(‘Black’) is executed. Stack colours=………………..?
('Black', 'Red', 'Green', 'Blue')
('Black', 'Blue')
(''Red', 'Green', 'Blue', 'Black')
Error
CIRCULAR QUEUE
q=Queue(4)
q.enQueue(10)
q.enQueue(20)
q.enQueue(30)
q.enQueue(40)
q.deQueue()
q.enQueue(50)
What is the value of q?
[10, 20, 30, 40]
[10, 20, 30, 50]
[50, 10, 20, 30]
[50, 20, 30, 40]
CIRCULAR QUEUE
q=Queue(4)
q.enQueue(10)
q.enQueue(20)
q.enQueue(30)
q.enQueue(40)
q.deQueue()
q.enQueue(50)
What is q.rear?
0
1
2
3
What is the boolean expression for this logic circuit?
Q = NOT (A OR B)
Q = NOT A AND B
NOT A OR B = Q
Q = (NOT A) OR B
What is the boolean expression for this logic circuit?
A OR B AND C = Q
Q = (A AND B) OR C
Q = A OR (B AND C)
Q = (A OR B) AND C
Which logic gate is this truth table for?
AND
OR
NOR
XOR
Which of these programming constructs make use of Boolean logic?
if ... then ...
while ... do ....
repeat ... until ....
repeat n times ....
Select Most Suitable Explanation Regarding De Morgan's Theorem (select two)
DeMorgan’s Theorems are two additional
simplification techniques that can be used to
simplify Boolean expressions.
DeMorgan’s Theorem is a Mathematical Expression.
DeMorgan’s Theorems can be used to
simplify Boolean expressions.
DeMorgan’s Theorem is a Karnaugh Map.
Select the De Morgan's Theorems
Which one is not a Karnaugh map rule?
Only power of 2 number of cells in each group.
No diagonals are allowed.
No zeros allowed in a group.
zeros allowed in a group.
Which option is correct regarding Karnaugh map rule?
Every logic “1” must be in at least one group.
Overlapping is allowed.
Wrap around is allowed.
Fewest number of groups as much as possible.
All are correct
Select all the choices that explains a KARNAUGH MAP?
Karnaugh map is used to simplify Boolean logic expressions.
It tells you what output your circuit will have given your inputs.
Karnaugh map combines illustrations with common factors and therefore eliminates unwanted variables.
It is a software tool for circuit building.
Which one is correct?
Which one is incorrect regarding Karnaugh map?
Please identify the numbers that are in normalised floating point format.
11001001
10101010
00110110
01011000
011011100
Please identify the numbers that are not in normalised floating point format.
11000011
111110000
011111111
10000000
1111111111
010110100011 (8 bit signed mantissa / 4 bit signed exponent) what is the decimal number?
5.625
11.5
-5.625
-11.5
What is the two's complement of 01100010 ?
10011101
11011101
10011110
10011111
What is the normalised form of 0.0000111 0111
1.0110000 0011
1.0110000 0111
0.1110000 0111
0.1110000 0011
