# Exam 2 Version X


📗 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="page.html" target="_blank">link<\a>. Which of the following returns "page.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 first cell of the last row in the table?
element.find_elements("tag name", "tr")[2].find_element("tag name", "td").text
element.find_elements("tag name", "tr")[2].find_elements("tag name", "td")[2].text
element.find_element("tag name", "tr").find_elements("tag name", "td")[2].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 A* search check next?
"C"
"B"
"A"
"D"
📗 [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)) = max(|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": "A", "to": "B"}
IP:5000/data?from=A&to=B
IP:5000/data?from="A"&to="B"
IP:5000/data?from=A,to=B
IP:5000/data?from="A",to="B"
📗 [1 points] What URL should be visited to get the page that displays "aaa"?

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

@app.route("/") def bbb():   return "aaa"
http://127.0.0.1:5000/
http://127.0.0.1:5000/aaa
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
Service provider
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/2?x=1" display?
2
1
(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?
0 clicks on A, 100 clicks on B
50 clicks on A, 50 clicks on B
75 clicks on A, 25 clicks on B
50 clicks on A, 0 clicks on B
📗 [1 points] When analyzing three contingency tables from an A/B test, scipy.stats.fisher_exact(df) returns 0.005 for table 1, 0.05 for table 2, and 0.5 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 10, 20, 30, respectively, which version with the UCB1 (upper confidence bound) algorithm display next?
A
C
A, B, C with equal probability
Depends on the variance
📗 [1 points] How many of the following visual encodings are more suitable for ordinal data columns over categorical data columns: (1) size, (2) shape (style), (3) color value (lightness or brightness), (4) color hue, (5) texture (different patterns inside a shape).
2
1
3
4
📗 [1 points] In a DataFrame with columns c1, c2, c3, c4 containing categorical data with 2, 3, 4, 5 categories respectively, how many subplots (axes) will seaborn.relplot(data, x = "c1", y = "c2", col= "c3", row = "c4") make? 
20
6
1
12
📗 [1 points] Which of the following transform will give you the circle that looks the largest 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)
fig.transFigure
ax.transAxes
ax.transData
(two of the choices have the same largest size)
📗 [1 points]If the quadratic Bezeir curve matplotlib.patches.FancyArrowPatch((10, 10), (0, 0), connectionstyle=ConnectionStyle.Angle3(135, 90) has three control points (10, 10), (a, b), (0, 0), what is the value of (a, b)?
(0, 20)
(10, 0)
(0, 10)
(20, 0)
📗 [1 points] Which of the following does NOT produce a square if x = shapely.geometry.box(0, 0, 2, 2), y = shapely.geometry.box(1, 1, 3, 3)?
x.union(y)
x.intersection(y)
x.convex_hull
(All other choices produce a square)
📗 [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 maximum number of vertices the polygon z will have?
8
6
4
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]+)(\d{3})", courses)
1
2
3
0
📗 [1 points] What does this line output re.sub(r"(((\d)\d)\d)", "\g<3>\g<2>\g<1>", "123 320")?
"112123 332320"
"321 023"
"123121 320323"
"123 320 12 32 1 3"
📗 [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: June 19, 2024 at 11:27 PM