Auto-sensing versus a crossover cable
If the switch's ports do not auto-sense the orientation of the tx/rx pairs, then absolutely nothing will happen because you've probably used a straight-through cable; the type of cable you'd normally use to connect a workstation/client to the switch.
So, instead let's assume you've used a crossover cable, or much more likely, you have a non-stoneage switch with auto-sensing tx/rx orientation, then...
"Dumb" Switches
You have just created a loop in the network topology. In a moment or two, your network, (all the segments off this dumb switch) will probably stop working as the dumb switch sends the first broadcast packet out one of those two switch ports, receives the packet on the other, and then sends it out the other, etc. Packet storm, meet network, network, this is a packet storm. The switch will probably, (hopefully) squelch the storm, things will come back to working... until the next storm comes along shortly.
So let's assume you're not using "dumb" switches, then...
Managed Switches
Managed switches almost always have loop detection, called Spanning Tree Protocol. When a port comes up with a new link, the switch does not immediately join it to the switch fabric at-large. Instead, it segregates the new port(s) and uses STP to see if a loop would exist if the new port(s) were added to the fabric. (In real-world networks, the loop might not be nearly as obvious as one mis-plugged cable.) Some people, (known as "novices") disable STP so the switch ports "come up" faster. This is great, until you discover why you need STP.
VLANs
(See also Introductory Level... or our VLAN tag.)
If the two ports are administratively configured in two separate VLANs, then you may well have intentionally wanted to put that cable there to provide connectivity between the VLANs. (But really that makes little sense. Change you're VLANs, or redesign the network, etc. instead of adding a wacky cable.)
For any n00b coming behind, break any one of the inter-switch links and you would not break your network. Then read the accepted answer and learn why. – YetAnotherRandomUser – 2016-04-16T15:26:19.157
4
Regarding both scenarios 1) and 2). This is what the IEEE 802.1d Spanning-Tree protocol was designed to facilitate; however, I do not know of an unmanaged switch which implements STP (or any of the later versions, 802.1w / 802.1s). If you loop unmanaged switches like this, you'll quickly find out why people use spanning-tree ;-). Bad Things© happen when you do this; it's one of the things professional network engineers work hard to prevent (including people who bought a switch from Walmart and do this through complete ignorance).
– Mike Pennington – 2014-03-12T18:46:45.723I thought it better not to test this in production. ;) Thanks for the help. – Jonathan – 2014-03-12T18:48:07.823
2Try to imagine all life as you know it stopping instantaneously and every molecule in your body exploding at the speed of light. – Daniel R Hicks – 2014-03-12T19:58:48.417
This is much more detail than originally provided. In this situation, as @MikePennington stated you would have issues. On unmanaged consumer switches this will create a loop and it will cause a broadcast storm, as previously stated. STP was designed to prevent issues with this type of setup. A proper implementation of STP or a deriviative (RSTP, MSTP) is needed. You would need managed layer 2 switches in order to accomplish the setup you've described. Daniel, thanks for clearing up the whole "good, bad" thing... :-) – Mike Naylor – 2014-03-13T20:26:06.737