feat(curriculum): add python multiple choice questions (#38890)
This commit is contained in:
committed by
GitHub
parent
18d2dca05b
commit
3567813c51
@ -26,7 +26,7 @@
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
"5ea9997bbec2e9bc47e94db2",
|
"5ea9997bbec2e9bc47e94db2",
|
||||||
"Developing and Nmap Scanner part 2"
|
"Developing an Nmap Scanner part 2"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"5ea9997bbec2e9bc47e94db3",
|
"5ea9997bbec2e9bc47e94db3",
|
||||||
|
@ -18,7 +18,7 @@ More resources:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What will the following Python program print out?
|
text: 'What will the following Python program print out?:
|
||||||
<pre>def fred():<br> print("Zap")<br><br>def jane():<br> print("ABC")<br>
|
<pre>def fred():<br> print("Zap")<br><br>def jane():<br> print("ABC")<br>
|
||||||
<br>
|
<br>
|
||||||
jane()<br>
|
jane()<br>
|
||||||
|
@ -18,7 +18,7 @@ More resources:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'Which does the same thing as the following code:
|
text: 'Which does the same thing as the following code?:
|
||||||
<pre>lst = []<br>for key, val in counts.items():<br> newtup = (val, key)<br> lst.append(newtup)<br><br>lst = sorted(lst, reverse=True)<br>print(lst)<pre>'
|
<pre>lst = []<br>for key, val in counts.items():<br> newtup = (val, key)<br> lst.append(newtup)<br><br>lst = sorted(lst, reverse=True)<br>print(lst)<pre>'
|
||||||
answers:
|
answers:
|
||||||
- 'print( sorted( [ (k,v) for k,v in counts.items() ] ) )'
|
- 'print( sorted( [ (k,v) for k,v in counts.items() ] ) )'
|
||||||
|
@ -18,7 +18,7 @@ More resources:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: "What will the following code print?
|
text: "What will the following code print?:
|
||||||
<pre>counts = { 'chuck' : 1 , 'annie' : 42, 'jan': 100}<br>
|
<pre>counts = { 'chuck' : 1 , 'annie' : 42, 'jan': 100}<br>
|
||||||
for key in counts:<br> if counts[key] > 10 :<br> print(key, counts[key])</pre>"
|
for key in counts:<br> if counts[key] > 10 :<br> print(key, counts[key])</pre>"
|
||||||
answers:
|
answers:
|
||||||
|
@ -18,12 +18,12 @@ More resources:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: "What does the word 'continue' do in the middle of a loop."
|
text: "What does the word 'continue' do in the middle of a loop?"
|
||||||
answers:
|
answers:
|
||||||
- 'skips to the code directly after the loop'
|
- 'Skips to the code directly after the loop.'
|
||||||
- 'skips to the next line in the code'
|
- 'Skips to the next line in the code.'
|
||||||
- 'skips to the next iteration of the loop'
|
- 'Skips to the next iteration of the loop.'
|
||||||
- 'skips the next block of code'
|
- 'Skips the next block of code.'
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ videoId: hiRTRAqNlpE
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'How many lines will the following code print?
|
text: 'How many lines will the following code print?:
|
||||||
<pre>for i in [2,1,5]:<br> print(i)</pre>'
|
<pre>for i in [2,1,5]:<br> print(i)</pre>'
|
||||||
answers:
|
answers:
|
||||||
- '1'
|
- '1'
|
||||||
|
@ -17,12 +17,12 @@ videoId: AelGAcoMXbI
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'Below is code to find the smallest value from a list of values. One line has an error that will cause the code to not work as expected. Which line is it?
|
text: 'Below is code to find the smallest value from a list of values. One line has an error that will cause the code to not work as expected. Which line is it?:
|
||||||
<pre>
|
<pre>
|
||||||
1|smallest = None<br>
|
1|smallest = None<br>
|
||||||
2|print("Before:", smallest)<br>
|
2|print("Before:", smallest)<br>
|
||||||
3|for itervar in [3, 41, 12, 9, 74, 15]:<br>
|
3|for itervar in [3, 41, 12, 9, 74, 15]:<br>
|
||||||
4| if smallest is None or itervar ⋖ smallest:<br>
|
4| if smallest is None or itervar < smallest:<br>
|
||||||
5| smallest = itervar<br>
|
5| smallest = itervar<br>
|
||||||
6| break<br>
|
6| break<br>
|
||||||
7| print("Loop:", itervar, smallest)<br>
|
7| print("Loop:", itervar, smallest)<br>
|
||||||
|
@ -17,7 +17,7 @@ videoId: dLA-szNRnUY
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What will the following code print out:
|
text: 'What will the following code print out?:
|
||||||
<pre>
|
<pre>
|
||||||
n = 0<br>
|
n = 0<br>
|
||||||
while True:<br> if n == 3:<br> break<br> print(n)<br> n = n + 1</pre>'
|
while True:<br> if n == 3:<br> break<br> print(n)<br> n = n + 1</pre>'
|
||||||
|
@ -17,15 +17,15 @@ videoId: 7lFM1T_CxBs
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: "What will the output of the following code be like:
|
text: "What will the output of the following code be like?:
|
||||||
<pre>import urllib.request<br>
|
<pre>import urllib.request<br>
|
||||||
<br>
|
<br>
|
||||||
fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt')<br>
|
fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt')<br>
|
||||||
for line in fhand:<br> print(line.decode().strip())</pre>"
|
for line in fhand:<br> print(line.decode().strip())</pre>"
|
||||||
answers:
|
answers:
|
||||||
- 'Just contents of "romeo.txt".'
|
- 'Just contents of "romeo.txt".'
|
||||||
- 'A header and the contents of "romeo.txt"'
|
- 'A header and the contents of "romeo.txt".'
|
||||||
- 'A header, a footer, and the contents of "romeo.txt"'
|
- 'A header, a footer, and the contents of "romeo.txt".'
|
||||||
solution: 1
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ More resources:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What Python library is used for parsing HTML documents and extracting data from HTML documents.'
|
text: 'What Python library is used for parsing HTML documents and extracting data from HTML documents?'
|
||||||
answers:
|
answers:
|
||||||
- 'socket'
|
- 'socket'
|
||||||
- 'http'
|
- 'http'
|
||||||
|
@ -17,20 +17,30 @@ videoId: zjyT9DaAjx4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: "What does the following code create?
|
text: |
|
||||||
<pre>
|
What does the following code create?:
|
||||||
import socket<br>
|
|
||||||
<br>
|
```py
|
||||||
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>
|
import socket
|
||||||
mysock.connect(('data.pr4e.org', 80))<br>
|
|
||||||
cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\r\n\r\n'.encode()<br>
|
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
mysock.send(cmd)<br>
|
mysock.connect(('data.pr4e.org', 80))
|
||||||
<br>while True:<br> data = mysock.recv(512)<br> if len(data) < 1:<br> break<br> print(data.decode(),end='')<br><br>mysock.close()</pre>"
|
cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\r\n\r\n'.encode()
|
||||||
|
mysock.send(cmd)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
data = mysock.recv(512)
|
||||||
|
if len(data) < 1:
|
||||||
|
break
|
||||||
|
print(data.decode(),end='')
|
||||||
|
mysock.close()
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- 'simple web server'
|
- 'A simple web server.'
|
||||||
- 'simple email client'
|
- 'A simple email client.'
|
||||||
- 'simple todo list'
|
- 'A simple todo list.'
|
||||||
- 'simple web browser'
|
- 'A simple web browser.'
|
||||||
solution: 4
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ videoId: p1r3h_AMMIM
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: "What will the following program print:
|
text: "What will the following program print?:
|
||||||
<pre>
|
<pre>
|
||||||
class PartyAnimal:<br> x = 0<br> name = ''<br> def __init__(self, nam):<br> self.name = nam<br> print(self.name,'constructed')<br><br> def party(self):<br> self.x = self.x + 1<br> print(self.name,'party count',self.x)<br>
|
class PartyAnimal:<br> x = 0<br> name = ''<br> def __init__(self, nam):<br> self.name = nam<br> print(self.name,'constructed')<br><br> def party(self):<br> self.x = self.x + 1<br> print(self.name,'party count',self.x)<br>
|
||||||
<br>
|
<br>
|
||||||
|
@ -17,7 +17,7 @@ videoId: FiABKEuaSJ8
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What will the following program print:
|
text: 'What will the following program print?:
|
||||||
<pre>class PartyAnimal:<br> x = 0<br><br> def party(self) :<br> self.x = self.x + 2<br> print(self.x)<br>
|
<pre>class PartyAnimal:<br> x = 0<br><br> def party(self) :<br> self.x = self.x + 2<br> print(self.x)<br>
|
||||||
<br>
|
<br>
|
||||||
an = PartyAnimal()<br>
|
an = PartyAnimal()<br>
|
||||||
|
@ -17,7 +17,7 @@ videoId: dnzvfimrRMg
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What does dict equal after running this code?
|
text: 'What does dict equal after running this code?:
|
||||||
<pre>dict = {"Fri": 20, "Thu": 6, "Sat": 1}<br>
|
<pre>dict = {"Fri": 20, "Thu": 6, "Sat": 1}<br>
|
||||||
dict["Thu"] = 13<br>
|
dict["Thu"] = 13<br>
|
||||||
dict["Sat"] = 2<br>
|
dict["Sat"] = 2<br>
|
||||||
|
@ -19,11 +19,11 @@ videoId: 3JGF-n3tDPU
|
|||||||
question:
|
question:
|
||||||
text: 'What is the purpose of the "def" keyword in Python?'
|
text: 'What is the purpose of the "def" keyword in Python?'
|
||||||
answers:
|
answers:
|
||||||
- 'It is slang that means "the following code is really cool"'
|
- 'It is slang that means "The following code is really cool."'
|
||||||
- 'It indicates the start of a function'
|
- 'It indicates the start of a function.'
|
||||||
- 'It indicates that the following indented section of code is to be stored for later'
|
- 'It indicates that the following indented section of code is to be stored for later.'
|
||||||
- 'b and c are both true'
|
- 'b and c are both true.'
|
||||||
- 'None of the above'
|
- 'None of the above.'
|
||||||
solution: 4
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@ videoId: uJxGeTYy0us
|
|||||||
question:
|
question:
|
||||||
text: 'Which is NOT true about objects in Python?'
|
text: 'Which is NOT true about objects in Python?'
|
||||||
answers:
|
answers:
|
||||||
- 'Objects get created and used'
|
- 'Objects get created and used.'
|
||||||
- 'Objects are bits of code and data'
|
- 'Objects are bits of code and data.'
|
||||||
- 'Objects hide detail'
|
- 'Objects hide detail.'
|
||||||
- 'Objects are one of the five standard data types'
|
- 'Objects are one of the five standard data types.'
|
||||||
solution: 4
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ videoId: LaCZnTbQGkE
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: "What will the following program print:
|
text: "What will the following program print?:
|
||||||
<pre>
|
<pre>
|
||||||
import re<br>
|
import re<br>
|
||||||
s = 'A message from csev@umich.edu to cwen@iupui.edu about meeting @2PM'<br>
|
s = 'A message from csev@umich.edu to cwen@iupui.edu about meeting @2PM'<br>
|
||||||
|
@ -17,7 +17,7 @@ videoId: AqdfbrpkbHk
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What is the best practice for how many times a peice of string data should be stored in a database?'
|
text: 'What is the best practice for how many times a piece of string data should be stored in a database?'
|
||||||
answers:
|
answers:
|
||||||
- '0'
|
- '0'
|
||||||
- '1'
|
- '1'
|
||||||
|
@ -17,7 +17,7 @@ videoId: QlNod5-kFpA
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'Which is NOT a primary data structures in a database?'
|
text: 'Which is NOT a primary data structure in a database?'
|
||||||
answers:
|
answers:
|
||||||
- 'index'
|
- 'index'
|
||||||
- 'table'
|
- 'table'
|
||||||
|
@ -17,7 +17,7 @@ videoId: LYZj207fKpQ
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What will the following code print?
|
text: 'What will the following code print?:
|
||||||
<pre>for n in "banana":<br> print(n)</pre>'
|
<pre>for n in "banana":<br> print(n)</pre>'
|
||||||
answers:
|
answers:
|
||||||
- 'n<br>n'
|
- 'n<br>n'
|
||||||
|
@ -17,7 +17,7 @@ videoId: 3Lxpladfh2k
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: "What will the following code print?
|
text: "What will the following code print?:
|
||||||
<pre>d = dict()<br>d['quincy'] = 1<br>d['beau'] = 5<br>d['kris'] = 9<br>for (k,i) in d.items():<br> print(k, i)</pre>"
|
<pre>d = dict()<br>d['quincy'] = 1<br>d['beau'] = 5<br>d['kris'] = 9<br>for (k,i) in d.items():<br> print(k, i)</pre>"
|
||||||
answers:
|
answers:
|
||||||
- 'k i<br>k i<br>k i'
|
- 'k i<br>k i<br>k i'
|
||||||
|
@ -20,7 +20,7 @@ question:
|
|||||||
text: 'What does API stand for?'
|
text: 'What does API stand for?'
|
||||||
answers:
|
answers:
|
||||||
- 'Application Portable Intelligence'
|
- 'Application Portable Intelligence'
|
||||||
- 'Accociate Programming International'
|
- 'Associate Programming International'
|
||||||
- 'Application Program Interface'
|
- 'Application Program Interface'
|
||||||
- 'Action Portable Interface'
|
- 'Action Portable Interface'
|
||||||
solution: 3
|
solution: 3
|
||||||
|
@ -17,7 +17,7 @@ videoId: ZJE-U56BppM
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: "What will the following code print?
|
text: "What will the following code print?:
|
||||||
<pre>import json<br>
|
<pre>import json<br>
|
||||||
<br>
|
<br>
|
||||||
data = '''<br>[<br> { 'id' : '001',<br> 'x' : '2',<br> 'name' : 'Quincy'<br> } ,<br> { 'id' : '009',<br> 'x' : '7',<br> 'name' : 'Mrugesh'<br> }<br>]'''<br>
|
data = '''<br>[<br> { 'id' : '001',<br> 'x' : '2',<br> 'name' : 'Quincy'<br> } ,<br> { 'id' : '009',<br> 'x' : '7',<br> 'name' : 'Mrugesh'<br> }<br>]'''<br>
|
||||||
|
@ -17,7 +17,7 @@ videoId: muerlsCHExI
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'With a services oriented approach to developing web apps, where is the data located.'
|
text: 'With a services oriented approach to developing web apps, where is the data located?'
|
||||||
answers:
|
answers:
|
||||||
- 'Spread across many computer systems connected via the internet or internal network.'
|
- 'Spread across many computer systems connected via the internet or internal network.'
|
||||||
- 'Within different services on the main web server.'
|
- 'Within different services on the main web server.'
|
||||||
|
@ -17,7 +17,7 @@ videoId: _pZ0srbg7So
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What is wrong with the following XML?
|
text: 'What is wrong with the following XML?:
|
||||||
<pre><person><br>
|
<pre><person><br>
|
||||||
<name>Chuck</name><br>
|
<name>Chuck</name><br>
|
||||||
<phone type="intl"><br> +1 734 303 4456<br>
|
<phone type="intl"><br> +1 734 303 4456<br>
|
||||||
|
@ -15,7 +15,8 @@ videoId: mHjxzFS5_Z0
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'When using Matplotlib''s global API, what does the order of numbers mean here <pre>plt.subplot(1, 2, 1)</pre>'
|
text: |
|
||||||
|
When using Matplotlib's global API, what does the order of numbers mean here?: `plt.subplot(1, 2, 1)`
|
||||||
answers:
|
answers:
|
||||||
- 'My figure will have one column, two rows, and I am going to start drawing in the first (left) plot.'
|
- 'My figure will have one column, two rows, and I am going to start drawing in the first (left) plot.'
|
||||||
- 'I am going to start drawing in the first (left) plot, my figure will have two rows, and my figure will have one column.'
|
- 'I am going to start drawing in the first (left) plot, my figure will have two rows, and my figure will have one column.'
|
||||||
|
@ -15,7 +15,8 @@ videoId: kj7QqjXhH6A
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'The Python method <code>.duplicated()</code> returns a boolean Series for your DataFrame. <code>True</code> is the return value for rows that:'
|
text: |
|
||||||
|
The Python method `.duplicated()` returns a boolean Series for your DataFrame. `True` is the return value for rows that:
|
||||||
answers:
|
answers:
|
||||||
- contain a duplicate, where the value for the row contains the first occurrence of that value.
|
- contain a duplicate, where the value for the row contains the first occurrence of that value.
|
||||||
- contain a duplicate, where the value for the row is at least the second occurrence of that value.
|
- contain a duplicate, where the value for the row is at least the second occurrence of that value.
|
||||||
|
@ -15,12 +15,39 @@ videoId: ovYNhnltVxY
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print out?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import pandas as pd
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
s = pd.Series(['a', 3, np.nan, 1, np.nan])
|
||||||
|
|
||||||
|
print(s.notnull().sum())
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- '3'
|
||||||
- two
|
- |
|
||||||
- three
|
```
|
||||||
solution: 3
|
0 True
|
||||||
|
1 True
|
||||||
|
2 False
|
||||||
|
3 True
|
||||||
|
4 False
|
||||||
|
dtype: bool
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
0 False
|
||||||
|
1 False
|
||||||
|
2 True
|
||||||
|
3 False
|
||||||
|
4 True
|
||||||
|
dtype: bool
|
||||||
|
```
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,48 @@ videoId: sTMN_pdI6S0
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print out?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import pandas as pd
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
s = pd.Series([np.nan, 1, 2, np.nan, 3])
|
||||||
|
s = s.fillna(method='ffill')
|
||||||
|
|
||||||
|
print(s)
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```
|
||||||
- three
|
0 1.0
|
||||||
solution: 3
|
1 1.0
|
||||||
|
2 2.0
|
||||||
|
3 3.0
|
||||||
|
4 3.0
|
||||||
|
dtype: float64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
0 NaN
|
||||||
|
1 1.0
|
||||||
|
2 2.0
|
||||||
|
3 2.0
|
||||||
|
4 3.0
|
||||||
|
dtype: float64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
0 NaN
|
||||||
|
1 1.0
|
||||||
|
2 2.0
|
||||||
|
3 NaN
|
||||||
|
4 3.0
|
||||||
|
dtype: float64
|
||||||
|
```
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,11 @@ videoId: h8caJq2Bb9w
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What is *not* allowed in a Jupyter Notebook's cell?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- "Markdown"
|
||||||
- two
|
- "Python code"
|
||||||
- three
|
- "An Excel sheet"
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,13 @@ videoId: VJrP2FUzKP0
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: "Why should you choose R over Python for data analysis?"
|
||||||
answers:
|
answers:
|
||||||
- one
|
- "It's simple to learn."
|
||||||
- two
|
- "It's better at dealing with advanced statistical methods."
|
||||||
- three
|
- "There are many powerful libraries that support R."
|
||||||
solution: 3
|
- "It's free and open source."
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,14 @@ videoId: k1msxD3JIxE
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: "What kind of data can you import and work with in a Jupyter Notebook?"
|
||||||
answers:
|
answers:
|
||||||
- one
|
- "Excel files."
|
||||||
- two
|
- "CSV files."
|
||||||
- three
|
- "XML files."
|
||||||
solution: 3
|
- "Data from an API."
|
||||||
|
- "All of the above."
|
||||||
|
solution: 5
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,33 @@ videoId: VDYVFHBL1AM
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print out?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
A = np.array([
|
||||||
|
['a', 'b', 'c'],
|
||||||
|
['d', 'e', 'f'],
|
||||||
|
['g', 'h', 'i']
|
||||||
|
])
|
||||||
|
|
||||||
|
print(A[:, :2])
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- "[['a' 'b']]"
|
||||||
- two
|
- |
|
||||||
- three
|
```
|
||||||
|
[['b' 'c']
|
||||||
|
['e' 'f']
|
||||||
|
['h' 'i']]
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
[['a' 'b']
|
||||||
|
['d' 'e']
|
||||||
|
['g' 'h']]
|
||||||
|
```
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,20 @@ videoId: N1ttsMmcVMM
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print out?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
a = np.arange(5)
|
||||||
|
|
||||||
|
print(a <= 3)
|
||||||
|
```
|
||||||
answers:
|
answers:
|
||||||
- one
|
- "[False, False, False, False, True]"
|
||||||
- two
|
- "[5]"
|
||||||
- three
|
- "[0, 1, 2, 3]"
|
||||||
solution: 3
|
- "[True, True, True, True, False]"
|
||||||
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: P-JjV6GBCmk
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: "Why is Numpy an important, but unpopular Python library?"
|
||||||
answers:
|
answers:
|
||||||
- one
|
- "Often you won't work directly with Numpy."
|
||||||
- two
|
- "It's is extremely slow."
|
||||||
- three
|
- "Working with Numpy is difficult."
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,14 @@ videoId: YIqgrNLAZkA
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
About how much memory does the integer `5` consume in plain Python?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- 32 bits
|
||||||
- two
|
- 20 bytes
|
||||||
- three
|
- 16 bytes
|
||||||
solution: 3
|
- 8 bits
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,19 @@ videoId: eqSVcJbaPdk
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What is the value of `a` after you run the following code?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
a = np.arange(5)
|
||||||
|
a + 20
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- "[20, 21, 22, 24, 24]"
|
||||||
- two
|
- "[0, 1, 2, 3, 4, 5]"
|
||||||
- three
|
- "[25, 26, 27, 28, 29]"
|
||||||
solution: 3
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,51 @@ videoId: BFlH0fN5xRQ
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print out?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
certificates_earned = pd.DataFrame({
|
||||||
|
'Certificates': [8, 2, 5, 6],
|
||||||
|
'Time (in months)': [16, 5, 9, 12]
|
||||||
|
})
|
||||||
|
names = ['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||||
|
|
||||||
|
certificates_earned.index = names
|
||||||
|
longest_streak = pd.Series([13, 11, 9, 7], index=names)
|
||||||
|
certificates_earned['Longest streak'] = longest_streak
|
||||||
|
|
||||||
|
print(certificates_earned)
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```
|
||||||
- three
|
Tom 13
|
||||||
solution: 3
|
Kris 11
|
||||||
|
Ahmad 9
|
||||||
|
Beau 7
|
||||||
|
Name: Longest streak, dtype: int64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
Certificates Time (in months) Longest streak
|
||||||
|
Tom 8 16 13
|
||||||
|
Kris 2 5 11
|
||||||
|
Ahmad 5 9 9
|
||||||
|
Beau 6 12 7
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
Certificates Longest streak
|
||||||
|
Tom 8 13
|
||||||
|
Kris 2 11
|
||||||
|
Ahmad 5 9
|
||||||
|
Beau 6 7
|
||||||
|
```
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,37 @@ videoId: _sSo2XZoB3E
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What code would add a "Certificates per month" column to the `certificates_earned` DataFrame like the one below?:
|
||||||
|
|
||||||
|
```
|
||||||
|
Certificates Time (in months) Certificates per month
|
||||||
|
Tom 8 16 0.50
|
||||||
|
Kris 2 5 0.40
|
||||||
|
Ahmad 5 9 0.56
|
||||||
|
Beau 6 12 0.50
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```py
|
||||||
- three
|
certificates_earned['Certificates'] /
|
||||||
|
certificates_earned['Time (in months)']
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```py
|
||||||
|
certificates_earned['Certificates per month'] = round(
|
||||||
|
certificates_earned['Certificates'] /
|
||||||
|
certificates_earned['Time (in months)']
|
||||||
|
)
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```py
|
||||||
|
certificates_earned['Certificates per month'] = round(
|
||||||
|
certificates_earned['Certificates'] /
|
||||||
|
certificates_earned['Time (in months)'], 2
|
||||||
|
)
|
||||||
|
```
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,11 +15,43 @@ videoId: 7SgFBYXaiH0
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print out?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
certificates_earned = pd.DataFrame({
|
||||||
|
'Certificates': [8, 2, 5, 6],
|
||||||
|
'Time (in months)': [16, 5, 9, 12]
|
||||||
|
})
|
||||||
|
|
||||||
|
certificates_earned.index = ['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||||
|
|
||||||
|
print(certificates_earned.iloc[2])
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```
|
||||||
- three
|
Tom 16
|
||||||
|
Kris 5
|
||||||
|
Ahmad 9
|
||||||
|
Beau 12
|
||||||
|
Name: Time (in months), dtype: int64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
Certificates 6
|
||||||
|
Time (in months) 12
|
||||||
|
Name: Beau, dtype: int64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
Certificates 5
|
||||||
|
Time (in months) 9
|
||||||
|
Name: Ahmad, dtype: int64
|
||||||
|
```
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,11 +15,42 @@ videoId: -ZOrgV_aA9A
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print out?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
certificates_earned = pd.Series(
|
||||||
|
[8, 2, 5, 6],
|
||||||
|
index=['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||||
|
)
|
||||||
|
|
||||||
|
print(certificates_earned[certificates_earned > 5])
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```
|
||||||
- three
|
Tom True
|
||||||
|
Kris False
|
||||||
|
Ahmad False
|
||||||
|
Beau True
|
||||||
|
dtype: int64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
Tom 8
|
||||||
|
Ahmad 5
|
||||||
|
Beau 6
|
||||||
|
dtype: int64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
Tom 8
|
||||||
|
Beau 6
|
||||||
|
dtype: int64
|
||||||
|
```
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,46 @@ videoId: 0xACW-8cZU0
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print out?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
certificates_earned = pd.Series(
|
||||||
|
[8, 2, 5, 6],
|
||||||
|
index=['Tom', 'Kris', 'Ahmad', 'Beau']
|
||||||
|
)
|
||||||
|
|
||||||
|
print(certificates_earned)
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```
|
||||||
- three
|
Tom 8
|
||||||
solution: 3
|
Kris 2
|
||||||
|
Ahmad 5
|
||||||
|
Beau 6
|
||||||
|
dtype: int64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
Kris 2
|
||||||
|
Ahmad 5
|
||||||
|
Beau 6
|
||||||
|
Tom 8
|
||||||
|
dtype: int64
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
Tom 8
|
||||||
|
Kris 2
|
||||||
|
Ahmad 5
|
||||||
|
Beau 6
|
||||||
|
Name: certificates_earned dtype: int64
|
||||||
|
```
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: NzpU17ZVlUw
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What is the main difference between lists and tuples in Python?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Tuples are immutable.
|
||||||
- two
|
- Lists are ordered.
|
||||||
- three
|
- Tuples are unordered.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -17,9 +17,9 @@ videoId: MtgXS1MofRw
|
|||||||
question:
|
question:
|
||||||
text: What method does a <code>Cursor</code> instance have and what does it allow?
|
text: What method does a <code>Cursor</code> instance have and what does it allow?
|
||||||
answers:
|
answers:
|
||||||
- The <code>Cursor</code> instance has a <code>.Run()</code> method which allows you to run SQL queries.
|
- The <code>Cursor</code> instance has a <code>.run()</code> method which allows you to run SQL queries.
|
||||||
- The <code>Cursor</code> instance has a <code>.Select()</code> method which allows you to select records.
|
- The <code>Cursor</code> instance has a <code>.select()</code> method which allows you to select records.
|
||||||
- The <code>Cursor</code> instance has a <code>.Execute()</code> method which will receive SQL parameters to run against the database.
|
- The <code>Cursor</code> instance has an <code>.execute()</code> method which will receive SQL parameters to run against the database.
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,35 @@ videoId: cDnt02BcHng
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Given a file named `certificates.csv` with these contents:
|
||||||
|
|
||||||
|
```
|
||||||
|
Name$Certificates$Time (in months)
|
||||||
|
Tom$8$16
|
||||||
|
Kris$2$5
|
||||||
|
Ahmad$5$9
|
||||||
|
Beau$6$12
|
||||||
|
```
|
||||||
|
|
||||||
|
Fill in the blanks for the missing arguments below:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import csv
|
||||||
|
|
||||||
|
with open(___, 'r') as fp:
|
||||||
|
reader = csv.reader(fp, delimiter=___)
|
||||||
|
next(reader)
|
||||||
|
for index, values in enumerate(reader):
|
||||||
|
name, certs_num, months_num = values
|
||||||
|
print(f"{name} earned {___} certificates in {months_num} months")
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- <code>'certificates.csv', '-', values</code>
|
||||||
- two
|
- <code>'certificates.csv', '$', certs_num</code>
|
||||||
- three
|
- <code>'certificates', '$', certs_num</code>
|
||||||
solution: 3
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,25 @@ videoId: v-7Y7koJ_N0
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What code would change the values in the 3rd column of both of the following Numpy arrays to 20?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
|
||||||
|
|
||||||
|
# Output:
|
||||||
|
# [[ 1 2 3 4 5]
|
||||||
|
# [ 6 7 20 9 10]]
|
||||||
|
```
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
`a[:, 3] = 20`
|
||||||
- three
|
- |
|
||||||
|
`a[2, :] = 20`
|
||||||
|
- |
|
||||||
|
`a[:, 2] = 20`
|
||||||
|
- |
|
||||||
|
`a[1, 2] = 20`
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ videoId: f9QrZrKQMLI
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: 'What will the following code print:<pre>b = np.array([[1.0,2.0,3.0],[3.0,4.0,5.0]])<br>print(b)</pre>'
|
text: 'What will the following code print?:<pre>b = np.array([[1.0,2.0,3.0],[3.0,4.0,5.0]])<br>print(b)</pre>'
|
||||||
answers:
|
answers:
|
||||||
- '<pre>[[1.0 2.0 3.0]<br>[3.0 4.0 5.0]]<pre>'
|
- '<pre>[[1.0 2.0 3.0]<br>[3.0 4.0 5.0]]<pre>'
|
||||||
- '<pre>[[1. 2. 3.]<br>[3. 4. 5.]]<pre>'
|
- '<pre>[[1. 2. 3.]<br>[3. 4. 5.]]<pre>'
|
||||||
|
@ -15,12 +15,25 @@ videoId: iIoQ0_L0GvA
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What is the value of `a` after running the following code?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
a = np.array([1, 2, 3, 4, 5])
|
||||||
|
b = a
|
||||||
|
b[2] = 20
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
`[1, 2, 3, 4, 5]`
|
||||||
- three
|
- |
|
||||||
solution: 3
|
`[1, 2, 20, 4, 5]`
|
||||||
|
- |
|
||||||
|
`[1, 20, 3, 4, 5]`
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,46 @@ videoId: 0jGfH8BPfOk
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What is another way to produce the following array?:
|
||||||
|
|
||||||
|
```
|
||||||
|
[[1. 1. 1. 1. 1.]
|
||||||
|
[1. 0. 0. 0. 1.]
|
||||||
|
[1. 0. 9. 0. 1.]
|
||||||
|
[1. 0. 0. 0. 1.]
|
||||||
|
[1. 1. 1. 1. 1.]]
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```py
|
||||||
- three
|
output = np.ones((5, 5))
|
||||||
solution: 3
|
|
||||||
|
z = np.zeros((3, 3))
|
||||||
|
z[1, 1] = 9
|
||||||
|
|
||||||
|
output[1:-1, 1:-1] = z
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```py
|
||||||
|
output = np.ones((5, 5))
|
||||||
|
|
||||||
|
z = np.zeros((3, 3))
|
||||||
|
z[1, 1] = 9
|
||||||
|
|
||||||
|
output[1:3, 1:3] = z
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```py
|
||||||
|
output = np.ones((5, 5))
|
||||||
|
|
||||||
|
z = np.zeros((3, 3))
|
||||||
|
z[1, 1] = 9
|
||||||
|
|
||||||
|
output[4:1, 4:1] = z
|
||||||
|
```
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,30 @@ videoId: CEykdsKT4U4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What will the following code print?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
a = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
|
||||||
|
|
||||||
|
print(np.full_like(a, 100))
|
||||||
|
```
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```
|
||||||
- three
|
[[100 100 100 100 100]]
|
||||||
solution: 3
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
[[100 100 100 100 100]
|
||||||
|
[100 100 100 100 100]]
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
[[ 1 2 3 4 5]
|
||||||
|
[ 6 7 20 9 10]]
|
||||||
|
```
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,42 @@ videoId: tUdBZ7pF8Jg
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Given a file named `data.txt` with these contents:
|
||||||
|
|
||||||
|
```
|
||||||
|
29,97,32,100,45
|
||||||
|
15,88,5,75,22
|
||||||
|
```
|
||||||
|
|
||||||
|
What code would produce the following array?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
[29. 32. 45. 15. 5. 22.]
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```
|
||||||
- three
|
filedata = np.genfromtxt('data.txt', delimiter=',')
|
||||||
|
output = np.any(filedata < 50)
|
||||||
|
|
||||||
|
print(output)
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
filedata = np.genfromtxt('data.txt', delimiter=',')
|
||||||
|
output = np.all(filedata < 50, axis=1)
|
||||||
|
|
||||||
|
print(output)
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```
|
||||||
|
filedata = np.genfromtxt('data.txt', delimiter=',')
|
||||||
|
output = filedata[filedata < 50]
|
||||||
|
|
||||||
|
print(output)
|
||||||
|
```
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,22 @@ videoId: 7txegvyhtVk
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What is the value of `b` after running the following code?:
|
||||||
|
|
||||||
|
```py
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
a = np.array(([1, 2, 3, 4, 5], [6, 7, 8, 9, 10]))
|
||||||
|
b = np.max(a, axis=1).sum()
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- '10'
|
||||||
- two
|
- '7'
|
||||||
- three
|
- '5'
|
||||||
solution: 3
|
- '15'
|
||||||
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,35 @@ videoId: VNWAQbEM-C8
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What code would produce the following array?:
|
||||||
|
|
||||||
|
```
|
||||||
|
[[1. 1.]
|
||||||
|
[1. 1.]
|
||||||
|
[1. 1.]
|
||||||
|
[1. 1.]]
|
||||||
|
```
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
```py
|
||||||
- three
|
a = np.ones((2, 4))
|
||||||
solution: 3
|
b = a.reshape((4, 2))
|
||||||
|
print(b)
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```py
|
||||||
|
a = np.ones((2, 4))
|
||||||
|
b = a.reshape((2, 4))
|
||||||
|
print(b)
|
||||||
|
```
|
||||||
|
- |
|
||||||
|
```py
|
||||||
|
a = np.ones((2, 4))
|
||||||
|
b = a.reshape((8, 1))
|
||||||
|
print(b)
|
||||||
|
```
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,13 @@ videoId: 5Nwfs5Ej85Q
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: 'Why are Numpy arrays faster than regular Python lists?:'
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Numpy does not perform type checking while iterating through objects.
|
||||||
- two
|
- Numpy uses fixed types.
|
||||||
- three
|
- Numpy uses contiguous memory.
|
||||||
solution: 3
|
- All of the above.
|
||||||
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,17 @@ videoId: ugYfJNTawks
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Which socket object method lets you set the maximum amount of data your client accepts at once?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
`.recv(1024)`
|
||||||
- three
|
- |
|
||||||
solution: 3
|
`.decode('ascii')`
|
||||||
|
- |
|
||||||
|
`.connect(host, port)`
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,23 @@ videoId: CeGW761BIsA
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Fill in the blanks to complete the `banner` function below:
|
||||||
|
|
||||||
|
```py
|
||||||
|
def banner(ip, port):
|
||||||
|
s = socket.socket()
|
||||||
|
s.____((ip, ____))
|
||||||
|
print(s.recv(1024))
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
`connect`, `port`
|
||||||
- three
|
- |
|
||||||
|
`getsockname`, `'1-1024'`
|
||||||
|
- |
|
||||||
|
`connect`, `int(port)`
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,11 +15,15 @@ videoId: z_qkqZS7KZ4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What is the main difference between the `.connect()` and `.connect_ex()` methods?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- There is no difference between the two methods.
|
||||||
- two
|
- |
|
||||||
- three
|
If there is an error or if no host is found, `.connect()` returns an error code while `.connect_ex()` raises an exception.
|
||||||
|
- |
|
||||||
|
If there is an error or if no host is found, `.connect()` raises an exception while `.connect_ex()` returns an error code.
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,11 +15,16 @@ videoId: jYk9XaGoAnk
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What is the correct command to install the Python 3 version of the `python-nmap` library?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
`sudo apt install python-nmap`
|
||||||
- three
|
- |
|
||||||
|
`pip install python-nmap`
|
||||||
|
- |
|
||||||
|
`pip3 install python-nmap`
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
id: 5ea9997bbec2e9bc47e94db2
|
||||||
|
title: Developing an Nmap Scanner part 2
|
||||||
|
challengeType: 11
|
||||||
|
isHidden: true
|
||||||
|
videoId: a98PscnUsTg
|
||||||
|
---
|
||||||
|
|
||||||
|
## Description
|
||||||
|
<section id='description'>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
<section id='tests'>
|
||||||
|
|
||||||
|
```yml
|
||||||
|
question:
|
||||||
|
text: |
|
||||||
|
Which of the following allows you to scan for UDP ports between 21 to 443?
|
||||||
|
|
||||||
|
answers:
|
||||||
|
- |
|
||||||
|
`.scan(ip_addr, '21-443', '-v -sU')`
|
||||||
|
- |
|
||||||
|
`.scan(ip_addr, '1-1024', '-v -sS')`
|
||||||
|
- |
|
||||||
|
`.scan(ip_addr, '21-443', '-v -sS')`
|
||||||
|
solution: 1
|
||||||
|
```
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
id: 5ea9997bbec2e9bc47e94db2
|
|
||||||
title: Developing and Nmap Scanner part 2
|
|
||||||
challengeType: 11
|
|
||||||
isHidden: true
|
|
||||||
videoId: a98PscnUsTg
|
|
||||||
---
|
|
||||||
|
|
||||||
## Description
|
|
||||||
<section id='description'>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
## Tests
|
|
||||||
<section id='tests'>
|
|
||||||
|
|
||||||
```yml
|
|
||||||
question:
|
|
||||||
text: Question
|
|
||||||
answers:
|
|
||||||
- one
|
|
||||||
- two
|
|
||||||
- three
|
|
||||||
solution: 3
|
|
||||||
```
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
@ -15,12 +15,14 @@ videoId: XeQ7ZKtb998
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What code editor and extension does the instructor recommend for developing penetration testing tools in Python?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Atom and the atom-python-run extension.
|
||||||
- two
|
- VSCode and Microsoft's Python extension.
|
||||||
- three
|
- Sublime Text and the Anaconda package.
|
||||||
solution: 3
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,16 @@ videoId: F1QI9tNuDQg
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Which of the following functions creates a socket object?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
`socket.bind((host, port))`
|
||||||
- three
|
- |
|
||||||
|
`socket.gethostbyname()`
|
||||||
|
- |
|
||||||
|
`socket.socket(socket.AF_INET, socket.SOCK_STREAM)`
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,14 @@ videoId: bejQ-W9BGJg
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: How should you assign weights to input neurons before training your network for the first time?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- From smallest to largest.
|
||||||
- two
|
- Completely randomly.
|
||||||
- three
|
- Alphabetically.
|
||||||
solution: 3
|
- None of the above.
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,13 @@ videoId: Y5M7KH4A4n4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: When are Convolutional Neural Networks not useful?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- If your data can't be made to look like an image, or if you can rearrange elements of your data and it's still just as useful.
|
||||||
- two
|
- If your data is made up of different 2D or 3D images.
|
||||||
- three
|
- If your data is text or sound based.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,13 @@ videoId: zvalnHWGtx4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: Why is it better to calculate the gradient (slope) directly rather than numerically?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- It is computationally expensive to go back through the entire neural network and adjust the weights for each layer of the neural network.
|
||||||
- two
|
- It is more accurate.
|
||||||
- three
|
- There is no difference between the two methods.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,13 @@ videoId: UVimlsy9eW0
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What are the main neural network components that make up a Long Short Term Memory network?
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- New information and prediction.
|
||||||
- two
|
- Prediction, collected possibilities, and selection.
|
||||||
- three
|
- Prediction, ignoring, forgetting, and selection.
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,13 @@ videoId: LMNub5frQi4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Most people that are experts in AI or machine learning usually...:
|
||||||
answers:
|
answers:
|
||||||
- one
|
- have one specialization.
|
||||||
- two
|
- have many specializations.
|
||||||
- three
|
- have a deep understanding of many different frameworks.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,11 @@ videoId: eCATNvwraXg
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What is **not** a good way to increase the accuracy of a convolutional neural network?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Augmenting the data you already have.
|
||||||
- two
|
- Using a pre-trained model.
|
||||||
- three
|
- Using your test data to retrain the model.
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,36 @@ videoId: h1XUt1AgIOI
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Fill in the blanks below to use Google's pre-trained MobileNet V2 model as a base for a convolutional neural network:
|
||||||
|
|
||||||
|
```py
|
||||||
|
base_model = tf.__A__.applications.__B__(input_shape=(160, 160, 3),
|
||||||
|
include_top=__C__,
|
||||||
|
weights='imagenet'
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
A: `keras`
|
||||||
- three
|
|
||||||
solution: 3
|
B: `MobileNetV2`
|
||||||
|
|
||||||
|
C: `False`
|
||||||
|
- |
|
||||||
|
A: `Keras`
|
||||||
|
|
||||||
|
B: `MobileNetV2`
|
||||||
|
|
||||||
|
C: `True`
|
||||||
|
- |
|
||||||
|
A: `keras`
|
||||||
|
|
||||||
|
B: `mobile_net_v2`
|
||||||
|
|
||||||
|
C: `False`
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: LrdmcQpTyLw
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What are the three main properties of each convolutional layer?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Input size, the number of filters, and the sample size of the filters.
|
||||||
- two
|
- Input size, input dimensions, and the color values of the input.
|
||||||
- three
|
- Input size, input padding, and stride.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,12 @@ videoId: _1kTP7uoU9E
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Dense neural networks analyze input on a global scale and recognize patterns in specific areas. Convolutional neural networks...:
|
||||||
answers:
|
answers:
|
||||||
- one
|
- also analyze input globally and extract features from specific areas.
|
||||||
- two
|
- do not work well for image classification or object detection.
|
||||||
- three
|
- scan through the entire input a little at a time and learn local patterns.
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,15 @@ videoId: 5wHw8BTd2ZQ
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What kind of estimator/model does TensorFlow recommend using for classification?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
`LinearClassifier`
|
||||||
- three
|
- |
|
||||||
solution: 3
|
`DNNClassifier`
|
||||||
|
- |
|
||||||
|
`BoostedTreesClassifier`
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: qFF7ZQNvK9E
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What is classification?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- The process of separating data points into different classes.
|
||||||
- two
|
- Predicting a numeric value or forecast based on independent and dependent variables.
|
||||||
- three
|
- None of the above.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,14 @@ videoId: 8sqIaHc9Cz4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: Which of the following steps is **not** part of the K-Means algorithm?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Randomly pick K points to place K centeroids.
|
||||||
- two
|
- Assign each K point to the closest K centeroid.
|
||||||
- three
|
- Move each K centeroid into the middle of all of their data points.
|
||||||
solution: 3
|
- Shuffle the K points so they're redistributed randomly.
|
||||||
|
- Reassign each K point to the closest K centeroid.
|
||||||
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: IZg24y4wEPY
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What makes a Hidden Markov model different than linear regression or classification?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- It uses probability distributions to predict future events or states.
|
||||||
- two
|
- It analyzes the relationship between independent and dependent variables to make predictions.
|
||||||
- three
|
- It separates data points into separate categories.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: _cEwvqVoBhI
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What are epochs?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- The number of times the model will see the same data.
|
||||||
- two
|
- A type of graph.
|
||||||
- three
|
- The number of elements you feed to the model at once.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: wz9J1slsi7I
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What is categorical data?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Another term for one-hot encoding.
|
||||||
- two
|
- Any data that is not numeric.
|
||||||
- three
|
- Any data that is represented numerically.
|
||||||
solution: 3
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,14 @@ videoId: fYAYvLUawnc
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What TensorFlow module should you import to implement `.HiddenMarkovModel()`?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
`tensorflow.keras`
|
||||||
- three
|
- |
|
||||||
|
`tensorflow_gpu`
|
||||||
|
- |
|
||||||
|
`tensorflow_probability`
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,11 +15,12 @@ videoId: u85IOSsJsPI
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
What does the pandas `.head()` function do?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Returns the number of entries in a data frame.
|
||||||
- two
|
- Returns the number of columns in a data frame.
|
||||||
- three
|
- By default, shows the first five rows or entries in a data frame.
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,16 @@ videoId: u5lZURgcWnU
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Which type of analysis would be best suited for the following problem?:
|
||||||
|
|
||||||
|
You have the average temperature in the month of March for the last 100 years. Using this data, you want to predict the average temperature in the month of March 5 years from now.
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Multiple regression
|
||||||
- two
|
- Correlation
|
||||||
- three
|
- Decision tree
|
||||||
solution: 3
|
- Linear regression
|
||||||
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,38 @@ videoId: kfv0K8MtkIc
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Fill in the blanks below to complete the architechture for a convolutional neural network:
|
||||||
|
|
||||||
|
```py
|
||||||
|
model = models.__A__()
|
||||||
|
model.add(layers.__B__(32, (3, 3), activation='relu', input_shape=(32, 32, 3)))
|
||||||
|
model.add(layers.__C__(2, 2))
|
||||||
|
model.add(layers.__B__(64, (3, 3), activation='relu'))
|
||||||
|
model.add(layers.__C__(2, 2))
|
||||||
|
model.add(layers.__B__(32, (3, 3), activation='relu'))
|
||||||
|
model.add(layers.__C__(2, 2))
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
A: `Sequential`
|
||||||
- three
|
|
||||||
|
B: `add`
|
||||||
|
|
||||||
|
C: `Wrapper`
|
||||||
|
- |
|
||||||
|
A: `keras`
|
||||||
|
|
||||||
|
B: `Cropping2D`
|
||||||
|
|
||||||
|
C: `AlphaDropout`
|
||||||
|
- |
|
||||||
|
A: `Sequential`
|
||||||
|
|
||||||
|
B: `Conv2D`
|
||||||
|
|
||||||
|
C: `MaxPooling2D`
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,13 @@ videoId: KwL1qTR5MT8
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Which statement below is **false**?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Neural networks are modeled after the way the human brain works.
|
||||||
- two
|
- Computer programs that play tic-tac-toe or chess against human players are examples of simple artificial intelligence.
|
||||||
- three
|
- Machine learning is a subset of artificial intelligence.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,14 @@ videoId: r9hRyGGjOgQ
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: Which of the following is **not** a type of tensor?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Variable
|
||||||
- two
|
- Flowing
|
||||||
- three
|
- Placeholder
|
||||||
solution: 3
|
- SparseTensor
|
||||||
|
- Constant
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,48 @@ videoId: 32WBFS7lfsw
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Fill in the blanks below to complete the `build_model` function:
|
||||||
|
|
||||||
|
```py
|
||||||
|
def build_mode(vocab_size, embedding_dim, rnn_units, batch_size):
|
||||||
|
model = tf.keras.Sequential([
|
||||||
|
tf.keras.layers.Embedding(vocab_size,
|
||||||
|
embedding_dim,
|
||||||
|
batch_input_shape=[batch_size, None]),
|
||||||
|
tf.keras.layers.__A__(rnn_units,
|
||||||
|
return_sequences=__B__,
|
||||||
|
recurrent_initializer='glorot_uniform),
|
||||||
|
tf.keras.layers.Dense(__C__)
|
||||||
|
])
|
||||||
|
__D__
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
A: `ELU`
|
||||||
- three
|
|
||||||
|
B: `True`
|
||||||
|
|
||||||
|
C: `vocab_size`
|
||||||
|
|
||||||
|
D: `return model`
|
||||||
|
- |
|
||||||
|
A: `LSTM`
|
||||||
|
|
||||||
|
B: `False`
|
||||||
|
|
||||||
|
C: `batch_size`
|
||||||
|
|
||||||
|
D: `return model`
|
||||||
|
- |
|
||||||
|
A: `LSTM`
|
||||||
|
|
||||||
|
B: `True`
|
||||||
|
|
||||||
|
C: `vocab_size`
|
||||||
|
|
||||||
|
D: `return model`
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,28 @@ videoId: j5xsxjq_Xk8
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
|
||||||
|
Fill in the blanks below to create the training examples for the RNN:
|
||||||
|
|
||||||
|
```py
|
||||||
|
char_dataset = tf.data.__A__.__B__(text_as_int)
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
A: `DataSet`
|
||||||
- three
|
|
||||||
solution: 3
|
B: `from_tensor_slices`
|
||||||
|
- |
|
||||||
|
A: `data`
|
||||||
|
|
||||||
|
B: `from_tensors`
|
||||||
|
- |
|
||||||
|
A: `DataSet`
|
||||||
|
|
||||||
|
B: `from_generator`
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,13 @@ videoId: WO1hINnBj20
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Before you make a prediction with your own review, you should...:
|
||||||
answers:
|
answers:
|
||||||
- one
|
- decode the training dataset and compare the results to the test data.
|
||||||
- two
|
- use the encodings from the training dataset to encode your review.
|
||||||
- three
|
- assign random values between 0 and the maximum number of vocabulary in your dataset to each word in your review.
|
||||||
solution: 3
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,12 @@ videoId: mUU9YXOFbZg
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Word embeddings are...:
|
||||||
answers:
|
answers:
|
||||||
- one
|
- an unordered group of encoded words that describes the frequency of words in a given document.
|
||||||
- two
|
- a group of encoded words that preserves the original order of the words in a given document.
|
||||||
- three
|
- a vectorized representation of words in a given document that places words with similar meanings near each other.
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,17 @@ videoId: bX5681NPOcA
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What is true about Recurrent Neural Networks?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
1: They are a type of feed-forward neural network.
|
||||||
- three
|
- |
|
||||||
solution: 3
|
2: They maintain an internal memory/state of the input that was already processed.
|
||||||
|
- |
|
||||||
|
3: RNN's contain a loop and process one piece of input at a time.
|
||||||
|
- |
|
||||||
|
4: Both 2 and 3.
|
||||||
|
solution: 4
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,36 @@ videoId: lYeLtu8Nq7c
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Fill in the blanks below to create the model for the RNN:
|
||||||
|
|
||||||
|
```py
|
||||||
|
model = __A__.keras.Sequential([
|
||||||
|
__A__.keras.layers.__B__(88584, 32),
|
||||||
|
__A__.keras.layers.__C__(32),
|
||||||
|
__A__.keras.layers.DENSE(1, activation='sigmoid')
|
||||||
|
])
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
A: `tensor_flow`
|
||||||
- three
|
|
||||||
|
B: `embedding`
|
||||||
|
|
||||||
|
C: `LSTM`
|
||||||
|
- |
|
||||||
|
A: `tf`
|
||||||
|
|
||||||
|
B: `Embedding`
|
||||||
|
|
||||||
|
C: `AlphaDropout`
|
||||||
|
- |
|
||||||
|
A: `tf`
|
||||||
|
|
||||||
|
B: `Embedding`
|
||||||
|
|
||||||
|
C: `LSTM`
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,41 @@ videoId: hEUiK7j9UI8
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Fill in the blanks below to save your model's checkpoints in the `./checkpoints` directory and call the latest checkpoint for training:
|
||||||
|
|
||||||
|
```py
|
||||||
|
checkpoint_dir = __A__
|
||||||
|
checkpoint_prefix = os.path.join(checkpoint_dir, 'ckpt_{epoch}')
|
||||||
|
|
||||||
|
checkpoint_callback = tf.keras.callbacks.__B__(
|
||||||
|
filepath=checkpoint_prefix,
|
||||||
|
save_weights_only=True
|
||||||
|
)
|
||||||
|
|
||||||
|
history = model.fit(data, epochs=2, callbacks=[__C__])
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
A: `'./training_checkpoints'`
|
||||||
- three
|
|
||||||
solution: 3
|
B: `ModelCheckpoint`
|
||||||
|
|
||||||
|
C: `checkpoint_prefix`
|
||||||
|
- |
|
||||||
|
A: `'./checkpoints'`
|
||||||
|
|
||||||
|
B: `ModelCheckpoint`
|
||||||
|
|
||||||
|
C: `checkpoint_callback`
|
||||||
|
- |
|
||||||
|
A: `'./checkpoints'`
|
||||||
|
|
||||||
|
B: `BaseLogger`
|
||||||
|
|
||||||
|
C: `checkpoint_callback`
|
||||||
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,13 @@ videoId: ZyCaF5S-lKg
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Natural Language Processing is a branch of artifitial intelligence that...:
|
||||||
answers:
|
answers:
|
||||||
- one
|
- deals with how computers understand and process natural/human languages.
|
||||||
- two
|
- translates image data into natural/human languages.
|
||||||
- three
|
- is focused on translating computer languages into natural/human languages.
|
||||||
solution: 3
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: S45tqW6BqRs
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: Which activation function switches values between -1 and 1?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- Relu (Rectified Linear Unit)
|
||||||
- two
|
- Tanh (Hyperbolic Tangent)
|
||||||
- three
|
- Sigmoid
|
||||||
solution: 3
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,37 @@ videoId: K8bz1bmOCTw
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Fill in the blanks below to build a sequential model of dense layers:
|
||||||
|
|
||||||
|
```py
|
||||||
|
model = __A__.__B__([
|
||||||
|
__A__.layers.Flatten(input_shape=(28, 28)),
|
||||||
|
__A__.layers.__C__(128, activation='relu'),
|
||||||
|
__A__.layers.__C__(10, activation='softmax')
|
||||||
|
])
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
A: `keras`
|
||||||
- three
|
|
||||||
solution: 3
|
B: `Sequential`
|
||||||
|
|
||||||
|
C: `Dense`
|
||||||
|
- |
|
||||||
|
A: `tf`
|
||||||
|
|
||||||
|
B: `Sequential`
|
||||||
|
|
||||||
|
C: `Categorical`
|
||||||
|
- |
|
||||||
|
A: `keras`
|
||||||
|
|
||||||
|
B: `sequential`
|
||||||
|
|
||||||
|
C: `dense`
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: hdOtRPQe1o4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What is an optimizer function?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- A function that increases the accuracy of a model's predictions.
|
||||||
- two
|
- A function that implements the gradient descent and backpropogation algorithms for you.
|
||||||
- three
|
- A function that reduces the time a model needs to train.
|
||||||
solution: 3
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,11 +15,12 @@ videoId: uisdfrNrZW4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
A densely connected neural network is one in which...:
|
||||||
answers:
|
answers:
|
||||||
- one
|
- all the neurons in the current layer are connected to one neuron in the previous layer.
|
||||||
- two
|
- all the neurons in each layer are connected randomly.
|
||||||
- three
|
- all the neurons in the current layer are connected to every neuron in the previous layer.
|
||||||
solution: 3
|
solution: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,12 +15,33 @@ videoId: RBBSNta234s
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: |
|
||||||
|
Fill in the blanks to complete the following Q-Learning equation:
|
||||||
|
|
||||||
|
```py
|
||||||
|
Q[__A__, __B__] = Q[__A__, __B__] + LEARNING_RATE * (reward + GAMMA * np.max(Q[__C__, :]) - Q[__A__, __B__])
|
||||||
|
```
|
||||||
|
|
||||||
answers:
|
answers:
|
||||||
- one
|
- |
|
||||||
- two
|
A: `state`
|
||||||
- three
|
|
||||||
solution: 3
|
B: `action`
|
||||||
|
|
||||||
|
C: `next_state`
|
||||||
|
- |
|
||||||
|
A: `state`
|
||||||
|
|
||||||
|
B: `action`
|
||||||
|
|
||||||
|
C: `prev_state`
|
||||||
|
- |
|
||||||
|
A: `state`
|
||||||
|
|
||||||
|
B: `reaction`
|
||||||
|
|
||||||
|
C: `next_state`
|
||||||
|
solution: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,11 @@ videoId: DX7hJuaUZ7o
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: What can happen if the agent does not have a good balance of taking random actions and using learned actions?
|
||||||
answers:
|
answers:
|
||||||
- one
|
- The agent will always try to minimize its reward for the current state/action, leading to local minima.
|
||||||
- two
|
- The agent will always try to maximize its reward for the current state/action, leading to local maxima.
|
||||||
- three
|
solution: 2
|
||||||
solution: 3
|
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
@ -15,12 +15,12 @@ videoId: Cf7DSU0gVb4
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
question:
|
question:
|
||||||
text: Question
|
text: The key components of reinforcement learning are...
|
||||||
answers:
|
answers:
|
||||||
- one
|
- environment, representative, state, reaction, and reward.
|
||||||
- two
|
- environment, agent, state, action, and reward.
|
||||||
- three
|
- habitat, agent, state, action, and punishment.
|
||||||
solution: 3
|
solution: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
Reference in New Issue
Block a user