Answers for Lab 5
EXERCISE 1
Copyright By Assignmentchef assignmentchef
–
i) What do you think would be printed after the first invocation to method1 (Line 38)?
ii) What do you think would be printed after the second invocation to method1 (Line 43)?
iii) What do you think would be printed after the third invocation to method1 (Line 48)?
Was answer (i) incorrect?
Was answer (ii) incorrect?
Was answer (iii) incorrect?
After commenting out line 10 and uncommenting line 11:
i) What do you think would be printed after the first invocation to method1 (Line 38)?
ii) What do you think would be printed after the second invocation to method1 (Line 43)?
iii) What do you think would be printed after the third invocation to method1 (Line 48)?
Was answer (i) incorrect?
Was answer (ii) incorrect?
Was answer (iii) incorrect?
EXERCISE 2
–
What line of the program causes the exception to be thrown?
Why did testArray[0][0] not change?
After pressing F6 until testArray[0][5] changes value from 0 to 5 and the statement for (int j=1; j<=6; j++) is highlighted in green,- what are the values of i and j?- is it correct that the program tries to store the value (i+1)*j in testArray[i][j]?EXERCISE 3———-Which line of the program causes the exception to be thrown?Which line is highligted after pressing F6?After re-running the program which line is highligter after pressing F5?What is the differentce between F5 and F6?What are the values of variables i, step, result and Load?Why does the progam crash after pressing F6?EXERCISE 4———-Why is there a compilation error in line 27?What do you think will be the values of variables var1 and obj1 immediately after method2(obj1) is executed?What do you think will be the values of variables var1 and obj1 immediately after method1(obj1) is executed?What are the correct values of variables var1 and obj1 immediately after method2(obj1) is executed?Why is the result of the comparison (obj1 == obj2) false even though both obj1 and obj2 contain the same information, namely “joe”? CS: assignmentchef QQ: 1823890830 Email: [email protected]
Reviews
There are no reviews yet.