Question 1 of 20
Hints left: 3
Q1
Which of this method is given parameter via command line arguments?
Q2
Which of these data types is used to store command line arguments?
Q4
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]); } }
Q5
Which of these method of String class can be used to test to strings for equality?
Q6
Which of these is a correct statement about args in the following line of code? public static void main(String args[])
Q7
All the variables of class should be ideally declared as?
Q8
Which of these data type can be used for a method having a return statement in it?
Q9
What will be the output of the following Java program? class static_out { static int x; static int y; void add(int a , int b) { x = a + b; y = x + b; } } class static_use { public static void main(String args[]) { static_out obj1 = new static_out(); static_out obj2 = new static_out(); int a = 2; obj1.add(a, a + 1); obj2.add(5, a); System.out.println(obj1.x + " " + obj2.y); } }
Q10
What will be the output of the following Java snippet, if attempted to compile and execute? class abc { public static void main(String args[]) { if(args.length>0) System.out.println(args.length); } }
Q11
Which of these method of String class is used to obtain character at specified index?
Q12
What will be the output of the following Java program? class access { static int x; void increment() { x++; } } class static_use { public static void main(String args[]) { access obj1 = new access(); access obj2 = new access(); obj1.x = 0; obj1.increment(); obj2.increment(); System.out.println(obj1.x + " " + obj2.x); } }
Q13
Which of these keywords is used to refer to member of base class from a subclass?
Q14
Which of these statement is incorrect?
Q15
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); } }
Q16
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); } }
Q17
What is the use of @syntax?
Q18
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); } }
Q19
What will be the output of the following Java program, Command line execution is done as - "java Output This is a command Line"? class Output { public static void main(String args[]) { System.out.print(args[0]); } }
Q20
What will be the output of the following Java program, Command line execution is done as - java Output "This is a command Line"? class Output { public static void main(String args[]) { for (String arg : args) { System.out.print(arg); } } }