This video teaches how to validate quiz scores using a boolean array approach. A quiz has 9 questions: 5 easy questions worth 3 points each and 4 difficult questions worth 5 points each. The maximum possible score is 35 points (5×3 + 4×5). The algorithm uses a one-dimensional boolean array called 'checkTotal' where each index represents a possible total score, and the corresponding element is true if that score is valid and false otherwise. The validation is performed by checking if the input score falls within the valid range (0-35) and then accessing the array at that index to determine validity.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
9618 May June 2025 P22 Question 4 | Past Paper PracticeAdded:
Well brother, we have a question.
Let's just get done with this. October November 2025 9618 Question Number Four. Correct.
Paper Two variant to a quiz has nine questions. I am reading There Are in front of you for the first time. And whatever my thought process is, just try to focus on that.
Correct? A quiz has nine questions. There are nine questions each. And there are five easy questions each with three points. There are five easy questions in it and four difficult questions which have five points each. Let's see how I am translating and trying to understand in my own local language so that that thing gets stuck in my mind and I understand it because my mind thinks in Urdu only.
Correct? At the end of the quiz is correct. Once the quiz is over, the points for each correctly answered question are added to give a total score. Whatever it is, for the total score, as soon as the quiz is over, all the correct answers will be added up and their points will be added up. A check is made a check. Check kind of flag should say. Do n't know what? I don't know. Did n't understand. Let's read further. Saying, a check is made to test that the total score is valid using a one-dimensional array check total. Well, what you are saying is, A check is made to test whether the total score that has come is valid or not. Using a one d array check total of type boolean. Type Boolean means True and False will be present inside it.
Correct. Each index value of the array represents a positive or a possible total score. Good sir. What are you saying? I did n't understand. Each index value of the array represents a possible total score. Whatever the total score is, it is its index. Each index value of the array represents a possible total score.
Correct? Well, what I have understood so far is that the index values would be representing whatever possible score there is.
The corresponding element value is true if the index value represents a valid total score and false otherwise. Otherwise we are fine I think okay let's let's read more what does the first nine roses of the array say next are the first nine roses what is the meaning of nine roses may be related to nine questions I don't know as of now what I am understanding is nine questions so see nine questions I am trying to figure out the patterns right now the nine questions, so maybe these nine roses are given for that reason. The First Nine Roses of the Array Okay. Ah five easy questions for hard questions.
Three three points, five points. Ok? The First Nine Roses of the Arrays are Zero. It has been truncated. That means what? Valid Total Score. No correct answers. Correct? If there is a forest then it has been fenced. Invalid total score. Too has been falsely accused.
Invalid total score. Three is true, it has happened, valid total score one three point question correct, it is correct, this is a three point question which has been answered correctly, ok perfect, what do you say next, four false invalid total score five true valid total score one five point question correct, the five point question has been answered correctly, it has been answered correctly, six true valid total score two two three point questions correct. Meaning one was on top, one went down. One has come on three and one has come on six. Ok?
Seven Pay False Invalid Total Score.
His answer was wrong. And then at one is true.
That means correct. That is valid total score one three point question and one five point question correct. Correct. So here we are doing at true.
Valid Valid Total Score One three point question and one five point question correct. Meaning a three point question was answered correctly. One five point question was answered correctly. How many questions were correct? One two ah three four five six.
Ok? For example, a total of six points is valid. The value of the array element at index six is true.
For example, a total score of six points is valid. Let's try to understand. For example, a total score of six points is valid. The value of the array element at index value six is true. Correct? A total score of six. What was the score on six?
Two three point questions correct na? So that's six points.
Okay got it okay now I understood it let me see if the index position is at three that means three points index position is five that means five points index position is six so two three 3 + 3 six points index position is eight so 3 + 5 eight points now I understood the pattern after explaining such a long story still I am not sure let's read what is said next is it right? So one three point question that means three points five index position five that means five points. Index position six means 3 + 3 two three three point questions. After that consume.
No one can become that person. A Because we don't have the option between five and three.
So this is not our valid score. After that we come to eight.
So in eight we are getting a three point question and a five point question. So this is an eight marks question. Ok? Do you understand now?
Ok? Now they are saying for example a total score of six points is valid because it is valid. Questions of three can be made. So the value of the array element at index value six is true. Right suite code to declare checkTotal and to set all elements of the array to false. Declare everything false. Let's do it quickly.
Good all way all variables must be declared ah right should good to declare. We also have to declare the check total. The array also needs to be declared. And according to that, what is he telling us about all the work and after that? Inset all elements of the array to false All variables must be declared. Correct? Ok. Ok.
Ok. Ok. I understood till here.
Now, how many of these elements do you have to create? Do We Have That?
Five easy questions each worth three points Four hard questions worth five points We are making some combination of this At the end of the quiz the points with each correctly answered question are added to give a total score A check is made that the total score is valid A check at the end of the quiz the points with each correctly answered questions are added to give a total score.
A check is made to test that the total score is valid using a one-dimensional check total of 100.
Each index value of the array represents a possible total score.
A possible total score. The corresponding element values is true. If the index value represents a valid total score.
The First Nine Roses of the Arrays are us cannot be zero. It cannot be a forest. Ca n't be two. It can't be three. Now do we have to make all its combinations? For example, a total score of six points is valid. The value of the array elements at index value six is to a sto code to declare check total and set all elements of the array to false. All variables must be declared. Ok? Got it. Let's move forward a little bit. Let's look at Part B. The sto code represents the algorithm to set the appropriate elements of the array to true.
Represents an algorithm to set the appropriate elements of the array to true.
For easy questions For hard questions Okay the array elements have been assigned ah the required values a module validate score will take an integer value representing a total score is a parameter it will return true if the two score is valid and false if it is not valid okay let's try to break it down and find out the patterns this is a very interesting question a quiz has nine questions there are five easy questions and 3 points now let's find out the possibilities of how many we can make. Correct? There will be a possibility that points will be awarded for each correctly answered question with error to give a total score.
Brother can become a three.
Correct? We take away maximum points.
Well, if you calculate the maximum points, how much will you get? 5 + 5 + 5 + 5 are four hard questions, each with four points. So look, now I am taking out the maximum.
So these index values are representing the total. Each index value of the array represents a possible total score. Zain son be seven. Yes and no, whatever the total score is, either your total score might be coming out to be three or your total score might be coming out to be five or your total score might be coming out to be six. Correct? Now I have already started to understand the pattern little by little.
So let's see now.
Now look, he has given only nine roses. Now how do I know how many elements I have to create an array of. Right?
So to figure this out, we know the initial value will be zero.
But what could be the maximum score?
Right? Let's figure that out. So, how many is 5 + 5 + 5 + 5 + 3 + 3 + 3? Five easy questions and four hard questions, right? So three, just multiply this a little. 5 * 4 This is one. This can give you maximum points. Five easy questions each worth three points. So there are five easy questions. So five times three. So what could the total score be? Maximum 20 20 + 15 so the maximum score can be 35, tell me yes or no, so see this is a very interesting technical question but I just thought a little bit, kept looking at the patterns, kept looking, kept looking and that's it, I clicked, so now what did I come to know here that the maximum marks that can be obtained, the possible marks that can be obtained, can be 35, so you see if three is possible, five is possible, six is possible. Correct? At possible.
How many possibilities do we have by doing this? There are 35 possibilities. So now I want to create an array of 35 elements.
Declare check total.
That's the maximum mark that a person can get. Colon array is a very interesting question brother.
Interesting, I am enjoying solving it.
0 35 of bullion.
Come on, what do you say next brother? To whom should I declare? The index values are representing the possible points.
Meaning you have nine questions.
You might get three points out of nine questions.
Maybe five can come.
Because look at their combinations, what combinations are being formed? 3 + 3 is a combo of three. If you look at the let's say there were nine questions. Out of nine, you got only three correct. So how many total points did you have? Three. You can do this also. If you correct two or three, how many will it be? Six. You have to press true on this.
Then what other possibilities can there be? The possibility of 3 + 5 at can be yours. What other possibilities are there besides this? The possibility of 3 + 3 + 3 nines can also be yours. Correct?
So Nine, you got it right. Nine points.
Its true at nine point too, right? Let's look into that. It is at. Nine will come after eight, right?
Nine should also be true. Why?
Because of course it is a valid score. Are you understanding this? Do you understand? Now 3 + 3 + 3 + now what is the second option in this? 3 + 3 + 5, so how much does this make for us? 6 + 5 11 11 is also a valid score. Are you understanding? So these are the valid scores we're creating.
What pattern have I come up with so far? Three then six then eight then nine then eleven.
What else can be made apart from this? 3 + 3 + 3 can also become 10, right? If you have done 5 + 5 5 + 5 with two fives correctly then that 10 can also become your valid score. Are you starting to understand, brother? So we just need to look at the combinations of valid scores. So here it will also set it to true at index position 10.
Well, what are you saying right now?
Inserts all the elements of the array to false.
Let's do it brother. When I figured out that there could be a maximum of 35.
After that I am going to leave some lines for your declaration purpose. Now I am starting from here.
For index arrow one to oh my bad 0 to 35 I will go to each element and store it as true and false my bad, we stored it as false, well that's it, that's all I had to do.
Next Index According to the New Syllabus.
Declare the index.
DeclareIndexColonInteger. Did you understand till here? Zan yes and no.
Come to chat quickly son. It became perfect.
Let's move on to the next part now. Saying the pseudo code represents an algorithm to set the appropriate elements of the array to true. Now the appropriate elements have to be made true.
Correct? Now I don't understand.
Let's try to figure out what it's trying to do. Declare EasyQuestionsHardQuestions Integer. Then it says check total.
You have to go to check total and store all the values here.
How is he doing it, we are saying declare easy question declare hard question hum three where did this 15 come from let's try to figure that out first right let's figure it out how many questions do we have three questions 5 times 315 is giving me right?
Five easy questions worth three points. So 5 times 3 is giving 15. Ok? 5 times 3 gives me 15. So he is calculating the hard questions. Let's not try to figure you out in the blanks. We try to understand it ourselves.
First let us create the logic ourselves as to how its logic will be created. After that we will think what should we do?
Correct? Let's skip this point. Let's leave it like this. First let us figure it out ourselves as to how the logic will be formed. After that we will think about it ourselves. Correct? Then after that we will try to fill the gaps. Okay, now he is saying easy questions, hard questions. What do you have to do? First, I have to make three true. Then five has to be true. Then after that now I am figuring out some patterns.
Then I have to do 3 + 3 equals 6. 3 + 3 is 6. Three has to do it. 5 have to do it. Apart from this, do not do this. If we have to do 8 then 5 + 3 is 8, this has to be done and then 3 + 3 + 3 is 9, this has to be done and 5 + 5 is 10, this also has to be done, ok got it perfect, now let's try to figure out how these blanks will be filled, this is an easy question, though it is simple. If we want to feel something without understanding it, then it is very easy.
But let's try to think for ourselves, how will we do it ourselves?
3 5 then 3 + 3 then 5 + 3 end then 3 + 3 + 3 end then 5 + 5 10 Okay so this is trying to do it with nested loops.
What will we do first? Will take zero.
First it will add all the combinations of five.
I was feeling like this.
I think. So, right? It will work on zero, okay, okay, okay, okay, okay, it can be zero also, zero is also a valid score. Oh ho ho ho, we did not even consider this.
So zero is also a valid score. So 0 + 0 that's going to give you zero. Then in the zero starting, we understood what it was. Got it.
What pattern can 0 plus 5 form?
Figure out the pattern brother.
0 then 30 + 30 + 0 that's going to give you valid total score okay what will happen after that then 0 + 5 then +10 then +15 then +20 so it becomes 5.
Then get it plus three.
3 + Got It. got it.
got it? It's done easy. Now look, the first pattern will be 0 + 0, right? Then it will become 0 + 5, I mean I am just imagining it right now.
This is a three point question and this is a five point question. Correct?
According to this, I am doing that right now not even one of my zero three marks has been corrected by one let. The one with five is correct. Is there one right now? So according to that, what value do I have now? It has become worth five marks. So I have to go to 0 and 5. This became zero and five.
I have such a scenario right now. That means, I am giving zero marks to the one which was worth three points. I just got five marks. So what should I do? I will go to 0 first. I made it true there.
0 means not even one of the three was correct and not even one of the five was correct with me. So I have zero points made. Then what will I have?
One got it right with five. So according to that, right now I am assuming that the one with three marks is zero. The one with five became one. So that's going to give me what? I have to go to index position five and store it there.
0 + 5 is going to give me five. I will go there and store it. Then what will happen? I will keep it as zero. 0 + 5 + 2 Fives got it right. So that means it is 10 points. So according to that index position I will go to 10.
I will store true there.
Then for now I am keeping zero only and accordingly I have corrected three fives.
So that should be 15, right? Right now, look at me, whenever I think of a pattern, it is correct. Like I was thinking initially, first I was thinking then 3 + 3 then I was thinking in order. But we will not be able to write it in order as a program.
So that's the reason, we have to think about it a little differently. First you do all the five ones. Then try adding threes one by one.
You will have to do it accordingly. Then here we are looking at it, if I correct three or five then accordingly I will have to go above 15. I have to go to 15 and store my value. The index moved to position 15. Made that true too. Then after that 0 + 20 means 0 + 20, that is, those with four to five marks were corrected. The index position went to 20. That means I made this true too.
So these are all my five marks winners. Now what should I do after this? Now I will start adding those with three marks.
Correct? Three one is mine. what have I done now?
Three one got it right. Not even one of my fives was correct. According to this, now I will start making logic. See, since there are many combinations being made, it will happen only through nested loop. So three one got it right.
Not even one of the fives was correct. So you went to index position three and corrected it.
Now three one is correct. The one with five also got it right. So 3 + 5 goes to 8.
You got it right. Then after that you have to keep three as it is. After that, two of the fives got it right. 3 went to 10, that means by going to 13 you made that true too. Then after that 3 15 went to 3 + 15 + 3 18. You made that true too.
Then what will happen? 3 only one is correct, right now we have done three only one + 20 so we reached 23, you have made that true also. Correct?
What will happen now? This is another loop of mine completed.
Now let's talk about the other loop.
Let's imagine now two of my three are correct.
Many combinations of this are being made, right?
Now my two-three ones are correct.
So now what will be the pattern that is being formed according to that? Six. Not even one five-pointer was correct. So 6 + 0 goes to index position six. Make it true. Then imagine you got a five with a six right. What does 6 5 mean, 6 + 5 A? It makes 11. Go and make it true.
Then put six as it is. According to that, correct two to five. So we have to make 6 + 10 16 true as well. What will happen after that? Keep it six as it is. Correct the three F three five marks ones. So 5 + 6 is going to give you 21. We have to make this true also.
Then what will happen after that? 6 20 This is also correct, meaning those with two-three marks got it right.
All four with five marks got it right.
So according to that I will have to make 26 true also.
Now what do I have left after hitting a six like this? Option A is made for nine.
So nine means three three three is correct. There was not even one with three marks or five marks. So go to index position nine and make it true.
Then go to 9 5 14 and make it true. Then 9 10 go to 19 and make it true. Then go to 9 15 24 and make it true. Then after that go to 9 20 9 20 i.e. 29 and make it true. Then after no, similar cases of 12 will be formed. Do you understand?
Now make 12 cases with me. This is such an interesting question, brother. This is such an interesting question. Meaning 12 means you got four correct.
How many? Those with three marks. Four. So not even one of the 12 0 five marks got it right.
So go to index position 12 and make it true.
Then one got it right. Go to 17 and make it true.
Then another one got it right.
Two two got it right. Go to 5 + 5 10 22 and make that true too. Then after that 12 ah 15 how much does this make? Go to 27 and make that true too.
Then after that 12 20 32 correct this also. So these are all your elements which you have to make true. Let's talk about the last loop you'll be running. That is going to be 15.
15 means all the three pointers were correct.
Not even one of the five marks was correct.
15 0 15 points. After that one got correct with five marks. Go to index position 20 and set it to true.
Then two after that got corrected.
15 10 25 Make this true. Then 15 30 make it true. Then 15 20 35 make it true. And that's it. All your work is done. I know it is taking a little long because I am explaining it to you slowly and I am also explaining my thought process to you. Then according to this hole pattern that I am seeing here, if I now come to this question, then this starts looking like pudding to me.
How? Now understand brother, what pattern do I need for easy questions? 0 then three then six then no, meaning 0 3 6 9 12 15 do you want this or not, tell me, do you want this pattern, for easy questions what step will I keep from zero, I will keep step three + increment of three and what pattern do I want for hard questions, I want zero five then 10 then 15 and then 20, this pattern is what I want.
So according to that we have to keep zero to 20.
And what steps should I take? I will keep it for five. And what were you doing inside Check Total? We were adding both the values one by one. So, it means easy question plus hard question, whatever its value will be, we will mark it true.
Let me ebrate this code now. How is it happening? The first loop will run.
The value of easy questions is zero. The value of hard questions is zero. Go to index position zero.
0 + 0 is going to give you the truth.
Go there and store true. Then the easy questions will remain zero.
The value of hard questions will be increased by +5 to five. So go to 0 5 index position five and make it true.
Then go to 0 10 index position 10 and set it to true.
Then go to 0 15 index position 15 and set it to true. Then go to 0 20 index position 20. Make that true as well. All this work is done by you in one loop. Then now increment three by +3 in the outer loop. Now make cases of three. 3 0 then 3 5 then 3 10 then 3 15 then 3 20 and then goes with six.
Make cases of six. 6 0 6 5 6 10 6 15 620 Now make cases of nine.
9095910915920 All these cases were made by him.
Then make cases of 12. 12 0 12 5 12 10 12 15 12 All cases are also done. The last loop is running with 15 easy questions. 15 0 15 a 5 then 15 10 15 15 then 15 20 and that's it, you have made all those values, whatever possible scores were there, true, I understood the point son, it is clear dear, now what am I asking you in the next part, now you are suppose to see the array element has been assigned the required values, the array elements have been assigned their appropriate values, true or false. has been assigned. The fault loops that were there are gone.
Now he is saying that he wants to create a module to validate the score and take a score.
Will take an integer value representing a total score as a parameter. We will take score as a parameter.
It will return true if the total score is valid and false if it is not valid. It is very easy. There is nothing difficult in it. Whatever A score you are getting, what should you do with it? I have to see it from this range of mine. The parameter value you created for the range from zero to 35 will be used as the index value. Meaning let me show you how.
From let's I called validate score and called this. I want to validate the score number whether it is a valid score or not. I want to do it on 35th from the latest. So now this 35 will go to index position 35. I'll go to the array containing the check total. I will go and check whatever parameter value is there. Is this true? If this value is true then in that scenario I am supposed to consider this as a valid score.
And if this is not true. Let's from let's imagine index position to he inserted. Two scores were coming. Is Two a valid score? Go and check it. Go to index position to pay. Let's just go together.
Go to index position to pay. Is that true? No, brother. There is a falls. That means it's not a valid score. You just have to explain these four points.
And that's it.
Write down the first point. Have you checked the parameter value that it should be in the range of zero to 35. And if it is not there then of course it is false. Correct?
If he is not in range.
He put in 50 from the let. So it's not even in the zero to 35 range. It is not possible.
What to do after that? You have returned a false return here. After that you have to use the same parameter value as the index of the array.
And according to that, return whatever value is at that index position.
So at the end you will be getting final answers as true and false. I understood Mohammed. So these four points are formed. Let me write them down for you guys.
Check that the parameter value is in the range of 0 to very form one this point is done if it is not if it is not then return false then return false use the parameter value use the parameter volume as index and and okay index to the array which was your array check total wala use it as index return the value return the value at that index there is no need to compare also. You can end it but there is no need. Let's say the index position is two, so go and check the index position two.
What's there? There is a falls. Return this same floss. So that means invalid score. That's it. He got these four marks. So it was one of the most interesting questions. But why did it take us a while? Because of course I was elaborating on it in great detail.
So what can you guys do about it? My suggestion would be to figure out the patterns. You had to figure out the patterns according to the loops they gave you. There is nothing more difficult than this. So it is doable. But this is not a question that arises in the first cycle.
Which I have told about paper attempting methods.
First cycle and second cycle. So this is the last cycle question. If this is done in the like end, you will have to invest more time after thinking carefully. I had to think about it because the wording was very tricky. These things were very tricky. It took time to understand this.
But how did I understand? After looking at the points, I slowly looked at the values one by one. I was not able to understand his wording.
But I tried to understand from the values, the example values, and figured out that this pattern will be formed in this manner. And then I figured out the total score. Figured out everything accordingly. So that's it.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03











