REVISION AND PRACTICE

Revision and practice with explained answers

3 min read
On this page 2 headings
YOUR COURSE DATA · TRY IT HERE

Count the score cards

Use the supplied 30 score cards. No download or coding is needed.

READY TO START

A pile of 30 cards

Start with the first card. Read its fields, do one small action, then move on.

What we remember

Read
0

Nothing has been read yet. Choose Next card to begin.

Look through all 30 original records
BhuvaneshMaths 68 · Erode
CardNo
0
Name
Bhuvanesh
Gender
M
DateOfBirth
7 Nov
CityTown
Erode
Mathematics
68
Physics
64
Chemistry
78
Total
210
HarishMaths 62 · Salem
CardNo
1
Name
Harish
Gender
M
DateOfBirth
3 Jun
CityTown
Salem
Mathematics
62
Physics
45
Chemistry
91
Total
198
ShashankMaths 57 · Chennai
CardNo
2
Name
Shashank
Gender
M
DateOfBirth
4 Jan
CityTown
Chennai
Mathematics
57
Physics
54
Chemistry
77
Total
188
RidaMaths 42 · Chennai
CardNo
3
Name
Rida
Gender
F
DateOfBirth
5 May
CityTown
Chennai
Mathematics
42
Physics
53
Chemistry
78
Total
173
RitikaMaths 87 · Madurai
CardNo
4
Name
Ritika
Gender
F
DateOfBirth
17 Nov
CityTown
Madurai
Mathematics
87
Physics
64
Chemistry
89
Total
240
AkshayaMaths 71 · Chennai
CardNo
5
Name
Akshaya
Gender
F
DateOfBirth
8 Feb
CityTown
Chennai
Mathematics
71
Physics
92
Chemistry
84
Total
247
SameerMaths 81 · Ambur
CardNo
6
Name
Sameer
Gender
M
DateOfBirth
23 Mar
CityTown
Ambur
Mathematics
81
Physics
82
Chemistry
87
Total
250
AdityaMaths 84 · Vellore
CardNo
7
Name
Aditya
Gender
M
DateOfBirth
15 Mar
CityTown
Vellore
Mathematics
84
Physics
92
Chemistry
76
Total
252
SuryaMaths 74 · Bengaluru
CardNo
8
Name
Surya
Gender
M
DateOfBirth
28 Feb
CityTown
Bengaluru
Mathematics
74
Physics
64
Chemistry
51
Total
189
ClarenceMaths 63 · Bengaluru
CardNo
9
Name
Clarence
Gender
M
DateOfBirth
6 Dec
CityTown
Bengaluru
Mathematics
63
Physics
88
Chemistry
73
Total
224
KavyaMaths 64 · Chennai
CardNo
10
Name
Kavya
Gender
F
DateOfBirth
12 Jan
CityTown
Chennai
Mathematics
64
Physics
72
Chemistry
68
Total
204
RahulMaths 97 · Bengaluru
CardNo
11
Name
Rahul
Gender
M
DateOfBirth
30 Apr
CityTown
Bengaluru
Mathematics
97
Physics
92
Chemistry
92
Total
281
SrinidhiMaths 52 · Chennai
CardNo
12
Name
Srinidhi
Gender
F
DateOfBirth
14 Jan
CityTown
Chennai
Mathematics
52
Physics
64
Chemistry
71
Total
187
GopiMaths 65 · Madurai
CardNo
13
Name
Gopi
Gender
M
DateOfBirth
6 May
CityTown
Madurai
Mathematics
65
Physics
73
Chemistry
89
Total
227
SophiaMaths 89 · Trichy
CardNo
14
Name
Sophia
Gender
F
DateOfBirth
23 July
CityTown
Trichy
Mathematics
89
Physics
62
Chemistry
93
Total
244
GoutamiMaths 76 · Theni
CardNo
15
Name
Goutami
Gender
F
DateOfBirth
22 Sep
CityTown
Theni
Mathematics
76
Physics
58
Chemistry
90
Total
224
TauseefMaths 87 · Trichy
CardNo
16
Name
Tauseef
Gender
M
DateOfBirth
30 Dec
CityTown
Trichy
Mathematics
87
Physics
86
Chemistry
43
Total
216
ArshadMaths 62 · Chennai
CardNo
17
Name
Arshad
Gender
M
DateOfBirth
14 Dec
CityTown
Chennai
Mathematics
62
Physics
81
Chemistry
67
Total
210
AbiramiMaths 72 · Erode
CardNo
18
Name
Abirami
Gender
F
DateOfBirth
9 Oct
CityTown
Erode
Mathematics
72
Physics
92
Chemistry
97
Total
261
VetrivelMaths 56 · Trichy
CardNo
19
Name
Vetrivel
Gender
M
DateOfBirth
30 Aug
CityTown
Trichy
Mathematics
56
Physics
78
Chemistry
62
Total
196
KalyanMaths 93 · Vellore
CardNo
20
Name
Kalyan
Gender
M
DateOfBirth
17 Sep
CityTown
Vellore
Mathematics
93
Physics
68
Chemistry
91
Total
252
MonikaMaths 78 · Bengaluru
CardNo
21
Name
Monika
Gender
F
DateOfBirth
15 Mar
CityTown
Bengaluru
Mathematics
78
Physics
69
Chemistry
74
Total
221
PriyaMaths 62 · Nagercoil
CardNo
22
Name
Priya
Gender
F
DateOfBirth
17 Jul
CityTown
Nagercoil
Mathematics
62
Physics
62
Chemistry
57
Total
181
DeepikaMaths 97 · Bengaluru
CardNo
23
Name
Deepika
Gender
F
DateOfBirth
13 May
CityTown
Bengaluru
Mathematics
97
Physics
91
Chemistry
88
Total
276
SiddharthMaths 44 · Madurai
CardNo
24
Name
Siddharth
Gender
M
DateOfBirth
26 Dec
CityTown
Madurai
Mathematics
44
Physics
72
Chemistry
58
Total
174
GeetaMaths 87 · Chennai
CardNo
25
Name
Geeta
Gender
F
DateOfBirth
16 May
CityTown
Chennai
Mathematics
87
Physics
75
Chemistry
92
Total
254
JKMaths 74 · Chennai
CardNo
26
Name
JK
Gender
M
DateOfBirth
22 Jul
CityTown
Chennai
Mathematics
74
Physics
71
Chemistry
82
Total
227
JaganMaths 81 · Madurai
CardNo
27
Name
Jagan
Gender
M
DateOfBirth
4 Mar
CityTown
Madurai
Mathematics
81
Physics
76
Chemistry
52
Total
209
NishaMaths 74 · Madurai
CardNo
28
Name
Nisha
Gender
F
DateOfBirth
10 Sep
CityTown
Madurai
Mathematics
74
Physics
83
Chemistry
83
Total
240
NaveenMaths 72 · Vellore
CardNo
29
Name
Naveen
Gender
M
DateOfBirth
13 Oct
CityTown
Vellore
Mathematics
72
Physics
66
Chemistry
81
Total
219

Try the mixed questions first, then reveal the reasoning. State the input order, initialization, comparison and tie policy before tracing a procedure.

Choose the pattern

TaskState / method
Find any matching recordFound flag; stop when true.
Find maximum valueRunning best seeded safely.
Find all maximum ownersBest value plus reset-or-append list.
Longest sentenceLocal Count plus global Longest.
Largest group frequencyPer-group counts plus MaxCount.
Largest nonnegative group totalPer-group totals plus running maximum.
Select globally rare wordsComplete counts, then second-pass filter.
Translate nested conditionsTrack block scope and every else.

Twenty mixed questions

Try it yourself

1. An early-exit search sees a match on the last card. Does Found=True imply it stopped before exhausting the pile?

Show explained answer

No. A last-card match can make Found=True just as the pile becomes empty. Inspect the flag and the remaining-pile state separately.

Try it yourself

2. Starting from the first actual value, trace the maximum for 4,2,8,8,3.

Show explained answer

Max values after visits: 4,4,8,8,8.

Try it yourself

3. Why is Max=100 wrong for marks whose actual maximum is 97, using a strict greater test?

Show explained answer

No score exceeds 100, so the incorrect seed survives and invents a maximum of 100.

Try it yourself

4. For −5,−9,−2, find maximum and minimum.

Show explained answer

Maximum=−2, minimum=−9. Seed from an actual value rather than assuming zero is suitable.

Try it yourself

5. Values at IDs A,B,C,D are 6,9,9,8. Give first, last and all maximum owners.

Show explained answer

Maximum=9. First owner B; last owner C; all owners [B,C].

Try it yourself

6. Current Max=9 with Owners=[B,C]. The next record E has 12. What updates?

Show explained answer

Max=12 and Owners=[E]. Replace the earlier owner list; do not append E to the obsolete 9-winners.

Try it yourself

7. A sentence’s fourth word carries a full stop. When should its count be compared and reset?

Show explained answer

Increment to 4, compare 4 with Longest, then reset Count to 0 for the next sentence.

Try it yourself

8. Grouped labels A,A,B,B,B have counts finalized only on label changes. What must happen at end?

Show explained answer

Finalize B’s count of 3 after the loop; otherwise the last group may never update the maximum.

Try it yourself

9. For labels X,Y,X,Y,Y,Z, give counts and maximum frequency.

Show explained answer

X=2, Y=3, Z=1; MaxFrequency=3.

Try it yourself

10. Two stores have bill amounts [10,20,30] and [100]. Which has more bills and which more revenue?

Show explained answer

The first has more bills (3). The second has more revenue (100 versus 60).

Try it yourself

11. Why must a new category counter be incremented after being created at zero?

Show explained answer

The current record is the first occurrence. Merely creating a zero counter would omit it.

Try it yourself

12. Normalize IT, it. and It, under the stated word rule.

Show explained answer

All become it, so they share one counter with combined frequency 3.

Try it yourself

13. For sun,rain,sun,wind, which words have final frequency 1?

Show explained answer

rain and wind. Neither sun occurrence qualifies.

Try it yourself

14. Does seeing a word once so far prove it belongs in the final uniqueness output?

Show explained answer

No. A later card can repeat the key; complete the frequency pass first.

Try it yourself

15. Old Count=3. Evaluate Count=Count+1, then test Count==4.

Show explained answer

Assignment stores 4. The following equality test is True.

Try it yourself

16. What does NOT Found evaluate to if Found=True?

Show explained answer

False, so a while condition using more-cards AND NOT Found stops.

Try it yourself

17. A Madurai M record enters a nested Chennai-only group split. What should happen?

Show explained answer

Neither Chennai count changes. The outer city condition fails.

Try it yourself

18. Why is if(Chennai AND F)…else MCount++ not the same as a Chennai-only F/M split?

Show explained answer

Its else includes every non-Chennai record too. The combined condition’s negation is broader than “Chennai and M”.

Try it yourself

19. What are the supplied dataset’s maths maximum and longest sentence length?

Show explained answer

Mathematics maximum=97 with cards 11 and 23; longest sentence=25 words.

Try it yourself

20. Which checks should be tried before trusting a maximum-owner algorithm?

Show explained answer

Empty input, one record, all-zero or negative values, tied maxima, a later higher score, and the intended first/last/all tie policy.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑