logo

Crowdly

Browser

Add to Chrome

Informatics 1 - Introduction to Programming (2026-2027)[SEM1]

Looking for Informatics 1 - Introduction to Programming (2026-2027)[SEM1] test answers and solutions? Browse our comprehensive collection of verified answers for Informatics 1 - Introduction to Programming (2026-2027)[SEM1] at moodle1.maths.ed.ac.uk.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

class Counter:

def __init__(self):

self.count = 0

def increment(self):

self.count = self.count + 1

c = Counter()

c.increment()

c.increment()

print(c.count)

What is printed?

❌
❌
❌
✅
View this question

Which correctly defines a function that returns the square of n?

✅
❌
❌
❌
View this question

def mystery(x):

y = x * 2

print(y)

What does mystery(3) return?

0%
0%
0%
❌
View this question

def greet(name):

return "Hello, " + name

result = greet("World")

print(len(result))

What is printed?

❌
✅
❌
❌
View this question

items = [10, 20]

items.append(30)

items[0] = 5

What is the value of items?

0%
0%
❌
0%
View this question

Which of the following causes an infinite loop?

❌
✅
❌
❌
View this question

total = 0

for i in range(0, 4):

total = total + i

print(total)

What is printed?

❌
❌
❌
✅
View this question

x = 4

y = 6

if x * 2 < y or y == 6:

print("A")

else:

print("B")

What is printed?

❌
✅
❌
❌
View this question

Consider: 

def mean(values): 

    """Return the arithmetic mean of the supplied values.""" 

    total = 0 

    for value in values: 

        total = total + value 

    return total / len(values) 

 

result = mean([2, 4, 9]) 

print(result) 

 

State the exact printed output. In your explanation, identify: 

  • the value supplied to values;
  • the final value of total;
  • what len(values) returns.

[2 marks] 

 

View this question

A student wants to calculate: 

result = mean([2, 4, 9]) + 1 

They suggest replacing the function’s final line with: 

print(total / len(values)) 

Explain why printing the mean is not a suitable replacement for returning it in this use of the function. [2 marks] 

View this question

Want instant access to all verified answers on moodle1.maths.ed.ac.uk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome