# z x Getting #zxStarted
Chapter 1
Getting Started
◼ Multiple Choice
1) Java is an object-oriented programming language. An object-oriented language
(a) Uses structured programming.
(b) Views a program as consisting of objects which communicate through interactions.
(c) Functionally breaks down problems into smaller, more manageable problems.
(d) All of the above.
Answer: B
2) In Java, the equal sign is used as the operator.
(a) increment
(b) decrement
(c) assignment
(d) negation
Answer: C
3) In Java, source code is compiled into object code called .
(a) Bit-code
(b) Class code
(c) Method code
(d) Byte-code
Answer: D
4) The hardest kind of error to detect in a computer program is a:
(a) Syntax error
(b) Run-time error
(c) Logic error
(d) All of the above
Answer: C
Copyright © 2016 Pearson Education, Inc., Hoboken NJ
VerifiedMedPapers
, Chapter #zx1 # z x 2
# z x Getting #zxStarted
5) Identify #zxthe #zxinvalid #zxJava #zxidentifier.
(a) 1Week
(b) Week1
(c) amountDue
(d) amount_due
#zx Answer: # z x A
6) What #zxis #zxthe #zxvalue #zxof #zxthe #zxvariable #zxamountDue?
double #zxprice #zx= #zx2.50;
#zx double #zxquantity #zx=
#zx 5; #zxdouble
amountDue #zx= #zx0;
#zx
amountDue #zx= #zxprice #zx* #zxquantity;
(a) 12
(b) 12.25
(c) 12.5
(d) 13
Answer: # z x C
7) What #zxis #zxthe #zxvalue #zxof #zx7.52e-5?
(a) 752000.0
(b) 0.0000752
(c) 0.000752
(d) 0.00752
Answer: # z x B
8) What #zxis #zxthe #zxJava #zxexpression #zxfor #zx4a2 #zx+ #zx2b #zx* #zxc?
(a) (4 #zx * #zxa) #zx+ #zx(2 #zx* #zxb) #zx* #zxc
(b) (4 #zx * #zxa #zx* #zxa) #zx+ #zx((2 #zx * #zxb) #zx* #zxc)
(c) ((4 #zx* #zxa #zx* #zxa) #zx+ #zx(2 #zx* #zxb)) #zx* #zxc
(d) (4 #zx+ #zxa #zx* #zxa) #zx+ #zx((2
#zx + #zxb) #zx* #zxc) #zxAnswer:
# zx B
9) What #zxis #zxthe #zxJava #zxexpression #zxfor #zx27xy?
(a) 27 #zx+ #zx(x #zx* #zxy)
(b) 27 #zx* #zx(x #zx+ #zxy)
(c) 27 #zx* #zxx #zx * #zxy
(d) 27x #zx*
VerifiedMedPapers
, Chapter #zx1 # z x 3
# z x Getting #zxStarted
y
#zx
#zx Answer:
#zx C
Copyright # z x © # z x 2016 # z x Pearson # z x Education, # z x Inc., # z x Hoboken # z x NJ
VerifiedMedPapers
, Chapter #zx1 # z x 4
# z x Getting #zxStarted
10) The #zxvalue #zxof #zxthe #zxexpression #zx(int) #zx27.6 #zxevaluates #zxto:
(a) # z x 28
(b) # z x 27
(c) # z x 26
(d) # z x None #zxof #zxthe
above. #zxAnswer:
#zx #z x B
11) Which #zxoperator #zxis #zxused #zxto #zxconcatenate #zxtwo #zxstrings?
(a) # z x +
(b) # z x –
(c) # z x *
(d) # z x /
#zx Answer:
#zx A
12) Which #zxoperator #zxreturns #zxthe #zxremainder #zxof #zxinteger #zxdivision?
(a) # z x %
(b) # z x /
(c) # z x *
(d) # z x none #zxof #zxthe
above #zxAnswer:
#zx #zx A
13) What #zxis #zxthe #zxvalue #zxof #zxthe #zxvariable #zxc #zxin #zxthe #zxstatements #zxthat #zxfollow?
String #zxphrase #zx= #zx"Make #zxhay #zxwhile #zxthe #zxsun #zxis #zxshining.";
char #zxc #zx= #zxphrase.charAt(10);
(a) # z x w
(b) # z x h
(c) # z x i
(d) # z x None #zxof #zxthe
above #zxAnswer: # z x B
#zx
14) The #zxescape #zxsequence #zxthe #zxrepresents #zxthe #zxnew-line #zxcharacter #zxis:
(a) # z x \r
(b) # z x \t
(c) # z x \n
(d) # z x \\
#zx Answer:
#zx C
VerifiedMedPapers