python代写-CSSE1001/7030
时间:2021-06-03
Preview Test: CSSE1001/7030 Semester One Final Examination 2020
Test Information
Description
Instructions
Timed Test This test has a time limit of 2 hours and 30 minutes.This test will save and be submitted
automatically when the time expires.
Warnings appear when half the time, 5 minutes, 1 minute, and 30 seconds remain.
[The timer does not appear when previewing this test]
Multiple
Attempts
Not allowed. This Test can only be taken once.
Force
Completion
This Test can be saved and resumed at any point until time has expired. The timer will
continue to run if you leave the test.
Your answers are saved automatically.
CSSE1001/7030. Introduction to Software Engineering.
Semester 1 Final Examinations.
Materials permitted include 2 blank sheets of A4 paper and a FX82 series calculator or a
UQ approved and labelled calculator or a calculator from UQ's list of approved
calculators. You are NOT allowed to run any Python software while doing this
examination.
Answer all questions. For all questions, please choose the most appropriate answer if it
appears that more than one option is a potentially correct answer. All coding questions
relate to the Python 3 programming language. If an evaluation produces an error of any
kind, choose Error as your answer. Different questions may have different numbers of
choices. Each question is worth one mark.
If you experience any technical difficulties during the exam, talk to your online invigilator
via the webcam or chat functions. If the technical trouble cannot be resolved, you should
ask for an email (or transcript of the chat) documenting any technical advice provided to
support your request for a deferred exam.
QUESTION 1
Please use this space to specify any assumptions you have made in
completing the exam and which questions those assumptions relate
to. You may also include queries you may have made with respect to
a particular question, should you have been able to ‘raise your hand’
in an examination room.
0 points   Save Answer
QUESTION 2
What does the expression (6.1 + 3.2) // 3 evaluate to?
3
3.0
3.1
Error
1 points   Save Answer
QUESTION 3
What does the expression 3 + 5 % 2 evaluate to?
4
4.0
5.5
0
Error
1 points   Save Answer
QUESTION 4
What does the expression 11.0 % 3 ** 2 evaluate to?
4.0
Error
2.0
4
2
1 points   Save Answer
QUESTION 5
What will be returned when (7,3,(6,)) + (9,(5)) is entered into
Python?
(7, 3, 6, 9, 5)
(7, 3, (6,), 9, (5))
(7, 3, (6,), (9, (5)))
(7, 3, (6,), 9, 5)
None of the other choices are correct
1 points   Save Answer
QUESTION 6
What does the expression ['ab'] <= ['ba'] evaluate to?
Error
'ba'
'ab'
False
True
1 points   Save Answer
QUESTION 7
What is the value of a after the following statements are evaluated?
x = [1, 'a', '\t bc'.strip()]
y = ['d', 'g', 'f']
z = x + y
a = z[2]
'\tbc'
'bc'
Error
'\t bcf'
'\tbc'
1 points   Save Answer
QUESTION 8
What is the result of max(2,4) < min(5,[6,3][1]) ?
True
False
Error
None of the other choices are correct
1 points   Save Answer
QUESTION 9
What is the value of x after the following statements are
evaluated?
x = [23, True, False]
y = x
y[2] = 46
x[1] = 7
[23, 7, False]
[23, 7, 46]
Error
None of the other choices
1 points   Save Answer
QUESTION 10
After the assignment s1 = "Ode to Programming", which of the
following statements assigns 'rog' to s2?
s2=s1[8:11]
       s2=s1[8:10]
s2 = s1[-7:-10]
s2 = s1[-10:-7]
More than one of the other options are correct
1 points   Save Answer
QUESTION 11
Given the assignment s1 = "Ode to Programming", what will the
value of s2 be after the following command is entered?
s2=s1[3:11:4]
s2 = 'e '
s2 = ' Pr'
s2 = ' P'
None of the other choices are correct
1 points   Save Answer
QUESTION 12
What will be in sum after the following loop has completed executing?
sum=''
for e,f in ('ab','cd'):
sum+=2*e+f
('ababcd')
'ababcd'
'aabccd'
Error
None of the other choices are correct
1 points   Save Answer
QUESTION 13
What will be printed after the following code is executed:
x = input("Please enter a two digit number: ")
x1 = int(x)
x1 = x1[0]
print("The first digit is:", x1)
The first digit is: 1
The first digit is: 15
An Error message
The first digit is:
1 points   Save Answer
QUESTION 14
After executing the code below, what would be the contents of a?
a={1:"s",2:"t",3:"r"}
b={4:"i",5:"n"}
a.update({6:b.get(5)})
{1: 's', 2: 't', 3: 'r'}
{1: 's', 2: 't', 3: 'r', 6: 'n'}
{}
Error
      None of the other choices are correct
1 points   Save Answer
QUESTION 15
What is the value of d2 after the following statements are evaluated?
d = {1:'a', 2:'b', 3:'c'}
d2 = d.update({5:['def']})
{1: 'a', 2: 'b', 3: 'c', 5: 'def'}

{1: 'a', 2: 'b', 3: 'c', 5: ['def']
        Error
None
{1:'a', 2:'b', 3:'c'}
1 points   Save Answer
QUESTION 16
What is the value of y after the following code is executed?
def g(y):
y = y+25
return y
y=40
g(y)
65
40
None
Error
1 points   Save Answer
QUESTION 17
The following recursive function definition is used in this question and the
next one.
def g(x) :
if x == 1 :
return 1
x -=1
return g(x-1)*x
What will the function call g(3) return?
2
RecursionError will be raised due to
maximum recursion depth being exceeded
6
4
1 points   Save Answer
QUESTION 18
What will the function call g(2) return?
0
-1
1
RecursionError will be raised due to maximum
recursion depth being exceeded.
1 points   Save Answer
QUESTION 19
The following class and method definitions are
used for this and the following 4 questions.
class A(object) :
def __init__(self, x) :
self._x = x+1

def m1(self, x) :
return self.m2(x) * 3

def m2(self, x) :
return x + 2

class B(A) :
def m2(self, y) :
return self._x + y

class C(B) :
def __init__(self, x, y) :
super().__init__(x)
self._y = y+1

def m1(self, x) :
return self._x + self._y

class D(B) :
def __init__(self, x, y) :
super().__init__(x)
self._x += y
self._y = y-1

def m1(self, y) :
return self._y + y

def m2(self, x) :
return super().m2(x) + x

a = A(2)
b = B(1)
c = C(1, 2)
d = D(1, 1)
What does a.m1(1) return?
7
9
11
13
None of the other choices are correct
1 points   Save Answer
QUESTION 20
What does b.m1(1) return?
5
7
9
11
None of the other choices are correct
1 points   Save Answer
QUESTION 21
What does c.m2(2) return?
1
2
3
4
None of the other choices are correct
1 points   Save Answer
QUESTION 22
What does d.m1(2) return?
-1
0
1
2
None of the other choices are correct
1 points   Save Answer
QUESTION 23
What does d.m2(2) return?
5
6
7
8
None of the other choices are correct
1 points   Save Answer
QUESTION 24
What is the value of z after the following has been evaluated?

g = lambda u,v: u+v
vs = 'trot'
z = [g(u,v) for u in 'same' if u not in
'amps' for v in vs]
['st', 'sr', 'so', 'st', 'at', 'ar',
'ao','at', 'mt', 'mr', 'mo', 'mt']
['et', 'er', 'eo', 'et']
[]
None of the above choices are correct

1 points   Save Answer
QUESTION 25
After running the following code:
import random
xs=[1,2,3,4]
new_list=[(x,random.random()) for x in xs]
new_list.sort()
z=[ (y,y) for y,x in new_list]
which of the following represents the most plausible contents of z?
[(1, 0.3656826997131658), (2,
0.4789711218283632), (3,
0.20367358828920812), (4,
0.4651024789182844)]
[(0.23845323656036166, 2),
(0.5411763744080424, 4),
(0.7368067435015173, 3),
(0.9585633916983842, 1)]

[(0.7070150251404196,
0.7070150251404196), (0.9635956493452444,
0.9635956493452444), (0.5960013756836279,
0.5960013756836279), (0.9623962721301965,
0.9623962721301965)]
[(1, 1), (2, 2), (3, 3), (4, 4)]
Error
1 points   Save Answer
QUESTION 26
The following partial definition of a SwimRecord class is used in this and
the following two questions.
class SwimRecord(object) :
def __init__(self, name, club) :
"""Parameters:
name(str): swimmer’s name
club(str): swimmer’s club
self._swim_record(dict): Data record to store
swim meets and
swim times. The key is the name of the
swim meet; the value is the time recorded for
each swim meet"""
self._name = name
self._club = club
self._swim_record = {}

def update_swim_record(self, new_results: dict) :
"""Add results from 'new_results' into
record."""
## code block 1 ##

def get_swim_results(self, swim_meet: str) :
"""Get swim results."""
return self._swim_record.get(swim_meet,'Err')

def get_swim_times(self) :
"""Return all swim times in a list"""
## code block 2 ##
What is the required code for ## code block 1 ##?
self._swim_record += new_results
self._swim_record.update(new_results)
self._swim_record.append(new_results)
None of the other code blocks are correct.
1 points   Save Answer
QUESTION 27
What is the required code for ## code block 2 ## ?
return [j for i,j in self._swim_record.items()]
return self._swim_record
       return list(self._swim_record.keys())
      return swim_record.update(self)
More than one of the other choices are correct
1 points   Save Answer
QUESTION 28
After the assignment z='ministry of silly walks' what does the
expression '----'.join(z.split('silly')) evaluate to?
['ministry', 'of', '----', 'walks']
      '----silly'
'ministry of ---- walks'
None of the other choices are correct
1 points   Save Answer
QUESTION 29
The next 3 questions refer to the following de
欢迎咨询51学霸君