Test Bank for Introduction to Programming Using Python 1st Edition Schneider 0134058224 9780134058221 - Full Book Is Now Available For Download
Test Bank for Introduction to Programming Using Python 1st Edition Schneider 0134058224 9780134058221 - Full Book Is Now Available For Download
http://testbankpack.com/download/solution-manual-for-introduction-to-
programming-using-python-1st-edition-
schneider-0134058224-9780134058221/
http://testbankpack.com/download/test-bank-for-introduction-to-
programming-using-visual-basic-10th-edition-
schneider-0134542789-9780134542782/
http://testbankpack.com/download/test-bank-for-introduction-to-
programming-using-visual-basic-2012-9th-edition-
schneider-0133378500-9780133378504/
http://testbankpack.com/download/solution-manual-for-blueprints-for-
writing-building-essays-1st-edition-by-pam-mathis-
isbn-0495802468-9780495802464/
http://testbankpack.com/download/solution-manual-for-marketing-5th-
edition-grewal-levy-0077729021-9780077729028/
http://testbankpack.com/download/solution-manual-for-financial-
accounting-14th-edition-by-warren-isbn-1305088433-9781305088436/
Test Bank for Introduction to Programming Using Python 1st Edition Schneider
0134058224 9780134058221
Full link download:
Test Bank:
https://testbankpack.com/p/test-bank-for-introduction-to-programming-using-python-
1st-edition-schneider-0134058224-9780134058221/
Solution Manual:
https://testbankpack.com/p/solution-manual-for-introduction-to-programming-using-
python-1st-edition-schneider-0134058224-9780134058221/
Chapter 2
Multiple Choice (47) WARNING: CORRECT ANSWERS ARE IN THE SAME POSITION AND
TAGGED WITH **. YOU SHOULD RANDOMIZE THE LOCATION OF THE CORRECT
ANSWERS IN YOUR EXAM.
22. Given str1 = “Life, the universe and everything.” what does str1.find(“ve”)
return? a. 13 **
b. 24
c. 14
d. -1
23. Given str1 = “Life, the universe and everything.” what does str1.rfind(“ve”)
return? a. 24 **
b. 25
c. 13
d. -1
24. Given str1 = “Life, the universe and everything.” what does str1.rfind(“rev”)
return? a. -1 **
b. 26
c. 15
d. 0
32. A long statement can be split across multiple lines by ending each line, except the last,
with the character(s) .
a. \ **
b. /
c. \\
d. //
34. sequences are short sequences that are placed in strings to instruct the
cursor to permits special characters to be printed.
a. escape **
b. special
c. expandable
d. cursor
36. What happens when a justification method is used to display string output but the
string is longer than the allocated width?
a. The justification method is ignored. **
b. The string is left justified.
c. The string is right justified.
d. A Throwback error is produced.
37. Which method removes all ending spaces and escape sequences in a string?
a. rstrip **
b. strip
c. remove
d. clean
40. After the del function or remove method are executed on a list, the items
following the eliminated item are .
a. moved one position left in the list **
b. moved one position right in the list
c. do not change position in the list
d. are also removed from the list
41. After the insert method is executed, items in the list having an index greater than or
equal to the stated index are .
a. moved one position to the right in the list **
b. moved one position to the left in the list
c. do not change position in the list
d. none of the above
44. Which method converts a list of strings into a string value consisting of the elements of
the list concatenated together?
a. join **
b. slice
c. splice
d. split
46. Which one of the following Python objects can be changed in place?
a. list **
b. number
c. string
d. tuple
True/False (28)
4. In a numeric expression, the operations inside parentheses are calculated last and
from left to right if more than one pair of parentheses is present.
Answer: false
6. An assignment statement evaluates the expression on the left side of the = and then
assigns its value to the variable on the right.
Answer: false
7. A variable is created in memory the first time it appears on the left side of an
assignment statement.
9. Python is case-
13. When writing a string literal, opening and closing quotation marks must be the
18. Python does not allow for out of bounds indexing for individual characters of a
19. Python does not allow for out of bounds indexing for
21. When the format method is used to format a string, right-justify is the default
22. In Python, a list may contain objects of any type but they must all be of the
23. Values used in a Python program that reside in memory are lost when the program
24. Strings in a text file may be formatted with bold, italics, and
mutable. Answer:
true
Answer: 2 28 22 32 30
program? x = 5
y=7
print (abs(x – y) –
10) print (int(x ** 2)
+ 1.4)
print(round(y + 3.14159, 2))
5. Create a variable called speed and assign the value 50 to it. In a second
statement, use an augmented assignment to add 15 to speed.
Answer: speed = 50
speed += 15
program? a = 3
b=7
c = 11
d = 17
a += b
b *= cc
**= 2 d
/= a
print (a, b, c, round(d))
Answer: 10 77 121 2
a = 31
b=7
print (a // b, a % b)
Answer: 4 3
8. Write a Python program to convert 250 minutes to 4 hours and 10 minutes and prints
the hours and minutes.
Answer: 3 14 ha
Answer: hat it is
Answer: it is
12. Write a Python statement to prompt a user with “Enter a positive number:” and
assigns the input to a variable called number.
Answer: eve
14. Write a single Python statement that creates three variables, length, width, and
height, and assigns the values 10, 14 and 5 respectively, to them.
When Three did not answer, Rossel was nervously gazing at the
snow, thinking of other things, and he called again. Several
moments later the realization of what was happening struck him like
a blow. Three had never once failed to answer. All they had to do
when they heard the signal buzz was go into the radio shack and say
hello. That was all they had to do. He called again and again, but
nobody answered. There was no static and no interference and he
didn't hear a thing. He checked frenziedly through his own apparatus
and tried again, but the air was as dead as deep space. He raced out
to tell Dylan.
Dylan accepted it. He had known none of the people on Three and
what he felt now was a much greater urgency to be out of here. He
said hopeful things to Rossel, and then went out to the ship and
joined the men in lightening her. About the ship at least, he knew
something and he was able to tell them what partitions and frames
could go and what would have to stay or the ship would never get
off the planet. But even stripped down, it couldn't take them all.
When he knew that, he realized that he himself would have to stay
here, for it was only then that he thought of Bossio.
Three was dead. Bossio had gone down there some time ago and, if
Three was dead and Bossio had not called, then the fact was that
Bossio was gone too. For a long, long moment Dylan stood rooted in
the snow. More than the fact that he would have to stay here was
the unspoken, unalterable, heart-numbing knowledge that Bossio
was dead—the one thing that Dylan could not accept. Bossio was
the only friend he had. In all this dog-eared, aimless, ape-run
Universe Bossio was all his friendship and his trust.
He left the ship blindly and went back to the settlement. Now the
people were quiet and really frightened, and some of the women
were beginning to cry. He noticed now that they had begun to look
at him with hope as he passed, and in his own grief, humanly, he
swore.
Bossio—a big-grinning kid with no parents, no enemies, no grudges
—Bossio was already dead because he had come out here and tried
to help these people. People who had kicked or ignored him all the
days of his life. And, in a short while, Dylan would also stay behind
and die to save the life of somebody he never knew and who,
twenty-four hours earlier, would have been ashamed to be found in
his company. Now, when it was far, far too late, they were coming to
the army for help.
But in the end, damn it, he could not hate these people. All they had
ever wanted was peace, and even though they had never
understood that the Universe is unknowable and that you must
always have big shoulders, still they had always sought only for
peace. If peace leads to no conflict at all and then decay, well, that
was something that had to be learned. So he could not hate these
people.
But he could not help them either. He turned from their eyes and
went into the radio shack. It had begun to dawn on the women that
they might be leaving without their husbands or sons, and he did
not want to see the fierce struggle that he was sure would take
place. He sat alone and tried, for the last time, to call Bossio.
After a while, an old woman found him and offered him coffee. It
was a very decent thing to do, to think of him at a time like this, and
he was so suddenly grateful he could only nod. The woman said that
he must be cold in that thin army thing and that she had brought
along a mackinaw for him. She poured the coffee and left him alone.
They were thinking of him now, he knew, because they were
thinking of everyone who had to stay. Throw the dog a bone.
Dammit, don't be like that, he told himself. He had not had anything
to eat all day and the coffee was warm and strong. He decided he
might be of some help at the ship.
It was stripped down now and they were loading. He was startled to
see a great group of them standing in the snow, removing their
clothes. Then he understood. The clothes of forty people would
change the weight by enough to get a few more aboard. There was
no fighting. Some of the women were almost hysterical and a few
had refused to go and were still in their cabins, but the process was
orderly. Children went automatically, as did the youngest husbands
and all the women. The elders were shuffling around in the snow,
waving their arms to keep themselves warm. Some of them were
laughing to keep their spirits up.
In the end, the ship took forty-six people.
Rossel was one of the ones that would not be going. Dylan saw him
standing by the airlock holding his wife in his arms, his face buried in
her soft brown hair. A sense of great sympathy, totally unexpected,
rose up in Dylan, and a little of the lostness of thirty years went
slipping away. These were his people. It was a thing he had never
understood before, because he had never once been among men in
great trouble. He waited and watched, learning, trying to digest this
while there was still time. Then the semi-naked colonists were inside
and the airlock closed. But when the ship tried to lift, there was a
sharp burning smell—she couldn't get off the ground.
Rush was sitting hunched over in the snow, his rifle across his knees.
He was coated a thick white and if he hadn't spoken Dylan would
have stumbled over him. Dylan took out his pistol and sat down.
"What happened?" Rush asked.
"Lining burned out. She's being repaired."
"Coincidence?"
Dylan shook his head.
"How long'll it take to fix?"
"Four—five hours."
"It'll be night by then." Rush paused. "I wonder."
"Seems like they want to wait 'til dark."
"That's what I was figurin'. Could be they ain't got much of a force."
Dylan shrugged. "Also could mean they see better at night. Also
could mean they move slow. Also could mean they want the least
number of casualties."
Rush was quiet and the snow fell softly on his face, on his eyebrows,
where it had begun to gather. At length he said, "You got any idea
how they got to the ship?"
Dylan shook his head again. "Nobody saw anything—but they were
all pretty busy. Your theory about it maybe being one of us is
beginning to look pretty good."
The colonist took off his gloves, lit a cigarette. The flame was strong
and piercing and Dylan moved to check him, but stopped. It didn't
make much difference. The aliens knew where they were.
And this is right where we're gonna be, he thought.
"You know," he said suddenly, speaking mostly to himself, "I been in
the army thirty years, and this is the first time I was ever in a fight.
Once in a while we used to chase smugglers—never caught any,
their ships were new—used to cut out after unlicensed ships, used to
do all kinds of piddling things like that. But I never shot at anybody."
Rush was looking off into the woods. "Maybe the mail ship will come
in."
Dylan nodded.
"They got a franchise, dammit. They got to deliver as long as they's
a colony here."
When Dylan didn't answer, he said almost appealingly: "Some of
those guys would walk barefoot through hell for a buck."
"Maybe," Dylan said. After all, why not let him hope? There were
four long hours left.
Small and shadowy, white-coated and almost invisible, the thing had
come out of the woods and was moving toward them, bobbing and
shuffling in the silent snow.
Dylan fired instinctively, because the thing had four arms and was
coming right at him. He fired again. This time he hit it and the thing
fell, but almost immediately it was up and lurching rapidly back into
the trees. It was gone before Dylan could fire again.
They both lay flat in the snow, half-buried. From the camp there
were now no sounds at all. For the first time today Dylan could hear
the snow fall.
"Did you get a good look?"
Rush grunted, relaxing. "Should've saved your fire, son. Looked like
one o' them monkeys."
But there was something wrong. There was something that Dylan
had heard in the quickness of the moment which he could not
remember but which was very wrong.
"Listen," he said, suddenly placing it. "Dammit, that was no
monkey."
"Easy—"
"I hit it. I hit it cold. It made a noise."
Rush was staring at him.
"Didn't you hear?" Dylan cried.
"No. Your gun was by my ear."
And then Dylan was up and running, hunched over, across the snow
to where the thing had fallen. He had seen a piece of it break off
when the bolt struck, and now in the snow he picked up a paw and
brought it back to Rush. He saw right away there was no blood. The
skin was real and furry all right but there was no blood. Because the
bone was steel and the muscles were springs and the thing had
been a robot.
The Alien rose up from his cot, whistling with annoyance. When that
ship had come in, his attention had been distracted from one of the
robots, and of course the miserable thing had gone blundering right
out into the humans. He thought for a while that the humans would
overlook it—the seeing was poor and they undoubtedly would still
think of it as animal, even with its firing ports open—but then he
checked the robot and saw that a piece was missing and knew that
the humans had found it. Well, he thought unhappily, flowing into
his suit, no chance now to disable that other ship. The humans
would never let another animal near.
And therefore—for he was, above all, a flexible being—he would
proceed to another plan. The settlement would have to be
detonated. And for that he would have to leave his own shelter and
go out in that miserable cold and lie down in one of his bunkers
which was much farther away. No need to risk blowing himself up
with his own bombs, but still, that awful cold.
He dismissed his regrets and buckled his suit into place. It carried
him up the stairs and bore him out into the snow. After one whiff of
the cold, he snapped his viewplate shut and immediately, as he had
expected, it began to film with snow. Well, no matter, he would
guide the unit by coordinates and it would find the bunker itself. No
need for caution now. The plan was nearly ended.
In spite of his recent setback, the Alien lay back and allowed himself
the satisfaction of a full tremble. The plan had worked very nearly to
perfection, as of course it should, and he delighted in the
contemplation of it.
When the humans were first detected, in the region of Bootes, much
thought had gone into the proper method of learning their
technology without being discovered themselves. There was little
purpose in destroying the humans without first learning from them.
Life was really a remarkable thing—one never knew what critical
secrets a star-borne race possessed. Hence the robots. And it was
an extraordinary plan, an elegant plan. The Alien trembled again.
The humans were moving outward toward the Rim, their base was
apparently somewhere beyond Centaurus. Therefore, a ring of
defense was thrown up on most of the habitable worlds toward
which the humans were coming—oh, a delightful plan—and the
humans came down one by one and never realized that there was
any defense at all.
With a cleverness which was almost excruciating, the Aliens had
carefully selected a number of animals native to each world, and
then constructed robot duplicates. So simple then to place the
robots down on a world with a single Director, then wait ... for the
humans to inhabit. Naturally the humans screened all the animals
and scouted a planet pretty thoroughly before they set up a colony.
Naturally their snares and their hunters caught no robots, and never
found the deep-buried Alien Director.
Then the humans relaxed and began to make homes, never realizing
that in among the animals which gamboled playfully in the trees
there was one which did not gambol, but watched. Never once
noticing the monkey-like animals or the small thing like a rabbit
which was a camera eye, or the thing like a rat which took chemical
samples, or the thing like a lizard which cut wires.
The Alien rumbled on through the snow, trembling so much now
with ecstasy and anticipation that the suit which bore him almost
lost its balance. He very nearly fell over before he stopped
trembling, and then he contained himself. In a little while, a very
little while, there would be time enough for trembling.
"They could've been here 'til the sun went out," Rush said, "and we
never would've known."
"I wonder how much they've found out," Dylan said.
Rush was holding the paw.
"Pretty near everything, I guess. This stuff don't stop at monkeys.
Could be any size, any kind ... look, let's get down into camp and tell
'em."
Dylan rose slowly to a kneeling position, peering dazedly out into the
far white trees. His mind was turning over and over, around and
around, like a roulette wheel. But, at the center of his mind, there
was one thought, and it was rising up slowly now, through the waste
and waiting of the years. He felt a vague surprise.
"Gettin' kind of dark," he said.
Rush swore. "Let's go. Let's get out of here." He tugged once at
Dylan's arm and started off on his knees.
Dylan said: "Wait."
Rush stopped. Through the snow he tried to see Dylan's eyes. The
soldier was still looking into the woods.
Dylan's voice was halting and almost inaudible. "They know
everything about us. We don't know anything about them. They're
probably sittin' out there right now, a swarm of 'em there behind
those trees, waitin' for it to get real nice and dark."
He paused. "If I could get just one."
It was totally unexpected, to Dylan as well as Rush. The time for this
sort of thing was past, the age was done, and for a long while
neither of them fully understood.
"C'mon," Rush said with exasperation.
Dylan shook his head, marveling at himself. "I'll be with you in a
little while."
Rush came near and looked questioningly into his face.
"Listen," Dylan said hurriedly, "we only need one. If we could just
get one back to a lab we'd at least have some clue to what they are.
This way we don't know anything. We can't just cut and run." He
struggled with the unfamiliar, time-lost words. "We got to make a
stand."
He turned from Rush and lay forward on his belly in the snow. He
could feel his heart beating against the soft white cushion beneath
him. There was no time to look at this calmly and he was glad of
that. He spent some time being very much afraid of the unknown
things beyond the trees, but even then he realized that this was the
one thing in his life he had to do.
It is not a matter of dying, he thought, but of doing. Sooner or later
a man must do a thing which justifies his life, or the life is not worth
living. The long cold line of his existence had reached this point,
here and now in the snow at this moment. He would go on from
here as a man ... or not at all.
Rush had sat down beside him, beginning to understand, watching
without words. He was an old man. Like all Earthmen, he had never
fought with his hands. He had not fought the land, or the tides, or
the weather, or any of the million bitter sicknesses which Man had
grown up fighting, and he was beginning to realize that somewhere
along the line he had been betrayed. Now, with a dead paw of the
enemy in his hand, he did not feel like a man. And he was ready to
fight now, but it was much too late and he saw with a vast leaden
shame that he did not know how, could not even begin.
"Can I help?" he said.
Dylan shook his head. "Go back and let them know about the robots,
and, if the ship is ready to leave before I get back, well—then good
luck."
He started to slither forward on his belly but Rush reached out and
grabbed him, holding with one hand to peace and gentleness and
the soft days which were ending.
"Listen," he said, "you don't owe anybody."
Dylan stared at him with surprise. "I know," he said, and then he
slipped up over the mound before him and headed for the trees.
Now what he needed was luck. Just good, plain old luck. He didn't
know where they were or how many there were or what kinds there
were, and the chances were good that one of them was watching
him right now. Well, then he needed some luck. He inched forward
slowly, carefully, watching the oncoming line of trees. The snow was
falling on him in big, leafy flakes and that was fine, because the
blackness of his suit was much too distinct and the more white he
was the better. Even so, it was becoming quite dark by now and he
thought he had a chance. He reached the first tree.
Silently he slipped off his heavy cap. The visor got in his way and
above all he must be able to see. He let the snow thicken on his hair
before he raised himself on his elbows and looked outward.
There was nothing but the snow and the dead quiet and the stark
white boles of the trees. He slid past the first trunk to the next,
moving forward on his elbows with his pistol in his right hand. His
elbow struck a rock and it hurt and his face was freezing. Once he
rubbed snow from his eyebrows. Then he came through the trees
and lay down before a slight rise, thinking.
Better to go around than over. But if anything is watching, it is most
likely watching from above.
Therefore, go around and come back up from behind. Yes.
His nose had begun to run. With great care he crawled among some
large rocks, hoping against hope that he would not sneeze. Why had
nothing seen him? Was something following him now? He turned to
look behind him but it was darker now and becoming difficult to see.
But he would have to look behind him more often.
He was moving down a gorge. There were large trees above him
and he needed their shelter, but he could not risk slipping down the
sides of the gorge. And far off, weakly, out of the gray cold ahead,
he heard a noise.
He lay face down in the snow, listening. With a slow, thick shuffle, a
thing was moving through the trees before him. In a moment he
saw that it was not coming toward him. He lifted his head but saw
nothing. Much more slowly now, he crawled again. The thing was
moving down the left side of the gorge ahead, coming away from
the rise he had circled. It was moving without caution and he
worried that if he did not hurry, he would lose it. But for the life of
him he couldn't stand up.
The soldier went forward on his hands and knees. When his clothes
hung down, the freezing cold entered his throat and shocked his
body, which was sweating. He shifted his gun to his gloved hand and
blew on the bare fingers of his right, still crawling. When he reached
the other end of the gorge, he stood upright against a rock wall and
looked in the direction of the shuffling thing.
He saw it just as it turned. It was a great black lump on a platform.
The platform had legs and the thing was plodding methodically upon
a path which would bring it past him. It had come down from the
rise and was rounding the gorge when Dylan saw it. It did not see
him.
If he had not ducked quickly and brought up his gun, the monkey
would not have seen him either, but there was no time for regret.
The monkey was several yards to the right of the lump on the
platform when he heard it start running, and he had to look up this
time and saw it leaping toward him over the snow.
All right, he said to himself. His first shot took the monkey in the
head, where the eyes were. As the thing crashed over, there was a
hiss and a stench, and flame seared into his shoulder and the side of
his face. He lurched to the side, trying to see, his gun at arm's-
length as the lump on the platform spun toward him. He fired four
times. Three bolts went home in the lump, the fourth tore a leg off
the platform and the whole thing fell over.
Dylan crawled painfully behind a rock, his left arm useless. The
silence had come back again and he waited, but neither of the alien
things moved. Nothing else moved in the woods around him. He
turned his face up to the falling snow and let it come soothingly
upon the awful wound in his side.
After a while he looked out at the monkey. It had risen to a sitting
position but was frozen in the motion of rising. It had ceased to
function when he hit the lump. Out of the numbness and the pain,
he felt a great gladness rising.
The guide. He had killed the guide.
He would not be cautious any more. Maybe some of the other robots
were self-directing and dangerous, but they could be handled. He
went to the lump, stared at it without feeling. A black doughy bulge
was swelling out through one of the holes.
It was too big to carry, but he would have to take something back.
He went over and took the monkey by a stiff jutting arm and began
dragging it back toward the village.
Now he began to stumble. It was dark and he was very tired. But
the steel he had been forging in his breast was complete, and the
days which were coming would be days full of living. He would walk
with big shoulders and he would not bother to question, because
Man was not born to live out his days at home, by the fire.
It was a very big thing that Dylan had learned and he could not
express it, but he knew it all the same, knew it beyond
understanding. And so he went home to his people.
One by one, increasing, in the wee black corner of space which Man
had taken for his own, other men were learning. And the snow fell
and the planets whirled, and, when it was spring where Dylan had
fought, men were already leaping back out to the stars.
*** END OF THE PROJECT GUTENBERG EBOOK SOLDIER BOY ***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
testbankpack.com