If I connect 3 computers to the same switch and used one of the PC's to ping another PC on the switch will this cause a broadcast domain as they are connected to the same switch?
That doesn't cause a broadcast domain. A broadcast domain is the domain in which all the other hosts receive a broadcast sent by a host, and it is created by the switch configuration (the default is that all switch interfaces are in VLAN 1, the same broadcast domain). On a pure layer-2 switch with one VLAN, then every switch interface is in the same broadcast domain. If the switch has multiple VLANs, and interfaces various VLANs, then the interfaces in a single VLAN are in the same broadcast domain, and the interfaces in the other VLANs are not in that broadcast domain. VLANs break up a switch into separate broadcast domains; one for each VLAN (basically, as if you had a separate, unconnected switch for each VLAN).
Ping is an application that uses layer-3, not layer-2, to accomplish its job. Ping works across network and broadcast domains because it can be routed. Broadcasts do not cross a layer-3 device, e.g. a router, but ping can cross a router if it is destined for a different network. Ping is not normally broadcast, but unicast (it may be possible to ping to a broadcast address, but then every host on the broadcast domain will receive the ping ICMP echo request request, although some ping applications will consolidate all the replies from all the hosts).
Also worth noting that the first ping command would normally trigger an ARP request for the pinged IP address (assuming start-up conditions) from the pinging host, and this is a broadcast. Any device with this address (assuming no fault conditions) will reply, not as broadcasts. Then there will be the ICMP echo request and echo reply packets. Feb 5, 2019 at 22:46