Oslo's international airport is in Gadermoen, about 50KM from the city centre, although it is well served by good value shuttle buses, and many package deals to the city are inclusive of a transfer to your hotel.
The city centre itself is quite compact, and many of the main attractions are well within walking distance of each other, but in the evenings it's a good idea to get a cab from bars to your hotel in the city.
Hiring a car is recommended if you are planning to explore the surrounding areas of the city or travelling to Oslo as the base for a longer holiday in the country.