The Joy of Computing using Python Week-4
Quiz Week 4: Assignment 4
Solution
1. Which of the following options provides the general formula for the magic constant of a magic square of size n, where all elements are distinct numbers from 1 to n2 ?
Answer: [Option 1] n(n2+1)/2 & [Option 4] (n4+n2)/2n
2. What would the magic constant be for a magic square of size 6, given that all elements in the square are distinct numbers from 1 to 36?
Answer: [Option 2] 111
3. Does transposing the magic square give us a new magic square ?
Answer: No
4. Which of the following are valid magic squares ?
Answer: [Option 1], [Option 3], [Option 4]
5. What is the minimum number of people required to ensure that at least two of them share the same 30-minute birth interval? The intervals start from 12:00 AM and each interval lasts for half an hour.
Answer: 49
6. Calculate the magic constant for 4x4 square, where all elements are distinct numbers from 1 to 16, is it same as the magic constant for Ramanujan’s magic square ?
Answer: 1057. What task does function1() perform ?
Answer: [Option 4] Calculate factors of number n excluding n.
8. For what n1,n2 flag will the variable flag inside function2() be not equal to true ?
Answer: [Option 2](0,0), [Option 3](1,1) & [Option 4](1,0)
Comments
Post a Comment