logo

Crowdly

Browser

Додати до Chrome

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

Шукаєте відповіді та рішення тестів для Informatics 1 - Introduction to Programming (2026-2027)[SEM1]? Перегляньте нашу велику колекцію перевірених відповідей для Informatics 1 - Introduction to Programming (2026-2027)[SEM1] в moodle1.maths.ed.ac.uk.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

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?

❌
❌
❌
✅
Переглянути це питання

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

✅
❌
❌
❌
Переглянути це питання

def mystery(x):

y = x * 2

print(y)

What does mystery(3) return?

0%
0%
0%
❌
Переглянути це питання

def greet(name):

return "Hello, " + name

result = greet("World")

print(len(result))

What is printed?

❌
✅
❌
❌
Переглянути це питання

items = [10, 20]

items.append(30)

items[0] = 5

What is the value of items?

0%
0%
❌
0%
Переглянути це питання

Which of the following causes an infinite loop?

❌
✅
❌
❌
Переглянути це питання

total = 0

for i in range(0, 4):

total = total + i

print(total)

What is printed?

❌
❌
❌
✅
Переглянути це питання

x = 4

y = 6

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

print("A")

else:

print("B")

What is printed?

❌
✅
❌
❌
Переглянути це питання

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] 

 

Переглянути це питання

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] 

Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на moodle1.maths.ed.ac.uk?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome