All chapters of Test Bank for Starting Out with Java From Control Structures through Data Structures 3rd Edition 0134038177 9780134038179 are available for quick PDF download
All chapters of Test Bank for Starting Out with Java From Control Structures through Data Structures 3rd Edition 0134038177 9780134038179 are available for quick PDF download
com
http://testbankpack.com/download/test-bank-for-starting-out-
with-java-from-control-structures-through-data-
structures-3rd-edition-0134038177-9780134038179/
OR CLICK HERE
DOWLOAD NOW
Visit now to discover comprehensive test banks for all subjects at testbankpack.com
Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.
http://testbankpack.com/download/solution-manual-for-international-
trade-4th-edition-feenstra-taylor-1319061737-9781319061739/
testbankpack.com
Solution Manual for Chemistry A Molecular Approach 3rd
Edition by Tro ISBN 0321809246 9780321809247
http://testbankpack.com/download/solution-manual-for-chemistry-a-
molecular-approach-3rd-edition-by-tro-isbn-0321809246-9780321809247/
testbankpack.com
http://testbankpack.com/download/solution-manual-for-calculus-8th-
edition-by-stewart-isbn-1285740629-9781285740621/
testbankpack.com
http://testbankpack.com/download/test-bank-for-general-chemistry-
atoms-first-2nd-edition-by-mcmurry-fay-isbn-0321809262-9780321809261/
testbankpack.com
Test Bank for Starting Out with Java From Control Structures
through Data Structures 3rd Edition 0134038177 9780134038179
Full link download
Test Bank
https://testbankpack.com/p/test-bank-for-starting-out-with-java-from-
control-structures-through-data-structures-3rd-edition-0134038177-
9780134038179/
Starting Out with Java: From Control Structures through Data Structures 3e (Gaddis and Muganda)
Chapter 2 Java Fundamentals
1) Which one of the following would contain the translated Java byte code for a program named Demo?
A) Demo.java
B) Demo.code
C) Demo.class
D) Demo.byte
Answer: C
5) The term typically refers to the device that displays console output.
A) standard output device
B) central processing unit
C) secondary storage device
1
Copyright © 2016 Pearson Education, Inc.
D) liquid crystal display
Answer: A
2
Copyright © 2016 Pearson Education, Inc.
7) If the following Java statements are executed, what will be displayed?
3
Copyright © 2016 Pearson Education, Inc.
11) Which of the following is NOT a rule that must be followed when naming identifiers?
A) The first character must be one of the letters a-z, A-Z, and underscore or a dollar sign.
B) Identifiers can contain spaces.
C) Uppercase and lowercase characters are distinct.
D) After the first character, you may use the letters a-z, A-Z, the underscore, a dollar sign, or digits 0-9.
Answer: B
16) The boolean data type may contain values in the following range of values:
A) true or false
B) -128 to + 127
C) - 2,147,483,648 to +2,147,483,647
D) - 32,768 to +32,767
Answer: A
4
Copyright © 2016 Pearson Education, Inc.
17) Character literals are enclosed in ; string literals are enclosed in .
A) single quotes; single quotes
B) double quotes; double quotes
C) single quotes; double quotes
D) double quotes; single quotes
Answer: C
10 + 5 * 3 - 20
A) -5
B) 5
C) 25
D) -50
Answer: B
25 / 4 + 4 * 10 % 3
A) 19
B) 5.25
C) 3
D) 7
Answer: D
int x = 5, y = 20;
x += 32;
y /= 4;
System.out.println("x = " + x + ", y = " + y);
A) x = 32, y = 4
B) x = 9, y = 52
C) x = 37, y = 5
D) x = 160, y = 80
Answer: C
21) What will be the value of z as a result of executing the following code?
int x = 5, y = 28;
float z;
z = (float) (y / x);
A) 5.60
B) 5.6
C) 3.0
D) 5.0
Answer: D
5
Copyright © 2016 Pearson Education, Inc.
22) What will be the displayed when the following code is executed?
23) In the following Java statement what value is stored in the variable name?
6
Copyright © 2016 Pearson Education, Inc.
24) What will be displayed as a result of executing the following code?
int x = 6;
String msg = "I am enjoying this class.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
char ltr = msg.charAt(x);
int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
ltr);
System.out.println("msg has " + strSize +
"characters.");
A) I am enjoying this class.
I AM ENJOYING THIS CLASS.
i am enjoying this class.
Character at index x = e
msg has 24 characters.
B) I am enjoying this class.
I AM ENJOYING THIS CLASS.
i am enjoying this class.
Character at index x = e
msg has 25 characters.
C) I am enjoying this class.
I AM ENJOYING THIS CLASS.
i am enjoying this class.
Character at index x = n
msg has 24 characters.
D) I am enjoying this class.
I AM ENJOYING THIS CLASS.
i am enjoying this class.
Character at index x = n
msg has 25characters.
Answer: D
7
Copyright © 2016 Pearson Education, Inc.
Visit https://testbankpack.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
25) What will be displayed as a result of executing the following code?
27) When saving a Java source file, save it with an extension of:
A) .javac
B) .class
C) .src
D) .java
Answer: D
29) To print "Hello, world" on the monitor, use the following Java statement:
A) SystemOutPrintln("Hello, world");
B) System.out.println{"Hello, world"}
C) System.out.println("Hello, world");
D) Print "Hello, world";
Answer: C
8
Copyright © 2016 Pearson Education, Inc.
30) To display the output on the next line, you can use the println method or use this escape sequence
in the print method.
A) \n
B) \r
C) \t
D) \b
Answer: A
int x = 578;
System.out.print("There are " +
x + 5 + "\n" +
"hens in the hen house.");
A) There are 583 hens in the hen house.
B) There are 5785 hens in the hen house.
C) There are x5\nhens in the hen house.
D) There are 5785
hens in the hen house.
Answer: D
34) The primitive data types only allow a(n) to hold a single value.
A) variable
B) object
C) class D)
literal
Answer: A
35) If x has been declared an int, which of the following statements is invalid?
A) x = 0;
B) x = -58932;
C) x = 1,000;
D) x = 592;
Answer: C
9
Copyright © 2016 Pearson Education, Inc.
36) Given the declaration double r;, which of the following statements is invalid?
A) r = 326.75;
B) r = 9.4632e15;
C) r = 9.4632E15;
D) r = 2.9X106;
Answer: D
25 - 7 * 3 + 12 / 3
A) 6
B) 8
C) 10
D) 12
Answer: B
17 % 3 * 2 - 12 + 15
A) 7
B) 8
C) 12
D) 105
Answer: A
40) What will be displayed after the following statements have been executed?
10
Copyright © 2016 Pearson Education, Inc.
41) What will be the value of z after the following statements have been executed?
int x = 4, y = 33;
double z;
z = (double) (y / x);
A) 8.25
B) 4
C) 8
D) 8.0
Answer: D
42) This is a variable whose content is read only and cannot be changed during the program's execution.
A) operator
B) literal
C) named constant
D) reserved word
Answer: C
43) What will be displayed after the following statements have been executed?
A) x = 54.3
B) x
C) x = 108.6
D) Nothing, this is an error.
Answer: D
11
Copyright © 2016 Pearson Education, Inc.
45) What will be displayed as a result of executing the following code?
int x = 8;
String msg = "I am enjoying java.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
char ltr = msg.charAt(x);
int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
ltr);
System.out.println("msg has " + strSize +
" characters.");
A) I am enjoying java.
I AM ENJOYING JAVA.
i am enjoying java.
Character at index x = j
msg has 20 characters.
B) I am enjoying java.
I AM ENJOYING JAVA.
i am enjoying java.
Character at index x = o
msg has 20 characters.
C) I am enjoying java.
I AM ENJOYING JAVA.
i am enjoying java.
Character at index x = o
msg has 19 characters.
D) I am enjoying java.
I AM ENJOYING JAVA.
i am enjoying java.
Character at index x = y
msg has 19 characters.
Answer: C
46) Which of the following does not describe a valid comment in Java?
A) Single line comments, two forward slashes - //
B) Multi-line comments, start with /* and end with */
C) Multi-line comments, start with */ and end with /*
D) Documentation comments, any comments starting with /** and ending with */
Answer: C
47) Which of the following statements correctly creates a Scanner object for keyboard input?
A) Scanner kbd = new Scanner(System.keyboard);
B) Scanner keyboard(System.in);
C) Scanner keyboard = new Scanner(System.in);
D) Keyboard scanner = new Keyboard(System.in);
Answer: C
12
Copyright © 2016 Pearson Education, Inc.
48) Which Scanner class method reads an int?
A) readInt()
B) nextInt()
C) getInt()
D) read_int()
Answer: B
50) Which one of the following methods would you use to convert a string to a double?
A) Byte.ParseByte
B) Long.ParseLong
C) Integer.ParseInt
D) Double.ParseDouble
Answer: D
1) A Java program will not compile unless it contains the correct line numbers.
Answer: FALSE
4) Although the dollar sign is a legal identifier character, you should not use it because it is normally used
for special purposes.
Answer: TRUE
5) Assuming that pay has been declared a double, the following statement is valid.
pay = 2,583.44;
Answer: FALSE
6) Named constants are initialized with a value, that value cannot be changed during the execution of the
program.
Answer: TRUE
7) A variable's scope is the part of the program that has access to the variable.
Answer: TRUE
8) In Java the variable named total is the same as the variable named Total.
Answer: FALSE
13
Copyright © 2016 Pearson Education, Inc.
9) Class names and key words are examples of variables.
Answer: FALSE
10) Both character literals and string literals can be assigned to a char variable.
Answer: FALSE
11) If the compiler encounters a statement that uses a variable before the variable is declared, an error will
result.
Answer: TRUE
12) Programming style includes techniques for consistently putting spaces and indentation in a program
so visual cues are created.
Answer: TRUE
14
Copyright © 2016 Pearson Education, Inc.
Visit https://testbankpack.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
Another Random Document on
Scribd Without Any Related Topics
The Perwāna resolved, therefore, to do nothing towards suppressing
Jelāl’s institutions.
84.
85.
87.
With his last breath Jelāl recommended to Husāmu-’d-Dīn to lay
him in the upper part of his tomb, so that he might be the first to
rise at the last day.
As he lay in his extreme sickness, there were earthquakes for
seven days and nights, very severe, so that walls and houses were
overthrown. On the seventh occasion, all his disciples were alarmed.
He, however, calmly remarked: “Poor earth! it is eager for a fat
morsel! It shall have one!”
He then gave his last instructions to his disciples, as follows:—“I
recommend unto you the fear of God, in public and in private;
abstemiousness in eating and in sleeping, as also in speaking; the
avoidance of rebelliousness and of sin; constancy in fasting,
continuous worship, and perpetual abstinence from fleshly lusts;
long-suffering under the ill-treatment of all mankind; to shun the
companionship of the light-minded and of the common herd; to
associate with the righteous and with men of worth. For verily ‘the
best of mankind is he who benefiteth men,’23 and ‘the best of
speech is that which is short and to the purpose.’”24
88.
······
90.
It is related that, after his death, when laid on his bier, and while
he was being washed by the hands of a loving and beloved disciple,
while others poured the water for the ablution of Jelāl’s body, not
one drop was allowed to fall to the earth. All was caught by the fond
ones around, as had been the case with the Prophet at his death.
Every drop was drunk by them as the holiest and purest of waters.
As the washer folded Jelāl’s arms over his breast, a tremor
appeared to pass over the corpse, and the washer fell with his face
on the lifeless breast, weeping. He felt his ear pulled by the dead
saint’s hand, as an admonition. On this, he fainted away, and in his
swoon he heard a cry from heaven, which said to him: “Ho there!
Verily the saints of the Lord have nothing to fear, neither shall they
sorrow. Believers die not; they merely depart from one habitation to
another abode!”
91.
When the corpse was brought forth, all the men, women, and
children, who flocked to the funeral procession, smote their breasts,
rent their garments, and uttered loud lamentations. These mourners
were of all creeds, and of various nations; Jews and Christians,
Turks, Romans, and Arabians were among them. Each recited sacred
passages, according to their several usages, from the Law, the
Psalms, or the Gospel.
The Muslims strove to drive away these strangers, with blows of
fist, or staff, or sword. They would not be repelled. A great tumult
was the result. The Sultan, the Heir-Apparent, and the Perwāna all
flew to appease the strife, together with the chief Rabbis, the
Bishops, Abbots, &c.
It was asked of these latter why they mixed themselves up with
the funeral of an eminent Muslim sage and saint. They replied that
they had learnt from him more of the mysteries shrouded in their
scriptures, than they had ever known before; and had found in him
all the signs and qualities of a prophet and saint, as set forth in
those writings. They further declared: “If you Muslims hold him to
have been the Muhammed of his age, we esteem him as the Moses,
the David, the Jesus of our time; and we are his disciples, his
adherents.”
The Muslim leaders could make no answer. And so, in all honour,
with every possible demonstration of love and respect, was he borne
along, and at length laid in his grave.
He had died as the sun went down, on Sunday, the fifth of the
month Jumāda-l-ākhir, a.h. 672 (16th December a.d. 1273); being
thus sixty-eight (lunar) years (sixty-six solar years) of age.
92.
Sultan Veled is reported to have related that, shortly after the
death of his father, Jelāl, he was sitting with his step-mother, Jelāl’s
widow, Kirā Khātūn, and Husāmu-’d-Dīn, when his step-mother saw
the spirit of the departed saint, winged as a seraph, poised over his,
Sultan Veled’s, head, to watch over him.
93.
94.
1.
2.
When Shemsu-’d-Dīn was quite worn out by a series of divine
manifestations and the consequent ecstasies, he used to break
away, hide himself, and work as a day-labourer at the water-wheels
of the Damascus gardens, until his equanimity would be restored.
Then he would return to his studies and meditations.
In his supplications to God, he was constantly inquiring whether
there was not in either world, corporeal and spiritual, one other saint
who could bear him company. In answer thereto, there came at
length from the unseen world the answer, that the one holy man of
the whole universe who could bear him company was the Lord
Jelālu-’d-Dīn of Rome.
On receiving this answer, he set out at once from Damascus, and
went in quest of his object to the land of Rome (Asia Minor).
3.
Chelebī Emīr ‘Ārif related that his father, Sultan Veled, told him
that one day, as a trial and test, Shemsu-’d-Dīn requested Jelāl to
make him a present of a slave. Jelāl instantly went and fetched his
own wife, Kirā Khātūn, who was as extremely beautiful as virtuous
and saintlike, offering her to him.
To this act of renunciation Shemsu-’d-Dīn replied: “She is my most
esteemed sister. What I want is a youth to wait on me.” Jelāl
thereupon produced his own son, Sultan Veled, who, he said, would
be proud to carry the shoes of Shems, placing them before him for
use when required for a walk abroad. Again Shems objected: “He is
as my son. But, perhaps, you will supply me with some wine. I am
accustomed to drink it, and am not comfortable without it.”
Jelāl now took a pitcher, went himself to the Jews’ ward of the
city, and returned with it full of wine, which he set before Shems.
“I now saw,” continued Sultan Veled in his recital, “that
Shemsu-’d-Dīn, uttering an intense cry, rent his garment, bowed
down to Jelāl’s feet, lost in wondering admiration at this implicit
compliance with the behests of a teacher, and then said: ‘By the
truth of the First, who had no beginning, the Last, who will have no
end, there never has been, from the commencement of creation,
and there never, until the end of time, will be, in the universe of
substance, a lord and master, heart-captivating and Muhammed-like,
as thou art.’”
He now bowed down again, declared himself a disciple to Jelāl,
and added: “I have tested and tried to the utmost the patient long-
suffering of our Lord; and I have found his greatness of heart to be
totally unlimited by any bounds.”
4.
5.
Jelāl is said to have related that Shemsu-’d-Dīn forbade him to
study any more the writings of his father, Bahā Veled, and that he
punctually obeyed the injunction.
But one night he dreamt that he was in company with a number
of friends, who were all studying and discussing with him those very
writings of Bahā Veled.
As he woke from his dream, Shems was entering the room with a
severe look. Addressing Jelāl, he asked: “How hast thou dared to
study that book again?” Jelāl protested that, since his prohibition, he
had never once opened his father’s works.
“Yes,” retorted Shems, “there is a study by reading, and there is
also a study by contemplating. Dreams are but the shadows of our
waking thoughts. Hadst thou not occupied thy thoughts with those
writings, thou wouldst not have dreamt about them.”
“From that time forward,” remarked Jelāl, “I never again busied
myself with my father’s writings, so long as Shemsu-’d-Dīn remained
alive.”
6.
7.
Shemsu-’d-Dīn was one day sitting with his disciples, when the
public executioner passed by. Shems remarked to those around him:
“There goes one of God’s saints.”
The disciples knew the man, and told Shems that he was the
common headsman. Shems replied: “True! In the exercise of his
calling, he put to death a man of God, whose soul he thus released
from the bondage of the body. As a recompense for this kind act of
his, the saint bequeathed to him his own saintship.”
On the following day the executioner relinquished his office,
vowed repentance, came to Shemsu-’d-Dīn, made his bow, and
professed himself a disciple.
8.
9.
10.
Jelāl’s father, Bahā Veled, had a disciple, who, for some reason,
gave offence to Shemsu-’d-Dīn; the latter, in punishment, inflicted a
deafness on both the disciple’s ears.
After a time, Shems pardoned the offender, and restored his
hearing. But the man bore him a grudge in his heart, nevertheless.
One day, Shems said to him: “Friend, I have pardoned thee;
wherefore art thou still cast down? Be comforted.” Notwithstanding
this, his rancour remained.
One day, however, he met Shems in the midst of a market.
Suddenly, he felt a new faith glow within him, and he shouted out:
“There is no god save God; Shemsu-’d-Dīn is the apostle of God.”
The market-people, on this, raised a great hubbub, and wished to
kill him. One of them came forward to cut him down; but Shems
uttered so terrific a shout, that the man at once fell down dead. The
rest of the market-people bowed, and submitted.
Shems now took the disciple by the hand, and led him away,
remarking to him: “My good friend, my name is Muhammed. Thou
shouldest have shouted: ‘Muhammed is the apostle of God.’ The
rabble will not take gold that is not coined.”
12.
13.
14.
15.
There is a tradition that Jelāl one day called his son Sultan Veled,
gave him a large sum of money, and bade him go, with a suite of
the disciples, to Damascus, and request Shems to return to Qonya.
Jelāl told his son that he would find Shems in a certain inn,
playing at backgammon with a young Firengī (European, Frank), also
one of God’s saints. Sultan Veled went, found Shems exactly so
occupied, and brought him back to Qonya, the Firengī youth
returning to his own country, there to preach Jelāl’s doctrines, as his
vicar.
Sultan Veled walked the whole way from Damascus to Qonya, at
the stirrup-side of Shems, as a groom walks by the side of a prince’s
charger. The whole city went forth to receive them. Jelāl and Shems
embraced each other. Jelāl became more than ever devoted to his
friend; and his disciples resented his neglect of them, as they had
done before. Not long afterwards, the dolorous event occurred that
terminated the life of Shemsu-’d-Dīn.
17.
18.
19.