I completed my b tech in ece.But want to pursue my ms in cs.

So,I want to know if the actual course duration is 2 years - will taking prerequisites extend my course duration to 2.5years.I also want to know if this will affect my study visa.

Well, it always depends on how many prerequisites you get and how many credits you take per semester. There is no such defined course duration, unless you are in a defined cohort program. You can complete it in less than 2 years as well. If you have valid F1 visa while entering, it should be fineā€¦All you need to do is maintain your F1 status after you are in US.