DAY 1
- Choose the correct output among the following options.
- -
- -c
- -c2
- -c22b
- -2c2b
- -2c2bc
- Compilation Error
- Which would be used to create an appropriate catch block? (Choose all that apply)
- ClassCastException
- IllegalStateException
- NumberFormatException
- ArrayIndexOutOfBoundException
- ExceptionInInitializerException
- IllegalArgumentException
- Which of the following can be written in place of INSERT CODE HERE? (Choose all that apply)
- for(int y : x) {
- for(x : int y) {
- int y = 0; for(y : x) {
- for(int y = 0, z = 0; z < x.length; z++) {y = x[z]
- for(int y = 0, int z = 0; z < x.length; z++) {y = x[z]
- int y = 0; for(int z = 0; z < x.length; z++) {y = x[z]
- Choose the correct output among the following options.
- 9 10 d
- 8 9 10 d
- 9 10 10 d
- 9 10 10 d 13
- 8 9 10 10 d 13
- 8 9 10 9 10 10 d 13
- Compilation Error
- Choose the correct output among the following options.
- -ic of
- -mf of
- -mc mf
- -ic mf of
- -ic mc mf of
- -ic mc of mf
- Compilation Error
class Example {
static String s = "-";
public static void main(String[] args) {
new Example().s1();
System.out.println(s);
}
void s1() {
try {
s2();
} catch (Exception e) {
s += "c";
}
}
void s2() throws Exception {
s3();
s += "2";
s3();
s += "2b";
}
void s3() throws Exception {
throw new Exception();
}
}
try{int x = Integer.parseInt("two");}
class Example {
public static void main(String[] args) {
int[] x = { 7, 6, 5, 4, 3, 2, 1 };
// INSERT CODE HERE
System.out.print(y + " ");
}
}
}
class Example {
static int x = 7;
public static void main(String[] args) {
String s = "";
for (int y = 0; y < 3; y++) {
x++;
switch (x) {
case 8:
s += "8 ";
case 9:
s += "9 ";
case 10: {
s += "10 ";
break;
}
default:
s += "d ";
case 13:
s += "13 ";
}
}
System.out.println(s);
}
static {
x++;
}
}
class Example {
static String s = "-";
public static void main(String[] args) {
try {
throw new Exception();
} catch (Exception e) {
try {
try {
throw new Exception();
} catch (Exception ex) {
s += "ic ";
}
throw new Exception();
} catch (Exception x) {
s += "mc ";
} finally {
s += "mf ";
}
} finally {
s += "of ";
}
System.out.println(s);
}
}
Great Content !
ReplyDelete