Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
BSCS1001 · Computational Thinking
All 2023 papers
Examination Instructions & Guidelines
- Solve on notebook/paper first before checking solutions.
- MCQ: Exactly 1 option is correct. Negative marking applies.
- MSQ: One or more options correct. Select all to score.
- NAT: Numerical response. No negative marking.
- Scientific calculator allowed for all calculations.
- Official answer key is sealed at the end of this sheet.
Qualifier · September 2023Qualifier
Useful Reference Data for this Paper

Q1MCQ2 Marks·Choose one option
- A

- B

- C

- D

- E

- A
- Q2MCQ3 Marks·Choose one option

- A

- B

- C

- D

- A
- Q3MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q4MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q5MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q6MCQ4 Marks·Choose one option
What will Count represent at the end of execution?- ANumber of words in which the same vowel occurs consecutively exactly once
- BNumber of words in which the same vowel occurs consecutively at least once
- CNumber of words in which the same vowel occurs consecutively exactly twice
- DNumber of words in which the same vowel occurs consecutively at least twice
- Q7MSQ2 Marks·Choose all correct options

- A

- B

- C

- D

- A
- Q8MSQ4 Marks·Choose all correct options

- A

- B

- C

- D

- A
- Q9MSQ4 Marks·Choose all correct options

- A

- B

- C

- D

- A
- Q10MSQ4 Marks·Choose all correct options

- A

- B

- C

- D

- E

- A
Read the passage below, then answer Q11–Q12

Answer the given subquestions based on the above information.
Q11MCQ3 Marks·Choose one option
- A

- B

- C

- D

- A
- Q12MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
Read the passage below, then answer Q13–Q14

Based on the above data, answer the given subquestion.
Q13MCQ4 Marks·Choose one option
- A

- B

- C

- D

- A
- Q14MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
Qualifier · May 2023Qualifier
Useful Reference Data for this Paper

Q15MCQ3 Marks·Choose one optionThe following pseudocode is executed using the "Words" dataset. What will count represent at the end of the execution?

- ANumber of words which are adjectives and have at least two letters
- BNumber of words which are either adjectives or have at most two letters but not both
- CNumber of words which are adjectives or have at most two letters or both
- DNumber of words which are not adjectives and have exactly two letters
- Q16MCQ3 Marks·Choose one option
The following pseudocode is executed using the “Library” dataset. What will A represent at the end of execution?

- ANumber of books written by author Kalam in English
- BNumber of books not written by author Kalam in English
- CNumber of English books written by authors other than Kalam
- DNumber of books that are written by Kalam or in English or both
- Q17MCQ3 Marks·Choose one option
The given pseudocode is executed using the “Words” dataset. Assume that vCount(X) returns the number of vowels in X.Word. What will B represent at the end of the execution?

- AAverage letter count of words in the dataset
- BSum of words that contain at least two vowels
- CAverage letter count of words containing at least two vowels in the dataset
- DAverage letter count of words containing at most two vowels in the dataset
- Q18MCQ3 Marks·Choose one option
Consider the "Scores" dataset. What will C represent at the end of the execution?

- ASum of Total marks of students whose Physics marks are less than the average Physics marks
- BSum of Total marks of students whose Physics marks are more than the average Physics marks
- CSum of Physics marks of students whose Physics marks are more than the average Physics marks
- DSum of Physics marks of students whose Physics marks are less than the average Physics marks
- Q19MCQ3 Marks·Choose one option
The following pseudocode is executed using the “Words” dataset. What will A represent at the end of the execution?

- ANumber of words with at most two vowels
- BNumber of words with at least three vowels
- CNumber of words with at least two vowels
- DNumber of words with exactly two vowels
- Q20MSQ4 Marks·Choose all correct options
Consider the Player dataset given below that keeps track of the runs scored by each player in the test matches held.


- AGoldStriker
- BSilverStriker
- CBronzeStriker
- DSilverStriker and BronzeStriker
- Q21MSQ4 Marks·Choose all correct options
The following pseudocode is executed using the “Scores” dataset. At the end of the execution, A captures the lowest Chemistry marks scored by a male student from Vellore. Choose the correct code fragment(s) to complete the pseudocode. It is a Multiple Select Question.

- A

- B

- C

- D

- A
- Q22MSQ4 Marks·Choose all correct options
The following pseudocode is executed using the “Olympics” dataset. At the end of the execution, A stores the number of players who are either female from India or have won the match hosted by Australia in the year 2006 or both. But the pseudocode may have mistakes. Identify all such mistakes (if any). Assume that all statements not listed in the options below are free of errors. It is a Multiple Select Question .

- ALine 1: Incorrect initialization of A
- BLine 5: Condition to update C is incorrect
- CLine 8: Condition to update D is incorrect
- DNo error in the code
- Q23MSQ5 Marks·Choose all correct options

- A

- B

- C

- D

- A
- Q24NAT4 Marks·Write the number
Your answer: - Q25NAT3 Marks·Write the number
Let the value of X be "aeroplane". What is the value of A at the end of the execution of the pseudocode ?
Your answer: Read the passage below, then answer Q26–Q27

Based on the above data, answer the given subquestions.
Q26MCQ3 Marks·Choose one optionLet unit be the number of units consumed by the consumer and cost be the amount of the bill to be paid. Choose the correct implementation to compute the cost.
- A

- B

- C

- D

- A
- Q27MCQ3 Marks·Choose one option


- A

- B

- C

- D

- A
- Q28MSQ5 Marks·Choose all correct options
The following pseudocode is executed using the "Scores" dataset. At the end of the execution, count captures the number of pairs of students who are of the same gender or are from the same city but not both. Choose the correct code fragment to complete the pseudocode. It is a Multiple Select Question.

- A

- B

- C

- D

- A
Official KeyMaster Answer Key & Explanations
Official answer keys from IIT Madras BS past papers. Click any question to review.
Reveal KeyCollapse Key
Master Answer Key & Explanations
Official answer keys from IIT Madras BS past papers. Click any question to review.
Detailed Answer Notes & Working
- Q1Answer: A
- a: 2 == 2 is True, so the 'or' is True. b: 2 > 3 is False, so the 'and' is False. c: 2 = 3 tries to assign a value to a number, so it is invalid. d: a number cannot be added to a string, so it is invalid. e: 2 < 3 is True. So a-2, b-3, c-1, d-1, e-2.
- Q2Answer: A
- countT counts books by Narayan and countG counts those books that are Fiction. The procedure returns True when countG / countT ≥ 10/100. So it returns True if at least 10 percent of Narayan's books are Fiction.
- Q3Answer: A
- The first if handles A as the largest, so Sum = B + C. The rest must be in an else: if B is the largest, Sum = A + C, otherwise C is the largest and Sum = A + B. Only option A does this. Without the else, option B overwrites Sum when A is the largest.
- Q4Answer: A
- For each word X, the inner loop moves every later copy of the same word to Table 3 and puts the other words back in Table 1. So Table 2 keeps only the first time each word appears. Removing the repeats gives: she sells seashells by the seashore shells are I'm sure.
- Q5Answer: A
- Lucknow: Saturday = 30 + 20 = 50 and Sunday = 50 + 50 = 100, so it returns Sunday. Chennai: Saturday = 20 + 30 = 50 and Sunday = 30 + 20 = 50. For a tie, countSun ≥ countSat is True, so it also returns Sunday.
- Q6Answer: B
- letter stores the last vowel seen, and A is True when the previous letter was a vowel. C becomes 1 when the current vowel is the same as the vowel just before it, that is, the same vowel occurs twice in a row. Count adds 1 for every word with C = 1, so it counts words where this happens at least once.
- Q7Answer: A, B, C
- To find a maximum, max must start with a value that is not above the real maximum. The Total of any card (random or top) works, because larger totals replace it later. A value below the minimum possible total also works. A value above the maximum is never replaced, so D is wrong.
- Q8Answer: A, B
- countOverall must count every student with Total ≥ 180. countPerSub must count those students who also have at least 60 in all three subjects. Options A and B do this; the order of the two statements does not matter. C and D update countOverall only for students who pass the subject check.
- Q9Answer: D
- Y is read but not moved, so it stays at the top of Table 1 and becomes X in the next round. So every pair of consecutive words is compared, including the last word. Table 2 does not need to be restored to get count, so the pseudocode is correct (assuming countSomething adds 1 to i in its loop).
- Q10Answer: C
- findItem should return the highest price on the card. Line 16 updates maxPrice when maxPrice ≥ Z.Price, which keeps the smaller value. It should be maxPrice < Z.Price. The other lines are correct: findItem is called only for Big Bazaar cards, and Line 6 keeps the larger value in A.
- Q11Answer: A
- i is 0 at the start and becomes 0 again after every full stop. So only the first word of each sentence goes to Table 2. The sentences start with IIT, Anyone, There, There, The, Learners and The. So Table 2 has these seven words.
- Q13Answer: A
- A keeps the smallest year seen. When a smaller year comes, the old A moves to B, and B also takes any year between A and B. So A is the year of the first book and B is the year of the second book of that author. doSomething returns B − A, the gap between the first and second book of the same author.
- Q14Answer: A
- Each round puts all books of one author in Table 2, and Diff is the gap between that author's first and second book. If Diff is larger than max, max is updated and Count is reset to 1. If Diff equals max, Count goes up. So Count is the number of authors with the maximum gap between the first and second book.
- Q15Answer: C
- flag becomes True if the word is an adjective, and also if LetterCount ≤ 2. count goes up when flag is True. So count is the number of words that are adjectives or have at most two letters or both.
- Q16Answer: D
- A first counts books that are not by Kalam and not in English. count is the total number of books. So A = count − A gives the books by Kalam or in English or both.
- Q17Answer: C
- vCount(X) > 1 means the word has at least two vowels. SumT adds the letter counts of these words and CountT counts them. So B = SumT / CountT is the average letter count of words with at least two vowels.
- Q18Answer: B
- DoSomething returns the average Physics marks and moves all rows to Table 2. The loop then adds X.Total to C for each student whose Physics marks are more than this average. So C is the sum of Total marks of students with Physics above the average.
- Q19Answer: B
- The inner loop counts the vowels of each word in B. A goes up only when B > 2, that is, when the word has at least three vowels.
- Q20Answer: A
- All three scores (167, 180, 180) are above 75, so maxMatch is called. Trial > TestSeries is False (167 < 180), so we go to the else part. TestSeries > WorldCup is False (180 = 180), so it returns WorldCup and A goes up. So the player joins GoldStriker.
- Q21Answer: B, D
- A starts at 101, above any possible mark, so we must keep the smaller value: X.Chemistry < A. The student must be male (Gender == 'M' or Gender != 'F') and from Vellore. Options B and D do this. Options A and C use >, so they cannot find the minimum.
- Q22Answer: B, C
- C should mean a female player from India, so Line 5 must check Gender == 'F' and Nationality == 'India'. D should mean the event in Australia in 2006, so Line 8 must check Year == 2006 and HostCountry == 'Australia'. The two lines mix up these conditions. Line 1 (A = 0) is correct.
- Q23Answer: A, D
- A Special pair has different words, different letter counts and the same number of vowels. Option A checks exactly these three conditions. Option D also works: with equal vowels, different consonant counts (LetterCount − vCount) means different letter counts. B needs the same word and C needs equal letter counts, so both are wrong.
- Q24Answer: 7
- The loop adds the last digit (n % 10) to s and then removes it (n // 10). So s is the sum of the digits of 1024: 1 + 0 + 2 + 4 = 7.
- Q25Answer: 32
- A starts at 1 and is doubled for every vowel in the word. 'aeroplane' has 5 vowels: a, e, o, a, e. So A = 2 × 2 × 2 × 2 × 2 = 32.
- Q26Answer: C
- Up to 50 units, cost = unit × 2. Above 50, the first 50 units cost 50 × 2 = 100 and only the extra units cost 3 each: 50 × 2 + (unit − 50) × 3. Check with 60 units: 100 + 30 = 130, as in the example. Option C does this.
- Q27Answer: D
- Statement I must put grade 4 users (Units > 550) in Table 5. For each pair in a grade table, we need the same area and a different year of registration. So Statement II is Y.YearOfRegistration != Z.YearOfRegistration and Y.Area == Z.Area, which is option D.
- Q28Answer: A, C
- We need pairs where exactly one of same gender and same city is True. Option A counts pairs with at least one match (or) and subtracts pairs with both (and), so it gives 1 only for exactly one. Option C checks (A and not B) or (not A and B) directly. B can return −1, and D counts pairs where both or neither match.