Skip to content

CT Week 6 Graded Assignments IIT Madras

 

Computational Thinking week 6 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 

  1. In the “Scores” table, let S be the list of sequence numbers of rows which have marks greater than 75 in at least one subject. What does the variable count represent at the end of the execution of the pseudocode given below?


 
 
 

 

 

Number of students who have scored less than 75 in both Mathematics and Physics

Number of students who have scored more than 75 in Chemistry

Number of students who have scored less than 75 in both Mathematics and Physics, but more than 75 in Chemistry

Number of students who have scored less than 75 in all three subjects

 
3 points
 

2. The following pseudocode is executed using the “Words” dataset. Assume that the rows in Table 1 are sorted in the increasing order of sequence number. What does the list L contain at the end of execution?

 
 
 

 

 

The list of nouns that come immediately after an adjective

The list of adjectives that come immediately after a noun

The list of nouns that come immediately before an adjective

The list of adjectives that come immediately before a noun

 
3 points
 

3.We have a non-empty list called authList that stores the names of all authors in the “Library” table sorted in alphabetical order of author names. There is one element corresponding to each book in the table. This results in many duplicates. The following procedure attempts to extract the unique list of authors, while preserving the sorted order. The pseudocode may have mistakes. Identify all such mistakes (if any). It is a Multiple Select Question (MSQ).

 
 
 

 

 

Error in line 1

Error in line 2

Error in line 3

Error in line 5

Error in line 8

No error

 
4 points
 

4. The procedure visitedShop returns the list of names of people who have visited a particular shop in the “Shopping Bills” dataset. It accepts the shop’s name as a parameter. Additionally, each customer must be represented exactly once in the returned list. The following pseudocode may have mistakes. Identify all such mistakes(if any). It is a Multiple Select Question (MSQ).

 
 
 

 

 

Error in line 2

Error in line 6

Error in line 7

Error in line 16

Error in line 18

Error in line 19

No error

 

Question – (5-6)

stations is a list that contains the sequence of stations visited by a train from the “Trains” dataset. Each element in stations is a list: [NameDistance], the first entry is the name of the station, while the second entry is the distance of this station from the first station in the list.

minDist is a procedure that accepts stations as a parameter and returns the names of a pair of consecutive stations which have the shortest distance between them on this route. Complete the following procedure.

 
 
 

 

 
4 points

5. There may be multiple pairs having the same minimum distance. If we wish to find a pair of stations closest to the first station in the list, which of the following is the correct code fragment?

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4 points

6. There may be multiple pairs having the same minimum distance. If we wish to find a pair of stations closest to the last station in the list, which of the following is the correct code fragment?

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4 points
 

7. stns is a list that contains information about the sequence of stations visited by a train. Specifically, each element in this list is itself a list: [ArrivalDeparture]. The first element in stns corresponds to the starting station for the train and the last element corresponds to the ending station for the train.

waitTime(arrdep) is a procedure that accepts the arrival time and departure time of a train at a given station as input and returns the waiting time at that station in minutes.

We wish to find the average waiting time across all intermediate stations where the train stops and store this result in variable avg. The pseudocode may have mistakes. Identify all such mistakes (if any). It is a Multiple Select Question (MSQ).

 
 
 

 

 

Error in line 2

Error in line 3

Error in line 4

Error in line 6

Error in line 7

No error

 

Questions – (8 to 10)

trains
 is a list that contains information about trains associated with a station stn. Specifically, each element in this list is another list: [ArrivalDeparture]. If the arrival or departure time is empty, it is represented as “None”.

 
 
 

 

 
3 points

8. Which of the following statements about the variable flag1 is True at the end of execution of the above pseudocode?

It is True if and only if stn is a starting or ending station for at least one train in the list

It is False if and only if stn is a starting or ending station for at least one train in the list

It is True if and only if stn is a starting station for one train and ending station for some other train in the list

It is False if and only if stn is a starting station for one train and ending station for some other train in the list

 
3 points

9. What does the variable count represent at the end of execution of the above pseudocode?

It is number of trains associated with stn

It is the number of trains for which stn is a starting station

It is the number of trains for which stn is an ending station

It is the number of trains for which stn is neither a starting nor an ending station

 
4 points

10. At the end of execution of the code given above, what can be said about the values stored by the Boolean variables flag1 and flag2?

flag1 and flag2 always store the same value

flag1 and flag2 always store opposite values

flag1 always stores the value True

flag2 always stores the value True

There is no relationship between these two variables

WhatsApp
Telegram
Print
Facebook

3 thoughts on “CT Week 6 Graded Assignments IIT Madras”

Leave a Reply

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