代写辅导接单-COMS10012

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top

UNIVERSITY OF BRISTOL

Summer Examination Period

FACULTY OF ENGINEERING

2023 Examination for the Degree of

Bachelor and Master of Engineering and Bachelor and Master of

Science

COMS10012

Software Tools

TIME ALLOWED:

2 Hours

This paper contains 44 questions, all of which are used for assessment; the maximum for this

paper is 44.

OtherInstructions:

This exam is open-book: you may bring in any handwritten or printed materials. You

may use a faculty-approved calculator model.

TURN OVER ONLY WHEN TOLD TO START WRITING

1. Please make sure you read the instructions on the answer sheet.

2. Each question is worth 1 mark.

3. Only the answer sheet will be marked, the empty pages at the back of the exam are only

used for your calculations.

4. When selecting answers, make clear, horizontal marks within the two sets of brackets,

making sure that the contained letter is struck through.

5. Avoid marking the answer sheet outside specified areas.

6. Do not crease, dog-ear or otherwise damage the answer sheet.

Page 2 of 29

Q1. Alice wishes to merge the branchhotfixinto the branchtesting. Which commands

should they run?

A.git checkout testing; git merge hotfix

B.git checkout hotfix; git merge testing

C.git checkout testing; git rebase hotfix

D.git checkout hotfix; git merge testing --no-ff

[1 mark]

Q2. Which option most accurately describes what thegit clonecommand does?

A.git cloneextracts a version of a file under version control at a specific commit

point in history.

B.git clonemakes a local copy of an entire repository

C.git clonefetches a file from Github and downloads it locally

D.git cloneduplicates a repository on a remote Git forge (like Github)

[1 mark]

Q3. When trying to fetch from a git remote Alice encounters the following error:

$ git fetch

ssh: Could not resolve hostname github.com: no address associated with name

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

What is the issue?

A. Their public key has not been correctly set up on Github.

B. The repository doesn’t exist; they need to create it before they can pull;

C. There is a merge conflict

D. Their network is down or misconfigured.

[1 mark]

Q4. Alice wants to delete the last commit they made on themainbranch. What command or

commands do they need to use?

A.git checkout main~1

B.git clean

C.git checkout main; git reset main~1

D.git branch -D main

[1 mark]

Page 3 of 29Turn Over/...

Q5. When running a command into their favourite pagermore(so they can scroll it on the

terminal) Alice notices the following unusual output. What is going on, and what are the

weirdESC[01;34mbits?

$ ls --color=always | more

ESC[0mESC[01;34mBackupsESC[0m

ESC[01;34mDesktopESC[0m

ESC[01;34mDocumentsESC[0m

ESC[01;36mDownloadsESC[0m

ESC[01;34mMailESC[0m

ESC[01;34mMusicESC[0m

ESC[01;36mNotesESC[0m

ESC[01;34mPicturesESC[0m

ESC[01;34mReposESC[0m

ESC[01;34mVideosESC[0m

mbox

- (END)

A. They are part of the filenames

B. They are ANSI color escape codes. The pagermoredoesn’t know to translate

them into colors

C. The terminal has glitched and is displaying random noise

D. They are escape codes embedded as part of the filenames to make some filenames

italic

[1 mark]

Q6. Bob has the following id:

$ id

uid=1000(bob) gid=800(users) groups=800(users)

Thepasswdprogram has the following permissions:

$ ls -l `command -v passwd`

-r-sr-sr-x 1 root bin 21112 Feb 12 00:27 /usr/bin/passwd

What user and group will it run as?

A. uid=root, gid=bin

B. uid=root, gid=users

C. uid=bob, gid=users

D. uid=bob, gid=bin

[1 mark]

Page 4 of 29

Q7. What is aninode?

A. An inode is an Apple music playing device

B. An inode is the underlying datastructure used to store files on a disk

C. An inode is a system call used to access files on a filesystem

D. In ODE means that the solution to this problem can be expressed as a series of

ordinary differential equations

[1 mark]

Q8. What flag is needed to make thelscommand list inode numbers?

A.-i

B.-l

C.-n

D.-z

[1 mark]

Q9. Alice has the following Makefile. Since the last build, they have made some updates to

main.c. Which rules will be run when next typingmake?

main: main.c interface.o analysis.o

docs.html: main.c interface.c analysis.c library.c

documentation-generator main.c interface.c analysis.c library.c -o $@

interface.o: interface.c config.c

analysis.o: analysis.c library.o

library.o: library.c

A. main

B. main interface.o analysis.o

C. main docs.html

D. main interface.o analysis.o docs.html

[1 mark]

Page 5 of 29Turn Over/...

Q10. Alice has created a new program in Java using the Maven buildsystem.

Theirpom.xmlfile looks like the following:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0

http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

com.mycompany.app

my-app

1.0-SNAPSHOT

my-app

http://www.example.com

UTF-8

1.7

1.7

maven-clean-plugin

3.1.0

maven-resources-plugin

3.0.2

maven-compiler-plugin

3.8.0

maven-surefire-plugin

2.22.1

maven-jar-plugin

Page 6 of 29Qu. continues ...

(cont.)

3.0.2

maven-install-plugin

2.5.2

maven-deploy-plugin

2.8.2

maven-site-plugin

3.7.1

maven-project-info-reports-plugin

3.0.0

When Alice builds their project and run the tests Maven throws the following error:

$ mvn test

[INFO] Scanning for projects...

[INFO]

[INFO] ----------------------< com.mycompany.app:my-app >----------------------

[INFO] Building my-app 1.0-SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO]

[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ my-app ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] skip non existing resourceDirectory /tmp/test/my-app/my-app/src/main/resources

[INFO]

[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ my-app ---

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @

my-app ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] skip non existing resourceDirectory /tmp/test/my-app/my-app/src/test/resources

[INFO]

[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ my-app ---

[INFO] Changes detected - recompiling the module!

[INFO] Compiling 1 source file to /tmp/test/my-app/my-app/target/test-classes

[INFO] -------------------------------------------------------------

Page 7 of 29Turn Over/Qu. continues ...

(cont.)

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[3,24]

package org.junit does not exist

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[3,1]

static import only from classes and interfaces

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[5,17]

package org.junit does not exist

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[15,6]

cannot find symbol

symbol: class Test

location: class com.mycompany.app.AppTest

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[18,9]

cannot find symbol

symbol: method assertTrue(boolean)

location: class com.mycompany.app.AppTest

[INFO] 5 errors

[INFO] -------------------------------------------------------------

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 0.917 s

[INFO] Finished at: 2023-02-14T15:42:26Z

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal

org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile

(default-testCompile) on project my-app: Compilation failure: Compilation

failure:

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[3,24]

package org.junit does not exist

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[3,1]

static import only from classes and interfaces

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[5,17]

package org.junit does not exist

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[15,6]

cannot find symbol

[ERROR] symbol: class Test

[ERROR] location: class com.mycompany.app.AppTest

[ERROR] /tmp/test/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java:[18,9]

cannot find symbol

[ERROR] symbol: method assertTrue(boolean)

[ERROR] location: class com.mycompany.app.AppTest

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read

the following articles:

[ERROR] [Help 1]

Page 8 of 29Qu. continues ...

(cont.)

http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

What has gone wrong?

A. The Java compiler version is incorrect

B. Thepom.xmlis syntactically incorrect

C. The syntax of themvncomand is wrong

D. A dependency is missing

[1 mark]

Q11. Bob wants to store a table containing students answers in an SQL database. The table

should have 3 attributes:

•student(an 8 digit number which references theidattribute of thestudenttable)

•question(a 2 digit number which references theidattribute of thequestiontable)

•answer(text containing their answer)

What SQL command would create the most appropriate table?

A.CREATE TABLE answers(student VARCHAR(8), question INTEGER, answer

TEXT, FOREIGN KEY student REFERENCES student(id), FOREIGN KEY question

REFERENCES question(id), PRIMARY KEY (answer));

B.CREATE TABLE answers(student VARCHAR(8), question INTEGER, answer

TEXT UNIQUE, FOREIGN KEY student REFERENCES student(id), FOREIGN KEY

question REFERENCES question(id), PRIMARY KEY (student, question));

C.INSERT INTO answers(student, question, answer) VALUES ("0607970",

10, "C");

D.CREATE TABLE answers(student VARCHAR(8), question INTEGER, answer

TEXT, FOREIGN KEY student REFERENCES student(id), FOREIGN KEY question

REFERENCES question(id), PRIMARY KEY (student, question));

[1 mark]

Page 9 of 29Turn Over/...

Q12. Bob wants to find each students mark in the exam. If each question is worth 1 mark,

which SQL query will find the students’ total scores?

You can assume the following tables in Bob’s database:

Exam:

Student Question Answer

11 A

12 B

21 A

22 C

31 -

32 -

Answers:

Question Answer

1 A

2 B

A.SELECT student, COUNT(exam.answer = answers.answer) AS mark FROM exam

JOIN answers WHERE exam.question=answers.question GROUP BY student_id;

B.SELECT student, SUM(exam.answer = answers.answer) AS mark FROM exam

JOIN answers WHERE exam.question=answers.question GROUP BY student_id;

C.SELECT student, SUM(exam.answer = answers.answer) AS mark FROM exam

JOIN answers WHERE exam.question=answers.question GROUP BY exam.question;

D.SELECT student, COUNT(exam.answer = answers.answer) AS mark FROM exam

JOIN answers WHERE exam.question=answers.question GROUP BY exam.question;

[1 mark]

Q13. TheFOREIGN KEYconstraint implies which other constraints (if any)?

A.NOT NULL, UNIQUE

B.NOT NULL

C.UNIQUE

D. No other constraints

[1 mark]

Page 10 of 29

Q14. Bob is trying to run a command but it isn’t working. To debug their issue they run their

command withstrace. What command are they trying to run?

execve("/usr/bin/cd", ["cd", "/home/jhl8636"], 0x7fff0476de18 /* 28 vars */) = 0

brk(NULL)= 0x1020000

access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)

open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=43207, ...}) = 0

close(3)= 0

open("/lib64/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\316\0\0\0\0\0\0"..., 832) =

832

fstat(3, {st_mode=S_IFREG|0755, st_size=174576, ...}) = 0

close(3)= 0

open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) =

832

fstat(3, {st_mode=S_IFREG|0755, st_size=19248, ...}) = 0

close(3)= 0

open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3

read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`&\2\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=2156592, ...}) = 0

close(3)= 0

arch_prctl(ARCH_SET_FS, 0x7f96437f7740) = 0

access("/etc/sysconfig/strcasecmp-nonascii", F_OK) = -1 ENOENT (No such file or

directory)

access("/etc/sysconfig/strcasecmp-nonascii", F_OK) = -1 ENOENT (No such file or

directory)

munmap(0x7f96437fa000, 43207)= 0

open("/dev/tty", O_RDWR|O_NONBLOCK) = 3

close(3)= 0

brk(NULL)= 0x1020000

brk(0x1041000)= 0x1041000

brk(NULL)= 0x1041000

open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=106176928, ...}) = 0

close(3)= 0

brk(NULL)= 0x1041000

getuid()= 377810

getgid()= 1349

geteuid()= 377810

getegid()= 1349

open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3

fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0

read(3, "MemTotal:3868352 kB\nMemF"..., 1024) = 1024

close(3)= 0

munmap(0x7f9643804000, 4096)= 0

uname({sysname="Linux", nodename="seis-shell", ...}) = 0

stat("/home/jh18636", {st_mode=S_IFDIR|0700, st_size=512, ...}) = 0

stat(".", {st_mode=S_IFDIR|0700, st_size=512, ...}) = 0

getpid()= 48130

Page 11 of 29Turn Over/Qu. continues ...

(cont.)

open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=26970, ...}) = 0

close(3)= 0

getppid()= 48128

getpgrp()= 48128

getrlimit(RLIMIT_NPROC, {rlim_cur=4*1024, rlim_max=14900}) = 0

open("/usr/bin/cd", O_RDONLY)= 3

ioctl(3, TCGETS, 0x7ffef00471e0) = -1 ENOTTY (Inappropriate ioctl for device)

lseek(3, 0, SEEK_CUR)= 0

read(3, "#!/bin/sh\nbuiltin cd \"$@\"\n", 80) = 26

lseek(3, 0, SEEK_SET)= 0

getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0

fcntl(255, F_GETFD)= -1 EBADF (Bad file descriptor)

dup2(3, 255)= 255

close(3)= 0

fcntl(255, F_SETFD, FD_CLOEXEC) = 0

fcntl(255, F_GETFL)= 0x8000 (flags O_RDONLY|O_LARGEFILE)

fstat(255, {st_mode=S_IFREG|0755, st_size=26, ...}) = 0

lseek(255, 0, SEEK_CUR)= 0

read(255, "#!/bin/sh\nbuiltin cd \"$@\"\n", 26) = 26

stat("/home", {st_mode=S_IFDIR|0755, st_size=2097152, ...}) = 0

stat("/home/jhl8636", 0x7ffef0046e80) = -1 ENOENT (No such file or directory)

open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=2502, ...}) = 0

read(3, "# Locale name alias data base.\n#"..., 4096) = 2502

read(3, "", 4096)= 0

close(3)= 0

munmap(0x7f96437fd000, 4096)= 0

open("/usr/share/locale/en_GB.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No

such file or directory)

open("/usr/share/locale/en_GB.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No

such file or directory)

open("/usr/share/locale/en_GB/LC_MESSAGES/libc.mo", O_RDONLY) = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=1474, ...}) = 0

close(3)= 0

open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No

such file or directory)

open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such

file or directory)

open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file

or directory)

fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 8), ...}) = 0

open("/usr/share/locale/en_GB.UTF-8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No

such file or directory)

open("/usr/share/locale/en_GB.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No

such file or directory)

open("/usr/share/locale/en_GB/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such

file or directory)

open("/usr/share/locale/en.UTF-8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No

such file or directory)

Page 12 of 29Qu. continues ...

(cont.)

open("/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such

file or directory)

open("/usr/share/locale/en/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file

or directory)

write(2, "/usr/bin/cd: line 2: cd: /home/j"..., 66/usr/bin/cd: line 2: cd:

/home/jhl8636: No such file or directory

) = 66

read(255, "", 26)= 0

exit_group(1)= ?

+++ exited with 1 +++

A.bash

B.cd

C.execve

D./etc/ld.so.preload

[1 mark]

Q15. Bob is trying to run a command but it still isn’t working. Using the trace from before:

what type of program doesstracetry and run, in the first instance?

A. A compiled binary command

B. A shell script

C. A shell builtin command

D. Impossible to say

[1 mark]

Q16. Bob is trying to run a command but it still isn’t working. Using the trace from before:

what’s the problem?

A. The command they’ve tried to run doesn’t exist

B. The permissions are set to prevent their command running

C. The filesystem and it’s inodes are corrupt.

D. A folder they’ve tried to access doesn’t exist

[1 mark]

Page 13 of 29Turn Over/...

Q17. Which of the following bash scripts would produce the output string “the easiest question”?

A.#!/bin/bash

input="the hardest question"

echoinput |seds/easiest/hardest/

B.#!/bin/bash

input="the hardest question"

echo$input |seds/hard/easi/

C.#!/bin/bash

input=the hardest question

echo"$input | sed s/hardest/easiest/"

D.!#/bin/bash

input="the hardest question"

echo"input | sed s/easi/hard/"

[1 mark]

Q18. Alice is trying to set up key-based login on a service she currently accesses via usingssh

and entering her password. Here are listings of her.sshdirectory on her local machine:

-rw------- 1 alice alice 389 Jan 19 10:56 authorized_keys

-rw-r--r-- 1 alice alice 395 Feb 21 13:03 id_rsa.pub

-rw-r--r-- 1 alice alice 225 Feb 21 13:01 known_hosts

And on the server:

-r-------- 1 alice alice 395 Feb 21 13:30 authorized_keys

-rw-r--r-- 1 alice alice 395 Feb 21 13:21 id_rsa.pub

-rw-r--r-- 1 alice alice 225 Jan 19 11:02 known_hosts

There’s a problem evident with her current setup. Identify which file’s presence, absence or

visible details indicates the problem.

A. The problem lies with ‘authorized_keys’ on the local machine.

B. The problem lies with ‘known_hosts’ on the server.

C. The problem lies with ‘id_rsa’ on the local machine.

D. The problem lies with ‘id_rsa.pub’ on the server.

[1 mark]

Page 14 of 29

Q19. Which of the below would redirect both standard output and standard error frommyprogram

tolog.txt?

A../myprogram > log.txt 1> log.txt

B../myprogram 1> log.txt 2>&1

C../myprogram 2>&1 > log.txt

D../myprogram 2&1> log.txt

[1 mark]

Q20. Ifcommand2ignores standard input and will only work with a file passed as an argument,

how can we redirect the output ofcommand1to be used bycommand2?

A.command1 > command2

B.command2 $(command1)

C.command1 | command2

D.command2 <(command1)

[1 mark]

Q21. Look at the below shell session:

$ cp * ~/backup/

cp: cannot stat '*': No such file or directory

What can be said about the state of the filesystem and shell environment?

A. There is no file called ’*’ in the current working directory.

B. There is no file called ’cp’ in the current working directory.

C. The current working directory is empty.

D. All of the above.

[1 mark]

Page 15 of 29Turn Over/...

Q22. Consider the following HTTP request as received by a web server:

GET /about.html HTTP/1.1

Host: www.example.com

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Firefox/108.0

Accept: text/html,application/xhtml+xml,application/xml

Accept-Language: en-GB,en;q=0.5

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Assuming the request headers can be trusted, which of the following best describes what has

happened to cause this request?

A. Someone attempted to run gzip on the webpageabout.htmlfrom their Linux

terminal.

B. Someone running the X11 windowing system navigated tohttp://www.example.

com/about.html.

C. Someone running the Mozilla OS navigated towww.example.com.

D. Several browsers made the same request forabout.htmlat once, forcing the

server to keep the connection alive.

[1 mark]

Q23. You encounter an unfamiliar HTTP status code 413. Without knowing more than this

code, which of the below might you reasonably conclude?

A. The request has completed successfully, with some additional effects.

B. The server needs to redirect you to another location.

C. The server has encountered an internal error.

D. There is an error in the request sent by the client.

[1 mark]

Page 16 of 29

Q24. Consider this snippet of HTML:

I'm creating a link to

href="https://www.mozilla.org/en-US/"

title="The best place to find more information about Mozilla's

mission and how to contribute">the Mozilla homepage.

Which of the below reflects the text you would click on in the browser to follow the link?

A. “I’m creating a link to the Mozilla homepage.”

B. “the Mozilla homepage”

C. “https://www.mozilla.org/en-US/”

D. “The best place to find more information about Mozilla’s mission and how to

contribute”

[1 mark]

Q25. Which of the following HTML elements should containelements?

A.

B.

C.

51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: Fudaojun0228