乐趣区

关于后端:COMPSCI110分析解答

1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 1/34
1215 Academic Integrity
As a member of the University’s student body, I will complete this assessment in a fair, honest,
responsible and trustworthy manner. This means that:

I will not seek out any unauthorised help in completing this assessment. Please note:
unauthorised help includes seeking assistance or advice from anyone, using a tutorial or answer
service whether in person or online, asking fellow students, friends or family, etc.
I will not discuss or share the content of the assessment with anyone else in any form,
including but not limited to, Canvas, Piazza, Chegg, Facebook, Twitter, Discord, Messenger or
any other social media platform or messaging service within the assessment window.
I will not reproduce and/or share the content of this assessment in any domain or in any form
where it may be accessed by a third party.
I am aware the University of Auckland may use Turnitin or any other plagiarism detecting
methods to check my content.
I declare that this assessment is my own work, except where acknowledged appropriately
(e.g., use of referencing). Please note: It is not appropriate (and will be considered plagiarism) to
reproduce or copy material provided by your teachers, including lecture slides, lecture notes
and/or course readings in your exam. All content must be written in your own words and
referenced appropriately. If quoting a source, quotations must be used and referenced
appropriately.
I declare that this work has not been submitted for academic credit in this course or another
University of Auckland course, or elsewhere.
I declare that I generated the calculations and data in this assessment independently, using
only the tools and resources defined for use in this assessment.
I declare that I composed the writing and/or translations in this assessment independently,
using on the tools and resources defined for use in this assessment.
I understand the University expects all students to complete coursework with integrity and
honesty. I promise to complete all online assessment with the same academic integrity
standards and values.
Any breach of this statement or identified academic misconduct will be followed up and may
result in disciplinary action.

Select one alternative

I agree
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 2/34
1 Binary Quantity
For these questions enter the answer using decimal digits.

If 2 is the closest power of 2 to 120,000 what is the value of n?

How many bits are necessary to store the binary number equal to 120,000?

What is the decimal value of the binary number 100000?

How many bits are necessary to store the binary number equal to the hexadecimal 400000?
n
Maximum marks: 4
2 About signed reps
For these questions enter the answer using decimal digits. Include the negative sign if the answer
is negative e.g. -4400

What is the most negative number we can represent with 7-bit two’s complement representation?

If a computer only works with 7-bit one’s complement numbers what would the computer give as
the answer to 60 + 4?

If a computer only works with 7-bit two’s complement numbers what would the computer give as
the answer to 60 + 4?

Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 3/34
3 Floating point
These questions are using the textbook’s floating point format that was introduced in lectures.

Given the floating point number 1110 0000 0000 0011 :

What is the sign of the number?
Select one alternative

What is the binary number of the mantissa? (Write your answer starting with “0.” as the mantissa
is normalised.)

What is the exponent as a decimal number? (Careful with the sign.)

What is the decimal number represented by the floating point number 1110 0000 0000 0011?
Positive
Negative
Maximum marks: 2
4 ASCII & Unicode
Select all of the statements which are correct about ASCII and UTF-8.
Select one or more alternatives:

The UTF-8 codes for the letters A to Z are only one bit different from the corresponding
codes for the letters a to z.
The ASCII code only encodes printable characters.
ASCII is an extension (superset) of UTF-8.
ASCII digits can be turned into their 8-bit binary equivalents by clearing the top (most
significant) four bits of the character.
Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 4/34
5 Boolean expressions TT
Select all boolean expressions which match this truth table.
A B Result
0 0 0
0 1 1
1 0 1
1 1 0

Select one or more alternatives

Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 5/34
6 Truth table from circuit
Given the circuit diagram below complete the truth table showing the values of the Output.

Truth Table
x y z Output
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 6/34
7 Von Neumann Architecture (Exam)
The following question is based on the textbook architecture discussed in lectures. The registers
used by this architecture make up the columns of the table below. Descriptions of what these
registers do make up the rows of this table. Match the descriptions to the appropriate register.

Please match the values:
MDR R MAR IR PC
Holds the encoding of the current instruction.
Holds the address of the next instruction.
Receives fetched data and holds data to be stored.
Holds the memory address to access.
Holds data used by the ALU.

Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 7/34
8 State Diagram (Exam)
Answer the following questions using the state diagram below:

Starting at State A, what state would you transition to given the input 0110011?
(A, B, C, D, E, F)

Starting at State E, which state would you transition to given the input 0011110010?
(A, B, C, D, E, F)

Which state would you have to start at to be able to transition to every other state?
(A, B, C, D, E, F)

Select alternative
Select alternative
Select alternative
Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 8/34
9 Assembly Output 1 (Exam)

1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 9/34

Given the provided instruction set and assembly program, answer the following questions.

What is the output of the above assembly program given the inputs 1 and 4 (in that order)?

What is the output of the above assembly program given the inputs 7 and 5 (in that order)?

Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 10/34
10 Assembling (Exam)

1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 11/34

Given the provided instruction set and assembly program, convert the following lines of
assembly code from the program into the equivalent machine code. All of your answers should
be in binary. Do not use any punctuation, symbols or spaces.

Line 5:

Line 8:

Line 11:

Line 21:

Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 12/34
11 Pseudocode (Exam)
Given the following pseudocode:
What output is produced when value4 = 1 and value5 = 5? Please only add spaces or other
formatting if required.

What output is produced when value4 = 13 and value5 = 4? Please only add spaces or other
formatting if required.
Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 13/34
12 Compilation – Tokens and Token Classes
Identify the number of tokens and token classes in the following high level programming
language source code:

The number of tokens is .

The number of token classes is
Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 14/34
13 Parse Tree
The following grammar is used to generate the parse tree shown below:
::=
::= +|-
::= *|/
::= |
::= ||()
::=
::= ||
::=
::= ||
::= =
Identify the non-terminals at the labels marked in the tree.
A (, , ,) B
(, , ,)
C (, , ,) D (,
, , )
E (, , ,) F
(, , ,)

How many productions does the parse tree contain? (25, 17, 20, 19, 21)

Given that Celsius and Fahrenheit are variables of type real, the given high-level statement is
syntactically correct but semantically wrong. (False, True)
Select alternative Select alternative
Select alternative Select alternative
Select alternative Select alternative
Select alternative
Select alternative
Maximum marks: 4
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 15/34
14 Goal Symbol
Consider the following BNF grammar:
::= a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p |
q | r | s | t | u | v | w | x | y | z
::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
::= ||

::=
::=

Which of the following strings will parse to this grammar’s .
Select one or more alternatives:

asha932
abcd000
zzz45
a345
fbc123
qw567
Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 16/34
15 BNF Grammar for HexDigit
You are trying to write a BNF grammar to match a single hexadecimal digit (the goal symbol is
).

Choose what to write:

::= (0|1|2|3|4|5|6|7|8|9, 0 – 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1|2|3|4|5|6|7|8|9, INT_DIGIT)

::= (A|B|C|D|E|F, A|B|C|D|E|F|G|H|I|J, A, B, C, D, E, F, A – F,
A|B|C|D|E|F|)

::= (|, |,
, , |)

Select alternative
Select alternative
Select alternative
Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 17/34
16 Code Generation from Parse Tree
The parse tree shown in the figure is based on the following grammar:

Given that x, y and z are integers and that the compiler assigns pseudo-names such as temp1,
temp2 etc. for semantic records corresponding to productions that combine two or more non-
terminals, which of the following semantic records will be contained in the symbol table for this
parse tree?

1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 18/34
Select one or more alternatives

x:integer
temp1:integer
-:operator
y:integer
z:real
expression:integer
temp2:real
result:real
result:integer
+:operator
Maximum marks: 1
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 19/34
17 OS – Generations
Choose the features that match the given generation of Operating Systems

Please match the values:
Batch
OS
Multi-
programmed
OS
Networked
OS
Naked
Machine
Time-
shared
OS
Distributed
OS
Loads many
user programs
simultaneously
into memory.
The processor
time is shared
among
multiple active
users.
Programmers
operated the
machine with
little software
support.
Introduced the
use of a
command
language (or,
job control
language)
Users do not
need to know
the location of
a remote
resource to
access it.
Allows remote
access to
resources over
a LAN.

Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 20/34
18 OS – Time Slices
There are five batch processes that need to be executed on a time-shared single processor
system. All processes arrive at time instant 0 in the order A, B, C, D and E and are serviced in
that order. A requires 700ms of processing time, B requires 500ms, C requires 200ms, D
requires 900ms and E requires 400ms.

How long will it take the following processes to complete, given that the time slice is set to
100ms and there are no context switches?

  1. Process C ms
  2. Process E ms

Now, assume that the OS runs for 20ms at the beginning and between each process to
switch context. How long will it take the following process to complete?

  1. Process E ms

What would be the efficiency of the processor in the above scenario, that is with context
switches? Enter your answer to two decimal places. %
Maximum marks: 4
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 21/34
19 OS – Deadlock
The resource allocation graphs for two different scenarios are shown below.

Which of the following statements are true?
Select one or more alternatives:

In (b), P3 has acquired one unit of r3 and is waiting for r2.
Neither (a) nor (b) represents a deadlocked state.
The processes in (a) are deadlocked.
The processes in (a) would never be in a deadlocked state if the system had three units of
each resource (r1 and r2).
The processes in (b) are deadlocked.
In (a), P3 has acquired one unit of r1 and is waiting for r2.
Both (a) and (b) represent deadlocked states.
Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 22/34
20 Linux File Permissions

The ls -l command gives the following output on a Linux machine :

Which of the following statements are true?

Select one or more alternatives

Logged in as user asha946, what command will you issue to change the permissions of the file
lecture1, such that it is readable by all users on the system.
(chmod, chgrp, setperm, cd, chown) (uo+r, ugo+rwx,
ug+r, go-wx, go+r)lecture1

Logged in as user asha946, what command will you issue to change the permissions of the
directory 110 such that it has all permissions for the owner, read and write permissions for users
belonging to group all and read permissions for everyone else.
(chperm, setperm, chmod, chown, chgrp) (744, 664,
754, 752, 661, 764)110

Assuming that you were logged in as root, what command would you use to transfer ownership
of the file lecture1 to user ssin820.
(setuser, chmod, chgrp, chuser, chown)
(asha946:ssin820, asha946, +ssin820, ssin820)lecture1

Users belonging to group all can see the files in directory test.
CompSci is a file with no permissions for anyone except the owner.
lecture1 is a file that cannot be opened by anyone except the user asha946.
The file lecture1 can only belong to one group, which is all.
110 is a directory that is executable by all users on the system.
Select alternative Select alternative
Select alternative Select alternative
Select alternative Select alternative
Maximum marks: 4
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 23/34
21 Access Networks
Match the characteristics of the following access networks to their respective technologies

Please match the values:
Hybrid
Fiber
Coaxial FTTH
Cable
Network Ethernet WiFi ADSL
Uses existing copper
phone lines for Internet
access.
Shared broadcast medium
built on top of existing
cable TV infrastructure.
Uses fiber optic cables to
connect central office to
customer premises.
Connects devices in a
wireless LAN.
Connects devices in a
wired LAN.
Uses both optical fiber and
coaxial cable to provide
Internet access.

Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 24/34
22 Transmission time
You need to transmit a hi-res image consisting of 12 megapixels (1 megapixel = 1,000,000
pixels), where each pixel is encoded using 3 bytes.

How long will it take to transmit the image on each of the following transmission media? Enter
your answer in seconds as a decimal value.

A 2Mbps DSL line seconds
A 100Mbps Fast Ethernet seconds
A 1Gbps Gigabit Ethernet seconds

If the image is first compressed before being transmitted using a compression ratio of 20:1, how
long will it take to transmit the compressed image over a 2Mbps DSL line?
Enter your answer in seconds as a decimal value. seconds
Maximum marks: 2
23 Packetization
The maximum transmission unit (or MTU) of an IP packet on 100 Mbps Ethernet is usually set at
1500 bytes. We need to send a file of 100MB.
How many IP packets will we need in each of the following cases?

Using the IPv4 protocol, where the network layer adds a 20-byte header and the transport layer
adds an 8-byte header.

Using the IPv6 protocol, where the network layer adds a 40-byte header and the transport layer
adds a 20-byte header.
Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 25/34
24 Packet’s Journey
An IPv6 packet between two hosts passes through 3 switches and 5 routers until it reaches its
destination.

Which of the following facts are TRUE about the journey of the packet between the sending
application and the receiving application?
Select one or more alternatives:

It is handled 15 times at the Link layer.
To ensure that the packet reaches the receiving application, the sending application must
use the TCP protocol at the transport layer.
The packet may get lost during its journey between the sender and the receiver.
All 5 routers along the way must be IPv6 routers for the packet to reach its destination.
It is handled twice at the Transport layer.
It is handled 5 times at the Network layer
Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 26/34
25 Packets, Layering & Encapsulation
The process of transmitting data over a network by breaking it into discrete self-
contained chunks is called (forwarding, routing, circuit switching, packet
switching).

(Circuit switching, Frequency Division Multiplexing, Time
Division Multiplexing, Packet switching) is a networking technology that provides a dedicated
connection between the source and destination for the duration of the session.

A packet in a packet-switched network consists of two parts – a (name,
protocol, source address, payload) and a (layer number, destination
address, identifier, header).

Encapsulation helps maintain a logical separation of each layer in the TCP/IP protocol stack by
hiding its functionality in the (payload, header, checksum, version) field of
the packet.

An IPv6 node on the sending side of an IPv4 tunnel (used to connect IPv6 routers) takes the
entire (TCP, UDP, IPv6, IPv4) datagram and puts it in the payload field of
an (802.11, IPv6, Ethernet, IPv4) datagram.

(SMTP, TCP, FTP, IP, UDP) is a reliable, in-order delivery protocol that
runs at the Transport layer in the TCP/IP protocol stack.
Select alternative
Select alternative
Select alternative
Select alternative
Select alternative
Select alternative
Select alternative
Select alternative
Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 27/34
26 2021S2_Security – general
Which of the following statements is/are FALSE?
Select one or more alternatives:

Adding salt to a hashed password makes it difficult to find out if you are using the same
password on different platforms or not.
In the Cambridge Analytica scandal, the firm was accused of storing data from a massive
amount of users without their permission.
A Trojan Horse is a coordinated attack where multiple computers connect simultaneously
to a server.
A hacker who is legally authorised to launch attacks to identify weaknesses in a computer
system is called a white hat.
A hacker who is launching attacks to steal data with malicious ends is called a grey hat.
If you are the system administrator, you can delete any file on your computer.
In a phishing attack, the attacker needs to send many emails because one user has to
click on multiple links to get infected.
Maximum marks: 3
27 2021_S2_CaesarCipher
Consider the ciphertext OMQEMD. If this ciphertext was encrypted with a Caesar cipher with
right shift and key 12, what would the original plaintext be? You may assume that the cipher’s
alphabet consists of the 26 letters of the English alphabet only.
Plaintext: Enter only CAPITAL letters, without any spaces.

Consider the ciphertext EMMB JSAI. If you know that this was encrypted from the plaintext
GOOD LUCK, what key was used? You may assume that the cipher’s alphabet consists of the
26 letters of the English alphabet only.
Key: Enter your answer as a decimal integer value.

Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 28/34
28 2021_S2_RSAEncryption
You decide to use the RSA key exchange protocol to encrypt a key, using p = 17 and q = 11.
Work through the process of finding a pair of encryption/decryption keys e and d by computing
the following steps.

What is the value of n? (26, 160, 187, 28)
What is the value of m? (160, 26, 28, 187)
Choose a valid value for e: (8, 2, 5, 3)
Choose a valid value for d: (107, 214, 160, 54)

Select alternative
Select alternative
Select alternative
Select alternative
Maximum marks: 6
29 2021_S2_DigitalCertificates
Which of the following statements is/are TRUE?
Select one or more alternatives:

In a typical TLS/SSL session, the client initiates the protocol by sending his encryption key
to the server, which then sends his digital certificate in return.
A digital certificate is used to verify if a server sharing a public key is trustworthy.
Well-known certificate authorities include Symantec and Comodo.
The protocol used to exchange data securely from a client to a server on the internet is
called the handshake.
A digital certificate contains the user’s private key, the user’s ID and the certificate
authority signature.
Maximum marks: 2
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 29/34
30 2021_S2_TuringMachines_General
Which of the following statements about Turing machines are FALSE?
Select one or more alternatives:

A Turing machine automatically halts after a pre-set number of instructions are executed.
The Turing machine model captures all the functionalities of any computing agent.
If I design a computable algorithm to generate Turing machines, I should be able to
represent it with a Turing machine.
One of the practical difference between a Turing machine and an actual computer is that a
Turing machine manipulates an unbounded amount of memory.
A Turing machine cannot simulate I/O operation such as input and print.
If a Turing machine designed to solve a problem cannot halt in a finite amount of time for
every possible input, then the problem is not computable.
The head of a Turing machine can read only one cell of the tape at a time.
Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 30/34
31 2021_S2_TuringMachines_Evaluation
Which of the following instruction set for a Turing machine is not valid?
Select one alternative

Consider the following instruction set for a Turing machine to choose the next 3 answers.
(1,1,0,3,R), (1,0,0,2,R), (2,1,1,3,R), (2,0,1,4,R), (3,1,0,2,L), (3,0,0,4,L), (4,1,0,4,L), (4,0,1,4,L)
(4,b,b,3,R)

The number of states in this Turing machine is (3, 5, 4, 2, 1).

If this Turing machine is executed on the tape …b010101bb…, starting in state 1 on the first 0
from the left of the tape (bolded character), after executing 6 instructions, it will end up in state
(4, 5, 2, 1, 3).

If this Turing machine is executed on the tape …b010101bb…, starting in state 1 on the first 0
from the left of the tape (bolded character), after executing 6 instructions, the tape will be
(…b010101bb…, …b100101bb…, …b000101bb…, …b100101bb…,
…01010101b…)

(1,1,0,2,R), (1,0,0,3,R), (2,0,1,3,R), (3,0,b,2,L), (3,1,b,2,L)
(1,0,0,1,R), (1,1,1,1,R)
(1,1,0,2,R), (1,0,0,2,R), (2,1,1,3,R), (2,1,0,3,R), (3,b,b,2,L)
(1,0,1,2,R), (2,1,1,3,R), (3,0,1,3,R), (3,1,0,3,L)
Select alternative
Select alternative
Select alternative
Maximum marks: 5
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 31/34
32 2021_S2_TuringMachines_Evaluation2
You want to design a Turing machine to detect if a binary sequence contains the sequence 110
(e.g. 00101100 contains 110). In other words, your Turing machine should halt when it
encounters the sequence 110 in the tape, without modifying any value.

Among the following sets of instructions, which one defines a Turing machine able to solve
this problem?
Select one alternative

If the selected Turing machine is executed on the tape …00101100bb…, starting in state 1 on the
first 0 from the left of the tape (bolded character), it will execute (6, 7, 3, 5,
8) instructions before halting.
(1,0,0,1,R), (1,1,1,2,R), (2,1,1,2,R), (2,0,0,3,R), (3,0,0,1,R), (3,1,1,4,R)
(1,0,0,1,R), (1,1,1,2,R), (2,0,0,2,R), (2,1,1,3,R), (3,0,0,1,R), (3,1,1,4,R)
(1,0,0,1,R), (1,1,1,2,R), (2,0,0,1,R), (2,1,1,3,R), (3,0,0,4,R), (3,1,1,3,R)
(1,1,0,1,R), (1,0,1,2,R), (2,1,1,2,R), (2,0,0,3,R), (3,1,1,1,R), (3,0,0,4,R)
Select alternative
Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 32/34
33 2021_S2_AI_General
Which of the following statements are FALSE?
Select one or more alternatives:

Computers are generally better than humans at reasoning tasks.
Backpropagation is used to modify the values of the weights in a neural network to better
fit the training data.
Some robots have a set programmed behaviour, while others can learn from their
environment.
A neural network is an exact representation of the human brain.
The Turing test is limited because it does not allow to verify if the computer actually
understands the conversation it is having with the person.
The sentence “Alice sent her data to Bob using DES encryption because she wants to
keep her data secret” can be used as a Winograd schema.
Maximum marks: 3
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 33/34
34 2021_S2_AI_NN
Choose the correct output for each of the following neural networks.

(1, 0, 4, 5)

(7, 0, 2, 1)

(1, -1, 3, 0)

Select alternative
Select alternative
Select alternative
Maximum marks: 6
1/28/22, 4:36 PM COMPSCI110 – 1215
https://auckland.inspera.com/… 34/34
35 2021_S2_ML&Ethics
Which of the following statements are TRUE?
Select one or more alternatives:

Recommender systems recommend new content to a user based on purely random
guess.
In a supervised machine learning problem, we do not know the classes in the data when
training a model.
A spurious correlation between 2 variables is not likely to hold in time.
Machine learning algorithms build models based on causality relationships in the training
data.
If an image recognition system is trained with 98% of dog images and 2% of cat images,
the model risks to exhibit bias (e.g. be less good at recognizing cats than dogs).
Maximum marks: 2

退出移动版