1) What is Truncation in Java?
a) Floating-point value assigned to a Floating type
b) Floating-point value assigned to an integer type
c) Integer value assigned to floating type
d) Integer value assigned to floating type
2) public class Test {
public static void main(String[] args) {
try {
throw new IOException("Hello");
} catch(IOException | Exception e) {
[Link]([Link]());
}
}
}
How many issues are there in the above code
a) 1
b) 2
c) 3
d) 4
3). What will be the output of the following Java program?
class output {
public static void main(String args[])
{
double a, b,c;
a = 3.0/0;
b = 0/4.0;
c=0/0.0;
[Link](a);
[Link](b);
[Link](c);
}
}
a) NaN
b) Infinity
c) 0.0
d) all of the mentioned
4) What will be the output of the following Java code?
class box
{
int width;
int height;
int length;
}
class main
{
public static void main(String args[])
{
box obj = new box();
[Link] = 10;
[Link] = 2;
[Link] = 10;
int y = [Link] * [Link] * [Link];
[Link](y);
}
}
a) 100
b) 400
c) 200
d) 12
5) What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int arr[] = {1, 2, 3, 4, 5};
for ( int i = 0; i < [Link] - 2; ++i)
[Link](arr[i] + " ");
}
}
a) 1 2 3 4 5
b) 1 2 3 4
c) 1 2
d) 1 2 3
6) Write Java program that checks if two Arrays contains same elements.
7) Write a Java program to check if two given strings are anagrams of each other.
8) How can you find string in text file in java?
9) How to convert a List of objects into a Map by considering duplicated keys and
store them in sorted order?
10) Write a program for Merge sort?