11. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int a1[] = new int[10];
int a2[] = {1, 2, 3, 4, 5};
System.out.println(a1.length + " " + a2.length);
}
}
class Output
{
public static void main(String args[])
{
int a1[] = new int[10];
int a2[] = {1, 2, 3, 4, 5};
System.out.println(a1.length + " " + a2.length);
}
}12. What will be the output of the following Java program?
class box
{
int width;
int height;
int length;
int volume;
void volume(int height, int length, int width)
{
volume = width * height * length;
}
}
class Prameterized_method{
public static void main(String args[])
{
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(3, 2, 1);
System.out.println(obj.volume);
}
}
class box
{
int width;
int height;
int length;
int volume;
void volume(int height, int length, int width)
{
volume = width * height * length;
}
}
class Prameterized_method{
public static void main(String args[])
{
box obj = new box();
obj.height = 1;
obj.length = 5;
obj.width = 5;
obj.volume(3, 2, 1);
System.out.println(obj.volume);
}
}13. String in Java is a?
14. Which of this method is given parameter via command line arguments?
15. What will be the output of the following Java snippet, if attempted to compile and run this code with command line argument "java abc Ram Shyam"?
public class abc
{
int a=2000;
public static void main(String argv[])
{
System.out.println(argv[1]+" :-Please pay Rs."+a);
}
}
public class abc
{
int a=2000;
public static void main(String argv[])
{
System.out.println(argv[1]+" :-Please pay Rs."+a);
}
}16. Which of these method of String class can be used to test to strings for equality?
17. What will be the output of the following Java program, Command line execution is done as - "java Output command Line 10 A b 4 N"?
class Output
{
public static void main(String args[])
{
System.out.print(args[6]);
}
}
class Output
{
public static void main(String args[])
{
System.out.print(args[6]);
}
}18. Which of these is a correct statement about args in the following line of code?
public static void main(String args[])
public static void main(String args[])19. Which of these method of String class is used to obtain character at specified index?
20. All the variables of interface should be?
Read More Section(Miscellaneous in Java)
Each Section contains maximum 100 MCQs question on Miscellaneous in Java. To get more questions visit other sections.
