 So, we are starting the next session. In this session, we will actually be conducting the quizzes based on the background material that has been given to you. Can somebody will give me one of the pages please? So, I hope each one of you has a page containing the background material for the quizzes. The first question will be on a simple principle that ASCII course are numbers which are allotted in ascending order to the corresponding characters of English alphabet. So, are we ready to start the quiz? So, when the power failed first in this room and then in the other room, the people who restored power partially in that room ensured that the network connection to our quiz server has failed. So, interesting. Anyway, so at least let us continue some discussion. Let us go back to the problem that I was discussing before we broke. I hope I am audible in the other classroom also. Sushant, can you once again confirm please all three am I audible? Yes, you are audible, sir. Thank you. Yes. So, I was telling you last time if we have let us say two character strings, let us call it CARS S100 and CARS S200 and we wish to determine which of this string is larger than the other, not larger, but greater and greater in the lexicographic sense. That means, if a character is greater in ASCII code than the corresponding character of the other string, then the whole string is pronounced as greater than the other string. So, how will we test this? Assume that we have read these strings. Let us say these two words have been read in. Sorry, yes question. No, I thought you had a question. So, how will I run an iteration to compare these two strings to say which one is larger? I have to compare S1I with S2I for I equal to 0 to what type, what point? Let us suppose we have two strings. First is capital A K A S H and then small a K A S H. So, are both strings same or the first one is considered as greater than the other? I told you the rule is first you check the first character of one string and the first character of the second string. If the first character of one string is larger than the first character of second string, then the whole string is larger. Capital A and small a have different ASCII values. So, depending upon which one is larger the whole string will be deemed as larger. That is the ASCII rule. For the time being we will assume that all letters in the words that we are looking at are capital letters. So, this confusion will not arise. Assuming they are all capital letters how will I still run an iteration? So, now let me calculate the length of each string. I know the function to be called. You agree that by these two function calls I will get the length of two strings in L1 and L2. Now I have to run an iteration I less than what smaller of the two. So, how do I find out the smaller of the two? So, you have to find out the smaller of L1 and L2. I can also use a function if there is a function for finding out minimum or finding out maximum of two integer numbers. Let me assume arbitrarily that there is a function called min which will tell me the minimum value of the two integer parameters pass to it. Is this clear? I am assuming that min is a function which takes two parameter values and returns the minimum of the two. Whichever is the minimum of the two I have to run my iteration up to that string ends. That is the suggestion that you had given. So, we are doing this here and I will increment I. What is the action I need to take? If S1 I is greater than S2 I then what? Else what? S2 is greater right? Any one character if this is greater that is greater then the string is greater. Of course I have written I have not written here cold I have written only a command which means you will have to write an appropriate code to see out or whatever. After this what do I do here? Nothing if neither this nor this is true I will not get any print out I will come out here and I will go to the next value of I and do the same thing. Obviously if I already located that one string is greater I should not waste my time in posting anything further. So, there should be a break in either of these things. If I do not break I come back here and I continue. When I come out here I could have come out for one of the two reasons. One all the characters in both the strings are identical so far in which case no string is greater. Second I would have come out because of the break statement here after printing something. So, what should I print here now? I cannot arbitrarily print that both strings are same that means it is not adequate for me to just print that S1 is greater or S2 is greater. It is important to remember what was the decision and that is the reason why you usually have a flag a variable which you may set to 0. If S1 is greater than S2 you may set flag to 1. If S2 is greater than S1 you may set flag to minus 1 and then when you come out here examine that flag. If it is 0 both strings are same. If it is 1 S1 is greater than S2. If it is minus 1 S2 is greater than S2 is that clear? You can use I itself as a flag why because when I do this correct completed and the value of I will be equal to minimum of this. So, if I is still less than min of L1 L2 then I have already printed my correct reason. If it is not then I can print that the strings are same. Actually that statement will also be incorrect. The strings may not be same if both strings are not identical in length. If the other one is larger then the strings are not same. How do you compare two strings of unequal length where the characters in the smaller string are identical to the corresponding characters of the second string. But the second string has more characters. No I am asking a more fundamental question. Suppose I have two string. Sir. Yeah. Sir, in the loop if we change the maximum value of I have to be minimum of L1 L2 equal to add an equality. No I am asking a more fundamental question. These are the two strings BE and BAST. If we follow the logic the smaller of the two is BE and the first two characters of BE are identical to the first two characters of BAST. In which case my program would actually say that there is no one greater. But that is not correct. In such situation what you ordinarily do is you pair the smaller string with blanks. Please note that the ASCII value of a blank is smaller than all other characters. In fact the ASCII value of blank is 32. All other printable characters start from 32 onwards. So, blank space has the lowest ASCII value. If you do that then you will find that best is larger than BE which makes common sense. You can apply the same logic that whenever you find the two strings to be compared are different in length. You can artificially pair the smaller string by blanks by pushing the backslide zero further and then make a comparison. Or if the smaller string ends first you can come you can just declare the other things to be larger. If so far you have not found any mismatch. So, let me see if my team is ready to conduct the quiz. They said they will take just five minutes or something. Are you ready? So, here we go with the first quiz, but before that you will have to re-login now. So, switch on your tablets. Now you will have to login to this IP address. You do not have to login again. If you are logged in in that classroom what they have done is they have swapped the server ID. So, this ID is now valid for that classroom and whatever you entered as IP address is valid for this classroom. So, what was that address? Just change that here. So, just confirm that you are logged in onto the quiz interface. No problem. 172.17.1.10. So, the Akash clicker software has some problems because the main server has calmed out. In the next five minutes we will run this quiz directly. I hope viewers in hall three are able to see the quiz on their screens. Are you able to read the words there? You are able to read this? Yes. So, very quickly. Hello. Can you temporarily dissociate yourself with Akash tablets? May have your attention please. I want you to stop discussing about Akash tablet for the time being. I am now conducting a class. So, please rest assured that you will get another chance when we will have all five hundred tablets working properly. Right now let me just complete this quiz so that people can go home. You have wasted enough time of this afternoon. So, we will do this with by raise of hands. By now you would have figured out what is the ASCII value of the later P. So, is it A raise hands if it is A? Both classes. Yes. Both classes. Nobody is raising hands. Is it B raise hands if it is D? Raise hands. Other classroom. C please raise hands. Yes. Ah. It is one fellow raised hands and then took it down. Yes. Okay. What about you? Nobody C. Nobody, anybody for D? No. Anybody for none of these? Okay. Now just a quick discussion. How do you find this out? A by cheating and looking in the ASCII table. B by looking at your neighbor and C whether the neighbor raises the hand then you also raise the hand. Or D you actually did the Godagiri of calculating A, B, C, D, E, F, G, H and then calculated that value of ASCII value of P should be this. Which one is true? C. Okay. Okay. Fine. Next quiz. There is a program given to you for comparing strings that is in your write up. That program is executed. The input values for the two strings are hexagon and hexadecimal. What will be the program output? You get two minutes to solve this quiz because you will have to hand execute the algorithm, the program that has been given which is printed in your sheet. So you hand execute that algorithm for these two input strings. String one is hexagon and string two is hexadecimal. Professor Prakashwaj just corrected an English error. You are not comparing strings. You are comparing strings. So one R is missing there. So you have half a minute more. Okay. By now you should have hand executed the algorithm because at most you have 20 iterations of that algorithm, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, etcetera, etcetera. So now we will have raised hands again. How many of you think the answer will be A 0? Please raise your hands. Nobody. How many of think the answer will be 4? B raise your hands. Okay. Good. How many of you think that answer will be C? Please raise your hands. Nobody. How many of think the answer will be D? Please raise your hands. 1, 2, 3, 4, 5, 6, 7. Good. There are 2, 3, 4 and some others. Good. How many of you think that the value is E? Namely, the value printed cannot be predicted. 1, 2, 3, 4. In the other class, how many hands? Srichan, can you count? I can see 1, 2, 3, 4, a few hands. Alright. 10, almost 10. Okay. So let us discuss this problem. You have the program in front of you. Please note that there is a critical statement called break which is commented in the program that is given. The break statement is not executed when you execute this program. Those of you who are saying 4 are saying so because when the index is 4, at that point in time, the character being compared is G here and D here, hexagon and hexadecimal and D is different from G. Therefore, these 2 strings are different. That will be the first value of I for which this should be different. Unfortunately, the loop will continue to execute. It will continue to execute till I becomes equal to 19 and you will exit from the loop although your program has determined which is different, whether it is different or not. It will come out at 19 and it will position the value as 19 which is the 20th character. That is possibly a correct answer but that presupposes that some character which is available already in the memory locations of those bytes which go beyond hexagon and hexadecimal are identical byte value. That is the assumption. We do not know that. We do not even know whether they are different and that is the reason the actually technically correct answer is that the value printed cannot be predicted. Although in most compilers, you will get the value as 19 but B is incorrect for the program that is given. So, now solve your question. Sorry, it is incorrect because this will not be the last value assigned to diff pass. The diff pass will get a value 4 because at that point the strings are different but it will go back again and examine the next character. We do not know whether the last two characters will be different or not different because we have not put anything into those locations. Please remember that when I do a C in, C in will take whatever characters that you input and put them into the appropriate positions of str1. What the remaining bytes of str1 contain? You do not know, I do not know. What the remaining bytes of str2 contain? You do not know, I do not know. 19 happens to be the value of I when you exit the loop that may happen to be the value of diff pass if diff pass has been assigned that value but that comparison in any case is meaningless in the context of the comparison of the two words. That is the point. So, now let us look at quiz 3. Quiz 3 time is less than 1 minute. The program is modified by removing the comment around the instruction break. That means there is no commented break. The break is actually a statement inside the iteration. So, the iteration now reads for I equal to 0 I less than 20 I plus plus. If string 1 I is not equal to string 2 I, diff pass is equal to I break and then see out diff pass. So, now the moment any two characters differ the diff pass will get the appropriate value assigned and you will come out of the iteration. If all characters are same you will remain inside the loop and terminate normally. In this particular case if the value input given is same hexagon and hexadecimal what will be the program output? A how many of you say A nobody here nobody in classroom 3. B how many of you say B very large number. This time you are more confident of life. C how many of you think C 1 2 D 19 none. E the value printed cannot determine none. Let us discuss 4 and 5. So, there are some people who said 5 can you tell me why it should be 5 in your opinion. It is probably because it is the fifth character which is different is that what is your reasoning hexagon and hexadecimal. So, D and G are different, but notice if you read the program the index value of I at that point will be 4 and not 5 because the string index starts with 0 1 2 3 first 4 characters are same. When I is 4 the two characters will differ and that is the value which will get assigned to dipos. Incidentally, the better way of writing this program is not to run the loop arbitrarily all up to 20, but like we saw in the example that we briefly discussed run the loop up to minimum of the two lengths and then check whether there is still something left in the other case in which case the dipos should be the character next to that otherwise it should be identical and dipos should be 0 all right. The last quiz these are small, but subtle points I hope you have learned something a little more or you have got a little more clarity on what happens when you have string characters inside and when you compare them. The fourth question is related to the description of the disk that is given. Let me go to the document mode and show you something for half a minute before I post this question I am not very good at drawing. So, assume that this is a circle looks reasonably close. Now the disk is actually a circular platter coated with magnetic material. Now you can draw any magnetic embedded information anywhere here, but to make sense the information is written in concentric circles. These are logical circles called tracks. So, the information is written on these tracks there is a spindle here around which the disk rotates and there is a magnetic head there is a motor mechanism here which actually moves this forward and backward. Now this magnetic head has the property of being able to read or write there. Obviously if I want to read or write on to the disk I will be reading or writing to a specific track and therefore it is necessary to move this magnetic head to that track position. Suppose I want to read or write somewhere let us say here. Now I will have to first move this magnetic head to this point. This is called seeking a track and it takes non-trivial time to move that magnetic head that is known as the seek time or the seek delay. I have mentioned that in the small writer after the magnetic head is so positioned you are now ready to read or write from that track, but you do not know at that point in time where is the piece of information you have. It may be here, it may be here in the worst case it may have just gone beyond this or in the best case it may just be here. So, anywhere on the track the desired information may lie that is why we said last time that as the disk is rotating on an average I may wait for half the disk rotation to get access to the information point where I want to read or write. So, in short I have a seek time plus I have a rotational delay these two together will define the average excess time of information in a disk. The next question corresponds to that particular problem. So, here is a quiz time is actually one minute where I will give half a minute to read this question. A disk has an average seek time of 3.2 milliseconds and it rotates at 12000 rpm. The average time to access data randomly on this disk will be 3.2 milliseconds, 5 07 milliseconds, 8.2 milliseconds or none of these. So, you have the background information in front of you you have a piece of paper and pencil do the arithmetic we have 5 more seconds left everybody has completed the calculations a simple calculations actually classroom 3 you have completed the calculations. So, I will not now ask you to answer the quiz answer a 3.2 milliseconds please raise your hands nobody there is one fellow who half raised his hand in all three no watching option b 5 millisecond please raise your hands option c 5.7 milliseconds you raise your hands really large number option d 8.2 milliseconds please raise your hands nobody you see the advantage of the aakash tablet would have been that suppose I was confused between c and d then while answering on my aakash tablet I have no other choice, but to correctly estimate and give an answer. But when I am sitting in a classroom I look at my neighbors and people are raising hand to see I will say c although in my mind I might have thought it is d that is the reason why we conduct quizzes in an isolated fashion etcetera taking one hour in one day that is the reason why we believe that a tool like aakash would be useful because we can conduct these quizzes every 15 minutes or 30 minutes in a classroom clarifying things to you as they are being discussed. However, I hope you understand the advantage here now let us just analyze most of you said c is 5.7 milliseconds I would like to go to some other classroom hall 3 would some student volunteer to tell all of us why does he or she think that the answer is 5.7 millisecond Sushant can you hand over the mic to some student any volunteer there otherwise yes pick up somebody is there a volunteer. Sir. Identify yourself and then tell us the answer. Sir, Dev Kumar. Yeah please go ahead. Sir, this total average time is basically the sum of the rotational delay and the seeking seek time. So, I just calculated the rotational delay to of the half of the time to rotation of the rotation of the disk. So, it came out to be 2.5 millisecond and I just added to the 3.2 millisecond and it came out to be 5.7 millisecond. Yeah. So, it is a very straight forward arithmetic at 12000 rpm the time taken the number of revolutions per second are 12000 by 60 which is 200. So, that means one revolution takes 1 by 200 second that happens to be 5 milliseconds half rotation will take 2.5 milliseconds and 2.5 milliseconds plus 3.2 milliseconds is 5.7 millisecond. There was why I gave so many answers is that there are some people last time who contended that I can do the action of moving the magnetic head and rotating the disk simultaneously. So, since that is happening parallelly I need not count the seek time separately at all that is one come because while the operations are happening parallelly that is you are moving the disk and you are also moving the arm. The point is whenever the arm comes on the track that is desired track at that point where is that information is still unknown and you have to count the average delay from that point which could be half the rotation. So, we will conclude this by saying that this is the time that you will need to do a random input output. It does not mean that to read one byte it will take so long because once you have sought a track and once you have identified the beginning position then the subsequent bytes are read at the speed at which the disk rotates and since a track contains extremely large amount of stuffed information the time required to read let us say 100 bytes from that point onward is minuscule. So, you can say that one record can be read in this much time. This is referred to as number of input output operations that are possible in random mode on the disk or number of I ops as they call it I O P S input output operations per second. Traditionally the input output operations per second from the disk were 50 then they became 100 they stabilizing around 200 because of the continuous reduction in seek time and faster days that you get, but you will agree that these times are nowhere near the time in which memory can be accessed. Second it is for this reason that you do not always read or write data randomly anywhere in the disk you try to keep related data continuously on the same track. So, that once you have reached the track in half a rotation you can read a million bytes of data, 2 million bytes of data, 4 million bytes of data assume there are 100 tracks on the disk and the disk capacity is 2 gigabytes how much is the information on one track all of it can be read in one rotation type. So, the amount of information that you can read sequentially after you have reached a position is very large and that is exploited when you handle disk files will not discuss any more on the disk files. What I will do is for the direct access files I will upload a brief write up my slides which I had made to be discussed today, but we did not get time you can read that those slides and maybe I will put a spoken tutorial or a spoken lecture rather than a video along with those slides and put up some sample programs those will of course not be relevant from an examination point of view because direct access files I am requesting professor Sridhar Iyer not to include them as the material for exam, but for those of you are interested in finding out how these direct access files work this would be perhaps useful. I will take about a week to do that, but by next Saturday I might if we get all the technology components such as power and network and everything in place I might request you for a joint class again on a mutually convenient time for just one hour so that we can actually see whether the Aakash tablets work properly for conducting quizzes or not. Can somebody from hall 3 just say whether I was audible completely. Yes sir. Good so this class was useful. I have got it out can I ask. Yeah can you can you hand over this mic to. Regarding that. Sorry you wanted to say something okay go ahead. I have got it out can I ask. Oh you got it okay. So just hand it over to somebody else your neighbor the camera is still not focused on your neighbor. Can I see the neighbor who has the mic please. Oh yes. I wanted to ask you a question when you are sitting in that room and listening to me and looking at the screen are you comfortable you are able to see and understand whatever is being discussed over to you. Yes sir. Yes sir. Good good thank you so that means this experiment can work you see the advantage is that if let us say there is a person like Professor Deepan Ghosh who used to be a absolutely top class teacher of PH 101 but he cannot teach every year or he cannot teach four divisions or five divisions but if we have this mechanism where people can sit in three or four classrooms and students can routinely swap every third or fourth lecture to be physically nearer to the teacher then this should be it should be possible for one teacher to give all the lectures in the course but the tutorials, discussions and quizzes can be conducted in different batches. Do you think this is a feasible solution? Thank you so much. Good day and thank you for listening to me patiently for the last week.