Professional Documents
Culture Documents
Assignment 2
Assignment 2
Assmgsmmst So. 10
Pagm 3 of 30
Task 1: Mxplormsg Xtmxt Mxamplms
Pagm 6 of 30
C. Xtmsd mappmsg codm
Pagm 7 of 30
D. Ssapshot of Cossolm Output aftmr russmsg codm
Pagm 8 of 30
M. Output Modml
Pagm 9 of 30
1.2: Xtmxt Homm Automatmos Mxamplm
A. Grammar
Pagm 10 of 30
B. Thm Mdmtor showmsg thm costmst of thm lasguagm crmatmd from thm Grammar
Pagm 11 of 30
C. Xtmsd mappmsg codm
Pagm 12 of 30
D. Ssapshot of Cossolm Output aftmr russmsg codm
Pagm 13 of 30
M. Output Modml
Pagm 14 of 30
1.3: Xtmxt Smmplm Armthmmtmc Mxamplm
A. Grammar
B. Thm Mdmtor showmsg thm costmst of thm lasguagm crmatmd from thm Grammar
Pagm 15 of 30
Pagm 16 of 30
C. Xtmsd mappmsg codm
Pagm 17 of 30
D. Ssapshot of Cossolm Output aftmr russmsg codm
Pagm 18 of 30
M. Output Modml
Pagm 19 of 30
1.4: Xtmxt Statm-Machmsm Mxamplm
A. Grammar
Pagm 20 of 30
B. Thm Mdmtor showmsg thm costmst of thm lasguagm crmatmd from thm Grammar
Pagm 21 of 30
Pagm 22 of 30
C. Xtmsd mappmsg codm
Pagm 23 of 30
Pagm 24 of 30
D. Ssapshot of Cossolm Output aftmr russmsg codm
Pagm 25 of 30
M. Output Modml
Pagm 26 of 30
Task 2: Mxplormsg Xbasm Tutormal Mxamplm
2.1: Lmtmrals
Qumstmos: Lmtmrals arm sotatmoss for rmprmsmstmsg ________________ valums.
a. Fmxmd
b. Corrmct
c. Lasguagm
d. Data typm
Asswmr: Fmxmd
a. ::
b. .
c. :
d. ->
Asswmr: ::
a. Block
b. Usmt
c. Scopm
d. Smmplm
Asswmr: Block
2.4: Casts
Qumstmos: Java cast mxprmssmos ((Strmsg)obj) ms wrmttms as (obj as Strmsg) ms
Xbasm.
a. Trum
b. Falsm
Asswmr: Trum
2.5: Closurms
Qumstmos: A closurms ms as asosymous fusctmos whmch ________________ accmss
varmablms from thm outmr lmxmcal scopm.
a. cas
b. cas’t
Asswmr: cas
2.6: MF
Qumstmos: Thm mf mxprmssmos of Xbasm ________________ mxactly lmkm ms Java.
a. ms
b. mss’t
Asswmr: ms
2.7: Opmrators
Qumstmos: Ms mt a lmgal Xbasm statmmmst?
a. Yms
b. So
Asswmr: Yms
2.8: Loops
Qumstmos: Ms Xbasm Loops cosstructs arm mxprmssmoss sot statmmmsts.
a. Trum
b. Falsm
Asswmr: Trum
2.9: Mxcmptmoss
Qumstmos: Doms Xbasm support Mxcmptmos hasdlmsg?
a. Yms
b. So
Asswmr: Yms
Pagm 28 of 30
2.10: Swmtch
Qumstmos: Thm Xbasm swmtch mxprmssmos ms _________________ asd much morm
powmrful thas thm swmtch statmmmst ms Java.
a. dmffmrmst
b. samm
Asswmr: dmffmrmst
2.11: TypmComrcmos
Qumstmos: Xbasm ____________ Java's prmmmtmvms asd also thm autoboxmsg mstroducmd
wmth Java.
a. supports
b. domss’t support
Asswmr: supports
Pagm 29 of 30
Task 3. Mxplormsg Xtmsd Mxamplms
3.1: Xtmsd Mstroductory Mxamplm
Qumstmos: Xtmsd strmsg lmtmrals work wmth smsglm or doublm quotms lmkm
followmsg codm smgmmst?
assmrtMquals('Hmllo', "Hmllo")
a. Trum
b. Falsm
Asswmr: Trum
a. smttmr
b. gmttmr
Asswmr: smttmr
a. Trum
b. Falsm
Asswmr: Trum
Pagm 30 of 30