This video teaches how to analyze and debug pseudo code by understanding variable purposes, logical operators (AND/OR), and common programming patterns like finding maximum values, counting occurrences, and tracking conditions through iteration. The instructor demonstrates how to identify errors in pseudo code such as incorrect operators, missing increment operations, and logical condition mistakes, using examples from datasets like scores, words, and library records.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
CT live
Added:to be whether it's English or not. There it comes. You know the condition is for only for English, right sir?
>> Yeah.
>> So it doesn't match.
>> So this is incorrect. What about option B?
>> Correct.
>> Correct.
>> This is correct. What about C?
>> Incorrect.
>> Incorrect. Reason >> because X dot pages should be greater than A. Then only we can find maximum.
>> Yeah. Page less than.
Incorrect. Correct.
>> Last one. Same. Incorrect. Right.
>> It's correct.
>> Incorrect.
>> Incorrect.
>> Option B is the correct one.
>> Incorrect one.
>> Okay. Uh let's move to next question.
Question is similar [snorts] to previous one. We have to >> do you have any question?
Okay. So, uh now we are using a scores data set and again some part of the pseudo code is missing and we are given what uh A is trying to capture and based on that we have to evaluate the options and pick the correct one. So A is basically capturing the second highest marks in mathematics. Okay. And uh one more variable is given max and it holds the value of the highest marks is mathematics.
Okay. So which one do you think is the correct one?
>> Third option.
>> Option C.
>> Option C. If match marks is less than maximum and greater than. Okay.
Why is option A incorrect?
So that holds the largest marks. Maximum marks.
>> Yeah.
What about the next one?
>> It will never give an >> no.
>> Third one is the correct one. And uh last we are just comparing with max and then changing the value of eight. So this is again okay. Uh so here we are using the words table or words data set and we are again given a procedure and uh in the procedure some part of the code is missing. We have to find that part. So let is short verb be a procedure to find whether the word in the row x is a verb with letter count at most five. So we have to check whether the word is verb or not and uh then we have to check that uh the letter count is at max five or not. Okay. The two conditions option A is it correct or incorrect?
>> Incorrect sir.
>> Incorrect.
>> Incorrect sir.
>> This we are not evaluating in option A.
So that is incorrect. What about option B?
>> Incorrect.
>> Incorrect sir.
>> Why?
>> Uh written is false sir.
>> Written is false sir.
>> This should be true right for this one.
So this one is again incorrect. Option D is also incorrect. What about option C?
>> True, sir.
>> Incorrect.
>> True.
>> Correct, sir.
>> Correct or incorrect, sir?
>> Correct.
>> Incorrect, sir.
>> Incorrect. Sir, >> is this meeting recorded?
>> Incorrect, sir. There statement is there. Both of them.
>> Incorrect.
>> This meeting is getting streamed on YouTube. So, you can watch it later if you want.
>> Sir, could you share the link in the chat? Actually, >> can someone please share it?
No, I think it is given in the calendar itself.
>> No, it's not showing the seventh month ago chart, not the present one.
>> Okay, give me Okay, let me share it.
Here I posted in chat.
Okay, thanks.
Okay. So option C it's incorrect. Why?
Because we have an or here and we want and operator right.
>> So this one is again incorrect.
What about the last one?
>> Correct sir.
>> This one is correct. Okay.
Question six.
So this pseudo code is again getting executed on board data set. We have a variable x defined over here. It's initialized over here and this proc uh this pseudo code is doing something we have to decode that and based on that we have to pick the options.
So let's see we initialize two variables I and b is equal to two. Then we are iterating over the letters of the current word. Okay. If the i letter of x dot word is a vary, we are saying that b is equal to false and i we are incrementing. And if this is the case, then we are incrementing a. So what is a representing?
Anyone?
So could you please explain 11th and 12th statement? Sir and >> C answers a number of words without mobiles.
>> One second.
So it is saying if B is true.
Okay. Then we will do A is equal to A + 1. Okay. So line number 11 is this. I hope this makes that clear.
>> Okay. So, so if like if anything is written like this, so it would mean that whatever the value that we initialized before in the initialization time that would be same as in the line 11, right?
>> We switching the value of uh B over here, right? So it could be true, it could be false. If it is true, then we will do this. Otherwise, we won't uh do A is equal to A + 1.
>> Okay? So, got it.
Okay. So now what is A representing?
Someone said I think >> C option number of movies with number >> option C. Why? Because uh here as you can see in line number six we are checking whether uh the I letter or some letter because we are checking all the letters uh in the current code. So if some letter is above L then we are switching the flag to false. We are switching the value of B to false and once B becomes false we won't execute this part. Right? So whatever A is storing it's negation of this particular line. Is this clear?
>> Yes sir.
>> If not you can ask.
Option C is the correct one.
Can you explain again?
>> Okay. See uh first of all we are uh executing on the word data set right. So we will pick one card or word. Say the word is maybe apple. Okay I'll just take this.
Now for apple we are initializing these two variables. I is equal to 1 and B is equal to 2. Okay, these are the two variables we have initialized. Now over here we are iterating over all the letters, right? So first we will pick A.
We will check whether A is a BL or not.
It is. So we will switch B became false. Right? And now we are incrementing I. So I will become two and now we have a new value for D which is false and then we will check the because of this we will check P.
[clears throat] Okay, we will again check whether P is wave or not and based on that uh we will switch.
So since B is already false and P is not a wel, you don't need to switch this part. Line number seven won't be executed. For P again for this one, it won't uh be executed. For L, it won't be executed.
Then for E it will be executed. But since we already have B is equal to false, we will again do B is equal to false itself.
Okay. And for that case we won't increment it. But suppose we take some other uh word XYZ maybe and we iterated over this. So first we will check this letter. Okay, it's not a wobble. Okay, so B was initially true. I is 1. So I'll just say B is equal to 2. I is equal to 1. Now I'm checking for X. So X is not a variable. So we will recoup the known.
We won't execute line number seven.
Right? This won't be executed and B will remain the same. Now we are incrementing I. So I become two. Okay. Now we will explore.
Yeah. Go ahead. Sir my question is that if we replace the as we init initialized B to true and if we initialize B to false and then we have taken that after if we have found a vowel then we change the B to true. So the answer would be I guess at least one vowel right?
>> Yeah at least one.
>> Okay. Thank you. Okay. Similarly, you can proceed further and uh at last you will see that B is true and I has value four. Right?
>> At that time the this thing line number five will give false and you will come out of the loop. Then you will execute this. You will see whether B is true or not. Currently B is true. So we will increment A.
Uh, someone's mic is on. Can you turn it off?
>> Okay. So >> in a what I understood is in a in a word if there is a vowel then B will become false right sir.
>> If yeah yeah if there is a wobble it will become false. So that means option C is correct right?
>> Yes sir. Got it. Thank you sir.
>> Yeah.
Now question seven.
Now we are again using the library data set and uh we have some pseudo code given.
A is capturing the number of books which are published after 2010 or have less than the average number of previous. Okay, two conditions are there.
So year should be greater than 210 or have less average number of books.
Okay. So I'll just say average.
Now we have one variable again average and that is holding the value of the average number of pages of the book in the data set. So this is defined and uh there are two conditions this one and this one. But uh as you can see uh in the options we have to figure out uh or check whether there are some incorrect lines or not. So we will go through each line one by one and check whether uh the statements are correct or not. So first we are initializing a that is correct.
We are iterating over the data set.
Now we have initialized the variable C.
Okay.
>> Can you mute yourself? Someone's mic is on again.
Okay. So C we have initialized as false and then we are checking whether uh x do is greater than 210 or not. So this is the first condition that we are checking and based on that we are switching the flag to true. Okay. Now we are again checking whether average is greater than oh sorry uh x.ph PH is greater than average or not.
Okay. And based on that we are again switching the flag. And if C is true then we are uh saying that A is equal to 1 and then we are moving that particular row to next level. Okay. So do you guys think any there is any wrong line which we should >> line >> line eight because the condition was this and it's doing the opposite thing.
Any other line?
>> Line number 12.
>> Line eight.
>> Line number.
>> Line eight is there. Yeah. Line eight.
>> Line eight. Sir >> line 12 also.
>> Line 12 by >> a + one increment. Yeah, we have to increment but we are not incrementing.
So line number eight and 12.
>> All the other lines look fine.
>> Line 8, line 12.
>> Line 8 and 12. Okay.
>> Yes sir.
>> Okay. Question number eight. Again we are using library data set and uh we have a variable defined over here and over here we can see that some part of the code is missing. So we have to figure out that so let's see what is is set to true if and only if there is a pair of books with same genre and same year of publication. Okay two condition.
So if suppose there are two books X and Y and uh they share the same genre. Okay.
Then we will switch. Sorry there are two.
This is the first condition. And then we have uh one more condition that is >> x dot I'm just writing y dot y= so if both conditions are getting satisfied only then we can say that a is true right otherwise a is false. Okay, now we are uh saying that a is false initially and then we are starting to iterate over the data set. So this particular part until over here uh line number four we'll pick the first card we picked one card and from line number five onwards we will compare it with next cards. So X is picked over here and then we are picking Y.
Okay.
And then we are doing the comparison and based on that we will switch the value of it. So option A is it correct or incorrect?
>> No >> incorrect.
>> Why?
>> No sir because condition what about option B?
Correct.
>> Correct.
>> Option C.
>> No. Incorrect.
>> No sir.
>> Correct.
>> Option C is correct. Someone is saying correct.
>> No sir.
>> No sir.
>> Option C is incorrect. Okay.
What about option D?
>> Incorrect.
>> It's all correct.
>> Incorrect. Yeah. Only this one is correct or all the others are incorrect.
>> Yes sir.
>> Right. Question number nine. Again we are using the library data set and we have two variables now A and B and we are doing some operations and at the end we have to tell what A and we represent.
We are initializing a and b over here.
And uh now for this one tell me what a will represent first. Go through the code and tell me what a will represent.
>> A will represent maximum a book which has maximum number of pages.
>> Okay. A will represent book which has maximum number of pages.
Okay. What will B represent?
>> B will represent the books which have maximum number of pages.
>> You are saying B will represent the book.
>> Yes. And A will represent the maximum number of pages.
>> Here we have defined both uh as some integer value.
>> B will represent the count.
You have to take care of data data type as well, right?
>> Keep the data type in mind as well.
>> Okay. So, option A, is it the correct one or incorrect one?
>> Incorrect.
>> Okay. What about option B?
>> Correct.
>> Correct.
>> Correct. This is the correct one because here we are counting the number of uh books with maximum number of pages and A is basically representing the maximum number of pages. So option B is the correct one. What about option C?
>> Incorrect.
>> Maximum number of pages across all books. Option D is also incorrect.
Yeah.
Now this one for this one we are using boards data set and again we have a pseudo code given over here along with a processor and uh we have to keep track of variable C what is happening with it and uh at the end what we will check. So for these type of questions always try to first understand the procedure. So what is happen what is happening in the procedure. Once you get that then start uh uh exploring what is happening in the pseudo code.
Okay. So let's first see what is happening in the procedure.
Get something and uh here we are saying that a is equal to zero. So we are initializing a and then we are iterating over the rows.
So we are picking two things x and y two things are getting picked.
If x dot letterlet count is not equal to y dot letter count at x dot part of a speech is equal to y dot part of a speech then we are incrementing a. Okay.
So two conditions are there and then we are moving the cards and all and then we are returning it. So what will a represent?
What is a in this procedure? What we will return at the end? What is a >> number of pairs of word with the same parts of a speech and different letter count?
>> Yeah, correct. So this line is what you are looking for. Letter count should be different and part of your speech should be same. Okay.
>> Yes sir.
>> Now we will explore this part. So we are iterating over the table and if x do world ends with a full stop then we are doing this. Okay. So what c will represent number of words in a sentence which have different letter count but same part of speech.
Correct.
Is this here or we are getting that?
>> Hello.
>> Any doubt in this? Yes. Yes, you are audible.
>> Can you explain the question number n?
>> Question number nine. Uh let's finish this one and then we'll check that.
Okay.
>> Where could you repeat the sound?
Yeah sure.
Okay. Is the procedure clear? What is happening in this one? We are basically as you can see we are doing two times iteration and uh in the first iteration we are picking variable x. In the second iteration we are picking variable y. So two things we are picking. Okay. And since it's the words data set so two words we are picking. Is it clear?
Now in line number 18 I won't write I'll just underline. In line number 18 we are checking whether the letter count of X and Y are equal or not. Okay per the condition they shouldn't be equal and the part of speech of both the word should be equal. If both conditions are getting satisfied only then we are implementing A. Okay.
So A is clear.
>> What is A? Yes sir.
>> And finally this procedure is returning a at the end. Okay.
Now this one.
So we initialized a variable C and uh now we are moving the words from table one to table two. Okay. So let's say we have four words. Okay. And after that we have a hook. Okay.
Now for the first word we will do this and move the first word to table two.
Okay. So this first word is moved to table two. Since this part is not true for the first word. So we will just move it to table two and do nothing. Okay. Is this clear?
>> Yes sir.
>> Okay. Now the second word. Same thing because uh second word is also not ending with the full stop. So we will just move it to table two and leave it as it is. Same three uh for the third one. Now for the fourth one we moved it to table uh two and now this particular line evaluates to true. Right?
Now since this is getting evaluated to true, you have to do the internal things as well. Now internal things are saying C is equal to C plus the procedure that we have. Okay. And in this procedure as you can see we are passing table two. So whatever we have in table two currently we're just passing that.
Okay.
And now you have to do the comparison in this one only. And what comparison you have to do? You have to do this.
Okay.
>> Yes sir. Got it.
>> Now it is what will it return?
Number of pairs of word with same >> uh yeah with same part of speech and uh equal letter of sound.
>> Yeah.
in different sentence or same sentence.
We had a full stop condition. So, same sentence, right?
>> Yes.
>> Okay.
So, which one option C or option D?
>> Option D.
>> Option D. Here it is saying same for both part of his speech and letter. So, that is incorrect.
Is it clear? Any doubt in question number 10?
No sir. No sir.
>> Okay. So let's quickly discuss nine again and then we will proceed to 11.
>> So what's the doubt first? Someone was asking question number nine again. So what is your doubt first?
>> Question number line.
>> Yeah. Okay.
So see what we are doing over here. So this condition x dot pages greater than a is equal to x dot pages. What this does?
What this does?
Have you seen this kind of pattern?
When do we use this?
>> It will update the value.
>> Yeah, it is updating the value. But uh after completing the iteration, what will a hold?
maximum number of pages.
>> Yeah, this pattern we use for maximum and if you use uh smaller than then that is for minimum. Okay, so this is for maximum. Suppose uh till here. Okay, you had some value maybe it was five and this was the maximum. Okay. Now we you got a new uh book library data set was related to book right?
>> Yeah I guess. Yeah. So x.pages suppose you got a new book and uh in that book the pages are maybe 90.
>> Okay.
>> So based on this condition >> what you will do? You will say >> basically >> uh someone's mic is again on >> please turn it off.
>> Now a will become 90. Right now since you have updated the value of a now you have to calculate the number of books. B is keeping track of number of books with maximum words the maximum number of pages. Right? So previously B had some value. You need to reinitialize it. Right now there are two options. B is =0 or B is = 1. Which one will you pick?
>> Why?
>> There's one book.
>> There is at least one book that you have currently seen and based on that you are updating the value. So that's why B is equal to one. Is it clear? Yes.
Okay.
Now question number 11.
Again we are using library data set. Let A be an author who had written a book in the library data set and B be a positive integer value.
What does the procedure do? Something come. Okay. So there are two parameters A and B.
A is an author. Okay.
And B is positive some positive integer.
We don't know much about B. So B is some positive integer.
Now uh we have two internal variables C and D. C is initialized to 1900 and D is 2022.
Now we are iterating over the data set and we are saying if author is equal to A and year is greater than C then C is equal to the year of uh current book. Okay. And uh if year is less than D then we are saying that year is sorry uh D is equal to the current uh year in the book.
Now we have one more condition. Once we are done with this particular iteration then we have one condition. If C minus D greater than equal to B then we are returning true otherwise we are returning false. Okay.
So first of all is the pod code clear or is the procedure clear? What is trying to do? What it is trying to do?
>> Repeat.
Yeah.
So first of all, A is some author. Okay.
We are passing some author name. B is some positive number. We don't know much about B. So it is just a positive integer. Now we have C. P uh from the conditions below you will see that C is basically 1900 and that is year. Okay. And D is 2022.
Okay.
Now we are comparing whether the author is A or not. Okay. If the author is A then we are evaluating these things. We are saying that uh X do year that the year of the current book is greater than C or not. If that is the case suppose we have uh a book which is maybe dated in 1953. Okay. So X year is 1953.
I'll just say x doy and uh when we compare line number six that is if x dot e greater than c it will evaluate to two true so we will update the value of c will become what is it clear >> yes >> we will >> yes and what will happen to d if it's less than uh 2022 So suppose book was written in 2020. So it will record 2020.
>> I have already given the >> Okay. So >> right.
>> Yeah. It's 1950s.
>> Okay. Now over here we are saying if C minus D greater than equal to B then we will return true otherwise we will return false. So this particular iteration we did just for single book right sorry this particular it is not given no >> what is not given >> b is not given >> greater than >> like when we call this procedure we will pass a and b okay so you can assume it is given but for the current context of the procedure it is not given outside it So the procedure is saying that the book is written between 1900 to 222 >> between these two years.
>> 1900 to 2022.
>> Why do you think so?
>> So because X here is greater than C. So X greater than C means after 1900. And then they have said if x year less than d which means like less than 2022. So between these two years I guess.
>> Okay. What about uh line number 15 16 and 17.
>> A = x.
>> Okay. I haven't read them. Sorry.
So can you take that now and uh tell me what do you think?
[snorts] >> If the book is written after 1900 then we will like uh we will uh replace that 1900 with that year after like if the year x year is greater than 1900.
>> Okay. At the end what C and D will represent?
What will C be and what will D be?
>> Recently written book like C maybe >> C. Yeah. Yeah. Correct. What about D?
>> D maybe I don't know. I'm confused about D.
>> D will be the first book.
>> First as in >> very earliest book. Yeah. Okay. So, is this clear? So, what will C minus D give?
C is the latest book.
D is the earliest, right? Or the oldest book.
What will C minus D give?
>> The difference of the year in the field, sir.
the air between his first book and the last book like the gap.
>> Yeah, correct. Now we have a uh variable B.
So can you tell me what uh will uh like when will we return true? Now take this line number 15 and tell me when will return true?
>> When C will be greater than D.
>> When it's a positive integer.
C is greater than D.
>> That is fine. But in terms of option like uh the way >> when the uh when the author have uh a latest has released a latest public book like suppose the author has written a latest public uh book on 2020 and it uh previously it was written last book he wrote in 1970. So it will return true then.
So it is basically saying that if the difference between their uh latest and earliest book or oldest book is at least d years then we will return true otherwise we will return.
Is it here?
>> If the difference is at least what you said like the a at least difference should be of >> those uh what was C.
>> C is the latest book like the year of the latest book.
>> Okay, I'll just write latest. What is D?
is the year of the book he has written like the earliest the first book I guess we can say >> okay first book now we are saying C minus D that means this is the D frames between these two ears right so the difference between his first hook and his last hook okay is it here.
>> Yes.
>> Last as in uh the latest one.
Now if that is greater than equal to B, so at least B. Okay. Then we will return true otherwise we will return false. Is it clear?
>> Yes. I thought that you said some numerical value for B but it wasn't written in the question. That is >> it is some numerical value.
But we don't >> and this specific value given for B like it wasn't I thought you said that greater than equal to three or something like I missed.
>> No no no no no I said B somehat.
>> Okay. Uh option A is it correct or incorrect?
>> Correct.
>> Correct.
>> Incorrect. Incorrect. Incorrect.
>> It is saying second. Okay.
What about option B?
Correct sir. Uh it is correct sir.
Correct.
>> The last book of was this one. Okay.
What about C?
Incorrect.
This one is also incorrect because again it is comparing the second class.
>> What about D?
>> False.
Okay.
>> Yeah.
>> So, option B is the correct one. All the others are incorrect.
>> I hope this is clear. If you have any doubt, you can ask now.
>> No sir.
>> Okay. So we again have a pseudo code and based on the options we can see that uh there is some mistake in the pseudo code and we have to find that. First of all uh this pseudo code is getting executed on course data set. There is a variable a and it is caping the number of female students who are above average in at least one subject. Okay. Then we have three variables M, P and C. They are holding the average marks of the subject. So M is average marks of mathematics. E is average marks of physics and okay.
So is a clear what is happening with A?
What we are trying to capture in A?
So a is basically capturing the number of female students who are above average in addition. Okay.
So this there are two conditions basically.
First condition is >> P the student >> gender should be f >> okay and there is one more condition just write and um it is their parts so I'll just say x dot mathematics marks should be greater than uh at least above average it's saying gave a average. So >> average by the way >> will be it will be this. Okay.
Now x dot e greater than this x dot uh c greater than c. There is some mistake in this. Can anyone point out?
Have I missed something in these two conditions?
I think >> is it or and you have written or else I've written.
>> Yeah.
>> It should be all because in the question they have asked at least one subject.
>> Uh could you repeat that again? I can get you >> in the at least one it should be or >> okay so this is clear right?
>> Yes sir.
>> Okay.
>> Okay. Uh let's go through the pseudo code then.
So here we are initializing a. So that is correct.
Now >> and in line five it shouldn't be a is equal to 1. It should be uh you should increment it.
>> Okay. So line five is incorrect. Let's first go through this one. What is happening with the procedure? So in the procedure we are saying that uh gender should be false. Uh sorry female. So that is correct and uh then we are comparing math slots with C1. So for that you need to check this how we are uh passing the value. So as you can see the first parameter is X the second one is M third one is P and fourth one is C.
So C1 is basically representing what? M.
Okay.
In the procedure C1 is representing M.
C2 is representing P and C3 is representing C. So you have to take note of this and keep this in mind while analytic. So in line number 11 we are saying Y dot mathematic mass is greater than C1.
Okay this one right?
Then we have and for this one and then we have and for with this one. So these are the three things. So is this correct?
>> No sir, >> this should be odd, right?
So line number 11 is also incorrect.
We are returning true or else we are returning false and then we have over here false. So these part are connected. So if this if fails then we will directly move to else and return false. That means >> uh if gender is not equal to female then we will just return false. Okay. So that is correct. So line five and 11. Any other line?
Sir apart from this can you please tell like uh for at least condition and we having three options like in this question only we are having three condition like the x math is greater than c1 and all that for at least one if we have to choose how we will use and and or condition in this like this and shows that we should we will have to achieve more than average marks in every subject but for at least one subject how we will depict If you have this or this or this, this is at least one.
You are saying at least one, not exactly one, right? At least >> at least.
>> So when you are saying at least one, it could be one, two or three, right? What if they ask like in case of like exactly one then what would be the condition?
In that case you have to check uh for exactly one you will you can't directly do this right you will have one variable and uh maybe instead of just giving true false you will uh calculate basically the number of uh greater than conditions like suppose if this is there then you will maybe have some count variable I'll just maybe now write C. So initially you will initialize it to zero. Then you will check for math. If math is greater than that then you will increment C. You will do for physics. This kind of question you might have seen in I think your G then you >> so they will be given in different if conditions. Yeah, three if conditions and uh in those three if conditions if either or all of them we evaluate to true based on that you will just increment the value of C and at the end you will do if C is equal to what >> you're taking for exactly >> equals to one for at least one then we will say yeah it's >> not for at least one this is exactly >> okay >> this is for exactly right >> oh okay like So you're saying that we can't depict that at least one subject we will have to get more than average in just one row like they have given in this 11th line right >> for at least you can do for at least you can do this is the condition that we are using this is for exactly so if you have to check whether uh there is just exactly one subject in which uh they are satisfying this particular condition maps greater than uh average maps physics greater than average physics function greater than math uh average chemistry if you have to check that then you need to keep a variable track the number of uh track the number like this C is equal to 1 2 or 3 and at the end you will do this C is equal to 1 got it so there are two things I'll just write it cleanly once so for at least one condition you have to do X dom.
Okay. So this is for at least one.
This you can write in a single statement. Okay. Right. And for the exactly one case you can >> and we will substitute and in place of.
Right.
What exactly?
>> Like uh x maths is greater than maths and x physics is not greater than physics and x chemistry is not greater than chemistry like that.
>> Not like that.
If you have to check at least uh sorry uh exactly one then it could be this this or this right? Any of these could be true. Just one like if this is true other two should be false right. If this one is true then these two should be false.
Right?
>> Yes.
>> Now you will check this and if this is the case you will increment this particular variable.
This will be some C = C + 1 kind of thing.
Okay. Again you will do the same thing for physics.
Uh C = again C + 1. Okay. And similarly you will do for chemistry as well.
Okay.
Similarly you will do for chemistry as well. And based on that you will have some count value and at the end you will have one if condition again and uh you will do if c is equal to this. This is checking exactly one or not. So if this condition evaluates to true then you will return true otherwise you will return positive.
>> Okay.
>> Is it clear?
>> Yes.
>> Okay.
So now we will move to okay first of all which are the correct options for this one line number five I guess for this one and line number 11 right >> yes sir >> yes sir okay now multiple return function that is correct option E is correct we Right. Uh why line number five?
>> Line number five is >> assignment, right? We need increment.
>> Okay.
>> Excuse me sir. So can you please scroll back to the question? Like in that only the first else condition uh we can say that if the student is not female the else condition then it is false.
What is the use of second else condition in line 16 or what? It is 18. I guess it is 18th line.
The else in 18th line.
>> Okay. So here you are saying if gender is equal to female, right?
>> Uh yes.
>> But you also need to check no that uh gender is uh male or not. Okay. So for that case >> we will need to evaluate this and based on that we are returning false. So if gender is male then this particular line line number 10 will evaluate to false.
So since you see we have the return statements inside if condition right if this statement evaluates to false we won't execute these lines line number uh 12 and 15 we won't execute but since this is a procedure it needs to return something right >> so to return something we have to add >> okay >> got Yes sir.
>> One thing you can argue is uh which is also done in practice during programming. So you don't need the else condition over here. You can just say return false. So that will work because the if you go in this branch you will already return true. If you go in this branch you will return false. So from the else part you are already returning two things. it won't uh uh like it won't uh just execute and uh return nothing.
So this part is sorted and if this if condition becomes false if it evaluates to false then you will come to line number 18 and it can just return this.
You don't need this condition in that in that thing. So that uh is generally done in programming but uh you for now you can just remember this pattern and how things are working. Okay.
>> Okay.
>> Line number sorry uh question number 13.
Now again we have words data set and uh we have a variable a and it captures the number of sentences with at least two nouns that have at most two bobbles. Okay. So a is captures the number of sentences with at least two nouns. So number of nouns should be at least two and both nouns. So all the nouns must have number of wobbles at most. This is at most.
Okay. So these are the two things and this one is multiple select. So we might have multiple correct options.
So a and c we have initialized then we are checking part of the speech and uh then we have count wobbles of x less than equal to two and based on that we are incrementing c. Okay. So first of all let's see the procedure whether it's correct or uh not. So I is equal to 1, B is zero and we are iterating over all the letters and if the letter is if the current letter is a vable we are incrementing B and we are incrementing I and then we are returning B. Okay. So what do you think is the procedure doing the correct thing or do we have any error in this?
>> I think the I condition like 21st line maybe >> line number 21 >> line number 21 >> it should be incremented outside the while loop.
>> Yeah, it should be after line number 22 and before line number 23. Correct?
>> Yes. Yes.
>> Okay. So, line number uh 21 is incorrect. I'll just write it over here.
Once we fix that, then this is this looks correct. This also looks correct.
If x dot word ends with a full stop and uh this is the thing then we are incrementing a and uh then we are changing c to zero. Is it correct or incorrect?
>> Line number 10.
>> What is what is the issue with that one?
>> Uh I think Z is equal to Z1 increment.
>> Sorry, could you repeat that?
>> I think C is increment the value.
>> C should increment. Why?
I think uh CS initialize in after line number 11.
>> Line number 11.
>> Line number 10 should be after line number 11. Is that what you are saying?
>> Yes. Yes.
Okay.
Uh what is the reasoning for that? Why do you think so?
So also we need to uh check uh the number of words uh with u nouns and the uh the vowel count it's at most two after every sentence in each every sentence and we are just reinitializing C when we are finding that uh the that type of sentence otherwise we are not reinitializing the uh C exam for each and every sentences.
So that it need to be reinitialized after 11 um what the uh if condition uh in the seventh line.
>> Okay. So what you are trying to say is basically C is uh uh uh C is for every sentence, right? And since in line number seven we are checking uh that the word is ending with a sent uh full stop.
So the sentence ends here. Okay. Once the sentence ends we need to pre-initialize C so that it tracks the new sentence now.
>> Yeah. Yes.
>> Correct.
>> It need to be reinitialized for every sentences.
>> Yeah. Yeah. Correct.
>> Only line number eight seems to be wrong.
>> Line number eight. Yes.
>> Okay. What is the issue with that one?
>> Because so far uh you you are considering if the part of speech is noun and the vowel count is at uh at most two then you are incrementing the count.
>> So if the part of speech like the word ends with full stop.
>> Yeah.
>> Okay. Then you should reinitialize the count. Okay. And you should uh consider a plus like whatever the count it is capture the but uh here if the she is less than uh greater than uh equal to two does not makes any sense.
>> We had this uh condition it's written over here.
>> I think the option uh line number 21 is incorrect because it will be outside the bracket. Yeah, that we already discussed, right?
>> Line number 21 21 is incorrect. And uh >> yeah, I was not there in the >> Okay. Okay, no issues. And we also said that uh line 10 should be after line 11. Okay. So write that.
Okay. Yes, 10 can be after the uh bracket >> after the curly braces.
>> Yeah.
>> Outside the inner a block.
>> Could you explain it?
>> See uh here a is representing number of sentences. For number of sentences what we need to do? We need >> two nouns with two vowels in each noun.
>> Yeah, that is that is correct. But uh to check whether >> the number of sentence >> yeah to check the num uh to check whether uh a word is ending the sentence or not. So in the data set we had uh full stop right with each word that was uh ending the sentence we had a full stop. So we are checking in line number seven we are checking whether there is full stop or not. If that is the case then we are checking this particular condition. Okay. And based on that we are incrementing it. Now what C was doing? C was keeping track of current sentence. Okay. And how many sentences are doing this thing sorry uh in the current sentence whether this uh thing is getting satisfied or not. Okay. And how many words are satisfying this particular condition in the particular sentence. Now once the sentence ends based on line number seven, we need to reinitialize C so that it starts tracking the next sentence. Right?
>> So to do that we are moving T outside this okay otherwise it will it will reinitialize only when the previous sentence had this and greater than equal to two. We don't >> I have a question sir. In line number seven you are checking whether the word ends with a full stop or not. So we are checking whether it ends with a full means we are checking whether the sentence is getting end with that word or not. So uh in that when the sentence is ending uh then we should reinitialize C to zero otherwise C will be like that same on the sentence means on the sentence uh on a sentence C should be initialized to zero one time only not >> okay I think uh uh uh in which line you want to move C is equal to Z >> uh no I want to keep C at the line 8 was eight.
No, no. In line number 10, I want to keep C.
If you do that, if you do that, then you are uh keeping this intact. No. So suppose you have a sentence.
Uh let me first write two things.
These are the current answers we are agreeing with. So you are saying C should be over here and uh first of all what C is trying to track what C is capturing? Can you tell me?
She's capturing the uh I think uh it is the calculating whether uh the number of uh nouns with at most two vowels in a word.
>> Yeah. T is capturing the number of nouns with at least sorry at most two vowels.
Is it clear in a sentence?
>> Now for each sentence we have to reinitialize C. Is this clear?
>> Yes sir.
>> Okay. If that is the case, suppose we have a sentence uh maybe of four words, okay? And uh two of them are none. Okay? This one is the ending.
>> So for this one, C will be two at the end of the execution.
>> Yeah.
>> Right. Like uh uh once we finish this part, C will be two. And now we will check line number seven. It will say that uh yes the word ends with full stop.
>> So go to next line. We are checking C is equal to two or not. Uh sorry we are checking C is greater than equal to two or not. It will evaluate to true. So we will increment it. Is it clear?
>> Yeah. Yeah.
>> Now we are reinitializing C.
>> Okay. For the next sentence. This is clear.
>> Yeah. Now suppose we have another sentence in the data set and there are five uh words in it. Okay.
And only one of that is a okay.
>> Okay.
>> Now what will C become for this one?
>> One >> at the it will be one. Okay. Now we will again evaluate line number seven. It will say true. Right.
>> Okay sir. I got it because uh in that sentence in the next sentence since there is one noun therefore c equal to 1 so it cannot satisfy the uh equation if c greater than or equal to two or not.
So therefore if it is not satisfied then it will not go into the if statement and the c will not be initialized to zero.
You are telling that right?
>> Yeah.
>> Okay. Okay.
>> Is it clear?
>> Yeah.
>> Okay.
Any other doubt related to this question?
Okay.
So this is the last question that we have.
Again we are using this course data set and uh we have a variable C and it is capturing the number of pairs of students who have the same date of birth or the same city town but different gender. Okay.
So three things we have to evaluate. Do ob should be same and uh uh this city or town could be same.
There is an or condition and then this gender. Okay.
Now we have some part of pseudo code given over here and some part of it is missing. We have to based on the uh thing that we are trying to track in C we have to fill out the missing code.
Option A is it correct or uh incorrect?
>> Correct sir.
It's someone is saying incorrect.
Someone is saying it's incorrect.
>> Sir in this question like uh gender being different is an like necessary condition different gender.
>> Yeah.
There are two things >> and we have huh >> this is the first thing. This is the second thing >> like same city town and different gender are the compulsory one. They both should be together.
>> Hey, first option seems to be correct.
>> Okay.
>> No sir, I think first is first option is wrong.
>> Incorrect. Uh actually if uh this type of found that the data birth is same and also it satisfy the second case then we will implement C2 times for one student.
So it will not be uh correct.
>> Correct. Option A is incorrect. Any doubt in this one?
>> Okay. What about option B?
>> Correct because um after the first step it's checking else.
>> Yeah.
>> So we have else and uh that will only evaluate when this condition is false.
So this fits correct. But I think this one is an MSQ. Yeah, this one is an escape. So, we might have multiple correct options. What about option C?
>> It's wrong because uh the whole thing will work as and.
>> So, it it'll be right.
>> What about uh the last one?
>> It'll work because we have an or.
>> Yeah, I already showed this uh in the first semester. So that's the correct one.
Option D and option B are the correct one. Other than that all the all the options are in.
Okay. So that's all for the session.
>> I have a doubt in uh >> July 2024. Question number uh >> July 2024. Can you share your screen?
>> Uh okay let me share my screen.
>> Yeah. So that can you tell me that uh from the given two condition which like I'm like we have 2 is equals to 2 and we have two equals to equals to two between these two which condition is correct like true >> 2 is equal to is equal to 2 is correct because there we are evaluating right we are checking whether that condition is uh true or not and 2 is equal to 2 is incorrect because there we are trying to assign and assignment is uh only for Okay.
>> Are you able to see my screen?
>> Yeah. Uh, assignment is only for uh variables, right? And both side are integer. So, you can do that.
>> Are you able to see my screen?
>> Yes. Yes.
Yes. Yes.
The following pseudo code is executed using the words table. At the end of the execution, count stores number of years of word verbs such that both verbs have either the same letter count or both end with a true stop.
Pair of verbs. Both verbs have either the same letter count or end with a full stop.
I have chosen these two.
same letter count part of a speech filter is there. Okay. So two filters are already there. Okay. Scroll to the options.
If X dot letter is equal to this X do word and Y do word. Okay. Looks reasonable to me. First option looks reasonable to me.
Second, if this is this ah uh can you scroll up a bit to the question stem? Yeah.
Okay. Uh this has the same issue that we discussed just now.
Scroll uh scroll to the first option.
There you are incrementing count twice.
>> Okay. Okay. Huh. Got it. Got it. same thing right it >> okay uh any other doubt okay and then I'll close the session and all the best for your >> sir >> yeah go ahead >> sir I have doubt in practice assignment week three question number five >> uh if If you have opened it in your screen, can you just share your screen and we can discuss quickly?
>> Okay, sir.
>> Otherwise, I'll have the sir, I'm not able to see my screen.
Uh, okay.
I can't.
Okay, let me pull up the question. Uh, which week was it? Week three practice assignment.
>> Okay.
Three practice assignment question number >> sir. Question number question number five.
>> Five.
>> Okay. Yes. The following pseudo code is that we created using the scores data set. Assume that the variable holds the average physics mark. What will be the values of uh these at the end of the execution?
Yes sir. This question Okay. What's your doubt in this one? Uh >> sir, question number six. Then question number seven.
>> Uh yes sir.
>> Okay.
Count B and count. Uh so were you able to solve question number five? This one?
>> No sir.
>> So what's your doubt?
Sir, I don't understand this question.
How do I solve?
Okay.
So, there are four variables given. Okay.
Average P holds the average physics marks and count A, count B, count C and there is one more count D. There are some more variables which are defined over here. Okay. So if you see average P is given as 73 and it uh stores average physics mode. Okay. And based on average P we are calculating two more variables mid 2 and mid one. What is mid2? 1.25 into >> average P.
>> Average P is 73. So you will calculate this and you will get uh mid2. Similarly >> 93.75.
>> Yeah. uh whichever value you get and then you will do the same thing for mid one.
Okay.
>> Okay.
>> So you will get the these values then you have the four variables initialized over here. Now you are iterating over the cards. Okay.
>> Okay.
>> If the gender is female then you will check x do.physics for that particular student is greater than equal to >> mid2 or not. Okay. If that is the case, you will increment A. If it is between mid 2 and uh average B, you will keep it in B.
Uh between average P and uh mid one, you will keep it in C and below this you will keep it in D. You are basically creating four pins, right?
And all bins will just contain female students. Okay? Since you have the female filter over here. So all the bins will contain female students in the first bin. This one you will keep all the female students whose marks is greater than equal to >> mid. Mid M2 I'll just write.
Okay. In the second bin, you will keep all the female students who are satisfying this particular condition.
Line number 11.
>> Okay.
>> For third bin, line number 14 and fourth bin, line number 17.
>> And now you have to basically in line number uh sorry question number five, you have to tell how many uh cards or students are there in uh bin A and in bin B. And then in C you have to pay. Is it clear?
>> Okay sir. Yeah I got it.
>> Okay.
>> Thank you sir.
>> Any other doubt?
>> Hello sir.
>> Yeah >> sir. I want to know something string and character. Sir my question is can we add a string to a character?
Can you add a string to a character?
So, uh, a string is basically multiple characters, right? So, let's say str I'll just write and character is some single character. Okay.
Now this one depends on the programming language. Okay. For uh Python it will work. In CT we have defined two separate uh things two separate uh data types. So in theory you shouldn't do that because uh there are two separate uh things. But uh in some languages like Python there is no concept of character there. Okay.
So this and this gets treated as a string and then you can add them in our pseudo code language uh basically characters are in a single inverted comma and the strings are in double inverted comma. So suppose I have to make a word like apples. So if there is a word apple in double inverted comma and we do we write apple into double inverted comma plus s in single inverted comma. So will it turn into apples into a double comma string?
So apple is basically a string and there you are suppose trying to attach some character as for the pseudo code that we are using it should be addable. Okay.
Yeah. Uh you can add them think okay you can add them and in the exam we won't ask these type of questions. So for now you can just keep in mind that uh you can add these but later uh if you find some programming languages where these two uh these two data types are different there you can't add these things. Okay. But for now you can uh assume that uh these are addable.
>> Okay. So that's why I asked whether a character or end screen can be added or not.
>> Yeah. Yeah. I got your push.
>> Okay. Thank you.
>> Yeah. Any other doubt?
>> No sir.
>> No sir. Sir.
>> Uh. Yes sir.
>> Yeah. Go ahead.
>> Uh sir can you open the mock test question number two.
Mock test question number two we solved just now. Uh okay let me open that.
Did you join late?
>> Yes sir.
>> We saw the whole paper just now.
Question number two. Yeah.
>> So why the A option is wrong? I was confused in both option A and B.
>> Why do you think uh it is correct?
>> Uh sir it says assign to assign to to or and they have given an or option right or operator.
So this should be uh true right?
>> When the interpreters start uh evaluating these things they start from this to this. So it will see that two.
Okay. Two is a valid thing. Then it will see this. It will say this is also valid. Okay.
Then it will see two again. Then it will see the whole thing and it will say this is not valid. Why? because you are trying to assign two to two which is not possible. You can assign to a variable you can't assign to an integer.
>> Okay. So if we have uh two uh equals to that's uh so that will be true right >> uh must uh if we have must be an operator like two equals to >> like in the second like in the second option uh uh instead of and we have or operator >> even in that case this will be true.
Sorry, not two. Well, this is valid. I I meant uh this is valid. This one is invalid because 2 is equal to two. It is trying to do that is assignment. So, it is invalid. But this one is false because of this part. But this particular thing is a valid expression.
Right? The first one is invalid expression.
Yes sir.
>> Is that clear?
>> Yes sir.
>> Sir.
>> Yeah. When we will get 22 in in just uh I mean when it is 2 + 2 it is invalid in I mean in D column number one of in D it will invalid right because one is integer and one is character.
>> Yeah this is invalid.
So sir when will you get 22? If we want an answer as 22.
>> This will give 22 equal to 22.
>> And similarly we will get four when we remove the inverted commas. Right?
>> Yeah. 2 + 2 in integer form is four.
Right >> sir.
>> Yeah >> sir. Uh, one second.
>> Let me plug one second.
>> Yeah.
>> Sir, for the first question, the answer is option B, isn't it?
>> For the first one, the answer is option.
This is invalid.
S first question.
>> Okay. Question number first.
students from. Yeah, correct. Option B, >> sir. But my portal is saying that the answer is option D.
Last option.
>> That is incorrect.
>> Your portal. uh it is showing incorrect.
This one is the correct one because we don't have uh lot of >> mark but the only showing the expected answer is option B. So that only >> that is incorrect. That is incorrect.
>> Okay sir. Thanks.
>> Yeah.
Any other doubt?
Okay, I think there are no more doubts.
I'll close the session and all the best for your exam tomorrow.
>> Thank you, sir.
>> Thank you, sir.
>> Thank you.
>> Thank you.
Love Meeting is inside.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23