For each of the questions, candidates are asked: “If you have ever held a different position than the answer above, please explain what changed your mind.” Candidates who meet the group’s standard will be invited to the Moms Demand Action annual convention, held this year in August in Washington. The event drew 1,000 supporters last summer when it was held in Atlanta.

Mr. Bloomberg himself, who along with his groups spent more than $112 million on the 2018 midterm elections, has yet to engage directly with the 2020 candidates. Since declaring in March that he would not seek the White House himself, he has spoken to just one presidential hopeful — former Vice President Joseph R. Biden Jr. — according to Howard Wolfson, Mr. Bloomberg’s political aide.

Everytown’s questionnaire includes queries about whether candidates support universal background checks, restricting assault weapons and high-capacity magazines, and repealing a 2005 law — which Mr. Sanders, then a House member, voted for — that gave gun manufacturers immunity from civil lawsuits related to shootings.

Mr. Sanders’s past positions on gun control loom over the debate in 2020. In 1990 he won his first federal race for the House with N.R.A. support. Throughout much of his career Mr. Sanders was seen as a friend to the gun-rights movement, backing the 2005 immunity bill and opposing legislation that would have installed a five-day waiting period to purchase a handgun.

After being attacked repeatedly for his past positions during the bruising 2016 contest with Mrs. Clinton, Mr. Sanders in 2016, and again in 2017, co-sponsored legislation to repeal the gun manufacturers’ immunity. He earned Everytown’s Gun Sense Candidate distinction during his 2018 Senate re-election bid, as did each of the Democratic presidential candidates on the ballot last year.

Mr. Sanders is hardly unique in the Democratic presidential field for having changed his position on gun control. Senator Kirsten Gillibrand had the N.R.A.’s endorsement during her 2008 House re-election bid, Representative Tim Ryan of Ohio had an A-minus N.R.A. rating in 2012 and Gov. Steve Bullock of Montana had a B-minus rating in 2012. Senator Michael Bennet of Colorado had a C-plus rating in 2010.

Mr. Bennet, Ms. Gillibrand and Mr. Ryan were all rated F by the N.R.A. during their most recent re-election campaigns. Mr. Bullock earned a C from the N.R.A. in 2016 and last year announced his support for a federal ban on assault weapons. Mr. Sanders received a D-minus N.R.A. rating in 2012 and an F in 2018.