Posts

Showing posts from August, 2024

Programming assignment - Week 5

Programming assignment - Week 5  Solutions Note: There could be optimised ways to solve the problem, but the goal here is to solve it effectively. The most intuitive solution has been provided for clarity.

The Joy of Computing using Python Week-5

Quiz Week 5: Assignment 5 Solution 1.  Which of the following is the correct way to add data with key as CS101  and value as "Web Programming"  to a dictionary named courseData? ? Answer:   [Option 4]  courseData["CS101"] = "Web Programming" 2.  What is the probability of Monty opening the door with goat, given the hypothesis that you initially chose the door which has car ? Answer :   [Option 4] 1 3. Does transposing the magic square give us a new magic square ? Answer :   [Option 1] True         [Option 2]  (2**90) % 2 == 0         [Option 3]  3*((3**89) + 3 ) % 3 == 0         [Option 4]  (2**90 ) % len(doors) == 1 4.  Given that you have a sorted list of 1024 elemets, what is the maximum number of comparisons required to find the target element using binar...

Programming assignment - Week 4

Programming assignment - Week 4  Solutions Note: There could be optimised ways to solve the problem, but the goal here is to solve it effectively. The most intuitive solution has been provided for clarity.

The Joy of Computing using Python Week-4

Image
Quiz Week 4: Assignment 4 Solution

Programming assignment - Week 3

Programming assignment - Week 3  Solutions Note: There could be optimised ways to solve the problem, but the goal here is to solve it effectively. The most intuitive solution has been provided for clarity.

The Joy of Computing using Python - Week 3

Image
Quiz Week 3: Assignment 3 Solution

Programming assignment - Week 2

Programming assignment - Week 2  Solutions

The Joy of Computing using python -Week 2

Image
Quiz Week 2: Assignment 2 Solution 1. Statement: If a variable is assigned multiple times, the latest value is not stored in the variable Answer: [Option 2] False, the variable stores the value from the latest assignment. 2. Which of the following code blocks print - "Hello Ram Lakshman and Hanuman!"? Answer : [Option 1] and [Option 3] 3. What aren't the correct ways to inform Python that input is an integer? Answer : [Option 1] in(input())   [Option 2] float(input()) 4. The following program outputs 722 - For what value of a does the code output 8? Answer : [Option 3] 4 5. What does the previous question calculate? Answer : [Option 4] Calculates the factorial ...

The Joy of Computing using python -Week 1

Image
 Week 1 Assignment Solution The cat wants to move 100 steps away slowly, and by the time it finishes moving 100 steps, it needs to slowly rotate as well towards the opposite direction. Can both these tasks be accomplished by using single loop in scratch?  Answer : YES  Which block moves the cat as described in the previous question ? Answer : [Option 3]  What does the cat say here ? Answer : [Option 4]  Says the number 4, and its multiples each for 1 second, till 40 and changes the value of number variable by adding previous value with 4. From the previous question, what is the value of number variable after the loop ends ? Answer : [Option 2]  44 Let answer for previous question be stored in variable x, what does the cat say after the execution of the loop ? Answer : [Option 3]  29  Which of the following is use case of variables in programming. Answer :  [Option 2]  They help in storing and retrieval of information/da...