It is possible to activate a virus during autoplay of Pendrive. To avoid this we can do a trick.
first open Run Command Prompt(or press windows key+r). And type "gpedit.ms", then the following window is opened

After then go to Computer Configuration and then to Administrative Templates and then go to or double click system folder and turn off Autoplay (Double Click on "Turnoff Autoplay") as shown below

and Done.
Tip: When autoplay of pendrive is stops then virus activation is also stopped.
first open Run Command Prompt(or press windows key+r). And type "gpedit.ms", then the following window is opened
After then go to Computer Configuration and then to Administrative Templates and then go to or double click system folder and turn off Autoplay (Double Click on "Turnoff Autoplay") as shown below
and Done.
Tip: When autoplay of pendrive is stops then virus activation is also stopped.