 Good morning everybody and welcome to the second day of this workshop. As I had mentioned yesterday, this workshop is not about learning computer programming. All of the participant friends have been teaching computer programming to their students. So we expect that all of you are fairly good at C programming or C++ programming. However this workshop is about teaching programming to students and therefore in this session what I am going to discuss is the way we introduce computing to our first year students. I would like to comment here that the traditional syllabus of most colleges insists on first teaching the basic hardware concepts, then teaching something about compilers and operating systems and then introduce programming. Most of us at IIT and in fact many amongst you would find this sequence unnatural. After all to learn programming in a higher level language does not require any deep understanding of computer hardware or for that matter the underlying operating system and so on. This dilemma is not completely solvable but the way we attempt to introduce programming to people here is we frame our own computing model using some extremely simple terms. I shall be covering that kind of approach in this session on introduction to programming. Along with this we have prepared a few simple animations. Hopefully all the material will be released in open source so we will be uploading the animations as well as the lecture slides on the moodle as well as on the home page. Please feel free to copy these, use these and of course modify these if you so wish. So here we go. In this session I will introduce you to a computing model built around a hypothetical character whom we call Mr. Dumbo in English or Mr. Budhuram in Hindi. We will describe the memory model that Dumbo uses. We will see how Dumbo interacts with us then we will look at the Dumbo's computing model specifically how Dumbo executes instructions. And finally we will describe the Dumbo's ability to store instructions which is what makes a computer so different from any other gadget because the computer is a stored program machine that means it can store instructions and execute them one by one. So we begin by looking at our computing model. We introduce a character called Mr. Dumbo or Mr. Budhuram. Here are two caricatures. The first one is a line drawing which I attempted to draw. The second one has been more professionally drawn by a graphics colleague of mine. We designate the Mr. Budhuram or Mr. Dumbo as our computer and we see how exactly Mr. Computer behaves. So here is the first set of observations about Dumbo's ability. Most important we emphasize that Dumbo cannot do anything on his own but can execute given instructions correctly. So that means Dumbo is not completely dumb or an idiot. He has the capability to understand our instructions and execute them. However, he is incapable of framing instructions on his own. He will act only when an instruction is given otherwise he will not do anything. What are the abilities of Mr. Dumbo? We state that he can do arithmetic operations, logical comparisons, he can manipulate strings and so on. Essentially then he can operate upon and manipulate values and produce resultant values. This point is important to be emphasized. The Dumbo's sole objective in life is to get some values from us, manipulate them as per given instructions and give the resultant values to us. That is all Mr. Dumbo does. Since the manipulation of these values involves logical comparisons, arithmetic operations, string manipulation, etc. We say that Dumbo can compute and in fact we claim that Mr. Dumbo receives the name computer because he can compute. This is essentially the introduction to our Mr. Dumbo's as a computer model. But the computing model or the programming model needs to be described in simplistic term which we now proceed to do. First we introduce the notion that Dumbo has assistance. It is important to indicate to our students that unlike in the old days where there used to be a central processing unit comprising of control unit and arithmetic and logic unit. In short a single CPU connected to memory, desks and so on. Something that we shall discuss later in the course as to how to describe that to our students. But that was the old style model. Today practically every component of the computer that you can think of has its own processor, has its own embedded software. For example you take a terminal. The terminal is almost a full-fledged computer in its own right. It not only captures keyboard strokes but it converts them into ASCII characters and communicates back with the central processor or the server. You take the monitor which is able to display whatever we wish to display. But the monitor today is a full-fledged graphic computers capable of handling graphics locally. You take a disk. The disk is connected to the machine through a disk controller which embeds various sophisticated algorithms to handle this. Consequently there is not a single computer that we speak of but actually a collection of computers. How do we describe this complicated notion to our students on the first day? The path that we take here is to say that we have one Mr. Dumbo and he has several assistants. One assistant can do arithmetic operations. Another assistant can do input output. A third assistant can do something else like displaying values and so on. In fact later on we use this notion to introduce software hierarchy also as a series of Dumbo's. So operating system is a Dumbo, compiler is a Dumbo. All these Dumbo's together constitute the super Dumbo who is our main computer. That is roughly the model that we initiate. I am explaining this to you. However at the level of the first year students in the very first lecture you need not really introduce all these complications. In fact the operating system, compilers, hardware and such words according to me need not be mentioned at all because the first year students are merely required to understand the programming concepts in the higher level languages which we propose to do. As I mentioned earlier the notion of these multiple Dumbo's representing different computers need not at all be stated in the first lecture. You only say that Dumbo has assistants and we shall see the use of these assistants in due course of time. We now proceed to define the computing model for this Dumbo. First and foremost we emphasize that Mr. Dumbo has very poor memory. Dumbo cannot remember anything in his head. It is important to mention this because most of our students are used to doing mental computing. So they can add 5 plus 4 in their mind and come up with number 9. And if you say 5 and 4 both of them can remember 5 and 4 as distinct numbers in their heads. Since they can remember they believe that Mr. Dumbo who looks like a human being can also remember things in its own hair. However since we are trying to depict a computing model with Mr. Dumbo we have to emphasize that Dumbo cannot remember anything in his head. So if Dumbo cannot remember anything in his head how does he remember anything? Because without remembering how can he do manipulation of numbers? So here is our computing model. We say that while Dumbo has poor memory he uses some kind of a cupboard with drawers as memory. So instead of keeping things in his head Mr. Dumbo keeps all the values which are to be manipulated all the results of all such values inside drawers which are part of a cupboard. We say that each drawer has a unique name. You will all appreciate that this is to introduce the notion of symbolic names or variable names later in the course. So each drawer has a name, a unique name which identifies the drawer. So this is drawer A, this is drawer E, this is drawer F etc etc. At this stage it is not at all necessary to indicate what is the largest value a drawer can contain and so on. The notion of word length, the notion of two byte values, four byte values, eight byte values, a single byte character etc etc should be introduced only later. At the beginning it is adequate for our students to understand that Mr. Dumbo who can manipulate values can actually put values into something like drawers of a cupboard where each drawer has a unique name. We then say each drawer contains some value. For example, a drawer can contain a number. So here we have shown number 437 being contained in a drawer which is marked B. And we say Dumbo's memory location B contains 437. Similarly, Dumbo's memory location F contains a string called Rana Day. So we show here Rana Day. Rana Day incidentally is the name of my colleague and in fact my boss, Professor Abhiram Rana Day is head of the Compute Science Department at IIT Bombay. This very clearly introduces to our students that Dumbo can store values, not only numerical values but also character strings inside these drawers which represent the memory of the Dumbo computing model. We now notice some peculiarities of the memory. We state that each location can contain only one value and not multiple value. It is important to emphasize that because students who have a single mind and the example that I gave some time ago that if you ask them to add 5 plus 4, they will add it to 9. And they can simultaneously remember 5, 4 and 9 as three distinct values in the same single head. It is important to emphasize having stated that Dumbo cannot remember anything in the head but Dumbo has to use the drawers of a cupboard to store values. It is important to emphasize that every drawer can contain only one value. Multiple values cannot be put inside a drawer which has been named as ABC or whatever. The second thing that we state is that the values in these locations which we have named as ABC or whatever are normally unknown. And what do we mean by unknown? We said if they are not defined by us, they are actually undefined. So usually we represent such values by a question mark inside a drawer. A question mark means nobody knows what the value is. It is again important to emphasize that there is no situation that a drawer does not contain anything. This our students will find hard to believe because when they compare it with the normal cupboards, there will be empty drawers. And if you open a drawer, you do not find anything. You say it is empty. We have to state that Mr. Dumbo's cupboard and the drawers are very peculiar. Every drawer always contains something the moment Dumbo comes to you with his memory. However, the contents are unknown to us because they have not been defined by us. So ordinarily we say the values in these locations are normally unknown. Now if they are unknown, how do the desired values get into these locations? And this is where we make perhaps the most important point of our computing model. We state that there are exactly two ways in which a desired value can get into the memory location. One way is we supply a value which Dumbo stores in that location. And the other way is Dumbo calculates some values using some power of computing and puts a value in that location. It is absolutely important to emphasize that there is no third way for a value to get into a drawer. I hope you will appreciate that while this model is extremely simple, it is very powerful. And in fact this fact is often missed out by many students and some teachers. The power of an assignment statement which thus computing and calculates a single value which gets stored into a memory location and the power of the input statement which collects a value from us and puts it in the designated location is known to us. But what we often fail ourselves to appreciate and therefore our students fail to appreciate is that there is absolutely absolutely no third way for a value to get into a designated drawer. If a drawer has been named as A, B, C, D, E, whatever, a value can get into a drawer by an input operation or a value can get into a drawer by a compute operation. Of course we do not state that as a compute operation and input operation at this stage and that is why I use a simplistic language here that if the values are undefined at the beginning how does a desired value get into a location? We state that either we supply a value which Dumbo stores in that location or Dumbo calculates a value and puts a value there. Of course it is not clear to our students how do we supply a value to Mr. Dumbo or how does Dumbo calculate a value? To illustrate that we continue with this simplistic model and state the notion of exchanging values with Dumbo. Notice that we are trying to introduce the basic input output operation. We say that Dumbo uses a cart which we call a data bus. Please note that the notion of bus in electronics hardware is something completely different from the notion of a bus that our students know and in fact the notion that our students know is more appropriate for the description that we are doing here. A bus carries passenger, a cart carries values that is the equals. So Dumbo uses a cart or a data bus to move values in and out of his memory and with the external world that is us. More specifically he can put a value in a location as instructed or can copy a value from a location and give it back to us. Notice that by the simple words we are implicitly emphasizing a very important point namely that an input operation which we shall describe later which permits us to supply a value which our Dumbo carries in the cart and puts it in a location will intrinsically destroy any existing value there and the new value will sort of remain in that drawer. However when we say he can copy a value from a location and give it to us we are stating that the contents of that drawer from which an output operation will subsequently be done are not destroyed at all they remain what they are. The Dumbo merely copies that value and gives it to us. So again all this is by the way an explanation to our teacher friends all this need not be stated at all. In the first lecture one can only say Dumbo uses a cart or a data bus to move values in and out. Dumbo can put a value in a location as instructed or can copy a value from a location and give it to us again as instructed. So far we have not seen how to instruct Dumbo but what we are trying to understand is how Dumbo does this exchanging of values with us and with his memory. We have shown here a numerical value but now we say that Dumbo cannot do anything unless he is instructed. So what if we give him an instruction C in greater greater B? You will wonder why does this instruction appear here. Since I am trying to indicate the way we teach programming at IIT Bombay our course syllabus by the way does not specify a programming language to be used. What we use is a mix of C and C++ You will observe that C in is actually a stream input command which can carry a value from outside world that is whatever is typed on the terminal into the computer's memory. So C in greater greater B is what we are saying here. Those of you who wish to introduce scanf or fscanf right at the beginning can do so. A better thing would be to write a small procedure using hash defined which resembles read or input or some such word. To emphasize that the instructions could look very funny to beginners we have added a few comments here in this slide. For example we say why C in, why not input, why not read, why not get because these are the English words which describe our intention best. After all we are trying to tell Mr. Dumbo take some value from us and put it in the location for B. In fact it would not be wrong to replace this complete line by a simple English command like take a value from us and put it in location B. However we are trying to go as near computer programming language as possible and therefore we directly use a very cryptic looking command right here. Subsequently when we give an example of a complete program people will see that the instructions in that program resemble these kind of explanations that we have given earlier about Mr. Dumbo's abilities and operations and they can relate one to the other. Here whenever there is a cryptic thing like this we immediately add a command why do we have to use greater greater symbol. Now this particular symbol which says greater greater is an intrinsic part of C++ input streaming using CIN. For C programming we might use parameters of a well defined function such as CANF. So there we can explain why percent D, why percent F and such things. In fact I will leave that as an exercise for you to make your contributions. Suffice it to say then that we have introduced indirectly the notion of a cryptic instruction that will have to be given to Mr. Dumbo. But we are still relating our instructions to the simplistic computing model that we have observed earlier namely Mr. Dumbo can take a value from us and put it in a memory location or Mr. Dumbo can compute a value or Mr. Dumbo can copy a value from a location and give it back to us. So in this particular case the input operation is indicated by saying that Dumbo will collect a value given by us, take it to his memory cupboard and store it in location B and we emphasize once again that any earlier value including an unknown value will simply be overwritten. So this states to the student that if there was a question mark or undetermined value in that location that will simply get destroyed and will get replaced by the new value which we are putting there. Similarly we emphasize or indicate the output operation. So we said Dumbo can output values from locations to us and the instruction to do so is C out less less G, C out less less A, less less G, less less square, less less root. Now all of these are actually valid C++ input statements. I by the way do not consider it improper to use the C in and C out statements in introducing these basic programming concepts to students. In fact you can use read or you can use any other sort of instruction that you think will be understood easily by the students. It is useful however to use instructions which we will use in a later program. Most probably the best strategy for all the participating teachers would be to use the basic slide set for introducing computing model but replace all these instructions by proper C instructions because the crypticness of any instruction whether it is C++ or C will not be understood and appreciated by our students anyway. So it might as well be that we use directly the C commands or C instructions as examples here. All that is important for our students to understand at this stage is that Dumbo will simply copy values from his memory locations and present these to us. And another important observation that we make here is that values in the locations from which these are copied and given to us the original values remain undisturbed. That means if a location contains say 430 the location will continue to contain 430 even though that copy of that value has been given to us. Then we introduce the notion of an additional feature. We say C out less less value of count is less less C. Observe that we are introducing the notion that we can display a useful string along with the value. So consequently when Mr. Dumbo gives us the value of C we know that he is giving us the value of C or value of count or some such thing. Later on in our programs right from day 1 we shall be using similar strings to emphasize that the output value belongs to such and such variable or such and such meaning. Having introduced that strings can be given to us as display we try out some of the Dumbo's input output capabilities. Here are two instructions that we have written for Mr. Dumbo. C out give value for B. C in B. The first one actually displays the string to us. The second one takes a value from us and puts it in location B. That part is indicated here diagrammatically where let's say value 437 is given by us on to the terminal monitor here of Mr. Dumbo and Dumbo simply puts that value in the card and takes it to the location B. Similarly we say give the value for location F and we say C in F. We are indicating that the character string is copied or is given by us and is taken and put inside the location F. However just to add some fun I have indicated here not a character string but simply the name run a day. Now to indicate that a character string is written differently in programming languages not just as R A N D A R A N A D E I indicate here in a jocular way is Dumbo carrying professor run a day himself? Of course not. How do we distinguish between a string and a person himself? Well we distinguish that by putting a string symbol. So there is another repetition of this slide which says give value of F and this time what is being given is a character string enclosed in double quotation marks. I have found that this simple example permanently h's in the minds of our students that character strings have to be written in quotation marks. Just to indicate that this is now happening correctly we have shown a smiling Dumbo here like a smiling Buddha. Now we look at Dumbo's computing model. So if two numbers are stored in drawers A and B say 35 and 12 Dumbo can add these and store the result in another drawer say some. Observe that we are now using this simple model to illustrate to our students the notion of an expression the notion of an assignment statement and the fact that after assignment statement the value of the left hand side variable will now change and will reflect the value of the expression on the right hand side. Again in our first lecture we do not mention the notion of expression we do not use the word assignment statement. We merely say we are instructing Dumbo to compute the sum of two numbers and we say that two drawers contain two values and these values are to be added. Another important point will be indicated in the process of calculating these sums which we shall see in a moment. We first say that we instruct our Dumbo to do this computation by saying sum equal to A plus B. It is quite tempting for us to emphasize that this is an expression evaluation this is an assignment operation this is not an equation etc. etc. I submit that we should desist from doing any of these things in our first introductory lecture and that is because the notion of syntax of a computer programming language at the higher level is not very easily understood immediately after the students come for our first lectures. It is useful therefore to continue with the Dumbo's model where we say we give an instruction to Dumbo and Dumbo follows that instruction. It is adequate at this stage to say the instruction that we give to Dumbo to compute the sum of two numbers let us go to the previous slide. We have already indicated that we have two numbers stored in drawers A and B and we want Mr. Dumbo to add these numbers and get the result in another drawer called sum. So the word sum A B two values to be added etc. has already been given in this slide and therefore in the next slide when we just say that we instruct Dumbo by saying sum is equal to A plus B students adequately understand this to be an instruction to Mr. Dumbo to add two values in drawers A and B and put the result in the drawer called sum. Ideally I should have shown a value in A value in B and value in sum. In fact an animation which I shall show you later illustrates this point. However I had drawn this drawing I remember late night at 2 o'clock and to open this drawer A which was a line drawing would have taken another 15 minutes which I was tired of doing. Otherwise A B both should be shown as having two values and the most important part which I have shown here of course in this illustration is that the sum contains a question mark. If there has been no previous instruction assigning a value to sum indeed the sum will contain an undefined value and as we have indicated in our earlier slides to begin with Mr. Dumbo comes with a set of drawers which all contain undefined values therefore it is appropriate to emphasize that before this instruction is executed by Dumbo the drawer sum will continue to contain an unknown value or an undefined value as designated by this question mark. Now we illustrate something very important again which will be explained much later in the course when we talk about hardware registers and the actual computing model and so on. We start by asking the question how will Dumbo do this? How will Dumbo compute the sum of A and B and put the value in sum? This time we said Dumbo uses his assistant or junior Dumbo's. The junior Dumbo which is roughly the representation of our arithmetic and logic unit by the way we say that junior Dumbo uses rough sheets or registers. Incidentally the register inside the computers processor and a plain register that we are familiar with or all of our students are familiar with are fundamentally no different. These are pieces of paper in real life bound in a sort of volume which we call register which we use for writing something. Here in the case of Dumbo we say that junior Dumbo who is an arithmetic and logic unit equivalent will actually do the computation using some rough sheets or register. So we introduce the word register without going into the details of that register at all. We merely indicate to the students that register is something like a scratch pad to be used for doing these computations. But how exactly does the computation happen? Well we suggest that what this Dumbo junior does is he accesses the location A and will copy the value which is 35 into a register. Then we say Dumbo junior will access the location B and will copy the value which is 12 into another register. Please note that when we are teaching high level programming languages it is completely useless to describe machine architecture as single register, two register or a window of registers etc. All of this can come in due course of time. It is adequate to say that Dumbo uses registers and since our students are familiar with multiple registers existing around them they are comfortable with this explanation that Dumbo junior accesses the location A, copies the value into a register accesses the location B and copies another value into another register. And then we say Dumbo adds these two values and the result is stored back in location called sum. Location sum will now contain value 47. This is perhaps a very important explanation from the perspective of actual computing that happens even inside a computer but observe how easily it can be explained using Mr. Dumbo as a computing model. We illustrate this further using a line diagram. So here we say that junior Dumbo uses a set of local registers which are like working sheets kept on a table. So here we have some working sheets here which are kept on a table and we have shown here directly the value 35 which was copied from A the value 12 which was copied from B and the final value 47 which is computed by Dumbo which will then be put inside the location called sum. Observe that an animation which displays actually the sequence of events that happen in computing could be extremely useful. Our colleagues here have made one such animation which I shall show you in a moment. We emphasize that when Dumbo is done with this simple computing as instructed A and B will continue to hold the existing values and location sum will now contain 47. Again I have indicated B to continue to contain the value 12 and sum now has a value 47 instead of a question mark. At this stage I would like to switch over to show you a couple of animations that have been prepared but if there are any questions from the participating teachers I will have a 5 minute interaction after the animations are seen. So here is an animation which we where we are showing the different cupboards that Mr. Dumbo uses and how the input operation is done. Let us go over this animation once again. So when we show this animation for example it will be useful to actually keep talking about the animation verbally. So here we say this is Mr. Dumbo. He has a set of drawers in a cupboard which are named ABCD whatever. We simply show the various drawers that can open and they contain something. Now here is an input operation Dumbo is carrying a value 5 and this value 5 will be kept inside a drawer. So he opens the drawer puts the value 5 inside that location and the location C now contains the value 5. The Dumbo goes back. This is one illustration. I would like to emphasize that this is an extremely elementary animation which our team has prepared for this workshop in rather hurry. I think by seeing this most of you will get ideas on how this animation can be improved. In fact we look forward to such ideas from you so that we can incorporate them and make this animation better. Here is another animation that I would like you to see. This one illustrates the addition of two numbers by Mr. Dumbo. Input operations are shown where drawers A and B will now contain two values. The C is shown to contain a question mark. Now Mr. Dumbo takes the value 35 copies it into a register. The two registers are shown on a table. Mr. Dumbo then copies another value 12 from the location B and puts it in another register. Then Mr. Dumbo does computation 12 plus 35 is equal to 47 and then this value 47 goes into a location called C. Now A contains 35, B contains 12, C now contains 47. I hope you will agree that such simple animations could explain the fundamental principles in computing in a much neater way. I would like to have now a 5 minute interaction with participants from different places. Is there a request from any center otherwise? Let us just go by the list that I see here. Can anybody point out an error, not a conceptual error really but an error which if corrected can make the second animation better. There is also an error and there is a connectivity problem with our earlier slides in terms of semantics. Anybody would like to say something? Can we go to Badnira, they have a question. Sir, error point of view there is one error you have not stored the third value in register that is nothing but the location. I think you have spotted the error correctly but perhaps you are explaining it slightly differently. If you look at the animation you are right in that the first value is put on a register, the second value is put on a register, the third value which is computed should also be put on a register. It was shown in the animation as if it was just lying on the table and was directly going into a location. As we all know inside the computer it does not happen like that. The computing is done using values in registers and the result also first goes into a register. In real life in a single register or two register machine the resultant value will replace one of the registers itself. However we need not go into those complications at the first level but having stated that Mr. Dumbo uses registers for doing computing it is important to illustrate either in our line drawings or in animation that if a value a comes from the location into a register if a value b comes from a location into another register then the resultant value which is computed must also be first computed and put in a register on the table and the Dumbo should be shown to pick up the result value from that register and put it in the memory location. Thank you and congrats for finding it out that this is a semantic discrepancy. There is also another small discrepancy. In the slides we had used the instruction sum is equal to a plus b and consequently the result was going into a location which we had designated as sum. However in the animation the animators have used location c instead of sum which is not correct. Either we should change our slides to say c is equal to a plus b or the animation should be modified to include the drawback name as sum rather than c. Thank you MGM. Yes. Government engineering college Amruta Puri sorry it is not government engineering college. ASC has some comments. First we are going to Trishur. Trishur had some observation. Yes. Somebody from Trishur would like to say something. We also noted the problem with the registers. That time he raised the hand. Can we go over to Amruta Institute who had some comments. Amruta Puri ASC Amruta Puri. Hello sir. This is Praveena from Amruta Puri sir. Hello Praveena, good to see you. You have said that sum is equal to a plus b in that expression right. So a we will be having some value in the cupboard and b also we will have some value in the cupboard. In the c cupboard it is actually a c cupboard or sum cupboard. It is actually a garbage value. So when we add it in the work place we have to put those values from the registers into the cupboard. So we have to replace the garbage value with the actual value 47. So how we can explain this to the student in a proper way. Very good question. In fact that is another, I would not say error but a semantic discrepancy in the animation which our friend from Amruta Puri has found out. So let me suggest the following. If you remember earlier we are shown both in our drawers in the line drawing as well as in the animation that the locations normally contain a question mark. The question mark actually represents a garbage value. What we ought to do in our animation is that when the final value 47 is being put inside the location c then first of all Mr. Dumbo should open the location c look at the question mark, remove the question mark and throw it away and then put the value 47 inside that. Perhaps that will explain the replacement of a garbage value with the correct result properly. Thank you very much. It is a very important observation that you have made. It will help us modify the animation better. Amruta CBE has one question. Let's go over to Amruta CBE. Yes, Fratek this is JC. I am attending this course all the way. I just had one suggestion. Yes, JC. You got over the shocker. I was so enamored by your purta that I could not recognize you JC. Okay, just a suggestion. I don't know. This is probably one of the unique caps who is attending this course because I never have taught CS 101. So please forgive the kind of question that I am raising. The whole operation, the whole animation and slides contained one automatic operation which was not animated. When you take out the values from register A and B, sorry, you put the values on register A and B, then there should be some kind of juggling there animated such that you come out with 47. How does Dumbo get 47? Yes, yes, very good point. I think it's another excellent suggestion. But first of all, for the benefit of all 900 colleague teachers who are attending this workshop, let me mention a personal note. Professor Jay Chandrasekar has not only been my colleague for almost 4 decades, but he is also my Guru Bandhu. He was the first PhD student of Professor Kekri and I was the second one. And we have spent very exciting moments in this institute. I am sorry JC that I could not recognize. Perhaps you have worn a little less flunky kurta. I would have paid attention to your face. But anyway, coming back to the point that was being made by Professor JC, how is it that Mr. Dumbo suddenly gets 47 out of nowhere? It is indeed very useful suggestion and perhaps what we could do is show the normal arithmetic that we do 32 plus this. So you are the first digit and put that digit there and you are the second digit and so on. This will explain that Dumbo is doing some computation but it will avoid getting into the details of electronic addition and so on at this juncture. Thank you very much JC for making an excellent suggestion. So we now go forward with or there is a request from HGSITS. Hello. Yeah please go ahead. I am Malar Jattar from HGSITS. Yeah please go ahead. My question is that, can we store the values A and B in same registers in different locations? Okay electronic yes. I understood your question. Let me repeat it. Malar from HGSITS is asking whether the two values can be stored in the same register. The answer is unfortunately no because a register is exactly like a location. Just as a location can contain one value, one register can contain only one value at a time. It cannot contain two values. While we are not explaining the notion of electronic registers to our students at this stage but it is important to certainly indicate to them that a register is no different from a memory location in the main memory. Only the electronics is different as some of the students doing computer science or electronics will later on discover or as we might explain to our students somewhere towards the end of this course that registers are merely fast memory locations where data access input and output to the registers can be much faster or between the registers. However the point to be made at this juncture is that the answer is no. A register can contain only one value at a time just like a location can contain a one value. I hope that satisfies your query. Okay thank you. Then how many registers? I will guess your question Malar. What you are trying to ask is how many registers can there be inside a computer? While that digresses a bit from the introduction to computing principles because we do not want to get into any kind of electronics at this stage but just to answer your curiosity in the very old days computers used to have either a single register or two registers. In fact the electronic circuits of the arithmetic and logic unit could actually perform a computation using one value in a register and one value directly copied from the location into its circuits and the resultant value would get into that register itself and you would have instructions at the machine level to load a value into a register from memory all to put a value of a register into the computer memory and so on. However modern day computers have multiple registers. In fact some processors have a large bank of registers and not one bank but multiple banks. Later on when you describe the notion of context switching when an operating system is handling multiple programs then the contents of all the registers which are stuffed with values from one program execution are simply swapped out to disk and the other values pertaining to other program are brought in. This is what we will discuss when we discuss the operating system details perhaps at an advanced level of computing course later. However in actual practice there are computers such as spark processor for example which has actually multiple register banks and you do not push the values of registers into a disk when you swap the contents all that you do is shift the pointer from one bank of registers to another bank and consequently the time spent in context switching is reduced significantly. However all of this explanation I gave only as an additional explanation to satisfy the curiosity of our teachers I will repeat my request please do not at all use any kind of electronic explanation in the first preliminary lectures to your students because you are trying to teach them computing as done through higher level languages and not computing as is done electronically actually inside a computer at this stage at all. So in a nutshell it is adequate to say that we have as many registers on the table of a computer or Mr. Dumbo as we may require for any computation that would be adequate explanation. There was one question from SICSR Pune. Sir I am Prachi and I wanted to ask whether the concept of L value and R value should be introduced right now a little bit too early L value and R value of a variable like some will use. At this juncture we have not even talked about the notion of a variable and therefore it will be inappropriate to talk about L value and R value. I would like all of you to appreciate that in the first lecture where we are trying to explain to students many of whom perhaps would have never seen computer and certainly most of them would not understand the intrinsic nature of calculations that happen in a higher level programming language. So I will once again state that our purpose in the first lecture is actually not to introduce higher level programming languages at all. Our purpose in this lecture is not to introduce the notion of expression and complicated evaluation. Our requirement is not to talk about an assignment statement as we shall talk immediately in subsequent lectures. The first lecture is meant to give an extremely simplistic and yet a reasonably accurate model of computing as would be seen by a programmer when writing higher level language programs. We are not talking about higher level programming languages at this stage except telling them that there are programming languages in which instructions would be issued to Mr. Dumbo. We have chosen very specifically simple instructions such as an input operation, output operation and a computation of some of two numbers as the third operation. Here we are not talking about an instruction in a conventional higher level programming language where a complex expression appears on the right hand side of the instruction. There is an equal to symbol and there is a left hand side variable name. These notions will be introduced in subsequent lectures when we talk about variables, data types, expressions and so on. The first lecture should be as simple as possible for everybody to understand and once the basic concept is understood we can expand upon them later on. I understand that there is another question the lady is waiting very patiently. Please go ahead. Good morning sir, thank you very much for giving me a chance. Sir, I want to ask the question why C is called as a middle level language? Okay, I can see that my friends, all the participating teachers are becoming more and more curious and they want to get answers about all aspects of higher level language programming in the first lecture itself. But one mistake you made lady which I would like to point out I had requested that everybody should first identify oneself and then ask a question. Can you identify yourself so that all other participants also know you? My name is Zana Tarannum, working as a lecturer in Alana Institute Pune. Wonderful, nice knowing you and thank you for the question. Let me give you an answer. The answer is simply that the question is misplaced at this juncture. If some student asks you that is C programming language, why is it called a middle level language? We should simply ask that what is a language, what is a middle level language? We have not talked about any such things. We are talking about a dumbo who is trying to follow our instructions to do some computing. And the answer should be if such a question is raised by a student when we start discussing the C programming language or when we start discussing programming languages in general these questions will be answered adequately. In fact I will see that you get an adequate answer to your question later because there has been a lot of confusion on the middle level and things like that. To my own personal test such questions are completely meaningless today. C is as good as a higher level programming language as any other programming language that you have. The correct answer is that using C programming you can actually write programs which are very close to the hardware capabilities of a machine and therefore ordinarily a few things which you would do only at the machine instruction level or assembly level can be done almost similarly using C programming language and that is why the C programming language by many stalwarts is not considered a full-fledged higher level language where you have only higher level abstractions and no ability to handle hardware directly. Since C can do that C is sometimes called a middle level language but let me assure you that this nomenclature of middle level language etc is rather ancient. Some of the textbooks still carry that nomenclature I think in today's computing world such nomenclature is completely meaningless. I also now understand that when we have 22 centres and people have queries our timetable will go for a toss but our friends from COEP have a question so we should go over to COEP and see what they have to observe. We are not receiving data from COEP for some reason. Well, let me put it this way. Let us stop this interaction for a moment. Let me complete at least this session very quickly and I will come back to you at the end of this session because I have two quizzes in this session. Ordinarily I would have expected all participants to answer these quizzes using clickers but since clickers have not reached everywhere I will try to just ask these questions by posing them on the screen and then you can perhaps try and answer these as we go ahead. So let me go back and continue this session. We have already made two important points about Dumbo's capability that Dumbo can exchange values with us through instructions for input and output and Dumbo can do simple computation such as adding two numbers. However, what we have not explained in this model to our students is how do we give instructions to Mr. Dumbo. The answer to that is attempted in the few sentences here. Firstly we observe that most machines take one instruction at a time and execute it. So if you want to explain for example a machine like a fan if you switch it on it will start rotating. If you change the speed knob to another position it will start rotating faster or slower. You give one instruction at a time the machine obeys it. If you are driving a car then you press an accelerator the car will accelerate. You press a brake the car will brake. However, there is no way to instruct a car that you accelerate for three seconds then go steady for five seconds turn right then go steady for three more seconds and then apply brake and stop. We will have to actually give one instruction at a time to the car. The car will execute that instruction and then when we have given all the instructions in sequence one by one at a time then and only then the car may reach its destination. Unlike that we say Dumbo is special. To this Dumbo friend of ours we can write all our instructions in advance and give the entire lot to him and this collection is called a program. We now state that Dumbo has a capability to store such a program. Note that this is the first time we are talking about a computer program. So far we are talking only about individual instructions and the ability of Mr. Dumbo to execute these individual instructions. We observe that Dumbo is very special. We observe that we can write all our instructions in advance and give the entire lot to him. So Dumbo is capable of storing the entire lot of instructions such a collection which is called a program. Therefore we say Dumbo has a stored program capability. At this stage it may not be out of place to tell our students that in actual practice the computers did not always have the stored program capability right from Day 1. Please note when I say Day 1 I am not talking about digital computers but I am talking about electromagnetic computers. Perhaps some of you might want to tell a few historical notes such as the Jackass loom cards or punch cards which were used to store instructions and subsequently the evolution of von Neumann architecture because that architecture was the first architecture for digital computers which had the stored program capability. However it is not necessary to go into the details at this stage you can just say that Dumbo has a capability to store programs. From this point onwards we consistently use the notion of a program and we say all the instructions that we wish to give to Mr. Dumbo we can write in advance and the entire collection which is called a program can be given to Dumbo and Dumbo can store this program. The natural question is if Dumbo has only memory in terms of the drawers and cupboard where does this Dumbo store this program? Because so far we have seen that the drawers store values which are exchanged with us or which are computed by Dumbo and this is where we inform the students that look Mr. Dumbo uses the same memory to store our instructions as well and we emphasize that Dumbo logically uses some space in the cupboard for storing data values and another separate space in the same cupboard to store instructions of our program. Logically we can show these two as two separate covers standing next to each other but it is important to emphasize that technically these two separate spaces are called instruction space and data space. We have found that the word instruction space and data space is very easily understood by students when given in the context of the same drawers and cupboards by saying that some space in the storage area is used for storing data values and another space in the same storage area or cupboard is used to store instructions of our program. This is where by the way in the last two slides we have introduced the notion of a computer program, the notion of an instruction space and notion of a data space. Please note however that the instruction space is not in terms of binary instruction that actually a computer will store in its memory but we are talking about instructions that we have written so far like C in, C out or sum is equal to A plus B. We tell our students that such instructions are written in computer programming languages and our Dumbo is capable of storing these instructions and executing them. At this stage it is not necessary to talk about compilers, at this stage it is not necessary to talk about the fact that these higher level programming language instructions have to be first converted into machine instructions etc. Unless you have chosen the traditional route of first introducing computer hardware bits, the notion of machine instruction, assembly instruction etc. I would like to mention here that there are multiple ways in which computer programming can be taught. In fact the 900 plus teachers who have assembled for this workshop would have hundreds of different ways of dealing with teaching of computer programming. However the most accepted norm for teaching higher level language programming is to first directly deal with the higher level programming instructions in a programming language without going into the details of hardware and machine instructions and such thing. All of these can be introduced at a later stage but first it is important to form a model of computing in the minds of students and the model of instruction giving mechanism. It is adequate at this stage to state that instructions can be given using the instruction mechanism that we have just seen and the fact that Dumbo can store all these instructions in advance and automatically execute them one after another is adequate to tell our students the notion of a computer program. The next few slides indicate a full phase program now. So here is a complete program. If you read this program you will notice that this is actually a C program written in C++ except that instead of scanf and printf we have used C out and C in but this is a complete program. There are two comments here. This program takes two integer numbers as input and calculates their sum. There is a syntax error in English. This program takes two input numbers as input and calculates their sum should be the correct English. However, here again I would like to suggest that this is the program that we show in our first lecture to our students. You might want to rewrite this program as a proper C program if your syllabus says that C programming language is the only part in the syllabus. Now what we are doing is giving some kind of shock to our students. So far they were looking at a simplistic model called Dumbo and suddenly a very cryptic kind of lines appear before us. At this stage we may simply state that ignore the first few lines that you see in this program. These are required for a modern computing Dumbo to make sense out of all our instructions. And we say that at a later stage we shall tell you more about what these lines mean. For example, include iostream or include mat.h or include stdi.h. Such statements would be explained at a later stage. Using namespace std is a C++ command that will not appear in a C program. In fact, my request to all of you is to try to rewrite this and the next program in plain C such that it can still be meaningfully understood by students in terms of its semantics if not in terms of its syntax. Although the syntax has to be written correctly. So here we are trying to say int a int b c out give two numbers c in a c in b sum is equal to a plus b c out sum is sum and backslash n return 0. There will be large number of questions that students will raise in their minds. Some of them will ask those questions. How do we answer those questions depends entirely on the approach that we wish to take. If we have already introduced the notion of machine language and assembly language we can tell them about compilers. We can tell them about compiler directive such as include iostream. We can tell them that C programs are essentially functions and each function returns a value. My own humble submission is nothing of that sort should be attempted in the very first lecture. But this program should be given and in a lab they should be asked to compile this program on this program. What is important is that our students appreciate that by writing instructions they can actually make a computer do useful computational work. Whether the program is cryptic in the first instance yes it is cryptic. To make more sense out of similar cryptic program we typically use another example. So here is an example that I have constructed which is a program to convert temperature from degree centigrade to degree Fahrenheit. This program looks very similar to the first program. It has a different comment so that our students understand that it is trying to do something else. It also introduces the notion of a float C float F. Again please remember do not bother to explain in the first lecture what is float what isn't. Just say that all the symbols which appear such as A B some C F etc are nothing but memory locations and they all contain numerical values. Do not bother to tell them the difference between integer numerical values and floating point numerical values in the first lecture. But let them just see this program and wonder what this does. They will all understand by the way this is what I have uniformly found with all our students and you will find with all your students also. Once you tell them to neglect the sentences which they don't understand they will figure out from this script that you see on your screen or a similar program that people will see on their computer screens that the two comments they will understand easily. They will understand the word see out at see in because we have explained those instructions earlier. They will understand F equal to C star 9 slash 5 plus 32. They will understand it implicitly that slash means division and star means multiplication without us telling them. Why? Because the formula for converting from centigrade to Fahrenheit is known to all of our students and they understand that the centigrade value is to be multiplied by 9 by 5 and the value 32 is to be added to it. They will understand all this. They will understand C out F but they may not understand back slash N. They will not understand return 0. It does not matter at this stage. Again to conclude I will say that introducing students to actual higher level language simple programs is best done by directly putting two simple programs in front of them asking them to read and then asking them specifically to ignore anything because they do not directly understand and then ask them whether do they make sense out of it or not. You will find 95 percent of your students will say the first program adds two values and the second program converts actually from centigrade temperature value to a Fahrenheit value. And once in the consequent lab in the same day or the next day if they are told to execute these C programs by compiling them and running them and they actually see that to a value is given in centigrade which is converted correctly into Fahrenheit. They will develop faith that our Mr. Dumbo is actually a real life computer. The fact that there are many unknown things in this program and many cryptic things is alright at this stage. We will tell them that during the course of teaching this subject over the semester we will slowly but surely understand each and every sentence that is written in this program. In a nutshell in one lecture we have achieved the following important objectives. We have conveyed to our students that there is a very simple and accurate model of computer programming that is conveyed in terms of a Dumbo who can execute instructions. We have conveyed that the computer's memory consists of memory locations. We have conveyed that a location can contain only one value. We have conveyed that an input operation can change the value of a location. We have conveyed that an output operation does not change the value of a location. We have conveyed that the computation is done by Dumbo by copying numbers into a register and the resultant value goes back into a location. We have implicitly conveyed that an output of a string as in help can be carried out by Mr. Dumbo and we have suddenly said that Mr. Dumbo is nothing but a model of a higher level programming language without explicitly mentioning so. We have conveyed the notion of a program. We have conveyed the notion that instructions in a program pre-written by us can be given to the computer or Mr. Dumbo and Dumbo can store these instructions. We have subtly introduced the notion of instruction space and data space. Believe me, all of these are important concepts and while people will not understand the very specifics of these details but they will all understand and remember the fundamental notions that we have conveyed to them. I will end this session by two quizzes which I typically ask the students. This is the first quiz. Approximately how many different programming languages have been defined so far by computer scientists? We ask the students to guess because many students who come to first year engineering have some of them have actually done C, C++ programming or Java programming. Many of them have heard programming languages such as COBOL or Pascal or whatever and therefore it is interesting to ask them this question. Let me now go over to a particular location which was not there earlier. Let us go to Sona College for example. Since we do not have the clickers, let me ask you this question directly, visibly. I will repeat the question. Approximately how many different programming languages have been defined so far by computer scientists? Option A, about five languages. Anybody for option A? Nobody. Option B, 6 to 20 programming languages. Anybody for option B? No. Option C, 21 to 100 programming languages. Anybody for option C? Yes. I can see some hands being raised. Option D, more than 100 programming languages. Anybody for option D? Large number of people. However, it is interesting to see that some people have not raised hands for any one of the A to D options. That is not fair because the question covers almost all possibilities. There is another college which claimed they have an answer. Can we go over to the other centre please? A, C, Amruta Puri, they have an answer. Amruta Puri, what is the most popular option amongst the teachers assembled there? A, B, C or D? D is the answer. The answer is more than 100. Yes, I hear you. But no, don't pass on the mic. I would like to ask you one more question. The first discipline that we have agreed to follow, you have to identify yourself and then only ask a question or answer a question. So may we all know your name please? Sir, I am Tushara. Okay Tushara, my question to you further is that when you say more than 100, can you guess how many programming languages would be there? Would it be 150, 200, 300, 1000, 5000? Maybe more than 200. Well, I am happy that you actually tried to guess. Let me share this with all the participants across 22 centres. The exact number of computer programming languages, higher level programming languages so far designed by computer scientists is not known. And that is because practically at every university or college, a researcher in computer programming languages ends up defining a new programming language and some people mostly his students end up writing a compiler for that programming language. The last time I had done some count from historical books was in 1978 or 79 and at that time more than 600 programming languages were known to have been defined. Most of these higher level programming languages however die a natural death. Suppose I am a computer scientist at IIT Bombay, I will define a programming language, three of my students will implement it. After those three students pass out or have their PhD and go somewhere else and after sometime when I lose interest that language definition, its compiler, etc. will quietly die away in my computers. What we must distinguish and we must perhaps sometime tell our students is that while there could be hundreds of higher level programming languages and when I say hundreds, hundreds well defined and well implemented programming languages, the actual programming languages used are only a few. It is this usage part which is of interest to the students. That is the reason why you will find that when our students pass out their final year and it does not matter whether they are computer science students, there could be students of any branch. In IIT Bombay, some of the best programmers who have emerged in IIT in past two decades have not necessarily been computer science students. Notably aerospace engineering, metallurgical engineering, mechanical engineering, chemical engineering, civil engineering have produced students who have become extremely competent programmers. So, programming at higher level language is positively meant for students solving computing problem from any branch and that is the point that we should emphasize that all of them would tend to use a few programming languages based on certain criteria which we will elaborate later in the course. Let me go over to the second question. Quiz two says the symbol backslash n in the instruction c out f backslash n will produce the following additional output. The word additional is used to distinguish between c out f and c out f and backslash n. So, c out f would have produced the value of f but c out f followed by backslash n will produce we say a backslash n, b n, c nothing visible and end of line is inserted and d I cannot guess. Please note of course that this question is not meant for colleague teachers who would automatically say c because that is the correct answer but it is meant for our students who have never seen a backslash n in their life. Some of them may think that this will produce an output of n. Some of them will think that it will produce a string with backslash n. A few who will do programming will say nothing visible. Majority of them however should say I cannot guess because at this time they have not been explained what a proper output instruction in c or c plus plus programming language is. So, this is perfectly fine. Badnera is saying that they have an answer. Thank you very much Badnera. Everybody amongst the audience has the correct answer. So, we will not bother going over to you. We will insert have a break at this juncture.