Here i am going to explain how to sync quote in apex .
We have "SyncedQuoteId" field on Opportunity object. If we want to sync a quote with opportunity then we just need to update opportunity with Quote Id as shown below. Then the Quote will be in sync with opportunity which we updated.
Opportunity oppobj=new Opportunity(id=opportunityId,SyncedQuoteId=quoteobj.id);