Week 2 Computational Thing
Week 2 Computational Thing
The following procedure counts the number of students from Bengaluru whose total marks are less than the
average total marks from the “Scores” dataset and stores it in variable A. Let avgT be the average total marks.
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 : Initialize variable A 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 X.CityTown == “Bengaluru” and X.Total > avgT then add 1 to A
Step 6 : Move the current card to another pile called Pile 2 and repeat from Step 2
Step 5
Step 6
Step 2
Step 3
No mistake
2 points
At the end of the execution of the given procedure on the “Scores” dataset, what will A and B represent?
(MCQ)
2 points
The following procedure took data from the “Scores” dataset and A represents the number of male students
whose Physics marks are less than the Mathematics marks but equal to their Chemistry marks. 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 : Initialize variable A 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 Gender is ‘M’ and Physics marks = Mathematics marks and Chemistry marks > Physics marks then
add 1 to A
Step 6 : Move the current card to another pile called Pile 2 and repeat from Step 3
Step 2
Step 5
Step 6
No mistake
2 points
At the end of the execution of the given procedure on the “Words” dataset, what will A represent? This is a
Multiple Choice Question (MCQ)
Step 1. Arrange all cards in a single pile called Pile 1
Step 2. Maintain two variables A, B and initialize A to 1000 and B to 0
Step 3. If Pile 1 is empty then stop the iteration
Step 4. Read the top card in Pile 1
Step 5. Add Letter Count to variable B
Step 6. If Word does not end with a full stop then execute Step 9
Step 7. If Word ends with a full stop and B < A then store B in A
Step 8. Re-initialize the variable B to 0
Step 9. Move the current card to another pile called Pile 2 and repeat from Step 3
2 points
Assume that a, b, and c are three distinct integers. What will X represent after the execution of the following
procedure?
Step 1. Maintain variable X and Initialize it to 0
Step 2. If a < b then go to step 4
Step 3. If b < c then store b in X else store c in X and stop the procedure.
Step 4. If a < c then store a in X else store c in X
X will always be 0
2 points
What will be the value of X after the execution of the following procedure using the “Scores” dataset? (MCQ)
(Note: Consider the same sequence as given in the Scores datasets)
Chennai
Bengaluru
Madurai
Vellore
2 points
The following flowchart is executed using the “Scores” dataset. Assume that Rida and Siddharth both
have scored the lowest total marks across the whole dataset which is 173. Let cards are arranged in such a way
that Rida's card is below Siddharth's card, what will the values of A and B be at the end of the execution?
A = "Siddharth", B = 173
A = 173 , B = "Rida"
A = "Rida", B = 173
A = 173, B = "Siddharth"
2 points
The following pseudocode is executed using the “Scores” dataset. What will count represent at the end of the
execution of pseudocode?
Number of students who scored less than 80 marks in at least two subjects
Number of students who scored more than 80 marks in exactly two subjects
Number of students who scored more than 80 marks in all three subjects
Number of students who scored less than 80 marks in at least one subject
2 points
What will (A–B) represent after execution of the following procedure using the “Shopping Bills” dataset?
(MCQ)
Step 1 : Arrange all cards in a single pile called Pile 1
Step 2 : Initialize variables A and B 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 the bill contains an item “Bananas” then add 1 to variable A
Step 6 : If Total < 600 and the bill contains an item “Bananas” then add 1 to variable B
Step 7 : Move the current card to another pile called Pile 2 and repeat from Step 3
Number of bills that contain the item "Bananas" and total is more than or equal to 600
Number of bills that contain the item "Bananas" and total is less than 600
Number of bills that do not contain the item "Bananas" and total is more than 600
Number of bills that do not contain the item "Bananas" and total is less than 600
2 points
The given pseudocode is executed using the “Scores” dataset. At the end of the execution, C will be True if
there are more female students from Chennai than male students from Bangalore. Choose the correct option to
complete the pseudocode. (MCQ)
Submit Answers