What will happen if i put colored toner in Black white laser printer cartridge

Yes it will print green. The machine doesn't really "sense" what exact color of ink is inside the cartridge, but some can read the sensor and see if it is the right catridge, however that means nothing if you put a different color in it yourself. It counts on the user to fill them and insert them correctly. It can sense the amount of ink left, however :)


Aren't the cartridges key-coded, to prevent inserting the wrong color in the wrong slot?

For some printers, it's done electronically: the ink cartridge has a small electronic part that tells the printer which color it is, how full it is, whether it's a genuine cartridge or a third-party one ...