Gra edukacyjna
Polecenie 1
Sprawdź swoją wiedzę biorąc udział w quizie.
Test
Sprawdź swoją wiedzę
Liczba pytań:
5
Limit czasu:
4 min
Twój ostatni wynik:
-
Rozwiąż poniższy test składający się z piętnastu pytań jednokrotnego wyboru.
Ćwiczenie 1
Ćwiczenie 2
Ćwiczenie 3
Ćwiczenie 4
Ćwiczenie 5
a_0 ... a_n to mnożniki potęg zmiennej x?
Poszczególne wyrazy wielomianu są zapisane od najniższej potęgi zmiennej x do najwyższej. Możliwe odpowiedzi: 1. W(x)=a_0+x(a_1+x(a_2+...+x(a_{n-1}+xa_n)...)), 2. W(x)=x(a_0+a_x+x(a_2+...+x(a_{n-1}+xa_n)...)), 3. W(x)=a_0+x(a_1+(xa_2+...+x(a_{n-1}+xa_n)...)), 4. W(x)=a_n+x(a_n-1+x(a_n-2+...+x(a_{1}+xa_0)...))
Ćwiczenie 6
W(x)=3x^3-6x^2+9x-13
przy wykorzystaniu schematu Hornera? Możliwe odpowiedzi: 1. W(x)=((3x+6)x+9)x-13, 2. W(x)=(3(3x-6)x-3)x-13, 3. W(x)=((3x^2-6)x+9)x-13, 4. W(x)=((3x-6)x+9)x-13
Ćwiczenie 7
1. def rek_horner(stopien, wsp, x):
2. if stopien == 0:
3. return wsp[stopien]
5. else:
6. ... Możliwe odpowiedzi: 1. return x * rek_horner(stopien - 1, wsp, x) / wsp[stopien], 2. return x * rek_horner(stopien - 1, wsp, x) + wsp[stopien], 3. return x * rek_horner(stopien - 1, wsp, x) * wsp[stopien], 4. return x * rek_horner(stopien - 1, wsp, x) - wsp[stopien]
Ćwiczenie 8
1. def rek_horner(stopien, ws, x):
2. if stopien == 0:
3. return wsp[stopien]
4. else:
5. return x*rek_horner(stopien- 1, wsp, x) + wsp[stopien]
6.
7. print(rek_horner(1, [1, 1], 7)) Możliwe odpowiedzi: 1. 9, 2. 1, 3. 8, 4. 7
Ćwiczenie 9
1. def rek_horner(stopien, wsp, x):
2. if stopien == 0:
3. return wsp[stopien]
4. else:
5. return x*rek_horner(stopien - 1, wsp, x) + wsp[stopien]
6.
7. print(rek_horner(0, [1], 7)) Możliwe odpowiedzi: 1. 7, 2. 9, 3. 1, 4. 8
Ćwiczenie 10
1. def rek_horner(stopien, wsp, x):
2. if stopien ==0:
3. return wsp[stopien]
4. else:
return x*rek_horner(stopien -1 , wsp, x) + wsp[stopien]
5.
6. print(rek_horner(1, [1,0], 7)) Możliwe odpowiedzi: 1. 8, 2. 1, 3. 7, 4. 9
Ćwiczenie 11
1. def rek_horner(stopien, wsp, x):
2. global operacje
3. if stopien == 0:
4. return wsp[stopien]
5. else:
6. operacje += 2
7. return x*rek_horner(stopien - 1, wsp, x) + wsp[stopien]
8.
9. operacje = 0
10. rek_horner(1, [1,1], 7)
11. print(operacje) Możliwe odpowiedzi: 1. 1, 2. 2, 3. 3, 4. 4
Ćwiczenie 12
1. def rek_horner(stopien, wsp, x):
2. global operacje
3. if stopien == 0:
4. return wsp[stopien]
5. else:
6. operacje += 2
7. return x*rek_horner(stopien - 1, wsp, x) + wsp[stopien]
8.
9. operacje = 0
10. rek_horner(1, [1,0], 7)
11. print(operacje) Możliwe odpowiedzi: 1. 1, 2. 2, 3. 3, 4. 4
Ćwiczenie 13
def rek_horner(stopien, wsp, x):
global operacje
if stopien == 0:
return wsp[stopien]
else:
operacje += 2
return x*rek_horner(stopien - 1, wsp, x) + wsp[stopien]
operacje = 0
rek_horner(2, [1,1,1], 7)
print(operacje) Możliwe odpowiedzi: 1. 1, 2. 2, 3. 3, 4. 4
Ćwiczenie 14
1. def horner_iter(wsp, x):
2. ""Współczynniki w liście wsp należy podać od końca""
3. stopień = len(wsp) - 1
4. wynik = wsp[stopien]
5. while stopien > 0:
6. stopien = stopien - 1
7. wynik = wynik*x+wsp[stopien]
8. return wynik
9.
10. print(horner_iter([1,1], 7)) Możliwe odpowiedzi: 1. 1, 2. 7, 3. 8, 4. 9
Ćwiczenie 15
1. def horner_iter(wsp, x):
2. ""Współczynniki w liście wsp należy podać od końca""
3. stopien = len(wsp) - 1
4. wynik = wsp[stopien]
5. while stopien = stopien - 1
6. wynik = wynik*x+wsp[stopien]
7. return wynik
8.
9. print(horner_iter([1,0], 7)) Możliwe odpowiedzi: 1. 1, 2. 9, 3. 7, 4. 8
Ćwiczenie 16
def horner_iter(wsp, x):
"""Współczynniki w liście wsp należy podać od końca"""
stopien = len(wsp) - 1
wynik = wsp[stopien]
while stopien > 0:
stopien = stopien - 1
wynik = wynik*x + wsp[stopien]
return wynik
print(horner_iter([0,1], 7)) Możliwe odpowiedzi: 1. 1, 2. 7, 3. 8, 4. 9
Polecenie 2
Tupla po polsku to 1. Wielomianach, 2. Generatorze, 3. Schemat, 4. Algorytm, 5. Instrukcje, 6. Krotka.
W informatyce sposób postępowania/opis sposobu rozwiązania problemu to 1. Wielomianach, 2. Generatorze, 3. Schemat, 4. Algorytm, 5. Instrukcje, 6. Krotka.
Niniejsza lekcja mówi o 1. Wielomianach, 2. Generatorze, 3. Schemat, 4. Algorytm, 5. Instrukcje, 6. Krotka.
Polecenia to inaczej 1. Wielomianach, 2. Generatorze, 3. Schemat, 4. Algorytm, 5. Instrukcje, 6. Krotka.
Instrukcja yield wykorzystywana jest w 1. Wielomianach, 2. Generatorze, 3. Schemat, 4. Algorytm, 5. Instrukcje, 6. Krotka.