In which area of memory, the system stores parameters and local variables whenever a method is invoked? Heap Stack Storage Area Array TRUE ANSWER : ? YOUR ANSWER : ?
What will be the return type of a method that not returns any value? None of these void double int TRUE ANSWER : ? YOUR ANSWER : ?
What is the expected output?public class Profile {private Profile(int w) { // line 1System.out.print(w);}public final Profile() { // line 5System.out.print(10);}public static void main(String args[]) {Profile obj = new Profile(50);}} Won't compile because of line (1); constructor can't be private 50 Won't compile because of line (5); constructor can't be final 10 50 TRUE ANSWER : ? YOUR ANSWER : ?
Which of these is a legal definition of a method named examveda assuming it throws IOException, and returns void. Also assume that the method does not take any arguments. Select the one correct answer. void examians(void) throws IOException{} void examians() throws IOException{} void examians() throw IOException{} void examians() {} throws IOException examians() throws IOException{} TRUE ANSWER : ? YOUR ANSWER : ?
What is the expected output?class Animal {Animal() {System.out.println("Animal");}}class Wild extends Animal{Wild() {System.out.println("Wild");super();}}public class Test {public static void main(String args[]) {Wild wild = new Wild();}} Animal Wild Wild Animal Compilation Error Runtime Exception TRUE ANSWER : ? YOUR ANSWER : ?
What is the output for the below code ?1. public class A{2. int add(int i, int j){3. return i+j;4. }5. }6. public class B extends A{7. public static void main(String argv[]){8. short s = 9;9. System.out.println(add(s,6));10. }11.} 15 None of these Compile fail due to error on line no 2 Compile fail due to error on line no 9 Compile fail due to error on line no 8 TRUE ANSWER : ? YOUR ANSWER : ?
What is the output of the program?class Test{ public int display(int x, int y){ return ("The sum of x and y is " + x + y); } public static void main(String args[]){ Test test = new Test(); System.out.println(test.display(4,5)); } } The sum of x and y is 45 does not compile None of these The sum of x and y is 9 TRUE ANSWER : ? YOUR ANSWER : ?
The main method should be static for the reason None of these It can be executed without creating any instance of the class. It can be accessed easily by the class loader. It can be accessed by every method or variable without any hindrance. TRUE ANSWER : ? YOUR ANSWER : ?
Which of the following options is the best for generating random integer 0 or 1? (int)Math.random() (int)(Math.random() + 0.5) (int)(Math.random() + 0.2) (int)Math.random() + 1 TRUE ANSWER : ? YOUR ANSWER : ?
The following code contains one compilation error, find it?public class Test {Test() { } // line 1static void Test() { this(); } // line 2 public static void main(String[] args) { // line 3Test(); // line 4}} At line 2, constructor call At line 3, compilation error, ambiguity problem, compiler can't determine whether a constructor At line 4 At line 1, constructor Tester must be marked public like its class TRUE ANSWER : ? YOUR ANSWER : ?