Assignment 7-12
Assignment 7-12
Due on 2024-09-11
• csv.readerO
csv.writeO
csv.loadO
csv. readfi leO
To create 3D plots
• To plot data on Google Maps
To generate matplotlib graphs
To create dashboards
Yes, the answer is correct.
Score: 1
Accepted Answers:
To plot data on Google Maps
4) In a game of Snakes and Ladders, a player is currently on square 96. There ls a snake on square 99 that sends the player back to square
78. If the
player wishes to reach square 100 in one dice throw, what number must they roll on the dice?
i onlinecourses.nptel.ac.in
4) In a game of Snakes and Ladders, a player is currently on square 96. There is a snake on square 99 that sends the player back to square 78. If the
player wishes to reach square 100 in one dice throw, what number must they roll on the dice?
1 point
5) In the same scenario, where the player is on square 96 and needs to roll a 4 to reach square 100, what is the probability of rolling this number o~1 point
a fair six-sided die?
1/2
1/3
1/4
1/6
6) Which of the following commands will draw a square using Python's turtle module? 1 point
Turtle is imported in the following way-
import turtle as t
turtle = t.Turtle()
./ for i in range(4):
turtle. forward(100)
turtJe.left(90)
for i in range(4):
turtle. forward(100)
turtle.right(90)
for i in range(4):
turtle.backward(100}
turtle.laft(90)
for i in range(4):
turtle.backward(100)
turtle.nght(90}
7) Does the turtle module in Python allow you to draw complex shapes on the screen?
Yes
No
8) What is the purpose of the lurtle.penupQ and turtle.pendownO commands in Python's turtle module?
• To stop the turtle from drawing and then resume drawing at a new position
To change the color of the turtle's pen
To speed up or slow down the drawing speed of the turtle
9) What is the default drawing state of the turtle when a new turtle object is created in Python's turtle module?
10) Which of the following commands is used to open an image file using Python's PIL (Pillow) library?
img = PIL.lmage.open('image.jpg')
• img = lmage.open('image.jpg')
img = open_image('image.jpg')
img = PIL.open_image('image.jpg')
Yes, the answer is correct.
Score: 1
Accepted Answers:
img = lmage.open('image.jpg')
We ek 8: Assignment 8
The due date for submitting this assignment has passed.
t = (1, 2, 3)
✓ t = (1, 2, 3)
t = {1, 2, 3}
✓ t = 1, 2, 3
t[1] = 4
t.append(4)
• t = t + (4,)
del t[1]
t=[1,2,3 ]
print(type((t,t)))
ASCJl('a'}
• ord('a'}
int('a'}
ASC_val('a'}
8) Which of the following Python code snippets correctly checks if two strings
are anagrams? 1 point
• def are_anagrams(str1 , str2):
return sorted(str1) == sorted(str2)
Week 9: Assignment 9
The due date for submitting this assignment has passed.
Due on
• True
False
• 6
8
12
16
4) Which Python library is most commonly used for working with graphs related to networks?
Random
Pandas
NumPy
NetworkX
5) Gephi is:
1
2
• 3
9
• To analyze the style and structure of literary works for authorship attribution
To create stylized graphics for digital art
To study phonology of languages
To enhance the readability of texts by adjusting font styles
• To analyze the style and structure of literary works for authorship attribution
To create stylized graphics for digital art
To study phonology of languages
To enhance the readability of texts by adjusting font styles
print(k)
4
• 21
24
26
1O) How can you estimate the area of a sub-region within a larger region by randomly throwing points in the larger region?
By counting the total number of points and calculating the sum of their distances from the center
• By calculating the proportion of points that land in the sub-region compared to the total number of points in the larger region
By calculating the distance between each point and the boundary of the region
By averaging the coordinates of all the points that land in the larger region
s = "Hello, World!"
print (s[7:12 ))
• "World"
"World!"
"Worl"
"orld"
2) Which string method would you use to remove all leading and trailing whitespace from a string in Python?
• stripp
splitO
replaceO
joinO
"PythonProgramming"
"Pto rgamn"
"PyonPormig"
"PtoPormig"
Yes, the answer is correct.
Score: 1
Accepted Answers:
"PtoPormig"
• i onlinecours es.nptel.ac. in
4) Why are names often converted to lowercase and spaces removed when implementing the FLAMES game in Python?
5) Given the names "Alice" and "Bob", what is the FLAMES result of their relationship according to the FLAMES game?
Friends
Love
• Affection
Marriage
Enemy
Siblings
(1 2 3)
• (2 3 4)
[2 3 4 5)
[1 2 3 4)
7) In the NumPy array arr= np.array ( [ [1,2,3),(4,5,6),[7,8,9)] ), what is the value of arr (1,2)? 1p
5
6
2
8
• "bd"
"bed "
"ace"
"be 11
datetime
• selenium
chrome
webdriver
3) Which method is used in Selenium to open a specific URL in the web browser?
driver.open(url)
driver.load(url)
driver.navigate(url)
• driver.get(url)
4) In Selenium, how can you simulate pressing the Enter key in a text input field?
4) In Selenium, how can you simulate pressing the Enter key in a text input field?
5) How can you get the current local date and time in Python using the datetime module?
datetime.date. todayO
• datetime.datetime.nowO
datetime.time.nowO
6) Which function from the calendar module can be used to create a formatted string representing a month's calendar?
calendar.printrnonthO
• calendar.monthO
calendar. rnonthcalendarO
string.rnodify0
string.replace(old, new)
string.rernove(old)
string.update(new)
8) Which of the following statements correctly imports the datetime module in Python? 1 poi
imoort datetime
i onlinecourses.nptel.ac.in
Accepted Answers:
string.replace(old, new)
8) Which of the following statements correctly imports the datetime module in Python?
import datetime
from datetime import datetime
import datetime as dt
• All of the given options
import calendar
print(calendar.isleap(2024))
• True
False
2024.0
None
10) Using the datetime module, how can you print the current date 7 times, each time increasing the day by 1 from the current date?
for i in range(?):
print(datetime.datetime.now0 + datetime.timedelta(days=i))
• for i in range(?):
print(datetime.date.today0 + datetime. timedelta(days=i))
for i in range(?):
print(datetime.datetime. todayQ.add(days=i))
for i in range(?):
print(datetime.date.nowQ.add(days=i))
Add 1
Multiply by 3 and add 1
• Divide by 2
Subtract 1
It is divided by 2
It remains unchanged
It is replaced by n x 3 + 1
It is replaced by n - I
Yes, the answer is correct.
Score: 1 •
Accepted Answers:
It is replaced by n X 3 + 1
10) For which values between 200 and 3000 does the Collatz Conjecture not converge to 1?
2498.0
1576.0
2789.0
• None of the given options
Yes, the answer is correct.
Score: 1
Accepted Answers:
None of the given options