# Exam 2 Version Y


📗 Name or ID: ____________________

📗 Question 1



📗 Question 2





📗 Question 3



📗 Question 4





📗 Question 5



📗 Question 6





📗 Question 7



📗 Question 8





📗 Question 9



📗 Question 10





📗 Question 11



📗 Question 12





📗 Question 13



📗 Question 14





📗 Question 15



📗 Question 16





📗 Question 17



📗 Question 18





📗 Question 19



📗 Question 20




📗 End of Exam
:
 ***** ***** ***** ***** ***** 

 ***** ***** ***** ***** *****

📗 [1 points] Assume element is a Selenium WebElement given by <a href="link.html" target="_blank">page<\a>. Which of the following returns "link.html"?
element.get_attribute("href")
element.get_attribute("text")
element.text
element.href

📗 [1 points] Suppose element is an HTML table WebElement with 3 rows and 3 columns, which of the following code finds the text in the last cell of the first row in the table?
element.find_element("tag name", "tr").find_elements("tag name", "td")[2].text
element.find_elements("tag name", "tr")[2].find_elements("tag name", "td")[2].text
element.find_elements("tag name", "tr")[2].find_element("tag name", "td").text
element.find_element("tag name", "tr").find_element("tag name", "td").text
📗 [1 points] Suppose the following nodes are in the priority queue, {node: "A", g: 1, h: 10}, {node: "B", g: 3, h: 7}, {node: "C", g: 5, h: 3}, {node: "D", g: 7, h: 2}, where "g" represents the distance from the initial node and "h" represents an admissible heuristic (estimated distance to the goal node). Which node will best first greedy search check next?
"D"
"C"
"B"
"A"
📗 [1 points] There are infinite number of web pages labeled by (0, 0), (0, 1), (0, 2), ..., (1, 0), (1, 1), ... and page (i, j) contains links to pages (i + 1, j) and (i, j + 1). Suppose we start at page (0, 0) and the goal is to find page (10, 10), which one of the following search heuristic is NOT admissible?
h((i, j)) = 1
h((i, j)) = 0
h((i, j)) = |10 - i| + |10 - j|
h((i, j)) = min(|10 - i|, |10 - j|)
📗 [1 points] Which of the following is a correct query string for route data that produces dict(flask.request.args) = {"from": "B", "to": "A"}
IP:5000/data?from=B&to=A
IP:5000/data?from="B"&to="A"
IP:5000/data?from=B,to=A
IP:5000/data?from="B",to="A"
📗 [1 points] What URL should be visited to get the page that displays "bbb"?

@app.route("/aaa")
def aaa():
  return "bbb"

@app.route("/") def bbb():   return "aaa"
http://127.0.0.1:5000/aaa
http://127.0.0.1:5000/
http://127.0.0.1:5000/index
http://127.0.0.1:5000/bbb
📗 [1 points] Which of the following types of visitor information can be found based on flask.request.remote_addr
Location information
Browser information
Operating system
Device information
📗 [1 points] In a Flask app, app.route("/index/<x>") binds the function index(x) return x. What will visits to "/index/1?x=2" display?
1
2
(Error)
(Status Code 404)

📗 [1 points] Suppose the total number of visits to version A and version B pages are fixed, say at 100 and 100. Which of the following will result in the smallest p-value for an A/B test?
100 clicks on A, 0 clicks on B
50 clicks on A, 50 clicks on B
25 clicks on A, 75 clicks on B
0 clicks on A, 50 clicks on B
📗 [1 points] When analyzing three contingency tables from an A/B test, scipy.stats.fisher_exact(df) returns 0.002 for table 1, 0.02 for table 2, and 0.2 for table 3. At a threshold for significance of 10 percent, for how many tests do we have statistically significant evidence that B has a different click-through-rate than A?
2
1
0
3
📗 [1 points] If the current average click through rates from versions A, B, C of the page are the same, and the numbers of visits to A, B, C are 30, 20, 10, respectively, which version with the UCB1 (upper confidence bound) algorithm display next?
C
A
A, B, C with equal probability
Depends on the variance
📗 [1 points] How many of the following visual encodings are more suitable for categorical data columns over ordinal data columns: (1) size, (2) shape (style), (3) color value (lightness or brightness), (4) color hue, (5) texture (different patterns inside a shape).
3
1
2
4
📗 [1 points] In a DataFrame with columns c1, c2, c3, c4 containing categorical data with 5, 4, 3, 2 categories respectively, how many subplots (axes) will seaborn.relplot(data, x = "c1", y = "c2", col= "c3", row = "c4") make? 
6
20
1
12
📗 [1 points] Which of the following transform will give you the circle that looks the smallest on the screen?

fig, ax = plt.subplots()
ax.set_xlim(0, 2)
ax.set_ylim(0, 2)
circle = plt.Circle((0.5, 0.5), 0.5, transform = ??)
??.add_artist(circle)
ax.transData
ax.transAxes
fig.transFigure
(two of the choices have the same smallest size)
📗 [1 points]If the quadratic Bezeir curve matplotlib.patches.FancyArrowPatch((10, 10), (0, 0), connectionstyle=ConnectionStyle.Angle3(-45, 0) has three control points (10, 10), (a, b), (0, 0), what is the value of (a, b)?
(20, 0)
(10, 0)
(0, 10)
(0, 20)
📗 [1 points] Which of the following does NOT produce a square if x = shapely.geometry.box(0, 0, 4, 4), y = shapely.geometry.box(1, 1, 3, 3)?
(All other choices produce a square)
x.union(y)
x.convex_hull
x.intersection(y)
📗 [1 points] If x = shapely.box(0, 0, 1, 1) and y = shapely.box(a, b, c, d) for some a < c, b < d, z = x.union(y), what is the minimum number of vertices the polygon z will have?
4
6
8
1
📗 [1 points] What will be len(matches) given the code below? (Note there is no space between CS and 320)

courses = "CS320, CS 368, CS 540, CS 559"
matches = re.findall("([A-Z]+)\s(\d{3})", courses)
3
2
1
0
📗 [1 points] What does this line output re.sub(r"(((\d)\d)\d)", "\g<3>\g<2>\g<1>", "320 123")?
"332320 112123"
"023 321"
"320323 123121"
"320 123 32 12 3 1"
📗 [1 points] If you think any of the questions are not clear or incorrect, please explain here; otherwise, enter "none". Please do not leave the answer blank:






Last Updated: April 29, 2024 at 1:11 AM