Looking for Computer Science / Rekenaarwetenskap - 144 test answers and solutions? Browse our comprehensive collection of verified answers for Computer Science / Rekenaarwetenskap - 144 at stemlearn.sun.ac.za.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Which statements about recursion (§2.3) are true? Select all that apply. Wrong choices reduce your mark (not below 0).
Watter stellings oor rekursie is waar? Kies al die korrekte opsies. Verkeerde keuses verminder jou punt (nie onder 0 nie).
Which statements describe the symbol-table API design in §4.4 (also followed by Python's dict)? Select all that apply. Wrong choices reduce your mark (not below 0).
Watter stellings beskryf die ontwerp van die simbooltabel-API in §4.4? Kies al die korrekte opsies. Verkeerde keuses verminder jou punt (nie onder 0 nie).
What does this code write (§3.2)?
class Account:
def __init__(self, owner, balance):
self._owner = owner
self._balance = balance
def deposit(self, amount):
self._balance += amount
def balance(self):
return self._balance
accounts = [Account('ann', 10), Account('bob', 20)]
first = accounts[0]
accounts[0] = Account('cat', 30)
first.deposit(5)
accounts[1].deposit(5)
print(first.balance(), accounts[0].balance(), accounts[1].balance())
Wat skryf hierdie kode?
Which statements about designing data types (§3.3) are true? Select all that apply. Wrong choices reduce your mark (not below 0).
Watter stellings oor die ontwerp van datatipes is waar? Kies al die korrekte opsies. Verkeerde keuses verminder jou punt (nie onder 0 nie).
A graph has these edges:
P-Q Q-R R-S S-P R-T T-UWhat is its average path length, as computed by averagePathLength() in smallworld.py (§4.5): the sum of the shortest-path distances over all ordered pairs of different vertices, divided by V(V − 1)? Give 3 decimal places, using a decimal point (e.g. 0.123).
'n Grafiek het die kante hierbo. Wat is sy gemiddelde padlengte, soos bereken deur averagePathLength(): die som van die kortste-pad-afstande oor alle geordende pare verskillende punte, gedeel deur V(V − 1)? Gee 3 desimale plekke en gebruik 'n desimale punt (bv. 0.123).
With questions.py (§4.2) and k = 7, the program asks "Greater than or equal to mid?" questions to find a hidden number between 0 and 127. The first question is "Greater than or equal to 64?". The hidden number is 45. Which list gives the replies, in order?
Met questions.py en k = 7 vra die program "Groter as of gelyk aan mid?"-vrae om 'n versteekte getal tussen 0 en 127 te vind. Die versteekte getal is 45. Watter lys gee die antwoorde, in volgorde?
Which statements about percolation (§2.4) are true? Select all that apply. Wrong choices reduce your mark (not below 0).
Watter stellings oor perkolasie is waar? Kies al die korrekte opsies. Verkeerde keuses verminder jou punt (nie onder 0 nie).
Let a = [10, 20, 30, 40, 50]. Match each expression with its value (§1.4).
Gestel a = [10, 20, 30, 40, 50]. Pas elke uitdrukking by sy waarde.
What does this program write (§1.3)?
count = 0
for i in range(1, 6):
for j in range(i, 6):
if (i + j) % 3 == 0:
continue
if j == 4:
break
count += 1
print(count)
Wat skryf hierdie program? Gee 'n heelgetal.
Evaluate this postfix (reverse Polish) expression with a single stack, as described in §4.3:
5 1 2 + 4 * + 3 -Evalueer hierdie postfix-uitdrukking (omgekeerde Poolse notasie) met een stapel. Gee 'n getal.