Can an Airbus A380 or Boeing B747 fly with only 2 engines?
First, my experience was with 747-100/200 aircraft. However, I'm reasonably certain that the subsequent variants of the 747 would perform just as well, and I would be surprised if the A380 did not as well.


  If during cruising with full load....


"Full load" is a little ambiguous. If what is meant is MTOW (max takeoff weight), note that by the time you reach cruising altitude, you're considerably lighter than MTOW.

But let's say you leveled at FL310 or thereabouts, and shortly thereafter two engines failed. Discounting catastrophic failures that leave things hanging out in the wind that generate a lot more drag than a simple inoperative windmilling engine, you should be able to fly as far as your fuel will take you, although common sense and the regulations would dictate finding the nearest suitable airport.

You won't be able to maintain your 4-engine cruising altitude. You'll drift down until you reach an altitude that you can maintain.

You'll be able to fly whether the two failures are both on one side or one on each side, but both on one side is the more problematical. We used to practice that in the sim. They always put both failures on one side to make it more interesting. The drag from the rudder necessary to counter the adverse yaw from the operating engines is significant, and as you start reducing the power for the landing, judging how much rudder to decrease and when is an interesting dance. You would have run in lots (maybe all) the rudder trim. How much of it should you take out and when. Take it all out too soon and your leg is going to get awfully tired.

While a double failure at cruise is handleable, it's easy to come up with scenarios that are not. If you had a double failure on takeoff just after V1, I doubt you'll make it. V1 and the balanced field length are predicated on one engine failing, not two.

Take a look at https://thepointsguy.com/2017/03/engines-boeing-a-747-can-fly-on/, the relevant part is:


  After almost 15 minutes in a controlled gliding descent, the crew coaxed one engine back to life, allowing them to significantly reduce their rate of descent. A few minutes later, a second engine came back on line with partial power, allowing the aircraft to enter a slow climb.


It's also worth noting, I think, that when you're doing a 3-engine ferry in a 747, you're depending on it being able to continue flying on two in case of an engine failure during that ferry flight.

A final thought about the last part of your question:


  controlling the rudder makes the airplane fly sideway.


To the best of my knowledge, the use of the proper amount of rudder to counter asymmetrical thrust does not make the airplane fly sideways. However, I am not an aerodynamicist. Perhaps one of the many here qualified in that area can comment.