1
point
1。
Which of the following Python data structures is most similar to the value returned in this line of Python:
1
*
*
*
*
List available video modes. If resolution is given show only modes matching it.x
= urllib.request.urlopen (
‘ http://data.pr4e.org/romeo.txt ‘)
*
*
*
*
socket
regular expression
-ise suffixes and with accents
file handle
list
1
point
2.
In this Python code, which line actually reads the data?
1
2
3
4
5
6
7
8
9
10
11
12
13
import socket
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect((‘data.pr4e.org’, 80))
cmd = ‘GET http://data.pr4e.org/romeo.txt HTTP/1.0\n\n’.encode()
mysock.send(cmd)
while True:
data = mysock.recv(512)
if (len(data) < 1):
break
print(data.decode())
mysock.close()
mysock.recv()
socket.socket()
mysock.close()
mysock.connect()
mysock.send()
1
point
3。
Which of the following regular expressions would extract the URL from this line of HTML:
one
<;
P
> Please click;
<;
a
href
=
the United Nations http://www.dr-chuck.com/ the United Nations
> here;
</
a
>;
</
P
>;
href=)+”。
href=”
http:/ *
<.>;
one
point
4。
In this Python code,which line is most like the open)call to read a file:
1
2
3
4
5
6
7
8
9
10
11
12
13
import socket
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect((‘data.pr4e.org’, 80))
cmd = ‘GET http://data.pr4e.org/romeo.txt HTTP/1.0\n\n’.encode()
mysock.send(cmd)
while True:
data = mysock.recv(512)
if (len(data) < 1):
break
print(data.decode())
mysock.close()
mysock.connect()
import socket
mysock.recv()
mysock.send()
socket.socket()
1
point
5。
Which HTTP header tells the browser the kind of document that is being returned?
HTML-Document:
Content-Type:
Document-Type:
ETag:
Metadata:
1
point
6。
What should you check before scraping a web site?
That the web site returns HTML for all pages
That the web site supports the HTTP GET command
That the web site allows scraping
That the web site only has links within the same site
1
point
7。
What is the purpose of the BeautifulSoup Python library?
It builds word clouds from web pages
It allows a web site to choose an attractive skin
It optimizes files that are retrieved many times
It animates web operations to make them more attractive
It repairs and parses HTML to make it easier for a program to understand
1
point
8。
What ends up in the “x” variable in the following code:
1
2
3
html
= urllib.request.urlopen(url).read()
soup
= BeautifulSoup(html,
‘html.parser’)
x
= soup(
‘a’)
A list of all the anchor tags (<a..) in the HTML from the URL
True if there were any anchor tags in the HTML from the URL
All of the externally linked CSS files in the HTML from the URL
All of the paragraphs of the HTML from the URL
1
point
9。
What is the most common Unicode encoding when moving data between systems?
UTF-32
UTF-64
UTF-16
UTF-128
UTF-8
1
point
10。
What is the decimal (Base-10) numeric value for the upper case letter “G” in the ASCII character set?
71
7
103
25073
14
1
point
11。
What word does the following sequence of numbers represent in ASCII:
108, 105, 110, 101
lost
tree
ping
line
func
1
point
12。
How are strings stored internally in Python 3?
Byte Code
UTF-8
ASCII
EBCDIC
Unicode
1
point
13。
When reading data across the network (i.e. from a URL) in Python 3, what method must be used to convert it to the internal format used by strings?
decode()
upper()
find()
trim()
encode()
1
point
1。
Which of the following Python data structures is most similar to the value returned in this line of Python:
1
*
*
*
*
x = urllib.request.urlopen (‘ http://data.pr4e.org/romeo.txt ‘)
*
*
*
*
socket
regular expression
-ise suffixes and with accents
file handle
list
1
point
2.
In this Python code, which line actually reads the data?
1
2
3
4
5
6
7
8
9
10
11
12
13
import socket
mysock
= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect((
‘data.pr4e.org’,
80))
cmd
=
‘GET http://data.pr4e.org/romeo.txt HTTP/1.0
\n\n
‘.encode()
mysock.send(cmd)
while
True:
data
= mysock.recv(
512)
if (
len(data)
<
1):
break
print(data.decode())
mysock.close()
mysock.recv()
socket.socket()
mysock.close()
mysock.connect()
mysock.send()
1
point
3。
Which of the following regular expressions would extract the URL from this line of HTML:
one
< p> Please click<; http://www.dr-chuck.com/ “> here<
href=)+”。
href=”
http:/ *
<.>;
one
point
4。
In this Python code,which line is most like the open)call to read a file:
1
2
3
4
5
6
7
8
9
10
11
12
13
import socket
mysock
= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect((
‘data.pr4e.org’,
80))
cmd
=
‘GET http://data.pr4e.org/romeo.txt HTTP/1.0
\n\n
‘.encode()
mysock.send(cmd)
while
True:
data
= mysock.recv(
512)
if (
len(data)
<
1):
break
print(data.decode())
mysock.close()
mysock.connect()
import socket
mysock.recv()
mysock.send()
socket.socket()
1
point
5。
Which HTTP header tells the browser the kind of document that is being returned?
HTML-Document:
Content-Type:
Document-Type:
ETag:
Metadata:
1
point
6。
What should you check before scraping a web site?
That the web site returns HTML for all pages
That the web site supports the HTTP GET command
That the web site allows scraping
That the web site only has links within the same site
1
point
7。
What is the purpose of the BeautifulSoup Python library?
It builds word clouds from web pages
It allows a web site to choose an attractive skin
It optimizes files that are retrieved many times
It animates web operations to make them more attractive
It repairs and parses HTML to make it easier for a program to understand
1
point
8。
What ends up in the “x” variable in the following code:
1
2
3
html = urllib.request.urlopen(url).read()
soup = BeautifulSoup(html, ‘html.parser’)
x = soup(‘a’)
A list of all the anchor tags (<a..) in the HTML from the URL
True if there were any anchor tags in the HTML from the URL
All of the externally linked CSS files in the HTML from the URL
All of the paragraphs of the HTML from the URL
1
point
9。
What is the most common Unicode encoding when moving data between systems?
UTF-32
UTF-64
UTF-16
UTF-128
UTF-8
1
point
10。
What is the decimal (Base-10) numeric value for the upper case letter “G” in the ASCII character set?
71
7
103
25073
14
1
point
11。
What word does the following sequence of numbers represent in ASCII:
108, 105, 110, 101
lost
tree
ping
line
func
1
point
12。
How are strings stored internally in Python 3?
Byte Code
UTF-8
ASCII
EBCDIC
Unicode
1
point
13。
When reading data across the network (i.e. from a URL) in Python 3, what method must be used to convert it to the internal format used by strings?
decode()
upper()
find()
trim()
encode()
Read More:
- Web Crawler: How to get the data in the web page and disguise the header, disguise as a browser to visit many times, avoid a single visit leading to IP blocked
- [Getting and Cleaning data] Quiz 2
- VCSA web access error 503 Service Unavailable
- Install in Python 3. X web.py
- Running Python 3.7 web.py Runtimeerror: generator raised stopiteration exception occurred during test
- Jetson nano uses Python to read and parse GPS data (GPRMC, gpgga).
- IOS WebView failed to load the web page. Error domain = kcferrodomaincfnetwork code = 310 “there was a problem communicating with the secure web proxy server (HTTPS). “
- Android: Web access activity error: error unknown URL scheme
- Python conversion hex to string, high and low data processing
- [solution] coursera webpage can’t be posted, video can’t be opened -20.05.23-
- The web project removal server reports an error, and the web project in eclipse cannot be automatically deployed to Tomcat
- There is more than one Web fragment with the same name: “spring_web”.
- Python data analysis dataframe converts dates to weeks
- Kibana access error: data too large [How to Solve]
- web.xml Web app error in file
- Python export data (CSV format)
- Python data cleaning — delete failed images__ Simple version
- Data analysis to obtain Yahoo stock data: some problems are encountered when using panda datareader (cannot import name ‘is_ list_ Like ‘problem)
- [leetcode] 295. Find Median from Data Stream Python
- Removing stop words —— Python Data Science CookBook