Quiz
Week 17
Erstelle ein kostenloses Konto, um dieses Quiz zu beenden
Speichere deinen Fortschritt und sieh dir dein Endergebnis an.
oder mit deiner E-Mail registrieren
Schon ein Konto? Anmelden
Fragen in diesem Quiz (37)
1What is the Python equivalent to try...catch in Javascript?
- Atry...exception
- Btry...raise
- Ctry...except
- D...
- Etry...catch
2Strings are sequences in Python. This means they have many functions that arrays have in JavaScript. For example, len() and join().
What type of error occurs if the join function for strings is called with some elements which are not strings?- ARuntimeError
- BJoinError
- CSyntaxError
- DTypeError
3print(34 % 5)
- A0
- B4
- C5
- D6
4print(3 ** 2)
- A6
- B8
- C9
5print(8.0 / 2.0)
- A4
- B4.0
6print(5 / 2)
- A2
- B3
- C2.5
7print(9 ** 4)
- A6561
- B95
- C35
- D13
8print(34 // 5)
- A4
- B5
- C0
- D6
9print(5 // 2)
- A2
- B3
- C2.5
10print(2 ** 3)
- A8
- B6
- C9
11True or False: Only individual characters in a string may be referenced by index.
- ARichtig
- BFalsch
12print('internet'.index('x'))
- A-3
- B6
- Cerror
- D-1
- E5
13print('run'[3])
- Arun
- Berror
- Cempty string
- Dundefined
- En
14print('run'[-1:2])
- Arun
- Bempty string
- Cundefined
- Dn
15print('internet'.indexOf('e'))
- Aerror
- B'3,6'
- C6
- D3
16print('run'.length);
- Aerror
- B3
- C2
- D1
17print('internet'.index('e'))
- A3
- B6
- Cerror
- D'3,6'
18print('run'[-2,-1])
- Aempty string
- Bu
- Cun
- Derror
- Eundefined
19print('run'[2])
- Au
- Bn
- Cempty string
- Derror
- Er
20print('internet'.index('net'))
- A-1
- B5
- C6
- Derror
- E-3
21Which of the following will throw an error in Python if you try to use it to specify a string?
- A'
- B"
- C'''
- D`
22print('run'[-1])
- Ar
- Bundefined
- Cn
- Dempty string
- Eu
- Ferror
23print(len('run'));
- Aerror
- B1
- C2
- D3
24nums = ['1','2','3','4','5','4','3','2','1']
print(sum(nums))- A25
- B1
- Cerror
- D5
- E15
25nums = 1,2,3,4,5
print(sum(nums))- Aerror
- B15
- C1
- D5
26Which of these best describes a tuple?
- AOrdered, mutable
- BUnordered, immutable
- COrdered, immutable
- DUnordered, mutable
27What does it mean that a dictionary is a mappable collection?
- AElements are referenced with a string index
- BElements are referenced with a numeric index
- CElements have no reference because they are unordered
- DElements are referenced with a hashable value
28Which of these best describes a list?
- AUnordered, immutable
- BOrdered, mutable
- COrdered, immutable
- DUnordered, mutable
29nums = [1, 6, 7, 9, 2]
print(sorted(nums)[4:])- A[9]
- B[1,2,6,7,9]
- C[1,6,7,9]
- D[1,6,7,9,2,'4:']
- E9
- Ferror
30Which of these best describes a dictionary?
- AOrdered, immutable
- BOrdered, mutable
- CUnordered, mutable
- DUnordered, immutable
31Which of these is a feature that makes sets different from other data structures?
- AString can be elements in a set
- BEach element is unique
- CSets are iterable
- DSets can only be defined with a built-in function
32nums = set([1,2,3,4,5,4,3,2,1])
print(sum(nums))- A15
- B5
- C1
- Derrror
- E25
33Which of these best describes a set?
- AUnordered, immutable
- BOrdered, mutable
- CUnordered, mutable
- DOrdered, immutable
34nums = [1,6,4.3,7,-8,9,2]
sorted(nums)
print(nums[4:])- A[-8, 2, 9]
- B[4, 6, 7, 9]
- C[6, 7, 9]
- Dthis code throws an error
- E[-8, 9, 2]
- F[-8, 2, 7, 9]
35Specifying ranges of a string or list can be done from the end of the iterable to the beginning ([-1:4]).
- ARichtig
- BFalsch
36Tuples are ordered.
- ARichtig
- BFalsch
37If you search a string or list for an index of a value, but that value does not exist, what type of error is thrown?
- ANo error, just returns an empty string or list.
- BSyntaxError
- CTypeError
- DValueError
Informationen
- Beschreibung
- Computer Science Quiz am Week 17, erstellt von Beep Boop am 04/12/2020.
- Autor
- Beep Boop
- Sprache
- English
- Aufrufe
- 3
- Schlagwörter
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz