CSCI240FinalExamQuestionsand
j j j j j
CorrectVerifiedAnswersLatest
jj j j j
Version jj
The jjclass jjX jjcontains jjtwo jjdata jjmembers: jjan jjinteger jjcalled jjxVal jjand jja jjfloat
called jjxPerc. jjWhich jjof jjthe jjfollowing jjis jjNOT jja jjvalid jjprototype jjfor jjthe jjclass
jj
definition jjfor jjX?
jj
a. void jjX( jjint, jjfloat jj);
b. void jjsetxVal( jjint jj);
c. float jjgetxPerc();
d. X( jjint, jjfloat jj);
e. void jjprintX();
✓ a. jjvoid jjX( jjint, jjfloat jj);
An jjinstance jjof jja jjclass jjis jjknown jjas jja/an jj .
a. variable
b. method
c. object
,d. thing
✓ c. jjobject
The jj:: jjoperator jjis jjused jjto jjassociate jja jjmethod jjwith jja jjspecific jjclass.
a. true
b. false
✓ a. jjtrue
Which jjof jjthe jjfollowing jjstatements jj(a-d) jjabout jjclasses jjis jjtrue?
a. A jjclass jjcan jjcontain jjboth jjdata jjmembers jjand jjmethods
b. The jjmembers jjof jja jjclass jjmay jjbe jjprivate jjor jjpublic
c. The jjname jjof jjthe jjconstructor jjis jjalways jjthe jjsame jjas jjthe jjname jjof jjthe jjclass
d. The jjclass jjdefinition jjcontains jjprototype jjstatements jjfor jjthe jjmethods
e. All jjof jjthe jjstatements jj(a-d) jjare jjtrue.
✓ e. jjAll jjof jjthe jjstatements jj(a-d) jjare jjtrue.
If jja jjstring jjwill jjneed jjroom jjfor jj25 jjcharacters, jjhow jjshould jjit jjbe jjdefined jjso jjthat
it jjwill jjbe jja jjvalid jjstring?
jj
,a. char jjstr[25];
b. char jjstr[24];
c. char jjstr[26];
d. char jjstr[];
✓ c. jjchar jjstr[26];
Which jjof jjthe jjfollowing jjstring jjfunctions jjwill jjALWAYS jjproduce jja jjvalid jjstring
after jjexecution?
jj
a. strcpy
b. strcat
c. Both jjof jjthe jjfunctions jj(a-b) jjwill jjproduce jja jjvalid jjstring
✓ c. jjBoth jjof jjthe jjfunctions jj(a-b) jjwill jjproduce jja jjvalid jjstring
The jjnull jjterminator jjis jj .
a. used jjto jjadvance jjto jja jjnew jjline jjwhen jjexecuting jja jjcout jjstatement
b. represented jjas jj'\0'
, c. used jjto jjend jja jjvalid jjstring
d. a jjmovie jjstarring jjArnold jjSchwarzenegger
e. All jjof jjthe jjstatements jj(a-d) jjare jjcorrect
f. Only jjstatements jjb jjand jjc jjare jjcorrect
✓ f. jjOnly jjstatements jjb jjand jjc jjare jjcorrect.
Which jjof jjthe jjfollowing jjis jjthe jjcorrect jjdefinition jjfor jja jjvariable jjcalled jjdblRef
that jjcan jjhold jja jjreference jjto jjthe jjdouble jjvariable jjdblNum?
jj
a. double jjdblRef jj= jjdblNum;
b. double jj *dblRef jj = jj &dblNum;
c. double jj&dblRef jj= jjdblNum;
d. double jj&dblRef;
✓ c. jjdouble jj&dblRef jj= jjdblNum;
Which jjof jjthe jjfollowing jjstatements jj(a-d) jjare jjtrue jjif jjthe jjfollowing jjlines jjof
code jjare jjexecuted?
jj
int jjG jj= jj17;
int jj&H jj= jjG;
j j j j j
CorrectVerifiedAnswersLatest
jj j j j
Version jj
The jjclass jjX jjcontains jjtwo jjdata jjmembers: jjan jjinteger jjcalled jjxVal jjand jja jjfloat
called jjxPerc. jjWhich jjof jjthe jjfollowing jjis jjNOT jja jjvalid jjprototype jjfor jjthe jjclass
jj
definition jjfor jjX?
jj
a. void jjX( jjint, jjfloat jj);
b. void jjsetxVal( jjint jj);
c. float jjgetxPerc();
d. X( jjint, jjfloat jj);
e. void jjprintX();
✓ a. jjvoid jjX( jjint, jjfloat jj);
An jjinstance jjof jja jjclass jjis jjknown jjas jja/an jj .
a. variable
b. method
c. object
,d. thing
✓ c. jjobject
The jj:: jjoperator jjis jjused jjto jjassociate jja jjmethod jjwith jja jjspecific jjclass.
a. true
b. false
✓ a. jjtrue
Which jjof jjthe jjfollowing jjstatements jj(a-d) jjabout jjclasses jjis jjtrue?
a. A jjclass jjcan jjcontain jjboth jjdata jjmembers jjand jjmethods
b. The jjmembers jjof jja jjclass jjmay jjbe jjprivate jjor jjpublic
c. The jjname jjof jjthe jjconstructor jjis jjalways jjthe jjsame jjas jjthe jjname jjof jjthe jjclass
d. The jjclass jjdefinition jjcontains jjprototype jjstatements jjfor jjthe jjmethods
e. All jjof jjthe jjstatements jj(a-d) jjare jjtrue.
✓ e. jjAll jjof jjthe jjstatements jj(a-d) jjare jjtrue.
If jja jjstring jjwill jjneed jjroom jjfor jj25 jjcharacters, jjhow jjshould jjit jjbe jjdefined jjso jjthat
it jjwill jjbe jja jjvalid jjstring?
jj
,a. char jjstr[25];
b. char jjstr[24];
c. char jjstr[26];
d. char jjstr[];
✓ c. jjchar jjstr[26];
Which jjof jjthe jjfollowing jjstring jjfunctions jjwill jjALWAYS jjproduce jja jjvalid jjstring
after jjexecution?
jj
a. strcpy
b. strcat
c. Both jjof jjthe jjfunctions jj(a-b) jjwill jjproduce jja jjvalid jjstring
✓ c. jjBoth jjof jjthe jjfunctions jj(a-b) jjwill jjproduce jja jjvalid jjstring
The jjnull jjterminator jjis jj .
a. used jjto jjadvance jjto jja jjnew jjline jjwhen jjexecuting jja jjcout jjstatement
b. represented jjas jj'\0'
, c. used jjto jjend jja jjvalid jjstring
d. a jjmovie jjstarring jjArnold jjSchwarzenegger
e. All jjof jjthe jjstatements jj(a-d) jjare jjcorrect
f. Only jjstatements jjb jjand jjc jjare jjcorrect
✓ f. jjOnly jjstatements jjb jjand jjc jjare jjcorrect.
Which jjof jjthe jjfollowing jjis jjthe jjcorrect jjdefinition jjfor jja jjvariable jjcalled jjdblRef
that jjcan jjhold jja jjreference jjto jjthe jjdouble jjvariable jjdblNum?
jj
a. double jjdblRef jj= jjdblNum;
b. double jj *dblRef jj = jj &dblNum;
c. double jj&dblRef jj= jjdblNum;
d. double jj&dblRef;
✓ c. jjdouble jj&dblRef jj= jjdblNum;
Which jjof jjthe jjfollowing jjstatements jj(a-d) jjare jjtrue jjif jjthe jjfollowing jjlines jjof
code jjare jjexecuted?
jj
int jjG jj= jj17;
int jj&H jj= jjG;