# NPTEL The Joy Of Computing Using Python Week 7 Assignment 1 July 2023 | NPTEL

## Values of CSV files are separated by?

A. Commas
B. Colons
C. Semi-colons
D. Slash

A. Commas

Values of CSV (Comma-Separated Values) files are separated by commas.

## Output?

```def spiral(row, column, arr):
rowStart = 0
columnStart = 0

while (rowStart < row and columnStart < column):
for i in range(rowStart, row):
print(arr[i][columnStart], end=" ")

columnStart = columnStart + 1

for i in range(columnStart, column):
print(arr[row - 1][i], end=" ")

row = row - 1

if (rowStart < row):
for i in range(row - 1, rowStart - 1, -1):
print(arr[i][column - 1], end=" ")
column = column - 1

if (columnStart < column):
for i in range(column - 1, columnStart - 1, -1):
print(arr[rowStart][i], end=" ")
rowStart = rowStart + 1

matrix = [
[1, 2, 3],
[5, 6, 7],
[9, 10, 11]
]
row = 3
column = 3

spiral(row, column, matrix)
```
a. 1, 2, 3, 7, 11, 10, 9, 5, 6
b. 1, 2, 3, 5, 6, 7, 9, 10, 11
c. 1, 5, 9, 10, 11, 7, 3, 2, 6
d. 1, 5, 9, 2, 6, 10, 3, 7, 11

c. 1 5 9 10 11 7 3 2 6

## What will be the output of the following code?

```import turtle

pen = turtle.Turtle()

for i in range(3):

pen.right(60)

pen.forward(120)

turtle.done() ```
a. Scalar triangle
b. Right angle triangle
c. Equilateral triangle
d. Isosceles triangle

c. Equilateral triangle

## Which of the following program will draw a hexagon?

```import turtle

pen = turtle.Turtle()

for i in range(3):

pen.right(60)

pen.forward(60)
pen.right(60)

pen.forward(60)

turtle.done()
```

## Which of the following library is used to render data on google maps?

a. gplot
c gmplot
d. gmeplot

c gmplot

gmplot is a Python library that allows you to create interactive Google Maps plots with your data. It enables you to plot markers, shapes, and lines on Google Maps using latitude and longitude coordinates.

## What is the output of the following code?

```import turtle

pen = turtle.Turtle()

for i in range(3):

pen.right(60)
pen.forward(60)
pen.penup()
pen.right(60)

pen.forward(60)
pen.pendown()

turtle.done() ```

a. penlift()
b. penup()
c. uppen()
d. penremove()

b. penup()

## Why do we use functions?

a. To improve readability.
b. To reuse code blocks.
c. For the ease of code debugging.
d. All of the above

d. All of the above

## Library used to import images?

a. PIL
b. Imageview
c. IMG
d. image

a. PIL

The library typically used to import and work with images in Python is PIL (Python Imaging Library). However, it's worth noting that PIL is now known as Pillow, which is a modern fork of PIL and provides improved functionality for working with images in various formats.

## In snakes and ladder what can be the ways to track ladders and snakes?

a. Maintain a dictionary with snakes or ladder number blocks as keys.
b. Using the if condition to check on every number.
c. Both A and B.
d. None of the above

c. Both A and B.

C. Both A and B. In a Snakes and Ladders game, you can track the positions of snakes and ladders using both of the methods mentioned: A. You can maintain a dictionary with keys representing the block numbers where snakes or ladders are located, and the values indicating where they lead to. For example, if there is a ladder from block 4 to block 15, you can have a dictionary entry like {4: 15}. Similarly, for snakes, you can have entries like {12: 2}. This allows you to quickly look up and update the player's position when they encounter a ladder or a snake. B. You can use if conditions to check the player's position after each dice roll. If the player lands on a block with a ladder or a snake, you can then update their position accordingly. Using both methods together can make your code more organized and efficient in tracking and handling the game's mechanics.

### |All Assignment: The Joy of Computing using Python - Course | NPTEL

Disclaimer:
"This page contains multiple choice questions (MCQs) related to The Joy of Computing using Python. The answers to these questions are provided for educational and informational purposes only.These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself."