UniSA STEM TEST COMP1039 Problem Solving and Programming
58 views 0 purchase
Course
UniSA STEM TEST COMP1039
Institution
UniSA STEM TEST COMP1039
UniSA STEM
TEST
COMP1039 Problem Solving and Programming
This paper is for Mawson Lakes and Mawson Lakes (External) students.
IMPORTANT:
THIS IS NOT THE TEST. There is no guarantee that these questions will appear in the
test. You need to study all the material covered during the study period...
TEST
COMP1039 Problem Solving and Programming
This paper is for Mawson Lakes and Mawson Lakes (External) students.
IMPORTANT:
THIS IS NOT THE TEST. There is no guarantee that these questions will appear in the
test. You need to study all the material covered during the study period (i.e. in
workshops, practical and assignment work. This SAMPLE TEST is provided in order to
give you practice in test style questions only. This is a good indication of the style and
type of questions you are likely to get in the actual test.
Test Duration: 120 minutes
Reading Time: 10 minutes For Examiner Use Only
Question Mark
1
2
3
4
5
6
7
Materials Permitted In The Test Venue:
(No electronic aids are permitted e.g. laptops, phones) 8
Open Book - No restriction.
Total ________
Materials To Be Supplied To Students:
None.
Instructions To Students:
Write your student number and full name in BLOCK letters in the space above.
The test is worth a total of ## marks. You are required to answer all questions.
Write your answers in this test booklet, which must be handed up. Spare pages are included at the back
for you to continue answers to questions if necessary.
Do not remove any pages from this booklet.
Answer each question precisely. Do exactly what the question asks, and nothing more.
1 of 18
,QUESTION 1 [25 marks]
What output does the following code produce?
Code Output
a)
k = 0
theList = ['eight', 'seven', 'two']
while k <= 2:
print(theList[k])
k = k + 1
[2 marks]
b)
k = 0
while k < 8:
if k % 2 == 0:
print('in da loop')
k = k + 1
[2 marks]
c)
k = 0
while k < 10:
k = k + 2
print(k)
[2 marks]
d)
x = 2
y = 7
z = 2
for k in range(x, y, z):
print('hello')
[3 marks]
2 of 18
, Code Output
e)
line = 'abcdef'
count = [3,4,7,1,2,5]
index = 0
while index < len(line):
print(count[index], end=' ')
for k in range(0,count[index]):
print(line[index],end='')
print()
index = index + 1
[3 marks]
f)
def does_something1(info):
return info[0]
def does_something2(info):
info = info.upper()
return info
info = 'apple'
result1 = does_something1(info)
result2 = does_something2(info)
print('Result is: ', result1)
for stuff in result2:
print(stuff)
[4 marks]
g)
aString = 'This is question thirteen.'
for k in range(8,13):
print(aString[k])
[3 marks]
3 of 18
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Themanehoppe. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $9.49. You're not tied to anything after your purchase.