NPTEL Joy Of Computing Using Python Week 6 Assignment 2025

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

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

For Faster Updates and Immediate answer links, join with us on Telegram

Join us on Telegram 👉 CLICK HERE

NPTEL Joy Of Computing Using Python Week 6 Assignment 2025

NPTEL Joy Of Computing Using Python Week 6 Assignment 2025


In Week 6, the following topics are discussed:
  • Substitution Cipher
  • Tic Tac Toe
  • Recursion
Last Date: 05-03-2025

Q1. If n is a positive integer, what is the output of the function given input n. 

def mystery(n):
     if n<=0:
        return 0 
     return n + mystery (n-1) {codeBox}

 A. Sum of numbers from 1 to n
 B. Sum of numbers from 1 to n-1
 C. n-1
 D. n

Answer: [ A ] Sum of numbers from 1 to n

Q2. Assertion (A): If a recursive function doesn’t have a base case, it may never stop.
Reason (R): Recursion means that a function calls itself.
 
A. Both (A) and (R) are true, and (R) is the correct explanation of (A).
B. Both (A) and (R) are true, but (R) is not the correct explanation of (A).
C. (A) is true, but (R) is false.
D. (A) is false, but (R) is true.

Answer: [ B ] Both (A) and (R) are true, but (R) is not the correct explanation of (A).

Q3. What is the output of following code?

def func (x): 
      return x**2
def func (x, y=1):
      return x**2 + y
print (func(5)) {codeBox}

A.  Error
B. 25
C. 26
D. 5

Answer: [ C ] 26

Q4. In English, the letter ‘z’ usually appears far less often than most letters. Now imagine applying a Substitution Cipher to a large body of English text, where ‘z’ is replaced by ‘r’, and every other letter is also mapped to a unique letter. After encryption, which letter is likely to be the least frequent in the new text?
Hint: Search the internet for more info, if needed.
 
A. z
B. r
C. e
D. It is not possible to determine

Answer: [ B ] r

Q5. If you have a large ciphertext produced by a simple substitution cipher on an English text, can you determine the original message by examining how often each letter appears?
Hint: Search the internet for more info, if needed.
 
A. Yes, it can be done.
B. No, it cannot be done.

Answer: [ A ] Yes, it can be done.

Q6. Suppose you suspect that a piece of ciphertext was produced using a simple sub-stitution cipher. Under which circumstances might frequency analysis fail to yield accurate results?
 
A. The ciphertext is short.
B. The ciphertext was encrypted with another method before encrypting with sub-stitution cipher.
C. The ciphertext is very long.

Answer: [ A ] [ B ] 
              The ciphertext is short. 
               The ciphertext was encrypted with another method before encrypting with sub-stitution cipher.

Q7. If variable dict_name is a non-empty dictionary, what does dict name.values() re-turn?
 
A. Returns nothing, but prints all the keys in the dictionary.
B. Returns a list of all the keys in the dictionary.
C. Returns a list of all the values in the dictionary.
D. Returns a list of all the items in the dictionary.

Answer: [ C ]  Returns a list of all the values in the dictionary.

Q8. Assertion (A): A Caesar Cipher is a type of Substitution Cipher.
Reason (R): In a Caesar Cipher, each letter in the plaintext is replaced by a letter at a fixed shift in the alphabet.

A. Both (A) and (R) are true, and (R) is the correct explanation of (A).
B. Both (A) and (R) are true, but (R) is not the correct explanation of (A).
C. (A) is true, but (R) is false.
D. (A) is false, but (R) is true.

Answer: [ A ] Both (A) and (R) are true, and (R) is the correct explanation of (A).

Q9. Which outcome generally follows from providing a proper base case in a recursive function?
 
A. The function returns a predefined result when the base condition is met.
B. It prevents infinite recursion and stops when a specific condition is met.
C. It ensures recursion depth is always constant.
D. It allows the function to keep calling itself indefinitely.

Answer: [ A ] [ B ] 
               The function returns a predefined result when the base condition is met.
                It prevents infinite recursion and stops when a specific condition is met.

Q10. In a standard 3×3 Tic-Tac-Toe board, how many distinct winning lines (rows, columns, or diagonals) pass through the center square?
 
A. 3
B. 2
C. 5
D. 4

Answer: [ D ] 4


One Comment Please !

Post a Comment (0)
Previous Post Next Post