Which of the following statements is true about Java?
What is the correct order of the Java program's execution?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which of the following data types is used to store a single character in Java?
What is the output of the following code snippet?
int a = 5;
int b = 7;
int c = a + b;
System.out.println(c);
Which of the following is not a valid identifier in Java?
Which of the following is a valid literal representation of a double data type in Java?
What is the output of the following code snippet?
int x = 5;
int y = 2;
double result = x / y;
System.out.println(result);
Which of the following is not a valid Java access modifier?
What is the output of the following code snippet?
int x = 5;
x++;
System.out.println(x++);
What is the output of the following code snippet?
int x = 10;
int y = 3;
System.out.println(x % y);
What is the output of the following code snippet?
String str1 = "Hello";
String str2 = "World";
String result = str1 + " " + str2;
System.out.println(result.length());
What is the output of the following code snippet?
int[] numbers = {1, 2, 3, 4, 5};
int sum = 0;
for (int i = 0; i < numbers.length; i++) {
sum += numbers[i];
}
System.out.println(sum);
What is the output of the following code snippet?
int x = 5;
int y = 2;
int result = x / y;
System.out.println(result * 2);
What will be the output of the following code?
public class Test {
public static void main(String[] args) {
int x = 10;
int y = 20;
swap(x, y);
System.out.println("x = " + x + ", y = " + y);
}
public static void swap(int a, int b) {
int temp = a;
a = b;
b = temp;
}
}
What will be the output of the following code?
public class Test {
public static void main(String[] args) {
String str = "Hello";
modifyString(str);
System.out.println(str);
}
public static void modifyString(String s) {
s += " World";
}
}
What will be the output of the following code?
public class Test {
public static void main(String[] args) {
int x = 5;
changeValue(x);
System.out.println(x);
}
public static void changeValue(int num) {
num += 10;
}
}
What will be the output of the following code?
public class Test {
public static void main(String[] args) {
int[] numbers = {1, 2, 3, 4, 5};
changeArray(numbers);
System.out.println(numbers[0]);
}
public static void changeArray(int[] arr) {
arr[0] = 10;
}
}
What will be the output of the following code?
public class Test {
public static void main(String[] args) {
int x = 5;
int y = 10;
x = y;
y = x;
System.out.println("x = " + x + ", y = " + y);
}
}
60 videos|37 docs|12 tests
|
60 videos|37 docs|12 tests
|