# x c Getting #xcStarted
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 # x c © # x c 2016 # x c Pearson # x c Education, # x c Inc., # x c Hoboken # x c NJ
TestBanksAdept
, Chapter #xc1 # x c 2
# x c Getting #xcStarted
5) Identify #xcthe #xcinvalid #xcJava #xcidentifier.
(a) 1Week
(b) Week1
(c) amountDue
(d) amount_due
#xc Answer: # x c A
6) What #xcis #xcthe #xcvalue #xcof #xcthe #xcvariable #xcamountDue?
double #xcprice #xc= #xc2.50;
#xc double #xcquantity #xc=
#xc 5; #xcdouble
amountDue #xc= #xc0;
#xc
amountDue #xc= #xcprice #xc* #xcquantity;
(a) 12
(b) 12.25
(c) 12.5
(d) 13
Answer: # x c C
7) What #xcis #xcthe #xcvalue #xcof #xc7.52e-5?
(a) 752000.0
(b) 0.0000752
(c) 0.000752
(d) 0.00752
Answer: # x c B
8) What #xcis #xcthe #xcJava #xcexpression #xcfor #xc4a2 #xc+ #xc2b #xc* #xcc?
(a) (4 #xc * #xca) #xc+ #xc(2 #xc* #xcb) #xc* #xcc
(b) (4 #xc * #xca #xc* #xca) #xc+ #xc((2 #xc * #xcb) #xc* #xcc)
(c) ((4 #xc* #xca #xc* #xca) #xc+ #xc(2 #xc* #xcb)) #xc* #xcc
(d) (4 #xc+ #xca #xc* #xca) #xc+ #xc((2
#xc + #xcb) #xc* #xcc) #xcAnswer:
# xc B
9) What #xcis #xcthe #xcJava #xcexpression #xcfor #xc27xy?
(a) 27 #xc+ #xc(x #xc* #xcy)
(b) 27 #xc* #xc(x #xc+ #xcy)
(c) 27 #xc* #xcx #xc * #xcy
(d) 27x #xc*
TestBanksAdept
, Chapter #xc1 # x c 3
# x c Getting #xcStarted
y
#xc
#xc Answer:
#xc C
Copyright # x c © # x c 2016 # x c Pearson # x c Education, # x c Inc., # x c Hoboken # x c NJ
TestBanksAdept
, Chapter #xc1 # x c 4
# x c Getting #xcStarted
10) The #xcvalue #xcof #xcthe #xcexpression #xc(int) #xc27.6 #xcevaluates #xcto:
(a) # x c 28
(b) # x c 27
(c) # x c 26
(d) # x c None #xcof #xcthe
above. #xcAnswer:
#xc # xc B
11) Which #xcoperator #xcis #xcused #xcto #xcconcatenate #xctwo #xcstrings?
(a) # x c +
(b) # x c –
(c) # x c *
(d) # x c /
#xc Answer:
#xc A
12) Which #xcoperator #xcreturns #xcthe #xcremainder #xcof #xcinteger #xcdivision?
(a) # x c %
(b) # x c /
(c) # x c *
(d) # x c none #xcof #xcthe
#xc above #xcAnswer: #xc A
13) What #xcis #xcthe #xcvalue #xcof #xcthe #xcvariable #xcc #xcin #xcthe #xcstatements #xcthat #xcfollow?
String #xcphrase #xc= #xc"Make #xchay #xcwhile #xcthe #xcsun #xcis #xcshining.";
char #xcc #xc= #xcphrase.charAt(10);
(a) # x c w
(b) # x c h
(c) # x c i
(d) # x c None #xcof #xcthe
above #xcAnswer: # x c B
#xc
14) The #xcescape #xcsequence #xcthe #xcrepresents #xcthe #xcnew-line #xccharacter #xcis:
(a) # x c \r
(b) # x c \t
(c) # x c \n
(d) # x c \\
#xc Answer:
#xc C
TestBanksAdept