class MCZ31 {
public static void main (String[] args) {
char a = '\t'; // 1
char b = '\\'; // 2
char c = '\"'; // 3
char d = '\''; // 4
char e = '\?'; // 5
}}
A compile-time error is generated at which line?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
| f. | None of the above |
Which of these words belong to the set of Java keywords?
| a. | exit |
| b. | strictfp |
| c. | enum |
| d. | super |
| e. | abort |
| f. | event |
| g. | goto |
| h. | native |
| i. | exception |
class MCZ13 {
public static void main (String[] args) {
String s = null;
System.out.print(s);
}}
What is the result of attempting to compile and run the program?
| a. | Prints nothing. |
| b. | Prints: null |
| c. | Compile-time error |
| d. | Run-time error |
| e. | None of the above |
Which of these words belong to the set of Java keywords?
| a. | Double |
| b. | goto |
| c. | min |
| d. | extern |
| e. | new |
| f. | signed |
| g. | finally |
| h. | const |
| i. | and |
| j. | array |
| k. | do |
class MCZ15 {
public static void main (String[] args) {
float a = 1.1e1f; // 1
float b = 1e-1F; // 2
float c = .1e1f; // 3
double d = .1d; // 4
double e = 1D; // 5
}}
A compile-time error is generated at which line?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
| f. | None of the above |
Which of these words belong to the set of Java keywords?
| a. | declare |
| b. | global |
| c. | const |
| d. | preserve |
| e. | continue |
| f. | Float |
| g. | extends |
| h. | select |
| i. | break |
| j. | dim |
| k. | instanceOf |
class MCZ16 {
public static void main (String[] args) {
float a = 1; // 1
float b = 1L; // 2
float c = 1F; // 3
float d = 1.0; // 4
}}
A compile-time error is generated at which line?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | None of the above |
Which of these words belong to the set of Java keywords?
| a. | next |
| b. | catch |
| c. | function |
| d. | instanceof |
| e. | mod |
| f. | const |
| g. | or |
| h. | Boolean |
| i. | goto |
| j. | import |
| k. | transient |
class MCZ17 {
public static void main (String[] args) {
String a = "\n"; // 1
String b = "\r"; // 2
String c = "\u000a"; // 3 \u000a = new line
String d = "\u000d"; // 4 \u000d = return
}}
Compile-time errors are generated at which lines?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
Which of these words belong to the set of Java keywords?
| a. | byte |
| b. | short |
| c. | int |
| d. | long |
| e. | decimal |
| f. | int64 |
| g. | float |
| h. | single |
| i. | double |
| j. | boolean |
| k. | char |
| l. | unsigned |
| m. | array |
| n. | string |
class MCZ18 {
public static void main (String[] args) {
String a = "abcd"; // 1
String b = "'\u0041'"; // 2
String c = "\u0041"; // 3
String d = "\uD7AF"; // 4
System.out.print(a+b+c+d); // 5
}}
A compile-time error is generated at which line?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
| f. | None of the above |
Which of these words belongs to the set of Java keywords?
| a. | clause |
| b. | loop |
| c. | expression |
| d. | overrides |
| e. | statement |
| f. | assertion |
| g. | validate |
| h. | exception |
| i. | cast |
| j. | None of the above |
class MCZ20 {
public static void main (String[] args) {
// Insert code here.
}}
Which of the following lines can be inserted at the specified location without generating a compile-time error?
| a. | String a = 'a'; |
| b. | String b = 'abc'; |
| c. | String c = '\u0041'; |
| d. | String d = '\uabcd'; |
| e. | None of the above |
class MCZ21 {
public static void main (String[] args) {
// Insert code here.
}}
Which of the following lines can be inserted at the specified location without generating a compile-time error?
| a. | char a = a; |
| b. | char b = abc; |
| c. | char c = \u0041; |
| d. | char d = \uabcd; |
| e. | None of the above |
class MCZ24 {
public static void main (String[] args) {
char a = 061; // 1
char b = '\61'; // 2
char c = '\061'; // 3
char d = 0x0031; // 4
char e = '\u0031'; // 5
System.out.print(""+a+b+c+d+e);
}}
A compile-time error is generated at which line?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
| f. | None of the above |
class MCZ25 {
public static void main (String[] args) {
char a = '\7'; // 1
char b = '\61'; // 2
char c = '\062'; // 3
char d = '\x7'; // 4
char e = '\x41'; // 5
System.out.print(""+a+b+c+d+e);
}}
Compile-time errors are generated at which lines?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | 5 |
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 |
class MCZ19 {
public static void main (String[] args) {
String a1 = null; // 1
String b1 = 'null'; // 2
String c1 = "null"; // 3
String d1 = "'null'"; // 4
}}
A compile-time error is generated at which line?
| a. | 1 |
| b. | 2 |
| c. | 3 |
| d. | 4 |
| e. | None of the above |
class MCZ22 {
public static void main (String[] args) {
// Insert code here.
}}
Which of the following lines will generate a compile-time error if inserted at the specified location?
| a. | char a = 0x0041; |
| b. | char b = '\u0041'; |
| c. | char c = 0101; |
| d. | char d = -1; |
| e. | char e = (char)-1; |
| f. | None of the above |
class MCZ23 {
public static void main (String[] args) {
// Insert code here.
}}
Which of the following lines can be inserted at the specified location without generating a compile-time error?
| a. | boolean b1 = true; |
| b. | boolean b2 = TRUE; |
| c. | boolean b3 = 'true'; |
| d. | boolean b4 = "TRUE"; |
| e. | boolean b5 = 0; |
| f. | None of the above |
class GFM16 {
static int m1 (int i1, int i2) {
int i3;
if (i1 > 0) {i3 = i1 + i2;}
return i3;
}
public static void main(String[] args) {
System.out.println(m1(1,2));
}}
What is the result of attempting to compile and run the program?
| a. | Prints: 0 |
| b. | Prints: 1 |
| c. | Compile-time error |
| d. | Run-time error |
| e. | None of the above |
class GFM17 {
int x; // 1
public static void main(String[] args) { // 2
int y = 0; // 3
System.out.print(x+","); // 4
System.out.print(y); // 5
}}
What is the result of attempting to compile and run the program?
| a. | Prints: 0,0 |
| b. | Compile-time error at line 1. |
| c. | Compile-time error at line 1. |
| d. | Compile-time error at line 2. |
| e. | Compile-time error at line 3. |
| f. | Compile-time error at line 4. |
| g. | Compile-time error at line 5. |
| h. | Run-time error |
| i. | None of the above |