CPEN 223 – FINAL Questions and
Answers Updated 2023
3BC'sBforB"goodBSoftware"B-BAnswer-BCorrectB(safeBfromBbugs)
-BComprehensibleB(easyBtoBunderstand)
-BChangeableB(readyBtoBchange)
StaticBCheckingB-BAnswerTheBcheckingBthatBisBdoneBatBcompilation.
-BBugBautomaticallyBfoundBbeforeBprogramBruns
DynamicBCheckingB-BAnswerTheBcheckingBthatBisBdoneBatBrunBtime.
-BFoundBautomatically
BenefitsBofBC#B-BAnswer-Safety
B>BTypeBsafe,BstaticBchecking,BexceptionBhandling,Betc
-BUbiquity
B>BMultiplatform:BMobile,BWeb,BWindows/Mac/Linux
-BElegance
-BPopular
-BPowerful
-BHigh-level
-BModernBobjectBoriented
IssuesBwithBC#B-BAnswer-BVerbose:BtakesBaBlotBofBcodeBtoBdoBsimpleBtask
-BLarge:BmanyBfeatures
staticBvoidBMain()B-BAnswerTheBstartingBplaceBofBaBprogram
intBvarNameB=B92;B-BAnswerDeclaringBanBintBtypeBvariable
doubleBVarNameB=B1.45;B-BAnswerDeclaringBaBdoubleBtypeBvariable
,charBvarNameB=B'*';B-BAnswerDeclaringBaBcharBtypeBvariable
TwoBcategoriesBofBC#BtypesB-BAnswer-BValueBtypes
-BReferenceBtypes
C#BoperatorsB-BAnswer-BarithmeticB(B+,B-,B/,B%B(remainder),B*)
-BcomparisonB(==,B!=,B>,B>=,B...)
-BconditionalB(&&,B||,B!)
C#BselectionBstatementsB-BAnswer-Bif(condition)
-BelseBif(condition)
-BswitchB*anBalternativeBtoBif-elseBstatements
C#BrepetitionBstatementsB-BAnswer-Bwhile
-Bfor
-Bdo-while
ClassB-BAnswerTheBmostBimportantBuserBdefinedBtype
-BContainsBtwoBtypesBofBmembers;
>BDataBmembersB(fields,B..)BthatBstoreBtheBdataBwithinBtheB______.
>BFunctionBmembersB(methods,Bconstructors,B...)BthatBperformBoperationsBonBtheBdata
MethodsB-BAnswerABblockBofBcodeBthatBcontainsBaBseriesBofBstatements.
ArraysB-BAnswerstoresBaBfixed-sizeBcollectionBofBelements
HowBtoBinitializeBanBarrayB-BAnswerint[]BnameOfVariableB=BnewBint[5];
-BTheBsizeBofBtheB______BisB5.
intB[]BnameOfVariableB=BnewBint[]B{1,B2,B3,B4,B5};
intB[]BnameOfVariableB=B{1,B2,B3,B4,B5};
,WhatBisBaBDataBType?B-
BAnswerAB_____BisBaBsetBofBvaluesBandBtheBoperationsBthatBareBpermittedBonBtheBvalues
ValueBpre-definedBtypesB-BAnswer-Bint
-Blong
-BdoubleB
-Bchar
-Buint
-Bbool
-Bdecimal
-Bbool
-Bbyte
-Bsbyte
-Bfloat
-Buint
-Bshort
-Bushort
ReferenceBpre-definedBtypesB-BAnswer-Bobject
-Bstring
-Bdynamic
ABvalueBtypeB-
BAnswerThisBtypeBneedsBonlyBoneBallocatedBmemoryBspaceBthatBstoresBtheBactualBdata.
ABreferenceBtypeB-
BAnswerThisBtypeBstoresBtheB*mentionBtoBsomeBotherBmemoryBlocationBwhereBtheBactualBd
ataBisBstored.
TwoBregionsBofBmemoryBthatBstoreBdataB-BAnswer-Bstack
-Bheap
, StackB-BAnswerlocationBforBstorageBofBvalueBtypes
(last-in,Bfirst-outBdataBstructure)
-BPrimaryBoperations:
B>Bpush()B:BadditionBofBanBelementBtoBtheBtopBofBtheBstack
B>Bpop()B:BremovalBofBanBelementBfromBtheBtopBofBtheBstack
B>BClear()
B>BRemove()
B>BToArray()
B>BContains()
B>BCount()
HeapB-
BAnswerTheBreferenceBtypeBisBstoredBinBtheBstackBbutBtheBactualBdataBisBstoredBinBtheB"__
____"
User-definedBtypesB-BAnswer-Bclass
-Bstruct
-Barray
NOTE:BcanBbeBclassifiedBasBeitherBreferenceBorBvalueBtypes
_______BisBaBtypeBthatBstoresBlogicallyBrelatedBdataBandBfunctionsB-BAnsweraBclass
DeclareBaBclassB-BAnswerclassBnameOfClass
{
//memberBdeclarations
}
ABfieldB-BAnswer-BStoresBdata
-BIsBaBvariableB(ofBanyBtype)BthatBisBaBmemberBofBaBclass
-
Answers Updated 2023
3BC'sBforB"goodBSoftware"B-BAnswer-BCorrectB(safeBfromBbugs)
-BComprehensibleB(easyBtoBunderstand)
-BChangeableB(readyBtoBchange)
StaticBCheckingB-BAnswerTheBcheckingBthatBisBdoneBatBcompilation.
-BBugBautomaticallyBfoundBbeforeBprogramBruns
DynamicBCheckingB-BAnswerTheBcheckingBthatBisBdoneBatBrunBtime.
-BFoundBautomatically
BenefitsBofBC#B-BAnswer-Safety
B>BTypeBsafe,BstaticBchecking,BexceptionBhandling,Betc
-BUbiquity
B>BMultiplatform:BMobile,BWeb,BWindows/Mac/Linux
-BElegance
-BPopular
-BPowerful
-BHigh-level
-BModernBobjectBoriented
IssuesBwithBC#B-BAnswer-BVerbose:BtakesBaBlotBofBcodeBtoBdoBsimpleBtask
-BLarge:BmanyBfeatures
staticBvoidBMain()B-BAnswerTheBstartingBplaceBofBaBprogram
intBvarNameB=B92;B-BAnswerDeclaringBanBintBtypeBvariable
doubleBVarNameB=B1.45;B-BAnswerDeclaringBaBdoubleBtypeBvariable
,charBvarNameB=B'*';B-BAnswerDeclaringBaBcharBtypeBvariable
TwoBcategoriesBofBC#BtypesB-BAnswer-BValueBtypes
-BReferenceBtypes
C#BoperatorsB-BAnswer-BarithmeticB(B+,B-,B/,B%B(remainder),B*)
-BcomparisonB(==,B!=,B>,B>=,B...)
-BconditionalB(&&,B||,B!)
C#BselectionBstatementsB-BAnswer-Bif(condition)
-BelseBif(condition)
-BswitchB*anBalternativeBtoBif-elseBstatements
C#BrepetitionBstatementsB-BAnswer-Bwhile
-Bfor
-Bdo-while
ClassB-BAnswerTheBmostBimportantBuserBdefinedBtype
-BContainsBtwoBtypesBofBmembers;
>BDataBmembersB(fields,B..)BthatBstoreBtheBdataBwithinBtheB______.
>BFunctionBmembersB(methods,Bconstructors,B...)BthatBperformBoperationsBonBtheBdata
MethodsB-BAnswerABblockBofBcodeBthatBcontainsBaBseriesBofBstatements.
ArraysB-BAnswerstoresBaBfixed-sizeBcollectionBofBelements
HowBtoBinitializeBanBarrayB-BAnswerint[]BnameOfVariableB=BnewBint[5];
-BTheBsizeBofBtheB______BisB5.
intB[]BnameOfVariableB=BnewBint[]B{1,B2,B3,B4,B5};
intB[]BnameOfVariableB=B{1,B2,B3,B4,B5};
,WhatBisBaBDataBType?B-
BAnswerAB_____BisBaBsetBofBvaluesBandBtheBoperationsBthatBareBpermittedBonBtheBvalues
ValueBpre-definedBtypesB-BAnswer-Bint
-Blong
-BdoubleB
-Bchar
-Buint
-Bbool
-Bdecimal
-Bbool
-Bbyte
-Bsbyte
-Bfloat
-Buint
-Bshort
-Bushort
ReferenceBpre-definedBtypesB-BAnswer-Bobject
-Bstring
-Bdynamic
ABvalueBtypeB-
BAnswerThisBtypeBneedsBonlyBoneBallocatedBmemoryBspaceBthatBstoresBtheBactualBdata.
ABreferenceBtypeB-
BAnswerThisBtypeBstoresBtheB*mentionBtoBsomeBotherBmemoryBlocationBwhereBtheBactualBd
ataBisBstored.
TwoBregionsBofBmemoryBthatBstoreBdataB-BAnswer-Bstack
-Bheap
, StackB-BAnswerlocationBforBstorageBofBvalueBtypes
(last-in,Bfirst-outBdataBstructure)
-BPrimaryBoperations:
B>Bpush()B:BadditionBofBanBelementBtoBtheBtopBofBtheBstack
B>Bpop()B:BremovalBofBanBelementBfromBtheBtopBofBtheBstack
B>BClear()
B>BRemove()
B>BToArray()
B>BContains()
B>BCount()
HeapB-
BAnswerTheBreferenceBtypeBisBstoredBinBtheBstackBbutBtheBactualBdataBisBstoredBinBtheB"__
____"
User-definedBtypesB-BAnswer-Bclass
-Bstruct
-Barray
NOTE:BcanBbeBclassifiedBasBeitherBreferenceBorBvalueBtypes
_______BisBaBtypeBthatBstoresBlogicallyBrelatedBdataBandBfunctionsB-BAnsweraBclass
DeclareBaBclassB-BAnswerclassBnameOfClass
{
//memberBdeclarations
}
ABfieldB-BAnswer-BStoresBdata
-BIsBaBvariableB(ofBanyBtype)BthatBisBaBmemberBofBaBclass
-