
Pleaseîwriterîyourîonîtheîtopîofîtheîpage.î
22c:21îComputerîîScienceîII:îDataîStructuresî
Quizî2Aî(openîbookîandînotes;îpleaseîcircleîallîtheîcorrectîsolutions)î
1.îîIfîyouîdeclareîanîarrayîdouble[]îlistî=î{3.4,î2.0,î3.5,î
5.5},îlist[1]îisî________.î
A.î3.4î
B.î2.0î
C.î3.4î
D.î5.5î
E.îundefinedî
î
2.îîIfîyouîdeclareîanîarrayîdouble[]îlistî=î{3.4,î2.0,î3.5,î
5.5},îtheîhighestîindexîinîarrayîlistîisî__________.î
A.î0î
B.î1î
C.î2î
D.î3î
E.î4î
î
3.îSupposeîintîiî=î5,îwhichîofîtheîfollowingîcanîbeîusedî
asîanîindexîforîarrayîdouble[]îtî=înewîdouble[100]?î
A.îiî
B.î(int)(Math.random()î*î100))î
C.îiî+î10î
D.îiî+î6.5î
E.îMath.random()î*î100î
î
4.îWhichîofîtheîfollowingîstatementsîisîvalid?î
A.îintîiî=înewîint(30);î
B.îdoubleîd[]î=înewîdouble[30];î
C.îint[]îiî=î{3,î4,î3,î2};î
D.îchar[]îcî=înewîchar();î
E.îchar[]îcî=înewîchar[4]{'a',î'b',î'c',î'd'};î
î
5.îîWhatîwouldîbeîtheîresultîofîattemptingîtoîcompileî
andîrunîtheîfollowingîcode?î
publicîclassîTestî{î
îîpublicîstaticîvoidîmain(String[]îargs)î{î
îîîîdouble[]îxî=înewîdouble[]{1,î2,î3};î
îîîîSystem.out.println("Valueîisî"î+îx[1]);î
îî}î
}îî
A.îTheîprogramîhasîaîcompileîerrorîbecauseîtheîsyntaxî
newîdouble[]{1,î2,î3}îisîwrongîandîitîshouldîbeîreplacedî
byî{1,î2,î3}.î
B.îTheîprogramîhasîaîcompileîerrorîbecauseîtheîsyntaxî
newîdouble[]{1,î2,î3}îisîwrongîandîitîshouldîbeîreplacedî
byînewîdouble[3]{1,î2,î3};î
C.îTheîprogramîhasîaîcompileîerrorîbecauseîtheîsyntaxî
newîdouble[]{1,î2,î3}îisîwrongîandîitîshouldîbeîreplacedî
byînewîdouble[]{1.0,î2.0,î3.0};î
D.îTheîprogramîcompilesîandîrunsîfineîandîtheîoutputî
"Valueîisî1.0"îisîprinted.î
E.îTheîprogramîcompilesîandîrunsîfineîandîtheîoutputî
"Valueîisî2.0"îisîprinted.î
î
6.îAssumeîint[]îtî=î{1,î2,î3,î4}.îWhatîisît.length?î
A.î0î
B.î3î
C.î4î
D.î5î
î