NPTEL Joy Of Computing Using Python Week 7 Assignment 2025

This article focuses on the NPTEL Joy Of Computing Using Python Week 7 Assignment Answers. If you didn't complete the Week 6 NPTEL Joy Of Computing, the link is below. The answers are 100% correct according to my source, and you are free to change the answers to your own choice.

Also Read: NPTEL Joy Of Computing Using Python Week 6 Assignment Answers

Join us on Telegram 👉 CLICK HERE

NPTEL Joy Of Computing Using Python Week 7 Assignment 2025

NPTEL Joy Of Computing Using Python Week 7 Assignment 2025

In Week 7, the following topics are discussed:
  • Snake and ladders - Not on Board
  • Spiral Traversing - Let's Animate
  • GPS - Track the route

Last Date: 12-03-2025

Q1. What will be the output of the following code? 
   
        my_dict = {1: 2, 2: 3, 3: 4}
        x = my_dict[ my_dict[1]]
        print(x) {codeBox}

A. 2 
B. 3 
C. 4
D. Error

Answer: [ B ] 3


my_dict = {1: 2, 2: 3, 3: 4}         x = my_dict[ my_dict[1]]

Q2. What is the spiral order traversal of the given matrix?

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) {codeBox}

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

Answer: [ C ] 1, 5, 9, 10, 11, 7, 3, 2, 6

What is the spiral order traversal of the given matrix


Q3. What type of triangle is drawn by the given code?


import turtle 
pen = turtle.Turtle()
for i in range(3):
      pen.forward(60)
      pen.right(120)
turtle.done() {codeBox}

A. Scalar triangle
B. Right angle triangle
C. Equilateral triangle
D. Isosceles triangle

Answer: [ C ] Equilateral triangle

What type of triangle is drawn by the given code


Q4. Which of the following programs will draw a hexagon?

Answer: [ B ]  Hexagon

A. 

Which of the following programs will draw a hexagon?

B.

programs will draw a hexagon?

C.
import turtle

D.

turtle shape hexagon

Q5. What will be the output of the following code?

      my_dict = {}
      my_dict[1] = "one"
      my_dict[1.0] = "float one"
      my_dict[True] = "boolean one"

      print (my_dict) {codeBox}

A. {1: ”one”, 1.0: ”float one”, True: ”boolean one”}
B. {1: ”boolean one”}
C. {1: ”one”, 1.0: ”float one”}
D. {1.0: ”float one”, True: ”boolean one”}

Answer: [ B ] {1: ”boolean one”}

{1: ”boolean one”}

Q6. 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() {codeBox}

Answer: [ D ] 

import turtle


Q7. Which turtle command is equivalent to lifting up a pen?

A. penlift()
B. penup()
C. uppen()
D. penremove()

Answer: [ B ] penup()

Q8. 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.

Answer: [ D ] All of the above

Q9. Which library is used to import images?

A. PIL
B. Imageview
C.IMG
D. image

Answer: [ A ] PIL

Q10. In Snakes and Ladders, what can be the ways to track ladders and snakes?

A. Maintain a dictionary with snake or ladder number blocks as keys.
B. Using the if condition to check on every number.
C. Both A and B.
D. Both A and B.

Answer: [ C ] Both A and B

Conclusion



One Comment Please !

Post a Comment (0)
Previous Post Next Post