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.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?
Answer: Yes
Comments
Post a Comment