According to Alison Green, who writes the blog Ask a Manager, this is common practice for some industries, especially if you’re leaving to work for a direct competitor. However, in those situations, you’ll likely know it’s coming and can prepare accordingly.
Otherwise, look to the history of your company. How have your boss and other managers handled employees’ resignations? If you see a pattern of upper management refusing to let the team members work out their notice, you can likely expect the same.
Also think about your relationship with your manager. Would he or she have reason to think that you’ll waste your last two weeks or distract your co-workers instead of doing what you can to make the transition seamless? If so, you may be asked to cut your two weeks short.