Skip to content

CT Week 1 Graded Assignments IIT Madras

Computational Thinking week 1 graded assignment Complete  Solutions Are Discussed In This Blog. We Hope This Might Help You All In Matching Answers . Or For Some Others Reasons If Not Able To Complete Graded Assignments 

What will be the values of A, B and C after execution of the following procedure using the “Scores” dataset?
Step 1: Arrange all cards in a single pile called Pile 1
Step 2: Maintain three variables A, B, C and initialize them to 0
Step 3: If Pile 1 is empty then stop the iteration
Step 4: Read the top card in Pile 1
Step 5: If Mathematics < 50 then increment A
Step 6: If Physics < 50 then increment B
Step 7: If Chemistry < 50 then increment C
Step 8: Move the current card to another pile called Pile 2 and repeat from step 3
  1. The value of A is  2  

  2. The value of B is  1  

  3. The value of C is  1   

 
4.What will variable B represent after execution of the following procedure on the “Words” dataset?

Step 1: Arrange all cards in a single pile called Pile 1
Step 2: Maintain two variables A, B and initialize them to 0
Step 3: If Pile 1 is empty then stop the iteration
Step 4: Read the top card in Pile 1
Step 5: If PartOfSpeech is “Verb” then increment A
Step 6: If the word does not end with a full stop then execute Step 9
Step 7: If the word ends with a full stop and A is greater than 1 then increment B
Step 8: Reset the variable A to 0
Step 9: Move the current card to another pile called Pile 2 and repeat from Step 3

 
 
 
5. A student proposed a hypothesis that less number of students are born in the first half of the year than the second half of the year. She wrote the following procedure which uses the “Scores” dataset to verify the hypothesis. However, the procedure may contain some errors. Find out the errors if present.
Step 1: Arrange all cards in a single pile called Pile 1
Step 2: Maintain two variables A and B and initialize them to 0
Step 3: If Pile 1 is empty then stop the iteration and start from Step 8
Step 4: Read the top card in Pile 1
Step 5: If the Date of Birth is from 1st January to 30th June then increment A
Step 6: If the Date of Birth is from 1st July to 31st December then increment B
Step 7: Move the current card to another pile called Pile 2 and repeat from Step 3
Step 8: If A > B then declare the hypothesis to be True
Step 9: If A ≤ B then declare the hypothesis to be False
 
 
 
6. What will variable X represent after execution of the following procedure on the “Shopping Bills” dataset?
Step 1: Arrange all cards in a single pile called Pile 1
Step 2: Maintain four variables A, B, C, X and initialize them to 0
Step 3: If Pile 1 is empty then stop the iteration and start from Step 9
Step 4: Read the top card in Pile 1
Step 5: If the Shop name is “SV Stores” and Customer name is “Suresh” then set A equal to 1
Step 6: If the Shop name is “Big Bazaar” and Customer name is “Suresh” then set B equal to 1
Step 7: If the Shop name is “Sun General” and Customer name is “Suresh” then set C equal to 1
Step 8: Move the current card to another pile called Pile 2 and repeat from Step 3
Step 9: Update the value of X as X = A + B + C
 
 
7. The following procedure is executed using the “Olympics” dataset.

Step 1: Arrange all cards in a single pile called Pile 1
Step 2: Maintain a variable X and initialize it to True
Step 3: If Pile 1 is empty then stop the iteration
Step 4: Read the top card in Pile 1
Step 5: If the Gender is “F” and Nationality is “Korean” then set X equal to False
Step 6: Move the current card to another pile called Pile 2 and repeat from step 3

At the end of the execution, X will be True if

 
 
 
8. The following procedure is executed using the “Library” dataset. At the end of the execution, count stores the number of books written by “Shakespeare” and published in “Morning Star” publications. But the programmer may have made mistakes in one or more steps. Identify all such steps (if any). It is a Multiple Select Question (MSQ).
Step 1: Arrange all cards in a single pile called Pile 1
Step 2: Maintain a variable count and initialize it to 1
Step 3: If Pile 1 is empty then stop the iteration
Step 4: Read the top card in Pile 1
Step 5: If Author == “Shakespeare” or Publisher == “Morning Star” then increment count
Step 6: Move the current card to another pile called Pile 2 and repeat from step 3
 
 
 
9. The following procedure is executed using the “Olympics” dataset. At the end of the execution, count stores the number of Indian players who have won a “Gold” medal. But the programmer has missed few Steps. Identify all correct Steps.
 
Step 1: Arrange all cards in a single pile called Pile 1
Step 2: Maintain a variable count and initialize it to 0
Step 3: ______________________________________
Step 4: Read the top card in Pile 1
Step 5: _______________________________________
Step 6: Move the current card to another pile called Pile 2 and repeat from Step 3
 

Detailed Answers

Solution
1,2,3 In this question we have to find exact values of three variables A, B and C. So, let us start with the procedure. Here in step 2 we have declared three variables A, B, C and also initialized them to 0. In step 5, variable A is getting incremented if Mathematics marks of a student is less than 50 which means we are counting the number of students who have secured less than 50 marks in Mathematics. In step 6, variable B
is getting incremented if Physics marks of a student is less than 50 which means we are counting the number of students who have secured less than 50 marks in Physics. In step 7 we are checking for the students whose Chemistry marks are less than 50 which means variable C is counting the number of students who secured less than 50 marks in Chemistry. It is a repeat step which indicates that this procedure is getting executed on all the cards available in the dataset. Therefore, if we compile all the Mathematics, Physics and Chemistry marks from the dataset

4. Let us analyze the given procedure, in Step 2 two variables A and B are initialized to 0. In Step 5 variable A is getting incremented if PartOfSpeech is “Verb” which means variable A is counting number of Verbs. Conditions in Steps 6 and 7 are exactly opposite to each other. As per the combination of Steps 6 and 9 we are counting nouns with variable A until we reach to a full stop. In other words, we are counting number of
Verbs in each sentence. As per Step 7 if a sentence ends and Verb count in variable A is greater than 1 then we are incrementing variable B. Step 8 resets the value of variable A so that the same variable can be used
to count number of Verbs in the next sentence. Based on this analysis we can conclude that the variable B gets incremented only if variable A’s value is greater than 1 which means if A is 2 or more. Hence, the
answer of this question is Total number of sentences with at least two verbs in it.

5. In Step 1 cards are arranged into a single pile and which is called as Pile 1. In Step 2 we are creating two variables called A and B then assigning the value 0 to them. Step 3 checks whether the iteration has to be continued or not. If the pile 1 is empty then the iteration has to be stopped. In Step 4, the top card of the Pile 1 is taken and read. Now, one has to count the number of people who are born in the first half of the
year and who are born in the second half of the year. In Step 5, we increment A if a student is born from 1st January to 30th June. In Step 6, we increment B if a student is born from 1st July to 31st December. In Step 7, the current card is moved to another called Pile 2 and the procedures are repeated from Step 3. After reading all cards, variables A and B will store the number of students whose Date Of Birth are in the first and
the second half of the year respectively. So to verify the hypothesis, the values of A and B should be compared with each other. If the value of A is less than B it will confirm the hypothesis to be True and if the
value of A is greater than or equal to B it will confirm the hypothesis to be False. Hence, Step 8 and 9 are incorrect. The correct answers are (c) and (d).

6,7.  Variables A, B, C, and X are initialized to 0 in Step 2. In Step 5 variable A’s value will be set to 1 if “Suresh” has a shopping bill from “SV stores”. Similarly, in Step 6 variable B’s value will be set to 1 if he has a bill from
“Big Bazaar” and variable C’s value for “Sun General” in Step 7. In Step 9 value of X is updated to with sum of A, B and C. Values of variables A, B and C either 1 or 0 based on the information if “Suresh” has visited the corresponding shop or not. Therefore, X will store the number of distinct shops visited by Suresh.

43 thoughts on “CT Week 1 Graded Assignments IIT Madras”

Leave a Reply

Your email address will not be published. Required fields are marked *