Docsity

Introduction to Computing and Programming - Solved Exam 2 | CSCI 1301, Exams of Computer Science

Toggle sidebar
bg1
\
r2,:esei -2 Jftai E^!i Ai'Ei.EO
J.Jf,r, rdll 4.vvo
rl
E.,^- t
E xc|t,t L
2008.11.13
Exam 2 has 11 questions worth a total of 100 points and 3 bonus questions. Please make certain
you have all 8 pages. You will have 75 minutes to complete the exam.
Acariemic Honesty:
The following represents my own work. I have neither received nor given inappropriate
assistance. I have not copied or modifieC code from any source o'ther than the cou!"se webpage
or the course textbook. I rbcognize that any unauthorized assistance or plagiarism will be
handled in aceordance with the University of Georgia's Academic lloiresty Policy and the
policies tif tiris course.
1. ( 5 points)
Briefly explain the difference between passing primitive data arguments by "value" and object
arguments by "reference" to a method.
.Lr
Q{'rei\rvt dA\a \€t y r$c o"ic".a\ va\.,+
st.e $* q)lP1s d
x\lz
tb
2. (5 Points)
Why are instance members of a class typically declardd as private?
What term is used to describe these programming choices?
oblect &*^t [1gu'
("*\
\o^t- \o
, \qc'les^.<- uar'r,g"b\r9 *'I "ra-\A1 a.r< &c\anted ?!\J6*<.- st3
o.{'\ ivt.glr\.} nurw\qtrr-- ( "*o.q,. -- ta\ L* \o a vrlf\.e
\.4
\9 caL\.e} e^coP3-i>^"-^-
' \./
f
2/.
t\
\e-\ \+ $a€{ 4aanr\ <\^a'Je
4*.r.*r),
pf2

Partial preview of the text

Download Introduction to Computing and Programming - Solved Exam 2 | CSCI 1301 and more Exams Computer Science in PDF only on Docsity!

\

esei r2,:

-2 (^) Jftai E^!i Ai'Ei.EO

J.Jf,r, rdll^ 4.vvo

rl

E.,^- t

E xc|t,t L

2008.11.

Exam 2 has 11 questions^ worth a^ total^ of^100 points and^3 bonus questions.^ Please make^ certain

you have all 8 pages. You will have^75 minutes to complete the^ exam.

Acariemic Honesty:

The following represents my own work. I^ have^ neither^ received^ nor^ given^ inappropriate

assistance. I have not copied or modifieC^ code^ from^ any source^ o'ther^ than^ the^ cou!"se^ webpage

or the course textbook. I rbcognize that any^ unauthorized^ assistance^ or^ plagiarism^ will^ be

handled in aceordance with^ the^ University^ of^ Georgia's Academic^ lloiresty^ Policy^ and the

policies tif tiris course.

  1. ( 5 points)

Briefly explain the difference between passing^ primitive^ data^ arguments^ by^ "value"^ and^ object

arguments by (^) "reference" to a method.

.Lr

Q{'rei\rvt

dA\a

\€t y^

r$c o"ic".a\

va.,+

st.e $*^ q)lP1s^ d

x\lz tb

  1. (5 Points)

Why are instance members of a class^ typically^ declardd^ as^ private?

What term is used to describe these programming^ choices?

oblect &*^t^

[1gu'

("*\

\o^t- \o

, \qc'les^.<- uar'r,g"b\r9 (^) 'I "ra-\A a.r< &c\anted ?!\J6<.- st

o.{'\ (^) ivt.glr.} (^) nurw\qtrr-- ( "*o.q,.

-- ta^ L*^ \o^ a vrlf.e .

\9 caL.e} e^coP3-i>^"-^- ' (^) ./

f

2/. t\

\e-\ + $a€{^ 4aanr^ <^a'Je

4.r.r),

  1. (^) i5 pcintsi^ r

What part of the signature line must^ differ^ between^ two^ overloaded methods?^ Clarify^

your

answer with two overloaded method examples.^ (You^ do^ not^ need^ to^ write^ the method^ body.

Signatures of the methods are^ sufficient).

tr- vrv6^L4'^ 6(^ \fa -F t<- rre-u.*^ tr5^ ru-s- *^ A$ce^ + I

f-r,a'.c-

Cfv€4C,^ (^) "'"r), /

qz-r".c-

c ".;7^ o-...1,2oqr-_

,t{itiru,

1,nuff

uu:$

lY2P'"'

'ntr. $A*ll

4.. (^10 points)

a. Explain the difference bdtween how^ Java^ handles a^ Clock^ type^ array and^ a^ Clock^ type

^,

t variible^ in^ memory. A'picture^ may be^ a^ sufhcient answer.^ (8 points)

W/rrl I (^) l- b. What^ are^ two or more^ referenees^ that^ point^ to the^ same^ object^ called?^ (2^ points)

(^) .,*1C*r[e-tfE_->

T ut./ ,/

'wd

  • (^) c-:\

\i-<_ i:4al^ '

I \ \ocat\an!-f (^4) L tftcco,1. *.1c\ock

{c.v.*Ur' Cioce *,.rC,.r:^ r€w^ Cu.gt);

fr sry (^) L\ocV __f,-

=@/ V

{;.s

cVc

q-

v

o\ 5'

4i,'.^ tV<- *rr+1'

.*e [8,

t) \t *- (^) aVrez.ts o&{"^.. k-- (^) ,o-,- (^) o\iect
a.r<. e(r+ (^) c!tra9e

v

af eaaLe\ar