Is it true that in the ideology of communism, the government owns all the companies and the exploitable resources? Also, what about the socialist countries and socialism as an ideology and are there any examples of this occurring?
Naturally this depends on what is and what isn't a "communist" or "socialist" country. There are some countries that claim this mantle, and yet are (by some definitions) neither communist nor socialist.
In the concept of communism implied by Marx in the Communist Manifesto and Das Capital, communism is about the common ownership of the means of production. The notion of a "company" with "owners" who are separate from the "workers" is dissolved. The means of production are held in common by those who work and there isn't a class of people who benefit from ownership without doing work.
Likewise the government is a common enterprise of the people. There isn't a political class of leaders who rule over the workers, and indeed the notion of the state as it exists in the pre-communist society is radically different. The idea of a political class forcing the working class to go to war against the working class of a different nation is inconceivable in the communist society. So the notion of "government" is radically different.
It is certainly not the case that in the communism as described by Marx that a political class called the "government" would "own" things called "companies", for those three things (government, ownership and companies) would not exist in the form that they do today.
Naturally, all this is utopian, and no country claiming to be communist has implemented this. In the Soviet Union and China, for example, the government did own all the large scale companies, sometimes in complex ways, though smaller private enterprise did exist, it was often part of a grey economy. In modern China things are different again, and the system created largely by Deng Xiaoping can't be seen a Marxist system, but something else. The government (at various levels) is intimately connected to industry it controls, but not necessarily purely through ownership.
Depends of what kind of socialism you area talking about. The answer above describes communism and how nationalizing the economy is not part of the final stage of communism. However, Karl Marx believed that one method for true communism is socialism or the lower stage of communism to achieve the final stage of communism. In his work Critique of the Gotha Program, Karl Marx mentions the dictatorship of the proletariat, a form of the state where members of the working class take control of the state and nationalize the means of production in order to make everything publicly owned and improve the standing of the current community.
Between capitalist and communist society there lies the period of the revolutionary transformation of the one into the other. Corresponding to this is also a political transition period in which the state can be nothing but the revolutionary dictatorship of the proletariat. -Karl Marx
This lower stage of communism is what we saw in the USSR and Maoist China. This is also what people mean when these nations are referred to as 'communist'. They were experiments to achieve this lower stage of communism where a council of members of the proletariat and potentially a leader of the council take the means of production to achieve collective ownership using the state, a cooperative with control of all utilities, or some other organization. Personal property is given to members of the proletariat based on the principle of "each according to his contribution" (which in many socialist countries, meant the members of the state get the most personal property), but public property is only utilized by those who are part of the worker's council.
Every member of society, performing a certain part of the socially-necessary work, receives a certificate from society to the effect that he has done a certain amount of work. And with this certificate he receives from the public store of consumer goods a corresponding quantity of products. After a deduction is made of the amount of labor which goes to the public fund, every worker, therefore, receives from society as much as he has given to it. -Karl Marx, Describing "each according to his contribution" for lower-stage communism in Critique of the Gotha Program
People like Marx and Vladimir Lenin grew to believe that this form of communism would be the only form that would be able to uplift the people to a higher stage of production while opposing capitalist countries that would seek to stop the revolution
"The dictatorship of a single class is necessary not only for every class society in general, not only for the proletariat which has overthrown the bourgeoisie, but also for the entire historical period which separates capitalism from "classless society", from communism. Bourgeois states are most varied in form, but their essence is the same: all these states, whatever their form, in the final analysis are inevitably the dictatorship of the bourgeoisie. The transition from capitalism to communism is certainly bound to yield a tremendous abundance and variety of political forms, but the essence will inevitably be the same: the dictatorship of the proletariat. -Vladimir Lenin, The State and Revolution
The proletariat needs the state, not in the interests of freedom but in order to hold down its adversaries, and as soon as it becomes possible to speak of freedom the state as such ceases to exist. - Friedrich Engels in a letter to the socialist thinker August Bebel
However, eventually, Karl Marx believed this dictatorship would naturally erode away because, to compete with capitalism, the dictatorship of the proletariat would have to provide education, technological development, and standards of healthcare. Then, once the people and society became advanced enough, the state would erode away through a final revolution or natural human development, leading to the last stage of communism and a clean, stateless society where everyone would be paid in personal property based on the principle of according to their need. So, to answer the question, all countries are nationalized if you are achieving lower-stage communism using the methods outline by Karl Marx in Critique of the Gotha Program. For the final stage of communism, however, the state should be eliminated by this point and while might be a small government or council that still manages certain resources, there is no state left or nationalization.
There is no single answer to this because the interpretation of socialism and communism varies wildly from country to country, and is often dependant on the economic situation of the country.
For example, China and Russia both handled the division of the agricultural sector in very different ways.
China seized all private farm land and divided it up between the population. Giving each farmer a portion of land to farm individually (or as a family) The land was divided up based on its expected Yield, so some farmers received large portions of poor land while others received smaller portions of high quality land. The farmers were considered to own the land and it could be inherited by their children. Though it could be sold or transferred by local committees without their consent
In contrast, Russia seized all of the farmland and divided the people up among it. People were assigned to groups and the groups were placed on the land and they shared joint responsibility for managing it. Nobody had ownership of anything. The people were simply laborers.
Similarly, with the actual concept of ownership varies. In Russia communist Russia and Socialist England the state directly owned businesses. While in Communist China and Socialist France the state invested in businesses sometimes through purchasing of financial interests or through the stock market.