Step 1:
You need to run all the replica Set use below command
mongod --dbpath "c://1" --replSet abc --port 27002
mongod --dbpath "c://2" --replSet abc --port 27002
mongod --dbpath "c://3" --replSet abc --port 27003
Step 2:
Note: do close mongo shell, if you have close then reload
the data as per step given in homework 4.1
Step 3:
Run on mongo shell
rs.initiate()
then
use replication
then db.foo.find() to check data
then run
homework.b()
you will get your answer as 5002