Almost anything is possible...the question is what's practical.
If you make the submarine large enough, you can fit in a large gun on a disappearing mounting. You now have a fairly substantial submarine, mounting a single large-caliber gun. It's not going to have the range of a similar gun aboard a battleship, since you don't have the high-mounted rangefinders needed for long-range gunnery. It's not going to have the rate of fire either, due to flooding issues. It certainly won't have the speed or range of a conventional big-gun ship, and even more certainly, it won't be able to take enemy fire as well as a more conventional ship.
In short, you have a very large and very expensive ship that can't shoot, move, or survive as well as her more conventional sisters. What, exactly, justifies the cost of her construction and her operation?