Thursday, 19 November 2015

Why CFL has an upper hand over incandescent light ?

Have you ever heard that using CFL in place of incandescent light would be better ?

Have you ever thought what could be the precise reason for that ?

What is the prime purpose of having a bulb for ?
     
                                                  Apparently it is for getting light.



Consider an incandescent light. If we give 100% of energy to an incandescent bulb, 90% of this energy is utilised for generating heat energy (which is not at all our purpose) & 10% is used for generating light energy.




Now consider a CFL bulb. If we give 100% of energy to a CFL bulb, (30-40)% of that energy is utilised for generating heat energy & (60-70)%  is used for generating light energy.




The above two statements aptly explains why CFL has an upper hand over incandescent bulb.


Other points that can be made out are

1) CFL lasts 10 times longer than an incandescent bulb.

2) CFL uses 1/3 rd of the energy used by an incandescent bulb to produce same amout of light, which implies that electricity bill on CFL would be 1/3 rd of that of an incandescent bulb.

3) In fact by using CFL, in place of incandescent bulbs, we can prevent greenhouse gas emission to some extent. Wonder how ?

    Where do we get electricity from ? Mostly 70% of the electricity that we use is generated from thermal stations by burning coal, which release greenhouse gases into atmosphere. If we use less energy(by using CFL), this indirectly implies that we are preventing greenhouse gas emission to some extent.

NOTE: Comparison was made only between CFL bulb and an Incandescent bulb. LEDs were not compared above. It would have revolutionised the entire article if comparison was made.

Monday, 9 November 2015

Why a zero watt bulb is called as zero watt bulb ?

Zero watt bulb, by its name,  doesn't mean that it will not consume any energy. In fact the rating of zero watt bulb is 10-15 Watt. But why is it named as zero watt ?

The answer is, in olden days, when all other loads are turned off and only one 10-15 W bulb is turned on, as sophisticated measuring instruments were not present, the conventional electromagnetic measuring instruments present by that time were not able to record very small consumption (10-15W).  So the name zero watt has come into use for 10-15 W bulb.

But now with the presence of much sophisticated instruments even a fraction of  watt can be  recorded, but the convention of calling them as zero watt bulbs still continues .................


Friday, 6 November 2015

If b=a+++++a+++a; What would be the output ?

If we use pre increment operator in a statement, then increment takes place first and then the statement gets executed. But if we use post increment operator in a statement the statement gets executed with it's older value and after this statement execution increment takes place 


Ex: a=10;
      b=a++; //b=10,a= 11

     a=10;
     b=++a; //b=11,a= 11


NOTE: You may have a doubt that If you use b=( a++)+(++a)+(++a) or any other statement which involves multiple pre or post increment or decrement operations on the same variable then what would be output?   

The answer is undefined i.e. it is a compiler dependent. The compiler won't give an error but different compiler gives different outputs and no c++ rule define their execution.

Wednesday, 14 October 2015

What is compile time & What is run time ? ?

We write program in high level language. But computer can understand only binary language (0's and 1's). In order to achieve this conversion from High level language to Machine language,compiler is used. The time taken by the compiler to convert the High level language to machine language(binary language) is called as compile time.

The time taken to execute the compiled program is called run time or execution time.


Tuesday, 13 October 2015

What is inline function in C++ ? ?

Sometimes we may come across using a small function many times in a program. Consider we use normal function definition. Whenever a normal function call is encountered, the program will store the memory address of the instructions which are immediately following the function call. It load the function being called and executes this function and stores the return value if any. Now it jumps back to the stored memory address,which is the memory address of the instruction which is immediate to the function call. So too much run time is involved here. In such cases we can declare the function as inline. This declaration is done by just keeping "inline" before the actual function definition. If we use this inline declaration, then compiler replaces all the function call statements with the function definition so that jumping can be avoided,which in turn decreases the run-time for the program.

***By using inline function, we are increasing the compile time  and decreasing the run time.

***It is just a suggestion to the compiler but not a compulsion. i.e, If the function is big,but it is declared as inline, the compiler won't treat it as inline function, it just treats as a normal function only.