0% found this document useful (0 votes)
248 views62 pages

Computation Thinking PYQ Book 2024

CT for IIT Madras

Uploaded by

chaturvedianay06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
248 views62 pages

Computation Thinking PYQ Book 2024

CT for IIT Madras

Uploaded by

chaturvedianay06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 62
IIT MADRAS f BS DATA SCIENCE PREVIOUS YEAR QUESTIONS BANK FOR QUALIFIER 2024 Qualifier May Term 2023 1 The following pseudocode is executed using the "Words" dataset. What will count represent at the end of the execution? Marks: 3 satle(Table 1 has more rows)( Flag - False ead the first row x in Table 1 AF OK. Partofspeech == “Aayective”)( flag = True > {FOL Lettercount <= 2)( Flag - Troe ) AF(AAag > ove X to Table 2 , 1% Number of words which are adjectives and have at least two letters = Number of words which are either adjectives or have at most two letters bu NOt both ‘¥ Number of words which are adjectives or have at most two letters or both x Number of words which are not adjectives and have exactly two letters 2 The following pseudocode is executed using the “Library” dataset. What will A represent at the end of execution? Marks: 3 Awe count = 0 while(Table 1 has more rows) ( Read the first row X dn Table 1 count = count 1 AF(K.Author t= “Kalam” and XLanguage = “English”){ Anaad 8 > Move X to Table 2 ) A= count - A = Number of books written by author Kalam in English # Number of books not written by author Kalam in English ' Number of English books written by authors other than Kalam ¥ Number of books that are written by Kalam or in English or both 3 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? Marks: 3 1 SumT = @, CountT = 8, B= @ 2 while(Pile 1 has more cards){ 3 Read the top card X from Pile 1 4 if(vCount (x) > 1){ s SumT = SumT + X.LetterCount 6 CountT = CountT + 1 } 8 Move X to Pile 2 } 18 B = SumT / CountT Average letter count of words in the dataset Sum of words that contain at least two vowels ~ Average letter count of words containing at least two vowels in the dataset 1% Average letter count of words containing at most two vowels in the dataset 4 Consider the "Scores" dataset. What will C represent at the end of the execution? Marks: 3 c-e8 A = DoSomething(Table 1) while(Table 2 has morellnows){ 4 Read the first row X from Table 2 if(X.Physics >oa){ 6 C=C +X.Total 7 } Move Kito Table 1 11 Procedure DoSomething(Table 1) 2 sum = 13 n-@ 14 while(Table 2 has more rows){ 15 Read the first row X in Table 1 16 sum = cum + X.Physics 17 n=nti 1s Move X to Table 2 19 } avg = sum /n return (avg) 22 End DoSomething ‘& Sum of Total marks of students whose Physics marks are less than the average Physics marks Sum of Total marks of students whose Physics marks are more than the average Physics marks 1 Sum of Physics marks of students whose Physics marks are more than the average Physics marks Sum of Physics marks of students whose Physics marks are less than the average Physics marks 5 The following pseudocode is executed using the “Words” dataset. What will A represent at the end of the execution? Marks: 3 1 Ase 2 while(Table 1 has more rows){ Read the first row X in Table 1 i-1,5-0 while({ <= X.LetterCount){ Af(ith letter of X.Word is a vowel){ B-B+4 8 } fated 19 } n 4€(8 > 2) 12 AawAGd 1 } 1 Move X to Table 2 15 |} #® Number of words with at most two vowels Number of words with at least three vowels %® Number of words with at least two vowels x Number of words with exactly two vowels 6 Consider the Player dataset given bélow that keeps track of the runs scored by each player in the test matches held. Marks: 4 PlayeriD Name rit | TestSeries | Werdup 1 | vravatit67 | a6 108 2 MS Dhoni m7 184 1B 3 Harbhajan Singh 89 4 2 4 Gautam Gambhir 100 100 100 @wed4ai_com oe @wed4di inte i) | Qureshi med 2 | 9 The following pseudocode is executed using the "Player" dataset. A player can join a sports club if his runs are above 75 in Trial, Test Series and World Cup. The variables A, B and € store the number of players in GoldStriker, SliverStriker and BronzeStriker clubs respectively based on the execution of the pseudocode. L Ast bee coe 2 whdle(Toble 1 hes more rows); 3 Read the Fest row x in Table © QL Teal » 75 and xTestserdes > 75 and X.Worlécup > 75)( 5 snatch = mastatch(x) « Af(aatch ex “worécup”){ 7 Aeaed . 2 ° Af(oatch = “TestSerdes")( w Beer a 2 Af(aaten we “Tehal”){ a Caco “ ? s| a se testes qy Pay AE Procedure maatatch(2) 28 Af(@.Tedal > z-Testserdes){ » ‘Af (2.Trial > Z.WorléCup){ >< i cece") a ; rr a} dat reer) & Which club willbe allotted toa player if he gets 167, 180, 180 runs in Trial, TestSeries, and WorldCup respectively? Y GoldStriker sears % BronzeStriker & SilverStriker and BronzeStriker Marks: 4 7 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. 1 A= 101 2 while (Table 1 has more rows) { 3 Read the first row X in Table 1 4 eeeeeereeressonseeees 5 * Fill the code * 6 a 7 Move X to Table 2 8 |} 1 if (X.Gender |= “F* and X.CityTown == “vellore”){ 2 if (X.chemistry > a){ 3 A = X.Chemistry 4 } 5 |} * 1 if (X.Gender t= "F* and X.CityTown == “Veblore”){ 2 if (X.chemistry > A){ 3 A = X.Chemistry 4 } 5 |} = 1 |if(X.Gender t= “Rr){ 2 if (X.CityTown == "Vellore”){ 3 if(x. Chemistry < A){ 4 A= X.Chemistry 5 } 6 } 7 |} 7 1 Af(X.Gender <= 'M' and X.CityTown == “Vellore”){ 2 if (X.Chemistry > A){ 3 A = X.Chemistry 4 , 5 |} 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 . Marks: 4 Azo while(Table 2 has more rows){ Read the first row X in Table 1 C= false, D= False and X.HostCountry == "Australia){ C= True , AF(X.Year == 2006 and X.Nationslity == “Endia"){ 5 Af(x.Gender == ° D = True 10 ) u AF(C or Of 2 eked B , 14 Move X to Table 2 1s |} x Line 1: Incorrect initialization of A Line 5: Condition to update C is incorrect ~ Line 8: Condition to update D is incorrect ® No error in the code Two words are said to be Special if they full thé following condition: © They are different words © Number of letters are not same in both words © Number of vowels are same in both words The given pseudocode is executed using the "Words" dataset. Assume that vCount(X) retumns the number cf vowels in XWord. At the end ofthe exetttion, count stores the number of Special pairs. Choose the correct code fragment(s) to complete the pseudocode. It is a Multiple Select Question Marks: 5 1 count = @ 2 while(Table 1 has more rows){ 3 Read the first row X in Table 1 Move X to Table 2 5 while(Table 1 has more rows){ 6 Read the first row ¥ in Table 1 ? to aaseee 8 * Fill the code * 9 ot ir 18 Move Y to Table 3 i } 12 Move all rows from Table 3 to Table 1 B |} 1 Sf (X.Word t= Y.word){ if (X.Lettercount t= Y.Lettercount){ 3 SF (vCount(x) == vCount(¥)){ 4 count = count +1 5 } 6 } 7 \F v 1 | SF (X.Word <= ¥.Word){ 2 Lf(X.LetterCount f= Y.LetterCount){ 3 iF (vCount(x) == vCount(¥)){ 4 count = count +2 $ } d 7 |} * {F (Mord te ¥.tord){ $#(eCount (x) == weownt (v9 ){ S¥(L.Lettercount ~ yCount (X) =» Y.LeREERGount ~ waeunt(¥))¢ “ count = count +2 ) ) > * $f (K.mord te Y.word){ AF(wCoune(X) n= Count (¥) 6 A¥(L-LetterCount ~ YEount Oxpil= ¥-LetterCount = wCount(¥)) ‘ count = caine + 4 ? > ) ’ 10 Twowords are said to be Special if they fulfil the following conditions: © They are different words © Number of letters are not same in both words * Number of vowels are same in both words. The given pseudocode is executed using the “Words” dataset. Assume that vCount(X) returns the number cof vowels in XWord. Atthe end of the execution, count stores the number of Special pairs. Choose the correct code fragments) to complete the pseudocode. Itis a Multiple Select Question Marks: 5 Ee wesai @we4ai_com oe @we4ai 1 count = @ 2 while(Table 1 has more rows){ 3 Read the first row X in Table 1 4 Move K to Table 2 5 while(Table 1 has more rows){ 6 Read the first row Y in Table 1 7 seenene 8 * Fill the code * 9 eeenennnnen 10 Hove Y to Table 3 1 } 2 Move all rows from Table 3 to Table 1 2B |} 2 AF Mord I= ¥.Word){ AF(K.Lettercount != Y.Lettercount){ 3 Af(wCount(x) == vCount(¥))( 4 count = count +2 s ? ‘ ? 7 |} 1 |AF(X.Mord == ¥.Word){ 2 AF(K.LetterCount |= Y.Letterdsunt i 3 Af(Count(x) == vcoune(y)){ 4 count = countet I 5 } ‘ ? 7 |} 2 Af Qt Mord t= YaWord¥E Af(vcoune(H) == wcount £F(Lettercount ~ vCount(X) “+ Yatettercount - vCount(¥)){ ‘ ‘count * count +3 , s| 9 7 |r 2 (Af QGMord te Yond) { Sf (vCount(x) == count(r)){ Af (L-Lettercount ~ vCount(X) t= Y.tettercount - vCount(¥)){ count = count + 3 » 11. What would be the value of s at the end of the execution of the following pseudocode if the value of nis 1024? Marks: 4 The operator ‘if returns the quotient. For instance, 8/7 = 1 and 10 1/5=2 The operator ‘returns the remainder. For instance, 8% 7 = 1 and 10% 5 = 0. PaO, 500, = 1026 while(n > @){ renkie seser neni/ i 7 12 _ Let the value of X be "aeroplane". What is the value of A at the end of the execution of the pseudocode? Marks: 3 i<2 aed while(i <* X.LetterCount){ Af(ith letter of X is 9 vowel) ( Awan } deata 32 eral @wed4ai_com oe @wed4ai 13 Comprehension The SouthCo Electricity Board charges consumers according to the number of the units consumed by them per month, However, the amounts to be paid quarterly in advance as per the tariff: Units consumed Charges. up to 50 units €2/unit more than 50 units | €3/ unit For instance, suppose a consumer has consumed 30 units. He/she has to pay ®2 per unit, Le. 860. fa customer has consumed 60 units, he/she has to pay ® 2 per unit for the first 50 units and ® 3 per unit for the remaining units so the total amount is ® 100 + & 30 = 130 Based on the above data, answer the given subquestions. Let 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. Marks: 3 cost = @ if(unit <= 50){ cost = unit * 2 3 if(unit >» 5e){ cost = unit * 3 vawne o 1 cost =@ if(unit <= 5e){ coston unit * 2 awn } if(unit > Se){ cost = cost + ( unit - se) * 3 soo 1 cost = 0 if(unit <= 5e@){ cost = unit * 2 } if(unit > 5e){ cost = 5@* 2+ ( unit-se)*3 cost = @ if(unit <= 5e){ cost = unit * 2 - } 5 if(unit > 5e){ cost = 50 * 2+ unit * 3 No 14 TheSouthCo Electricity Board rates its consumers by the units consumed yeary 2 inthe Flow tion Marks: 3 Units (per annum) | Grade less than 200 1 200 to 350 2 351 t0 $50 3 >550 4 Consider the dataset of the SouthCo Blectriity Board given below. Consumer | FirstName | LastName | MeterRaenber Units | Aree YearOtRegtration somo! | Shon | fons | mine? | 456 | ing | 208 a a a ee a ee a sepreser2 Neha | Kashyap | 202203364] 199) PAG Townhat | 2023 The following pseudocode is executed) using the above dataset. At theend of the execution, A, B, C and D capture the number of pairs of users Who have scored the same grade, reside in the same area but have different YearOfRegistration. Choose the correct code fragment{s) to complete the pseudocode. Ee wesai @we4ai_com oe @we4ai ” 6 = 8,0 while(Table 1 has more rows){ onan Read the first row X in Table 2 sfQX-units < 200){ Move X to Table 2 > AfQLUnite >= 200 and X.Unite <= 350){ tove X to Table > } Af(K.Units >= 351 and X.units <= 55@){ Nove X to Table 4 ? Af(t4t* statement £ **°**){ Nove X to Table 5 > Findtateh(Table 2) Findnatch(Table 3) = Findtatch(Table 4) = Finanaten(Table 5) Procedure findMatch(Teble T1) t-e hile(Toble TA has more rows){ j head the first row ¥ in Table TL Move Y to Table 12 * while(Table Tl hes sore rows){ > Read the first row Z in Table Ta Move Z to Table T3 a#( ? ? Move all rows from Table 73 to Table Ti > return(e) End Fingnatch 1 1: Xunits > Sse 2 IL: Y.vestOthegiatration <= 2.YearofRegistration and Y.Ares |= Z.Area 1 2 1 2 4 2 Ts X.Units < $50 IT : V.YearofRegistration |= Z.vearofRegistration or Y.Area == Z.Area 1: X.units > 550 IT: Y.YearofRegistration |= 2.YearOfRegistration or Y.Area == 2.Area 1: X.Unite > 550 TI : Y.vearofRegistration = 2.Vesrofmegistration and Y-Area == Z.Area 15 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. count + @ wil } Procedure HingPair(t, ¥) le(Table 1 has sore rows){ fend the first row x in Table 2 ore X to Table 2 while(Table 1 has wore rows){ Read the Fleet row ¥ An Table Hove ¥ to Table 3 count * count + findPair(x, ¥) d More all rows from Teble 3 to Table 1 2 3 2 A=0,8=0 Af(X.Gender == Y.Gender or X.TownCity == Y¥.TownCity){ AwAGl } Af(X.Gender == ¥.Gender end K.TownCity, == Y.TownCity){ B-B+2 } return(A-8) Aze,8= Af (X.Gender ==\y. Gender! and x.Towncity == Y.Towncity){ An Ae , Af(X.Gendetiins ¥,Gender or X.Towncity == Y.Towncity){ exeer , return(A-B) A= False, 8 Af(X. Gender A= True Fell Y.Gender)( ? Af(K.TownCity == Y.Towncity)( 8 = True ? LF((A and not 8) or (not A and B)){ return(1) ? return(@) Marks: 5 A= False, 8 = False if(X.Gender == Y.Gender){ A= True t if(X.TownCity == Y.Towncity){ 8 = True , 8 4f((A or not B) and (not A or B)){ . return(1) } return(@) x 16 The following pseudocode is executed using the “Library” dataset. What will A represent at the end of execution? Marks: 3 A-0 count = @ while(Table 1 has more rows)( Read the first row X in Table 1 count = count + 1 if(K.Author |= “Shakespeare” and X. Language tm “French”){ AwAed ) Move X to Table 2 , A count - 4 ‘x Number of books written by author Shakespeare in French ‘¥ Number of books that are written by Shakespeare or in French or both x Number of French books written by authors other than Shakespeare Number of books notiwritten by author Shakespeare in French 17 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? Marks: 3 Suet «0, Countt = 0, 8 = 0 hile(Pile 1 has more cards)( Read the top card X from Pile 1 £F(vcoune(H) <= 3){ Suet = SuaT + X.Letcercount Count = Count + 2 , nove x to pile 2 ) 8 = suet / count Eves @wed4ai_com oe @wed4di 18 Average letter count of words in the dataset % Sum of words that contain at least three vowels 1 Average letter count of words containing at least three vowels in the dataset Y Average letter count of words containing at most three vowels in the dataset Consider the Player dataset given below that keeps track of the runs scored by each player in the test matches held, Marks: 4 Player Name TWisl | TestSeres | WerldCup 1 Weat Kai 17 | 185 104 2 (MS Dhont 7 | 198 Vw 3 Hthoansngh | || 4 Goxam Gambhir 100 | 100 100 |. $8 Queshishmed 218 7 10 alan wo | 1 0 The following pseudocode is executed using the “Playes* dataset. A player can join a sports cub fis runs are above 75 in Tria), Test Series and World Cup. The varales A,B and € store the number of players in Golder, lveStriker and BronzeStriker cud spectively Based onthe execution ofthe pseudocode. 1 Ane, @C-e 2. while(Table 1 has nore rows){ 3 Read the first row X in Table 1 4 F(X. Trial > 75 and X.TestSeries 75 and X.worldCup > 75){ 5 match = maxtatch(X) {Fateh = “Woes ? rears : ) 5 ‘(natn “Tester ){ 1 0.0 au ) 2 Af(match = “Trial"){ 2 c-cea “ ) |} 16 Move XK to Table 2 vu) 18 Procedure maxkatch(2) 19 ¢(2.Trda > Z.TestSertes)( ry Af(2.Trial > Z.Worlétup){ 4 retuen(*Trtal") 2 ) a eset u retuen("worlécup") 2% ) 19 fess ) else( AF(Z.Testseries > Z.WorléCup) { return(“TestSeries”) } else( return(“worldcup") d ) End maxtatch Which club will be allotted to a player if he gets 120, 118, 113 runs in Trial, TestSeries, and WorldCup respectively? = GoldStriker & SilverStriker ~ BronzeStriker & SilverStriker and BronzeStriker What would be the value of s at the end of the execution of the following pseudocode if the value of n is 2048? The operator ‘//" returns the quotient. For instance, 81/7 = 1 and 10//5=2 The operator '% returns the remainder. For instance, 8 % 7= 1 and 10% 5=0. = 8, 528, n= 2008 while(n > @){ renkie seser nen// 38 14 @wed4ai_com Marks: 4 20 Let the value of X be "umbrella". What is the value of A at the end of the execution of the pseudocode? Marks: 3 t-a Aaa while( <= X.Lettercount){ {F(1th letter of X 4s 2 vowel) ( Asa > Redes 21 The SouthCo Electricity Board charges consumers according to the number of the units consumed by them per month. However,the amount is to be paid quarterly in advance as per the tariff : Units consumed Charges Marks: 3 up to 100 units ©3/unit more than 100 units | &5/unit aa For instance, suppose a consumer has consumed 60 units. He/she has to pay ® 3 per unit, i.e. 180. If a customer has consumed 160 units, he/she has to pay & 3 per unit for the first 10Qunits and @ S per unit for the remaining units so the total amount is € 300 + @ 300 = € 600 Let 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. 1 cost = @ 2 if(unit <= 108){ 3 cost = unit * 3 a |} if(unit > 100){ cost = unit * 5 @wedai_com oe @wed4ai inten cost = 6 if(unit <= 16¢){ 3 cost = unit * 3 , if(unit > 108){ * cost = cost + ( unit - 100) * 5 } 1 cost =@ if(unit <= 108){ cost = unit * 3 } if(unit > 100){ cost = 100 * 3 + ( unit - 100) *5 } v 1 cost =@ if(unit <= 10@){ cost = unit * 3 4 |} if(unit > 106){ cost = 108 ;* 3 + unit * S } * @wed4ai_com Qualifier Jan Term 2023 1 _LetXand ¥ be two rows in the "Words" dataset. Select the most appropriate datatype for each iter/expression in the left column, haarker2 Field Data Type a.X.Word ==Y.Word 1, String b.X.Word =="a" 2. Invalid c.XPartOfSpeech 3, Boolean d. X.LetterCount 4, Integer W a-(3), b-(3),-(1),d-(4) * a-(1),b-(3), c-(4),d-(3) ® a - (3), b - (2), c- (1), d-(4) ® a-(1), b-(2), c-(3),d-(4) 2 The following pseudocode is executed using the "Words" dataset. What will count represent at the end of the execution? Marks: 2 1 count = 0 while(Table 1 has more rows) { flag = False 4 Read the first row x in Table 2 1f(x.partofspeech == “Noun”){ flag = True } if(x.Lettercount >= 4){ 2 flag = True 1 } u if (flag) count = count +1 } move x to Table 2 ® Number of words which are nouns and have at least four letters ® Number of words which are either nouns or have at least four letters but not both ‘¥ Number of words which are either nouns or have at least four letters or both * Number of words which are not nouns and have at most three letters The following pseudocode is executed using the "Scores" dataset. What will count2 represent at the end of the execution? Marks: 3 count = 0, count2 = 0 while(Table 1 has more rows){ read the first row x in Table 1 SF (x.Gender == 'F’ or X.Mathematics > x.Physics)f) countl = countl + 1 1 3 4 5 6 } 7 elset 8 count2 = count? + 1 9 } 10 Move X to Table 2 u|} Number of male students whose Physi¢s marks are greater than Mathematics marks .¥ Number of male students whose Physics marks are greater than or equal to mathematics marks ® Number of female students whose Physics marks are greater than or equal to Mathematics marks * Number of female students whose Physics marks are less than or equal to Mathematics marks The following pseudocode is executed using the “Library” dataset. Procedure biGenre(A) returns Marks: 3 True ifthe author A has written equal number of fictional and non-fictional books. Choose the correct code fragment tp complete the pseudocode. Assume that the dataset has only two possible geners. 1 procedure bicenre(a) count = 0 3 whiTeCrable 1 has more rows){ ‘ ‘ead the first row x in Table 2 5 Move x to Table 2 1D ff {count = 0){ u recurn(true) 2) } 12 return(eatse) Lend bisenre 1 | if (x.author == a){ 2 if(x.Genre == "Fiction"){ 3 count = count +2 4 + 5 else{ 6 count = count - 1 7 } 8\} 1 if(x.author == a){ 2 if(x.Genre == “Fiction"){ 3 count = 1 4 } 5 else{ 6 count = - 1 7 } 8\} 1 if(x.author == A){ 2 count = count +1 3/3} 4 if(*.Genre == “Biction"){ 5 count = count + 1 6|} 7 | else{ 8 count = count - 1 9|} 1 | if(x.author == a){ 2 if (x.Genre == "Fiction"){ 3 return(True) 4 } 5 else{ 6 return(False) 7 } 8|} 5 The following pseudocode is executed using the "Olympics" dataset. What will count represent at the end of the execution? Assume that every player has a distinct name. Marks: 3 1 | count = 0 while(Table 1 has more rows){ Read the first row x in Table 1 4 Move X to Table 2 flag = False while(rable 1 has more rous){ Read the first row Y in Table 1 if (x.Name == Y.Name){ 9 if ((X.Sport == Y.Sport) and (X.medal != v,Medal)){ u flag = True } Move Y to Table 2 # 4 else{ 1 Move Y to Table 3 6 x } if(flag)f count = count + 1 } 2 Move all rows from Table 3 to Table 1 ¥ Number of players who have won different medals in the same sport * Number of players who have won the same medal in different sports *® Number of pairs of players who have won different medals in the same sport ® Number of pairs of players who have won the same medal in different sports @wed4ai_com oe @wed4di Fives The following pseudocode is executed using the "Library" dataset. Assume there are m books with distinct names that are written by n authors and each book is written by only one author. Assume that every author has a distinct name. Marks: 4 1 countl = 0, count2 = 0 while(Table 1 has more rows){ 3 Read the first row x in Table 1 Move X to Table 2 5 count = count + 1 6 while(Table 1 has more rows){ Read the first row Y in Table 1 8 if(x.author == y. author) { 9 count2 = count2 +1 10 Move ¥ to Table 2 uu ) v else{ 1 Move Y to Table 3 uu } 15 } 16 Move all rows from Table 3 to\Table 1 At the end of the execution of the above pseudocode, choose the correct option(s). itis a Mulkiple Select Question (MSQ). .¥ countt = n. - ® count =m -¥ count2=m-n - ® count2=m+n @wed4ai_com oe @wed4di Fives 7 The following pseudocode is executed using the “Scores” dataset. At the end of the execution, A captures the number of students who are either male from Bengaluru or have scored lower marks in Physics than the average Physics marks. Assume that the variable Avg holds the value of the average Physics marks. 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. Marks: 4 It is a Multiple Select Question (MSQ). Llano while(Table 1 has more rows){ 3 Read the first row x in Table 1 : = False, D = False ; if(x.Gender == 'M' or X.Towncity == “sengaluru”){ 6 C= True ? } 8 if (x.Physies < Avg){ 9 0 = True 10 } u 4#(C and Df 2 AwAed B } 4 Move X to Table 2 $|2 * Line 1: Incorrect initialization of A ¥ Line 5: Condition to Update C is incorrect ¥ Line 11: Condition to update A is incorrect ® No error in the code @wed4ai_com oe @wed4di Ee wesai 8 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. Itis a Multiple Select Question (MSQ). Marks: 5 count = 0 while(Table 1 has more rows){ Read the first row x in Table 1 4 Move X to Table 2 5 while(Table 1 has more rons){ 6 Read the first row y in Table 1 Move Y to Table 3 8 count = count + findPair(x, Y) 9 } 10 Move a1] rows from Table 3 to Table 1 u)} 12 Procedure findpair(x, ¥) iT] the code 16 End findpair 1|A=0,8=0 2 if (X.Gender == y.cender or X.Towncity == Y.TownCity){ 3 AwAe.1 4|} 5 if (X.Gender == ¥.Gender and x.Towncity == Y.Towncity){ 6 B-8 +2 T|} 8 return(a-8) 1|/A=0,68=0 2 if (X.Gender == Y.Gender and x.Towncity == Y.Towncity){ 3 AwAt. ai} 5 if(x.Gender == y.Gender or x.Towncity == Y.Towncity){ 6 B=B4+1 7} 8 return(A-B) weet @wed4ai_com oe @wed4ai eevaneune 10 a2 A= False, 6 = False if(x.Gender == y.Gender){ A= True } If (X.Towncity == Y¥.Towncity){ B= True } if((A and not B) or (not A and 8)){ return(1) } return(0) A= False, B = False if (x.Gender == Y.Gender){ A= True } 1f(%.Towncity == ¥.Towncity){ 8 = True } if((A or not 8) and (not A or 8)){ return(1) } returnco) ‘Twowords are said to be conjugate if they fulfil following conditions: Marks: 5 © They are different words © Number of vowels are same in both words ‘* Number of consonants are same in Both words For a row X in the "Words" dataset, assume that vCount(X) return the number of vowels in XWord. At the end of the @xecutlon, count stores the number of conjugate pairs. Choose the correct code fragmentis) to Complete the pseudocode. tis a Multiple Select Question (MSQ). 1 3 4 5 6 count = 0 while(Table 1 has more rows) { Read the first row x in Table 1 Move X to Table 2 whileCTable 1 has more rows){ Read the first row ¥ in Table 1 * FANT the code * Move ¥ to Table 3 Move all rows from Table 3 to Table 1 1 if(.word != y.word){ if(x.Lettercount == Y.Lettercount){ if (vcount(x) == vcount(y)){ count = count + 1 5 } € } 7\} v 1 if(x.word == y.word){ if(X.Lettercount == Y.Lettercount){ if(vcount(x) == vcount(y)){ count = count + 1 } 6 } s } L | if(x.word != ¥.word){ iF(vcount(x) == veount(¥)){ iF (X.Lettercount ~ vcount(x), == Y.Lettercount - vcount(y)){ 4 count = count + 1 } } vo ty 1 if(x.word ==\y.word){ 2 exitloop: 3 |} 4 else{ if(X.Lettercount == y.Lettercount) { é if(vcount(x) == vCount(y)){ count = count + 1 8 } 9 3 = 10\} @wed4ai_com oe @wed4ai Fives 10 The following pseudocode is executed using a dataset similar to the "Words" dataset, based on the folloning paragraph. “This snot what! selected yesterday. There was a design on the left pocket. The color is also different. | clearly remember that the color which | had chosen was sightly dark. | can not believe that the shopkeeper has sent mea different product." Marks: 4 1 count = 0, flag = True 2 while(rable 1 has more rows){ 3 Read the first row x in Table 1 4 Nove X to Table 2 5 if(flag){ 6 ‘if(ast letter of x.word == ‘t'){ 7 ‘if (2nd letter of x.word == ‘h'){ 8 count = count + 1 9 } 10 } u } 2 flag = False B if(x.word ends with Full stop){ “4 flag = True 15 } as} What would be the value of count at the end of the execution of the above pseudocode? Assume that upper case and lower case are ignored during comparison of letters. 3s 11. Whatwould be the value of result at the end of the execution of the following pseudocode if the value of nis 7? Marks: 4 1 iel 2 resulth = 1, result2 = 2, result = 1 3 while( < a)f 4 result = resulta" s result2 = resultz*i*(i + 1) 6 aie? A 9 result = result2/resultl 12 the following pseudocode is executed using the “Words” dataset. Marks: 4 1 Procedure dosonething(Table TL, Table 72) 2 count = 0 while(Table TL has wore rows) { 4 Read the First row Y from Table TL 5 Read the first row Z from Table 72 6 if(y.word == Z.word){ count = count + 1 } elsef 10 return(count) n + Move the row Y to Table T11 Move the row Z to Table T22 1 return(count) 16 End dosomething Let there be two datasets stored in Table 1 and Table 2 corresponding to the following sentences Table 1: “ifyou are honest with your work, the money is just a compliment” Table 2: “ifyou are honest with your work, the progress is just a compliment” What will doSomething(Table 1, Table 2) return? Assume that upper case and lower case are ignored during comparison of words. 8 @wed4ai_com oe @wed4di Fives 13 14 The following pseudocode is executed using the “Scores” dataset. Let variables F, M, F250, and M250 represent the followings: © F=Number of female students in the dataset * M=Number of male students in the dataset © F250 = Number of female students with total marks greater than 250 * M250 = Number of male students with total marks greater than 250 A=0,8=0 while(Table 1 has more rows){ Read the first row x from Table 1 flag = False if(x.Gender == 'F*){ € if(x.Total > 250){ 7 flag = True 8 } 9 7 10 if(not flag){ 11 AazA+1 12 if(x.Total > 250){ 13 B=B+1 14 } 15 i 16 Move X to Table 2 17 |} Based on the above data, answer the given subquestions. What will be the value of A at the end of the execution? Marks: 3 ® F+F250 * F250 7 M+ (F-F250) ® M+ F250 What will be the value of B at the end of the execution? eM Marks: 4 ® F-F250 ~ m2s0 ® M+(F-F250) Qualifier Sep Term 2023 1 Match the following expressions on the left side with the appropriate values on the right side a 2 1. Invalid expression b 2 2 Tre «2 3. Fake d 2 a4 e 2 8 oP Marks: 2 w 2- (2), b- (3), e- (1), d- (1), e- (2) » - (2), b- (3), e- (1), d- ( 2) 2) x a- (2), b~ (3), - (1), d- (4), e- (2) » a-(1), b- (3), c- (2), d- (1), e- (1) 2 The given procedure ts executed using the “Library” dataset (Table 1). Marks: 3. Procedure selected (auth, gen, num) count T 0, countG = 0 while (Table 1 has more rows) { Read the first row X from Table 1 if (X.Author == auth) { countT = countT if (X.Genre == gen) { countG = countG +1 } ) Move Xto Tablle 2 } if (countG / countT > num / 100) { return(True) } return( False) End selected selected ( “Narayan”, “Fiction”, 10) will return True if @we4ai_com ao @wed4ai fi We4Al wv At least 10 percent of the books written b y Narayan are in the genre Fiction. » At most 10 percent of the books written by Narayan are in the genre Fiction, a At least 10 books written by Narayan are in the genre Fiction. At most 10 books written by Narayan are in the genre Fiction. miniSum accepts three nambers as parameters and returns the sum of two least parameters. (Choose the correct code fragment to complete the procedure, Marks: 4 Procedure miniSum(A, B, C) Sum = 0 if (A > Cand A > B) ( Sum =B+C return (Sum) End miniSum else { if (B > C and B > A) { Sum =A+C } else { Sum =A +B } wt if (B > Cand B> A) { Sum =A+C } else { Sum =A+B a Ee wesai cbse { Sum =A+B } else { if (C > Band B > A) { Sum =A+C , else { Sum = A+B } if(C > Band B > A) { Sum =A+C } @we4ai_com oe @we4ai 4 The given pseudocode is executed using a dataset having the same fields as the “Words” dataset, and contains the following words - Marks: 4 “she sells seashells by the seashore the shells she sells are seashells I'm sure.” while (Table 1 has mote rows) { Read the first row X from Table 1 Move X to Table 2 while (Table 1 has more roms) { Read the first row Y from Table 1 if (X.Word == Y. Word) { More ¥ to Table 3 } cbse { Move Y to Table 4 ) } ‘Move all rows from Table 4 to Table 1 ) ‘Choose the correct paragraph created from the Table 2 at the end of execution of above pseudocode. @ “she sells seashells by the seashore shells are I'm sure.” i» ‘she sells seashells by the seashore the shells sells are seashells I'm sure.” ® “sells seashells by the seashore the shells she sells are seashells I'm sure.” « “by seashore the shells she sells are seashells I'm sure.” A company has collected some data (stored in Table 1) for promotion of their products. Every row in the table has information about the number of pcople willing to attend the promotion on ‘Saturday and Sunday, respectively. in a given city. For example take the first row. According to Fantabook, 20 anid 90 people are willing to attend the promotion on Saturday and Sunday, respectively, in Chennai. ‘The pseudocode below is used to process the data in this table, Procedure bestDay (2) countSat = 0, countSun = 0 while (Table 1 has more rows) { Read the first row X from Table 1 if (X.City == Z) { Which of the following is correct? vy bestDay (“Lucknow”) = “Sunday”, bestDay (“Chennal") = “Sunday” x bestDay (“Lucknow”) = “Saturday” , bestDay (“Chennai”) = “Sunday” x bestDay (“Lucknow”) = “Sunday”, bestDay (“Chennai”) = “Saturday” i bestDay (“Lucknow”) = “Saturday” , bestDay (“Chennai”) = “Saturday” ‘The following pseudocode is exeeuted using the “Words” dataset. Count =0 ‘while (Table 1 has more rows) { Read the first row X in Table 1 im 1, A= Fale while (I< X.LetterCount) { Af (etter of X. Word ts a vowel) { Af (A and lettor letter of X.Word){ C=1 d lottor = 1% letter of X.Wont A= True ) se ( A-Falso } fait : #(C==1f Count = Count +1 I What will Count represent at the end of execution? ® Number of words in which the same vowel occurs consecutively exactly once ‘¥ Number of words in which the same vowel occurs consecutively at least once ® Number of words in which the same vowel occurs consecutively exactly twice ® Number of words in which the same vowel occurs consecutively at least twice ‘Swara has used a variable max to find the maximum total score using “Scores” dataset. There are many ways to initialize max, choose the correct option(s). [t is a Multiple Select Question (MSQ). wv Pick any random card X from the dataset and max = X. Total wv Pick the top card X from the dataset and max = X. Total. g Initialize max with any value less than the possible minimum total score y Initialize max with any value greater than the possible maximum total score ‘The given pseudocode is executed using the “Scores” dataset. There is a hypothesis that if a student performs well overall (Le., scores at least total 180 marks), then he/she must have performed well in all the subjects (Le., scored at Jeast 60 marks in each subject), At the end of execution, fracTrue stores the fraction of students who satisfy this hypothesis. Choose the correct code fragment(s). It is a Multiple Select Question (MSQ). countOverall = 0, countPerSub = 0 while (Table 1 has more rows) { Read the first row X in Tabled if (X. Total > 180) { fracTrue = countPerSub / countOverall countOverall = countOverall + 1 if (X.Physies > 60 and X.Chemistry > 60 and X.Mathematics > 60) { countPerSub = countPerSub + 1 v) if (X.Physics > 60 and X. Chemistry > 60 and X.Mathematics > 60) { countPerSub = countPerSub + 1 } ¥ countOverall = countOverall + 1 Mf (X. Physics > 60 and X. Chemistry > 60 and X.Mathematics > 60) { countOverall = countOverall + 1 countPerSub = countPerSub + 1 } if (X. Physies > 60 and X. Chemistry > 60 and X. Mathematics > 60) ( ‘countOverall = countOverall + 1 ) g countPerSub = countPerSub + 1 ‘The following pseudocode is executed using the “Words” dataset. At the end of execution, ‘count stores the number of pairs of consecutive words which have equal number of vowels? Choose the correct option(s). It is a Multiple Select Question (MSQ). count = 0 while (Table 1 has at least two rows) { Read the first row X from Table 1 countVx = countSomething(X) Move X to Table 2 Read the first row Y from Table 1 count Vy = countSomething(Y) if (countVx == countVy) { count = count +1 } } Procedure countSomething(Z) f= A=0 while (i < Z.LetterCount) { if (@” letter of Z. Word is vowel) { A=A+1 } } return (A) End ‘The above pseudocode will not provide the correct result because Table 2 must be restored ® to Table 1. ‘The above pseudocode will not provide the correct result because card Y is not being ‘# moved to anywhere, ‘The above pseudocode will not provide the correct result because the last word is not ie being compared. iy The above pseudocode will provide the correct result. ‘The following pseudocode is executed using the “Shopping Bills” dataset. At the end of execution, A captures the highest “Price” of an item purchased from “Big Bazaar”. But the pseudocode may have mistakes in one or more lines. Mentify all such lines (ifany), Assume that all statements not listed in the options below are free of errors. It is 8 Multiple Select ‘Question (MSQ). A=0 ‘hile (Pile 1 has more cards) { Read the top card X tn Pile 1 if (X.ShopName == “Big Bazaar”) { temp = findltem(X) if (temp > A) { A= temp ) } Move X to Pile 2 } Procedure findltem (Y) maxPrice = 0 while (Card Y has more items) { Read an item 2 from Stembat of card Y if (maxPrice > ZPrice ){ ‘maxPrice = Z.Price } Remove Z from ftemList of card Y } return (maxPrice) End findltem Line 5: Misplaced calling of procedure findItem x Line 6: Incorrect conditional statement w Line 16: Incorrect conditional statement x There must be a re-initialization of maxPrice before the return statement x No error ‘The given pseudocode is executed using a dataset having the same fields ‘as the “Words” dataset, and contains the following words - “IT Madras has launched the world’s first ever online degree and diploma courses in programming and data science. Anyone who his passed class 12 examination can enrol in the online course. There are three levels in the online degree program. There are total of 31 course. The completion time is between three to six years. Learners will have to complete the online courses and assignments, quizzes and exams to gain 116 credits. The online application process for next batch is open now.” Assume that while moving the rows from one table to,other, the rows are always arranged in the increasing order of sequence number from top to bottom, count = 0,i1=0 while (Table 1 has more rows) { Read the first row X from Table 1 if (i == 0){ Move X to Table 2 i=l } else { Move X to Table 3 } if (X.Word ends with full stop) { i=o0 } Choose the set of correct words in Table 2. wv IIT, Anyone, There, There, The, Learners, The x» IIT, Anyone, There, The, Learners x science, course, program, course, years, credits, now x science, course, program, years, credits, now Consider the Table 2 created from the previous question. At the end of execution, what will the value of countMax and occurMax be? countMax = 0, occurMax = “None” while (Table 2 has more rows) { count = 0 Read the first row Y from Table 2 Move Y to Table 4 while (Table 2 has more rows) { Read the first row Z from Table 2 if (Y. Word == Z. Wond) { count = count + 1 Move Z to Table 4 Move Z to Table 5 } } Move all the tows from Table 5 to Table 2 if (count > countMax) { countMax = count occurMax = Y.Word » countMax = 1, occurMax = “The” wv countMax = 2, occurMax = “The” * countMax = 1, occurMax = “There” » countMax = 2, occurMax = “There” ‘The following pseudocode is executed using the “Library” dataset, Assume that an author publishes at least two books, and only one in a year. Count = 0, max = 0 while (Table 1 has more rows) ( Read the first row X from Table 1 Move the row X to Table 2 while (Table 1 has more rows) { Read the first row Y from Table 1 Mf (X. Author == Y.Author) { Move the row ¥ to Table 2 } else { Move the row Y to Table 3 ) } Diff = doSomething(Table 2) if (Diff == max) { Count = Count + 1 , if (Dit > max){ max = Count =1 } Delete all the rows from Table 2 Move all the rows from Table 3 to Table 1 > Procedure doSomething (Table 2) A = 2050, B = 2050 while (Table 2 has more rows) { Read the first row Z from Table 2 Mf (Z. Year < A) { B=A A= Z.Year } Mf (Z. Year > A and Z. Year < B) { B=ZYear } More the row Z to Table 4 , return((B - A)) End doSomething Based on the above data, answer the given subquestion. ‘What will procedure doSomething return? Difference between year of publication of first v and second book of the same author Difference hetween year of publication of first ® and second book of the different author Difference between year of publication of latest and second latest book of the same ® author Difference hetween year of publication of latest. and second latest book of the different author What will Count represent at the end of execution? Number of authors with maximum gap between ‘¥ year of publication of first and second book Number of authors with minimum gap between ‘® year of publication of first and second book Number of authors with maximum gap between year of publication of latest and second ‘& latest book Number of anthors with minimum gap between year of publication of latest and second w latest book Qualifier Jan Term 2024 The following pseudocode is executed using the “Library” dataset. What will B represent at the end of execution? aso count = 0 wh{leCrable 1 has more rows){ fread the first row x in Table 2 count = count + 1 $fCx.author {= “Kalan” and X.tanguage ‘= “Engl ish") { Aeael d wove x to Table? B= count - % Number of books written by author Kalam in English % Number of books not written by author Kalam in English * Number of English books written by authors other than Kalam ‘¥ Number of books that are written by author Kalam or in English or both The following pseudocode is executed using the "Scores" dataset. At the end of the execution of below pseudocode, if count2 represents the number of male students whose Physics marks are less than or equal to Mathematics marks, then select the correct code fragment for A and B. count = 0, count? = 0 while(Table 1 has more rows) { Read the first tow X in Table 1 count = count + ) elset 8 count2 = count2 + 1 } Move x to Table 2 A: X.Gender == "F" # B: x.mathematics > x.physics A: X.Gender == "M" we B: X.Mathematics < x.Physics A:x.Gender == ‘F* w 8: X.mathematics < x.Physics A: X.Gender == "mM" yw B: x.mathematics > x.Physics The following pseudocode is executed using the “Scores" dataset. What will A represent at the end of the execution? 1 Aso while(Pile 1 has more cards){ Read the top card x from pile 1 A= A+ istnseq(x) move x to Pile 2 Procedure isinseq(x) ‘if (x.mathematics > x.Physics){ 10 if (x.Physies < x.chemistry){ ni return(1) 12 } B } “ return(o) 15 End isinseq * Number of students with highest marks in Mathematics among the three subjects ® Number of students with highest marks in Mathematics and lowest marks in Physics ® Number of students with highest marks in Chemistry among the three Subjects ‘¥ Number of students with lowest marks in Physics among the three subjects The following pseudocode is executed using the “Words” dataset. 1 count = 0 2 while(Table 1 has more rows){ 3 Read the first row x in Table 1 ‘4 Move X to Table 2 f= 1, A= False, 6 = False 6 whileCi < x.Lettercount){ if (ith letter of x.word 1s a vowel){ 8 AFCA 9 B= True u , u A= True L } B elsef u A» False 1 , 16 fefen 1 } s SFB) » count = count + 1 2 } au} What will count represent at the end of execution? ‘¥ Number of words with at least one pair of vowels occurring consecutively ® Number of words with at most two pairs of vowels occurring consecutively ® Number of words with at least two pairs of the same vowel occurring consecutively ® Number of words with at most two pairs of the same vowel occurring consecutively The following pseudocode is executed using the "Words" table. At the end of the execution, count ‘stores the number of pairs of nouns such that both nouns have either the same letter count or both end with a full stop. Choose the correct code fragment to complete the pseudocode. count = 0 » whfle(Table 1 has wore rows){ ead the First row x fn Table 1 nove x to Table 2 $f 0x.partofspaech = “roun”){ wo{TeCTable 1 has wore rows) ( ead the first row Y in Table ‘ vove ¥ to Table 3 ’ if (er*statement 1°**){ 0 ‘sf Ce*rstatenent. 2°**){ u count = count + 1 u ) B eset u Sf (e*estatenent 3***){ x count = count + 2 6 ) u t 1 } ° wove al] rows from Table 3 to Table 1 ) ‘¥ Statement 1:X-PartOfSpeech == ¥.PartOfSpeech ‘Statement 2:X.LetterCount == ¥.LeterCount ‘Statement 3: X.Word and Y.Word end with a full stop. statement 1: XWord and ¥.Word end with a full stop ‘Statement 2: X.PartOfSpeech == ¥.PartOfSpeech ‘Statement 3:X.LetterCount == ViLetterCount * statement 1:X.LetterCount »* Y.LetterCount Statement 2:X Word and ¥.Word end witha ful stop Statement 3: XPartOfspeech == ¥.PartOFSpeech Statement 1: X.LetterCount == ¥.LetterCount ‘Statement 2: X PartOfSpeech == ¥.PartOfSpeech Statement 3: X.Word and ¥.Werd end with a full stop The following pseudocode is executed using the “Scores” dataset. At the end of the execution,variable Count captures the number of students whose total marks are more than the class average (of total marks) but have scored below the subject average in at least one subject. ‘Assume that the variable AvgT holds the value of the average total marks. Similarly, the variables ‘AvgP.AvgC and AvgM hold the value of the average marks of Physics, Chemistry and Mathematics respectively. Choose the correct code fragment to complete the pseudocode. 1 come = 0 waleCrable 4 bas wore rows) { ead the First row x from Table 1 A= False, 0 = False, € = False, 0 = False $fG.rowl > age As true d SFO sathematics 4F(A or (8 and ¢ and 0)){ count = count + 2 1? AFCA oF not(B or ¢ or 0)){ Count = count + 1 , Procedure miniSum accepts three numbers as parameters and returns the sum of two smallest numbers. Choose the correct code fragment to complete the procedure. 1 Procedure winisum(a, ®, ¢) ‘sun = 0 {f(a > € and a> ot Sum Bsc 1 elset 1 else{ 2 if(e > ¢ and 8 > ad{ 2 Sum = Ass 3 sum ade 3|} . ’ 4 if(C > Band B > Ad{ 5 elsef 5 sum = A+ 6 sum A+ 8 <3 7 , s\} 7 v * 1 1f(8 > Cc and B > A){ ipiaieat : Sem Ass 2 Sum = A+B 3} sles 4 else 4 if(c > Band 8 > a){ 5 Sum = A+B 5 Sum = B+ 6|} s|> ‘The following pseudocode is executed using the “Words” dataset. What will A represent at the end ‘of the execution? 2 sum = 0, count = ° 2 while(table a has wore rows) { 5 ead the first row x fn Table 1 © Count = count + 2 5S Suet = Sum + x.Lettercount nove x to Table? ) © = sent / count 1D Sums = 0, Counts = 0, A= 0, #0 LL whifTe(table 2 has more rows)( head the First row x in Table 2 1 counts = counts + 3 Le Sus» Sunt 4 x.Lettercount 2S koword ands th a full st09){ is C= Sums / counts wv ite < ot * Anked 8 ? » Suns = 0, counts = 0 , wove x to Table 1 ® Number of sentences with average letter count more than the average letter count of dataset ~ Number of sentences with average letter count less than the average letter count of dataset ® Number of words with average letter count more than the average letter count per word of dataset ® Number of words with average letter count less than the average letter count per word of dataset ‘The following pseudocode is executed using the “Olympics” dataset, Procedure doSomething accepts a table of rows which contains rows of the same player. Assume that the player has won at least two medals and only one medal in any year. What will (B - A) represent at the end of the execution? | Procedure dosonething(Table T1) A= 2030, 8 = 2030 2 whfTe(Table 1 has more roms) ( 4 Read the first row z from Table TL 5 Af(z.vear < a){ Bea Aw Z.vear ) ° Af (2.vear > A and 2.vear< 8){ B= Z.vear u , 2 wove the row z to Table 12 a } a return((B - aD) 5 end dosomething ¥ Year gap between first and second medal won by a player * Year gap between first and latest medal won by a player ® Year gap between latest and second latest medal won by a player ® Year gap between first and second latest medal won by a player The given pseudocode is executed using the “Olympics” table. What will count represent at the end of the execution? Assume all players have distinct names. L count + 0 Paén(Te(Table 1 Pas more rows) ead the fest row x (Table wove x to Table? vhile(Table 1 has more rows){ ‘ ead the first row ¥ dn Table nove Y t0 Table} ' 1 0.name = ys) ’ {FO national ty — Y.watforalty snd x.madal — v.madal)( 10 count = count #1 x , x , ul] 9 MM wove aT? rows frow Table 3 to Table a '* The number of pairs of players having the same nationality or the same medal. ‘¥ The number of pairs of players having the same nationality and same medal. The number of players having the same nationality and same medal '§ The number of players having the different name but of same nationality. The given pseudocode is executed using the “Shopping Bilis” dataset. frac stores the ratio of the number of customers who purchased both “Bread” and “Milk” to the number of customers who purchased “Milk”. Choose the correct code fragment(s) of procedure hasltem to complete the pseudocode. (Assume there is at least one customer who has purchased “Milk’). simot = 0, tome = ¢ siete # as ware cart end the top cart fm rile §(fOaszemce, i) ‘ tusttenn, “tree")( owt = teat © c= alse whi la(eard ¥ has more (tems) ( Read an ttem z from itemist of card ¥ $4Cz. Tem = a © = True ? elset Co False ) Remove 2 from rtemcist of ) return¢c) c= False while(card ¥ has wore tress) ( Read an item 2 from Ttemist of card ¥ A¢Cz.2t0m = AL c= True ) nenove 2 from temist of ¥ y return(c) = True white(card ¥ has more ftems){ Read an item z from Item ist of card ¥ Af(@.tem = 00 c= True » Remove 2 from ItemList of ¥ » return(e) c= True whiTe(card ¥ has more Stems) ( ead an iter 2 from trem ist of card ¥ [email protected] = at © = False » Remove 2 from ItemList of ¥ ) return moxie) The given information represents a "Words" dataset and it may have some mistakes with respect to the sanity of data. Identify all rows with such mistakes. Rowne. Field Value Row Card number oye Row2 Word 1 Row3 Part of Speech "Noun" Rows Letter Count 5 ‘¥ Row 1: Incorrect data type of card number ¥ Row 2: Incorrect data type of Word * Row 3: Incorrect data type of Part of Speech * Row 3: Invalid value of Part of Speech * Row 4: Incorrect data type of Letter Count Row 4: Invalid value of Letter Count The following pseudocode is executed using the “Scores” dataset. At the end of the execution, ‘count captures the number of pairs of students having either same gender or from the same city ‘but not 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. 12 Procedure findPair(x, ¥) fee, B A= False, B = True 2 whilecrable 1 has more rows) ( ié|| Aeoccsmkcrows v came 3 Read the first row X in Table 2 . ame 4 Move X to Table 2 a } 5 whiTle(rable 1 has more rows){ ae | | itceictaypiee oe esctey omit 6 ead the first row Yin Tablet pealtee Move ¥ to Table 3 alla s ON Cie CORE TR ES CAS 20 4f((A and not B) and (not @ and 8)){ o } 21 return(1) 10 Move all rows from Table 3 to Table 1 } u|} 23 return(o) ¥ Line 13: Incorrect initialisation of B ® Line 18: Incorrect update of B © Line 20: Incorrect condition ® Line 21: It should return(0) The following pseudocode is executed using a dataset similar to the "Words" dataset, based on the following paragraph. "Surrounded by nature, Susan often takes a stroll, savoring the soothing sounds of chirping birds.Such moments underline the significance of embracing simple joys in life. Rustlings in the trees suggest squirrels beginning their day, searching for sustenance. Surely, the beauty of a sunrise holds unparalleled magic.” count = 0, flag = True whi le(rable 1 has more rows)( Read the first row x in Table 1 4 Move x to Table 2 s 1#¢Flag)4 ‘ Af(ast letter of x.word — "5" ? if (2nd Verter of X.Word == "u'){ 8 count ~ count + 1 9 ) 10 } un) } 2 flag < False 13 if(x.word ends with full stop){ 1“ flag = True 1 } 16} What would be the value of count at the end of the execution of the above pseudocode? Assume that upper case and lower case are ignored during comparison of letters. 3 Qualifier May Term 2024 The gen information represents "Scores" dataset and it may have some mistakes with respect to the sanity of data. Identify all rows with such mistakes. It isa Multiple Select Question (MSQ). Row no. Field Value Row! Card number 1 Row2 Name Harish Row 3 Gender M Row4 Date of Birth 30 November Row 5 Mathematics 62 Row6 Physics 145 Row7 Chemistry 1 Row8 Total 398 * Row 1: Incorrect data type of card number Marks: 3 Row 4: Invalid Date of Birth ¥ Row 6: Physics score is out of range ¥ Row 8: Total score is out of range The given pseudocode is executed using “Scores” dataset. Let B be a positive integer. What does the procedure DoSomething compute? Procedure Dosonething (8) ©=0,0= 101 whileCrable 1 has more rows){ » ead the first row x fn Table 1 if xPhystes > © c= physics ) $f 0x.chentstry < 0)( 0 = x.chenistry ) wove x to Table 2 Af(€ - D>» Wf return (False) » return(trve) End Dosomething Marks: 4 * Returns “True” if and only if the difference between the maximum Physics marks and the minimum Chemistry marks is at least B Returns “True” if and only if the difference between the maximum Chemist marks and the minimum Physics marks is at most B 'Y Returns “True” if and only if the difference between the maximum Physics marks and the minimum Chemistry marks is less than B * Returns “True” if and only if the difference between the maximum Chemist marks and the minimum Physics marks is less than B The following pseudocode is executed using the “Scores" dataset. What will A represent at the end of the execution? ° eee Marks: 4 2 whilerfte 1 has wore cards)( 2 Read the top card x from pile 1 4 he ke Stese90 wove x to pile 2 6|t 7 Procedure ‘srnseq(x) © $F GxPhystes < xamathematies){ ° if satnematics < x.cheststry)( 0 retuen(a) 2 , 2} + return) Und fete ¥ Number of students with highest marks in Chemistry and lowest marks in Physics. ® Number of students with highest marks in Mathematics and lowest marks in. Physics. * Number of students with highest marks in Physics among the three subjects. * Number of students with lowest marks in Physics and highest marks in The following pseudocode is executed using the “Library” dataset. 1 k= 0, count = 0 2 whfle(rable 1 has wore Fema) { ‘ead the first row x from Table 1 6 Afevear > OE 3 As xvear “| 9 ove x to Table 2 1 venflecrable 2 has more rows){ ‘ead the first row ¥ from Table 2 Sfeycvear t= ADC count = count + 1 ) move y to Table 1 5|} What will count represent atthe end of execution of the above pseudocode? * Number of books which were published after the least recent year. ® Number of books which were published in the least recent year. -¥ Number of books which were published after the most recent year. Number of books which were published in the most recent year. The following pseudocode is executed using the "Words" dataset. At the end of the execution, A ‘captures the number of nouns with letter count at least four and at most eight. Choose the correct code fragment{s) to complete the pseudocode. It is a Multiple Select Question (MSQ). ane swiecrable 4 has wore card) ead the Fest row x fron Table 1 sflOhechsomethingtx, 4, 9)( acaet ) nove x to Table 2 ay 9 Procedure chechsomething(v, C1, €2,) 10 (r.Partotspeech m- “Noun")f ul) baat “ retura(False) voy Ls tnd chechsonet hing 2) SCL oe v.Lertercoune and y.Lertercount a G2), retuen(trve) 1 et eturn(False) ) $F(CL ce Y.Lettercount and v.tettercount <= @)¢ return(reve) 1 eset return(False) 1 2) S#(GL o Y.tertercount and y.tettercount <= €2){ 2 ‘return(alse) 1} oy ee leet s return(true) soa S€(c1 > y.aeweerceunt or v.aettercoumt > @){ reterecralse) ) at return) ) The following pseudocode is executed using the "Words" table. At the end of the execution, count stores the numberof pais of verbs such that both verbs have either the same letter count or both end with a full stop, but not both. Choose the correct code fragment to complete the pseudocode. 1 count 2 whleCrable 1 has more rows)( 5 ead the First row x in Table 1 © neve x te Table 2 5 4f0x.Partofspeech a= “verb">{ 6 hlTeCrable 1 has more rows)( . ° ead the first row ¥ in Table 1 wove y to Table} 2 ocumearcant = yeeren ) cant comes t a) set oir nd sod et 0h 4 AN OD (| emas came 4 , ‘) ox cartercnmt — v.ceeareeet)| count = count +b ) tO. naed and Yond end wth a fal staph out» cent 1 ) « 2) Houvet and vmod end witha FN) aly Antrim ¥ aero ‘ cot = ent ’ 0 ol fut st Inthe Shopping Bis" dataset, the procedure countBils counts the numberof bis from Big ‘Bazaar with total amount more than the average total bil amount. Assume tht the variable Avg holds the value ofthe average total il amount. Choose the correct code fragments) to complete ‘the procedure. kis Mutiple Select Question (MSQ). 1 Procedure countsiT150) 2 coume = 0 3 whfle(otte 1 has wore eards)( ‘ ead the top card x from afte x : 200 ne 7 4 os BINT the code ove card x to pile 2 ’ ie retura(count), LL end counts tts 2 Ox shopane m= “eigtaraae"Df (4. roLaletM aot > 9 , ‘Coant = count + 1 “| 9 sy 2) A roeatarTamoaae > aNg)( 116, sheppame = "Wi gazane"){ 3 cont = Coomt + “) a o) 2) HfoxToratesTTARCUNE > Ang oF x.shepmame = Mwigtazanr")f 2 count = comtt + 8 yD 1 FO-Toeate Namoone > sng and xShopaad me “Hiptansae”){ 2 count = Coane + 5 ni ‘The following pseudocode's executed using the "Words" dataset. At the end ofthe execution, A ‘represent number of sentences with average letter count less than the average letter count of dataset. identify all such mistakes (if any). Assume that all statements not listed in the options below are free of errors. tis a Multiple Select Question (MSO). 1 Seat = 0, Counet = 0, w= 8 2 wbfle(rabte 2 has wore rows) ead the First row x fn Table 2 out = countt + 1 Sart = Sut + .Lettercount nove x to Table? + © be suet / counet 2 Sons = 0, counts = 0, Aw 0, Co 20 | whfle(rable 2 has sore rows)( LL head the first row x in Table z 22 counts = counts + 2 2 Sums = sums + x terrercount Atif Qc.word ends with a full stop){ ry C= Sums / count 6 if > Of v AeaeL u ) » Sums = 0, Counts = 0 |) 9 21 Move x to Table 1 nly ® Line 8: Incorrect expression for B Line 15: Incorrect expression for C Line 16; Incorrect conditional statement * No mistake ‘Two words are said to be conjugate if they fulfil following conditions: © They are different words. ‘© Number of vowels are same in both words. '* Number of consonants are different in both words. For a row X in the "Words" dataset, assume that vCount(X) return the number of vowels in X.Word. At the end of the execution, count stores the number of conjugate pairs. Choose the correct code fragment(s) to complete the pseudocode. It is a Multiple Select Question (MSQ).. 1 count = 0 2 while(rable 1 has more roms){ 3 Read the First row x in Table 1 4 move x to Table 2 5 while(Tablle 1 has sore rows) { ‘ ead the first row ¥ in Table 1 ‘ ° * FATT the code * 19 move ¥ to Table 3 n d 2 move all rows fron Table 3 to Table 1 Bi?) 2 AFGword = Y.word) { $F 0c.Lettercount = Y.Lettercount) { {f¢vcount(x) == veoune(¥)){ count = count + 2 ? 2 ff QC.word t= y.word){ AFCK.Lettercount != y.Lettercount){ 3 {f(vcountO) == veount (VD) 4 count = count + 2 ; ) ‘ 2 AfO.word I= ¥.word){ $f(vcount Oo) = veount(¥)){ 3 Af (x.Lettercount ~ vcount(X) = Y.Lettercount! - vcount(y)){ ‘ count = count +1. 5 ’ 6 1 Qx.word ' Y.word){ $f (veount OD = veount(¥)){ ‘4f(X.Lertercount - veount(X) Im ¥.Lettercount - veount(¥)){ count = count + 2 I Consider the procedure mSum as shown below. 1 Procedure msum(a, 8, C) > sme0 2 AF oe € and A >= ODE ‘ sume Bsc 3] 2 6 alse 7 if(8 >= C and B >= a){ ‘ sm Ase : } 0 eset n fm ease 2 ) bl} u return(sum) 15 ind Sum What will be the value of mSum(4,4,2) ? 6 The following pseudocode is executed using a dataset similar to the ‘Words" dataset, based on the following paragraph. “Surrounded by nature, Susan often takes a stroll savoring the soothing sounds of chirping birds. Rustings in the trees suggest squirrels beginning thelr day, searching for sustenance. Surely, the beauty ofa sunrise holds unparalleled magic.” 1| cmt = 0, Ton = tre 2 |ateCable 1 has wre ros) 2 ead the First row x in Table rove x to Tle? secre ‘ Af (ase Tetter of x.word a= 's°)f ? $f Cand eter Of x, word == 'u'){ 5 count = count + 1 * d » ? ul 22 FOcvord ands with FuTT stop) 2 flag = False uo? wD What would be the value of count at the end of the execution of the above pseudocode? ‘Assume that upper case and lower case are ignored during comparison of letters. The following pseudocode is executed using the “Scores” dataset. What will count represent at the end of the execution? 2 count = 0 2 whiTe(Table 1 has more rows){ 3 Read the first row x fe Table 1 4 wove x to Table 2 5 whiTecrable 1 has more rovs)f ‘ ead the First row ¥ in Table 1 7 wove ¥ to Table 3 5 count = count + Findrair(x, ¥) o> 10 wove all rows fron Table J to Table 1 nu? 12 Procedure Findpair(x, ¥) 1 Aw False, 0 = False AF (x.Gender — y.cender) { 8 an true 1%} LAF QX.CItyToun == y.ciryrown){ * Be True » 10 AF((A and &) oF (not A and not #)){ return(1) ? 23 rewurn(o) 24 tnd Adoni % count represents the number of pairs of students having either the same _ | gender or from the same city or both, % count represents the number of pairs of students having the same gender \_ and from the same city. ‘¥ count represents the number of student pairs who either share the same | gender and come from the same city, or who share neither the same gender nor the same city. % count represents the number of pairs of students having the same gender but not from the same city. -

You might also like