The Joy of Computing using Python Week-6

Quiz Week 6: Assignment 6

Solution

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

Answer: [Option 4] n

2. Which of the following are true about recursion?

Answer: [Option 1] Recursion is a process in which a function calls                     itself as a subroutine.

       [Option 3] Recursion requires more resources compared to                      iteration.

3. What is the output of following code ?

Answer:  [Option 2] 8

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

Answer[Option 1] Yes, it would be same as ’e’ in the original text 

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.

Answer[Option 1] Yes, it's possible.

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

Answer: [Option 1] It will not work if the cipher text is too small.

      [Option 3] It will not work if the encrypted text was                         previously encrypted using a different cipher, which                  could have removed patterns in common English.

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

Answer[Option 2] Returns a list of all the keys in the dictionary.

8. Is Ceaser Cipher a type of Substitution Cipher?

AnswerYes

9. What is the consequence of not having a base case in a recursive function?
Answer: [Option 1] The function will run infinitely.

10. What are the number of possible final lines when someone wins, in a game of TicTac-Toe?
Answer[Option 2] 8

Visit here to know about Week-5 Question-4 Discrepancy 
Discussion makes the solution more accurate ( social computing ) discuss the solution in comments. Do share this with your friends !! Comment the queries, I will reach out to you.
Week 6 programming assignment solution coming soon ☺......

Comments

Popular posts from this blog

The Joy of Computing using python -Week 1