class JJF1 {
public static void main (String args[]) {
System.out.print(Byte.MIN_VALUE+",");
System.out.print(Byte.MAX_VALUE);
}}
What is the result of attempting to compile and run the program?
| a. | Prints: 0,255 |
| b. | Prints: 0,256 |
| c. | Prints: -127,128 |
| d. | Prints: -128,127 |
| e. | Compile-time error |
| f. | Run-time error |
| g. | None of the above |
class JJF2 {
public static void main (String args[]) {
System.out.print(Short.MIN_VALUE+",");
System.out.print(Short.MAX_VALUE);
}}
What is the result of attempting to compile and run the program?
| a. | Prints: -32767,32768 |
| b. | Prints: -32768,32767 |
| c. | Prints: 0,65535 |
| d. | Prints: 0,65536 |
| e. | Compile-time error |
| f. | Run-time error |
| g. | None of the above |
class JJF3 {
public static void main(String args[]) {
System.out.print(Integer.toBinaryString(Byte.MAX_VALUE)+",");
System.out.print(Integer.toOctalString(Byte.MAX_VALUE)+",");
System.out.print(Integer.toString(Byte.MAX_VALUE)+",");
System.out.print(Integer.toHexString(Byte.MAX_VALUE));
}}
What is the result of attempting to compile and run the program?
| a. | Prints: 1111111,177,127,7f |
| b. | Prints: 11111111,377,256,ff |
| c. | Compile-time error |
| d. | Run-time error |
| e. | None of the above |
class JJF4 {
public static void main(String args[]) {
System.out.print(Long.toHexString(Byte.MAX_VALUE)+",");
System.out.print(Long.toHexString(Character.MAX_VALUE)+",");
System.out.print(Long.toHexString(Short.MAX_VALUE));
}}
What is the result of attempting to compile and run the program?
| a. | Prints: f,ff,7f |
| b. | Prints: f,ff,ff |
| c. | Prints: 7f,ffff,7fff |
| d. | Prints: ff,ffff,ffff |
| e. | Prints: 7fff,ffffff,7fffff |
| f. | Prints: ffff,ffffff,ffffff |
| g. | Compile-time error |
| h. | Run-time error |
| i. | None of the above |
class JJF5 {
public static void main(String args[]) {
System.out.print(Integer.toHexString(Integer.MIN_VALUE)+",");
System.out.print(Integer.toHexString(Integer.MAX_VALUE));
}}
What is the result of attempting to compile and run the program?
| a. | Prints: 0000,ffff |
| b. | Prints: 00000000,ffffffff |
| c. | Prints: 7fff,8000 |
| d. | Prints: 8000,7fff |
| e. | Prints: 7fffffff,80000000 |
| f. | Prints: 80000000,7fffffff |
| g. | Compile-time error |
| h. | Run-time error |
| i. | None of the above |
Which of the following represent the full range of type char?
| a. | '\u0000' to '\u7fff' |
| b. | '\u0000' to '\uffff' |
| c. | 0 to 32767 |
| d. | 0 to 65535 |
| e. | -32768 to 32767 |
| f. | -65536 to 65535 |
Which of the following represent the full range of type char?
| a. | -0x8000 to 0x7fff |
| b. | 0x0000 to 0xffff |
| c. | -0100000 to 077777 |
| d. | 0 to 0177777 |
| e. | 0 to 32767 |
| f. | 0 to 65535 |
| g. | -32768 to 32767 |
class JJF6 {
char c1 = 0xffff; // 1
char c2 = 0xfffff; // 2
byte b1 = 0xffff; // 3
byte b2 = 0x7f; // 4
byte b3 = 0xff; // 5
byte b4 = -0x80; // 6
}
Compile-time errors are generated at which lines?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
| f. | 6 |