I completed my undergrad in Graphic design and I'm currently looking for a job. I'm aware that I need a portfolio to be considered for an interview. I would like to know ideally how many pieces of work should I submit? Also, while creating a portfolio piece is it ok to borrow content from websites or other work(posters, flyers etc).
There is really no definitive answer to this question.
It's generally best to shoot for around 10 give or take one or two. But, there is no rule.
While I don't really know what content you are referring to with "is it ok to borrow content from websites or other work" - it is generally unacceptable to "borrow" anything for a portfolio. The purpose of a portfolio is to show your work, nNot how well you "borrow" content.
That being posted, if by chance you mean something like "I designed a poster for a band named XXXX and I used dates from their North American tour I found on some other poster." that is generally not an issue. But if you designed a web site for, say, "Bob's Chokeburger" a fast food chain, you could not "borrow" content from McDonald's web site to fill in text areas and the like.
In all cases "borrowing" images, logos, and other graphic elements is a very big mistake for a portfolio.
How many is an impossible question to answer: you should have your best work there, it should represent a cross-section of the work you do or hope to do.
Posters, flyers etc are of course easy, the tricky part is websites. Images only? Links to live sites, customers?
I cannot stress this enough: keep your best work in your portfolio. It is better with few but excellent pieces, than a whole load of indiscriminate chaos of odds, ends and rubbish.
I find it odd that you are an undergrad and have not created a portfolio.
Edit: you can not use other peoples work in your portfolio. That is called theft or plagiarism