问题 单项选择题

为了减少栈溢出的可能性,可让两个栈共享一片连续内存空间,两个栈的栈底分别设在这片空间的两端,这样,只有______时才可能产生上溢。

A.两个栈的栈顶在栈空间的某一位置相遇

B.其中一个栈的栈顶到达栈空间的中心点

C.两个栈的栈顶同时到达栈空间的中心点

D.两个栈均不为空,且一个栈的栈顶到达另一个栈的栈底

答案

参考答案:A

解析:两栈共享连续存储空间,两个栈的栈底分别设在这个存储空间的两端的存储结构中,为了使两栈的 空间能够做到互补余缺,减少溢出的可能性,两个栈的栈满溢出都不能按位置判别,仅当两栈的栈顶相遇 时,才可能栈满溢出。选项B、C、D都是按栈顶位置来判别是否不产生上溢,因此是错误的。选项A符合 上述判别规则,即两个栈的栈顶在栈空间的某一位置相遇时才可能产生上溢。

单项选择题
单项选择题

The sun today is a yellow dwarf star. It is fueled by thermonuclear reactions near its center that convert hydrogen to helium. The sun has existed in its present state for about 4 billion, 600 million years and is thousands of times larger than the Earth.
By studying other stars, astronomers can predict what the rest of the sun’s life will be like. About 5 billion years from now, the core of the sun will shrink and become hotter. The surface temperature will fail. The higher temperature of the center will increase the rate of thermonuclear reactions. The outer regions of the sun will expand approximately 35 million miles, about the distance to mercury, which is the closest planet to the sun. The sun will then be a red giant star. Temperatures on the earth will become too hot for life to exist.
Once the sun has used up its thermonuclear energy as a red giant, it will begin to shrink. After it shrinks to the size of the earth, it will become a white dwarf star. The sun may throw off huge amounts of gases in violent eruptions called nova explosions as it changes from a red giant to a white dwarf.
After billions of years as a white dwarf, the Sun will have used up all its fuel and will have lost its heat. Such a star is called a black dwarf. After the Sun has become a black dwarf, the earth will be dark and cold. If any atmosphere remains there, it will have frozen onto the earth’s surface.

When the sun becomes a red giant, what will conditions be like on Earth

A.Its atmosphere will freeze and become solid.
B.It will be enveloped in the expanding surface of the sun.
C.It will become too hot for life to exist.
D.It will be nearly destroyed by nova explosions.