In many cases, the naval guns of WWI were the same guns as those of WWII. There were a considerable number of older warships in service during WWII, which had seen service during WWI, or had been built in the years immediately afterward. However, these guns did see a considerable increase in effectiveness over the intervening years.
It should be remembered that naval guns are just one part of the system of naval gunnery. They depend heavily on the fire control systems which control them, and the shells they fired. These saw a major increase in efficiency over the interwar period. During WWI, there were a number of problems with the shells used by British naval guns. They were improperly heat treated, making them too brittle to effectively pierce armour. They were filled with an explosive called Lyddite, which was shock-sensitive, and tended to explode as the shell penetrated armour. This managed to disguise the other flaw, which was that their fuses rarely worked as intended. These problems were recognised in the aftermath of the indecisive Battle of Jutland in 1916. Improved metallurgy and quality control solved the first problem, with the improved shells entering service as the so-called 'Green Boy' shells towards the end of WWI. Over the course of the interwar period, new shells with TNT filling and better fuses entered service. These greatly increased the effectiveness of British naval guns. The 15 in shells in service in 1916 could not effectively penetrate a 6 in plate; those of 1939 could penetrate a 14 in plate at the expected battle range of ~17,000 yards. WWII shells also tended to be heavier than WWI shells, increasing their armour-piercing capabilities and explosive payload.
Fire control saw a similar improvement over the period. WWI experience showed the need for significant improvement in this field. Larger rangefinders were fitted - this allowed the range to the target, a key parameter for fire control, to be more accurately measured. These were also given improvements in areas like low-light vision, or vision in fog and smoke. The invention of radar also helped to greatly improve fire control. Newer, more effective fire control equipment led to improvements in accuracy. New fire control computers were developed, and equipped on ships. New technologies, like remote power control, also added accuracy.
As well as these ancillary improvements, there were improvements in the guns themselves. Gunmakers moved away from the traditional 'wire-wound' method of gun construction to the new method of building up guns from a series of concentric tubes. These new guns could take higher pressures, and be built longer. This allowed heavier shells to be fired at a higher muzzle velocity. Turrets were constructed such that guns could achieve a higher elevation, increasing the range. For a direct comparison, the wire-wound 14" Mark II entered service with the RN in 1915. It fired a 1,400 lb shell at a muzzle velocity of 2,400 fps. At a maximum elevation of 20^o, it could reach a range of 24,400 yards. It could, in theory, pierce a 13" plate at 12,000 yards. The 14" Mark VII entered service in 1940, 25 years later. It fired a 1,590 lb shell at a maximum muzzle velocity of 2,850 fps, and could hit targets out to 38,650 yards. It's armour-piercing abilities were greater; at 13,000 yards, it could penetrate a 14" plate.