What will be displayed after you try to compile and execute the following code?
------
int i = 10;
if(i) {
System.out.println("A");
} else {
System.out.println("B");
}
1/10
int i = 10;
if(i) {
System.out.println("A");
} else {
System.out.println("B");
}
Choose one
A
B
Compilation Error
Nothing will be displayed
How do you write an infinite loop?
2/10
Choose all that apply
for(;;) {
}
while (true) {
}
do {
} while (true);
Which of the following variables are defined correctly?
3/10
Choose all that apply
String $;
String _;
String 12x;
String x12;
String s#;
String h@ppy;
String myString#2;
How many primitive data types are in Java?
4/10
Choose one
5
6
7
8
9
10
12
Which will be the value of variable y after you compile and execute the following block of code?
------
public class MyClass {
private int x =10;
public static void main(String[] args) {
int y = x++%5;
}
5/10
public class MyClass {
private int x =10;
public static void main(String[] args) {
int y = x++%5;
}
Choose one
0
2
Compilation Error
Runtime Error
What will be displayed after you try to compile and execute the following code?
------
public static void main(String[] args) {
final String s = "A";
s.concat("B");
System.out.println(s);
}
6/10
public static void main(String[] args) {
final String s = "A";
s.concat("B");
System.out.println(s);
}
Choose one
Compilation Error
Runtime Error
A
AB
B
How many Constructors has the Character object?
7/10
Choose one
1
2
3
4
Which of the following statements are true about Math.random() function
8/10
Choose one
It generates an int value bigger or equal to 1 and less than 10.
It generates an int value bigger or equal to 1 and less than 100
It generates a float value bigger or equal to 0.0 and less than 1.0
None of these
What will be displayed after you try to compile and execute the following code?
------
double x = -34.45;
System.out.println(Math.floor(x));
System.out.println(Math.ceil(x));
System.out.println(Math.abs(x));
9/10
double x = -34.45;
System.out.println(Math.floor(x));
System.out.println(Math.ceil(x));
System.out.println(Math.abs(x));