NPTEL The Joy of Computing using Python Week 6 Assignment Answers 2024

Sanket
By Sanket

NPTEL The Joy of Computing using Python Week 6 Assignment Answers 2024

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

code1
  • Sum of numbers from 1 to n
  • Sum of numbers from 1 to n-1
  • n-1
  • n
Answer :- For Answers Click Here 

2. Which of the following are true about recursion?

  • Recursion is a process in which a function calls itself as a subroutine.
  • Recursion is a better alternative for performing repetitive tasks compared to iteration.
  • Recursion requires more resources compared to iteration.
Answer :- For Answers Click Here 

3. What is the output of following code ?

code3
  • 10
  • 8
  • 5
  • Error
Answer :- For Answers Click Here 

4. The letter ‘e’ is the most frequently occurring letter in the English language. Suppose we apply a Substitution Cipher where ‘e’ is mapped to ‘a’, and all other letters are uniquely mapped to different letters. If we encrypt a very long English storybook using this cipher, will the frequency of ‘a’ be the highest in the encrypted text?

Hint: Search the internet for more info, if needed

  • Yes, it would be same as ’e’ in the original text
  • Yes, it would be higher than ’e’ in the original text.
  • No, it would be lower than ’e’ in the original text.
  • No, we cannot predict
Answer :- 

5. Could we check frequency of letters in a long ciphertext and map them to frequency of letters in English to decrypt the message?

Hint: Search the internet for more info, if needed.

  • Yes, it is possible.
  • No, it is not possible.
Answer :- 

6. What are drawbacks of using frequency analysis to decrypt a message that has been encrypted using Substitution Cipher?

  • It will not work if the cipher text is too small.
  • It works flawlessly.
  • It will not work if the encrypted text was previously encrypted using a different cipher, which could have removed patterns in common English.
  • The frequency analysis method doesn’t work at all for Substitution Cipher
Answer :- For Answers Click Here 

7. If variable dict name is a non-empty dictionary, what does dict name.keys() return?

  • Returns nothing, but prints all the keys in the dictionary.
  • Returns a list of all the keys in the dictionary.
  • Returns a list of all the values in the dictionary.
  • Returns a list of all the items in the dictionary
Answer :- 

8. Is Ceaser Cipher a type of Substitution Cipher?

  • Yes
  • No
Answer :- 

9. What is the consequence of not having a base case in a recursive function?

  • The function will run infinitely.
  • The function will run only once.
  • The function will not run at all.
  • The function will run only for a fixed number of times.
Answer :- 

10. What are the number of possible final lines when someone wins, in a game of TicTac-Toe?

  • 3
  • 8
  • 9
  • 4
Answer :- For Answers Click Here 
Share This Article
Leave a comment