Because exchanged markets like NASDAQ or NYSE are normal public businesses can they go into bankruptcy ? Supposedly they went into mysterious bankruptcy then what will happen to the listed companies and to the shareholder's stock who invested in companies that were listed in these markets ? Let's suppose I am an investor and I bought stocks from a listed company in NYSE and NYSE went into bankruptcy, even though NYSE is a unique business, meaning it doesn't have to do anything with that firm which I invested in. How would I know the stock price of that firm and will I lose my purchased stocks ? In general, what will happen after that ?
You seem to think that stock exchanges are much more than they actually are. But it's right there in the name: stock exchange. It's a place where people exchange (i.e. trade) stocks, no more and no less. All it does is enable the trading (and thereby price finding).
Supposedly they went into mysterious bankruptcy then what will happen to the listed companies
Absolutely nothing. They may have to use a different exchange if they're planning an IPO or stock buyback, that's all.
and to the shareholder's stock who invested in companies that were listed in these markets ?
Absolutley nothing. It still belongs to them. Trades that were in progress at the moment the exchange went down might be problematic, but usually the shutdown would happen in a manner that takes care of it, and ultimately the trade either went through or it didn't (and you still have the money). It might take some time to establish this.
Let's suppose I am an investor and I bought stocks from a listed company in NYSE and NYSE went into bankruptcy, even though NYSE is a unique business, meaning it doesn't have to do anything with that firm which I invested in. How would I know the stock price of that firm
Look at a different stock exchange. There are dozens even within the USA, hundreds internationally.
and will I lose my purchased stocks ?
Of course not, they will still be listed as yours at your broker.
In general, what will happen after that ?
People will use different stock exchanges, and some of them migth get overloaded from the additional volume. Expect some inconveniences but no huge problems.
@MichaelBorgwardt gave an excellent answer. Let me add a little analogy here that might help. Suppose you bought a car from Joe's Auto Sales. You pay your money, do all the paperwork, and drive your car home. The next day Joe's goes bankrupt. What affect does that have on your ownership rights to your car? The answer is, Absolutely none. Same thing with stocks and a stock exchange. A stock exchange is basically just a store where you can buy stock. Once you buy it, it's yours.
That said, there could potentially be a problem with record keeping. If you bought a car from Joe's Auto Sales, and Joe went out of business before sending the registration paperwork to the state, you might find that the state has no record that you legally own the car and you could have difficulty proving it. Likewise if a stock exchange went out of business without getting all their records properly updated, their might be an issue. Actually I think the bigger concern here for most folks would be their broker and not the stock exchange, as your broker is the one who keeps the records of what stocks you own long term.
In practice, though, most companies are responsible enough to clean up their paperwork properly when they go out of business, and if they don't, a successor company or government regulators or someone will try to clean it all up.
It might be easiest to think of stock exchanges like brokers. If you buy a home, and your broker goes bankrupt, you still own your home, but you could not sell it without the aid of another broker.
Same with stocks, you own the stocks you buy, but you would be unable to either purchase new stocks or sell your stock holdings without an exchange.