1. You compile this program ...
... then run it as follows:
java One this is my song for the asking | |
What does the program print (if anything)?
| |
2. Assuming that the following program fragment is syntactically correct...
int[][] a = new int[10][10]; ... a = fun(a[1], a[2][3]); | |
... select the correct header for method fun.
| |
3. If you compile and run this code, what is the output?
| |
| |
4. Consider the following fragment. What does it print?
| |
| |
5. Does this source code compile?
| |
| |
| 6. You compile and run this program. What's the output? | |
| |
| |
7. Given the following array declaration
what does a[a[3][2]][1] evaluate to?
| |
|
|
8. If fun is defined as below:
| |
What will fun(3, 3)[2] evaluate to? (Yes, it compiles and runs fine).
|
|
| 9. What is printed if you compile and run the following program? | |
|
|
| 10. What is printed if you compile and run the following program? | |
|
|
| 11. You compile and run this program. What is the output? | |
|
|
| 12. What letter should go in both blank spaces for the following program to compile? | |
|
|
13. Assume the program above is in a file E.java and you want to compile and run it.
| |
C:\> javac E.java C:\> java ____ |
|
| Fill in the blank with the name of the class that you need to run. | |
boolean x; if (x = (false && (false || true))) System.out.print(0); else System.out.print(1); if (! x) System.out.print(2); else System.out.print(3);
02
12
03
13
other
| 15. What is the output produced by the following code when embedded in a complete program? | |
boolean x; if (x = (false && false || true)) System.out.print(0); else System.out.print(1); if (! x) System.out.print(2); else System.out.print(3); |
|