Sensex – It is calculated based on 30 scrips selected by them. These 30 stocks are selected from different industries and they have given certain weigtage consolidated to 100%. if the price of these stock would go up, then the sensex will grow based on the weitage of the stocks.
Nifty – It is calcluated based on 50 scrips selected by S&P in the similar way as above.
These scrips are revised from time to time