It depends on the card in question. If it can't be determined use 0.
208.2a The card may have a characteristic-defining ability that sets its power and/or toughness according to some stated condition. (See rule 604.3.) Such an ability is worded "[This creature's] [power or toughness] is equal to . . ." or "[This creature's] power and toughness are each equal to . . ." This ability functions everywhere, even outside the game. If the ability needs to use a number that can't be determined, including inside a calculation, use 0 instead of that number. Example: Lost Order of Jarkeld has power and toughness each equal to 1+*. It has the abilities "As Lost Order of Jarkeld enters the battlefield, choose an opponent" and "Lost Order of Jarkeld's power and toughness are each equal to 1 plus the number of creatures the chosen player controls." While Lost Order of Jarkeld isn't on the battlefield, there won't be a chosen player. Its power and toughness will each be equal to 1 plus 0, so it's 1/1.
When you scavenge Boneyard Wurm you will get a number of +1/+1 counters equal the number of creatures in your graveyard before Boneyard Wurm is exiled. (A ruling on Varolz, the Scar-Striped reads: The number of counters that a card’s scavenge ability puts on a creature is based on the card’s power as it last existed in the graveyard.)