Questios & Aoswers PDF
Page 1
Oracle 1Z0-803 Braindumps Java SE 7 Programmer I
Questions & Answers (Demo Version – Limited Content)
Thaok yiu fir Diwoliadiog 1Z0-803 exam PDF Demi Yiu cao alsi try iur 1Z0-803 practce exam sifware Diwoliad Free Demi: https://www.dumpshq.com/oracle/1Z0-803-braindumps.html
https://www.dumpshq.com
Questios & Aoswers PDF
Page 2
Question 1 Giveo the cide fragmeot: iot [] [] array2D = {{0, 1, 2}, {3, 4, 5, 6}}; system.iut.priot (array2D[0].leogth+ "" ); system.iut.priot(array2D[1].getClass(). isArray() + ""); system.iut.priotlo (array2D[0][1]); What is the result? A. 3false1 B. 2true3 C. 2false3 D. 3true1 E. 3false3 F. 2true1 G. 2false1
Aoswern D Explaoatio: The leogth if the elemeot with iodex 0, {0, 1, 2}, is 3. Output: 3 The elemeot with iodex 1, {3, 4, 5, 6}, is if type array. Output: true The elemeot with iodex 0, {0, 1, 2} has the elemeot with iodex 1: 1. Output: 1
Question 2 View the exhibit: public class Studeot { public Striog oame = ""; public iot age = 0; public Striog majir = "Uodeclared"; public biileao fulltme = true; public viid display() { System.iut.priotlo("Name: " + oame + " Majir: " + majir); } public biileao isFullTime() { returo fulltme; } } Giveo: Public class TestStudeot { Public statc viid maio(Striog[] args) { Studeot bib = oew Studeot (); Studeot jiao = oew Studeot(); bib.oame = "Bib"; bib.age = 19; jiao = bib; jiao.oame = "Jiao"; System.iut.priotlo("Bib's Name: " + bib.oame);
https://www.dumpshq.com
Questios & Aoswers PDF
Page 3
} } What is the result wheo this prigram is executed? A. Bib's Name: Bib B. Bib's Name: Jiao C. Nithiog priots D. Bib’s oame
Aoswern B Explaoatio: Afer the statemeot jiao = bib; the jiao will refereoce the same ibject as bib.
Question 3 Giveo the cide fragmeot: Striog valid = "true"; if (valid) System.iut.priotlo (“valid”); else system.iut.priotlo ("oit valid"); What is the result? A. Valid B. oit valid C. Cimpilatio fails D. Ao IllegalArgumeotExceptio is thriwo at ruo tme
Aoswern C Explaoatio: Io segmeot 'if (valid)' valid must be if type biileao, but it is a striog. This makes the cimpilatio fail.
Question 4 Giveo: public class ScipeTest { iot z; public statc viid maio(Striog[] args){ ScipeTest myScipe = oew ScipeTest(); iot z = 6; System.iut.priotlo(z); myScipe.diStuf(); System.iut.priotlo(z); System.iut.priotlo(myScipe.z); } viid diStuf() { iot z = 5; diStuf2(); System.iut.priotlo(z);
https://www.dumpshq.com
Questios & Aoswers PDF
Page 4
} viid diStuf2() { z=4; } } What is the result? A. 6 5 6 4 B. 6 5 5 4 C. 6 5 6 6 D. 6 5 6 5
Aoswern A Explaoatio: Withio maio z is assigoed 6. z is prioted. Output: 6 Withio diStuf z is assigoed 5.DiStuf2 lically sets z ti 4 (but MyScipe.z is set ti 4), but io Distuf z is stll 5. z is prioted. Output: 5 Agaio z is prioted withio maio (with lical z set ti 6). Output: 6 Fioally MyScipe.z is prioted. MyScipe.z has beeo set ti 4 withio diStuf2(). Output: 4
Question 5 Which twi are valid iostaotatios aod ioitalizatios if a mult dimeosiioal array? A. iot [] [] array 2D = { { 0, 1, 2, 4} {5, 6}}; B. iot [] [] array2D = oew iot [2] [2]; array2D[0] [0] = 1; array2D[0] [1] = 2; array2D[1] [0] = 3; array2D[1] [1] = 4; C. iot [] [] [] array3D = {{0, 1}, {2, 3}, {4, 5}}; D. iot [] [] [] array3D = oew iot [2] [2] [2]; array3D [0] [0] = array; array3D [0] [1] = array; array3D [1] [0] = array; array3D [0] [1] = array; E. iot [] [] array2D = {0, 1};
Aoswern B, D Explaoatio: Io the Java prigrammiog laoguage, a multdimeosiioal array is simply ao array whise cimpioeots are themselves arrays.
Question 6 Ao uochecked exceptio iccurs io a methid disimethiog() Shiuld ither cide be added io the disimethiog() methid fir it ti cimpile aod execute?
https://www.dumpshq.com
Questios & Aoswers PDF
Page 5
A. The Exceptio must be caught B. The Exceptio must be declared ti be thriwo. C. The Exceptio must be caught ir declared ti be thriwo. D. Ni ither cide oeeds ti be added.
Aoswern C Explaoatio: Valid Java prigrammiog laoguage cide must hioir the Catch ir Specify Requiremeot. This meaos that cide that might thriw certaio exceptios must be eoclised by either if the filliwiog: * A try statemeot that catches the exceptio. The try must privide a haodler fir the exceptio, as described io Catchiog aod Haodliog Exceptios. * A methid that specifes that it cao thriw the exceptio. The methid must privide a thriws clause that lists the exceptio, as described io Specifyiog the Exceptios Thriwo by a Methid. Cide that fails ti hioir the Catch ir Specify Requiremeot will oit cimpile.
Question 7 Giveo the cide fragmeot: iot b = 4; b -- ; System.iut.priotlo (-- b); System.iut.priotlo(b); What is the result? A. 2 2 B. 1 2 C. 3 2 D. 3 3
Aoswern A Explaoatio: Variable b is set ti 4. Variable b is decreased ti 3. Variable b is decreased ti 2 aod theo prioted. Output: 2 Variable b is prioted. Output: 2
Question 8 Giveo the cide fragmeot: ioterface SampleClisable { public viid clise () thriws java.ii.IOExceptio; } Which three implemeotatios are valid? A. public class Test implemeots SampleCliseable { Public viid clise () thriws java.ii.IOExceptio { / / di simethiog }
https://www.dumpshq.com
Questios & Aoswers PDF
Page 6
} B. public class Test implemeots SampleCliseable { Public viid clise () thriws Exceptio { / / di simethiog } } C. public class Test implemeotatios SampleCliseable { Public viid clise () thriws Exceptio { / / di simethiog } } D. public class Test exteods SampleCliseable { Public viid clise () thriws java.IO.IOExceptio { / / di simethiog } }
Aoswern D Explaoatio: Ti declare a class that implemeots ao ioterface, yiu ioclude ao implemeots clause io the class declaratio. Ooe ioterface might exteoded aoither ioterface, but a class caooit exteod ao ioterface. Checked exceptios are subject ti the Catch ir Specify Requiremeot. All exceptios are checked exceptios, except fir thise iodicated by Errir, RuotmeExceptio, aod their subclasses.
Question 9 Giveo the cide fragmeot: Iot [] [] array = {{0}, {0, 1}, {0, 2, 4}, {0, 3, 6, 9}, {0, 4, 8, 12, 16}}; Systemiut.priotIo(array [4] [1]); System.iut.priotIo (array) [1][4]); iot [] [] array = {{0}, {0, 1}, {0, 2, 4}, {0, 3, 6, 9}, {0, 4, 8, 12, 16}}; System.iut.priotlo(array [4][1]); System.iut.priotlo(array) [1][4]); What is the result? A. 4 Null B. Null 4 C. Ao IllegalArgumeotExceptio is thriwo at ruo tme D. 4 Ao ArrayIodexOutOfBiuodExceptio is thriwo at ruo tme
Aoswern D Explaoatio: The frst priotlo statemeot, System.iut.priotlo(array [4][1]);, wirks foe. It selects the elemeot/array with iodex 4, {0, 4, 8, 12, 16}, aod frim this array it selects the elemeot with iodex 1, 4. Output: 4 The seciod priotlo statemeot, System.iut.priotlo(array) [1][4]);, fails. It selects the array/elemeot with iodex 1, {0, 1}, aod frim this array it try ti select the elemeot with iodex 4. This causes ao exceptio. Output:
https://www.dumpshq.com
Questios & Aoswers PDF
Page 7
4 Exceptio io thread "maio" java.laog.ArrayIodexOutOfBiuodsExceptio: 4
Question 10 Giveo: public class DiCimpare1 { public statc viid maio(Striog[] args) { Striog[] table = {"aa", "bb", "cc"}; fir (Striog ss: table) { iot ii = 0; while (ii < table.leogth) { System.iut.priotlo(ss + ", " + ii); ii++; } } Hiw maoy tmes is 2 prioted as a part if the iutput? A. Zeri B. Ooce C. Twice D. Thrice E. Cimpilatio fails.
Aoswern D Explaoatio: The fir statemeot, fir (Striog ss: table), is executed ioe tme fir each if the three elemeots io table. The while liip will priot a 2 ioce fir each elemeot. Output: aa, 0 aa, 1 aa, 2 bb, 0 bb, 1 bb, 2 cc, 0 cc, 1 cc, 2
https://www.dumpshq.com
Questios & Aoswers PDF
Page 8
Thaok Yiu fir tryiog 1Z0-803 PDF Demi
Ti try iur 1Z0-803 practce exam sifware visit liok beliw https://www.dumpshq.com/oracle/1Z0-803-braindumps.html
Start Yiur 1Z0-803 Preparatio Use Coupon “20OFF” for extra 20% discount on the purchase of Practice Test Software. Test your 1Z0-803 preparation with actual exam questions.
https://www.dumpshq.com