ExamVeda
Login
Home
21
What will be the output of the following Java code?
class area 
{
    int width;
    int length;
    int area;
    void area(int width, int length) 
    {
        this.width = width;
        this.length = length;
    }

}    
class Output 
{
    public static void main(String args[])
    {
        area obj = new area();
        obj.area(5 , 6);
        System.out.println(obj.length + " " + obj.width);        
    } 
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
22
What will be the output of the following Java program?
class main_class 
{
    public static void main(String args[])
    {
        int x = 9;
        if (x == 9) 
        { 
            int x = 8;
            System.out.println(x);
        }
    } 
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
23
What is -Xms and -Xmx while starting jvm?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
24
What will be the output of the following Java program?
class recursion 
{
    int fact(int n) 
    {
        int result;
        if (n == 1)
            return 1;
        result = fact(n - 1) * n;
        return result;
    }
} 
class Output 
{
    public static void main(String args[]) 
    {
        recursion obj = new recursion() ;
        System.out.print(obj.fact(6));
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
25
What will be the output of the following Java program?
class box 
{
    int width;
    int height;
    int length;
} 
class mainclass 
{
    public static void main(String args[]) 
    {        
         box obj = new box();
         obj.width = 10;
         obj.height = 2;
         obj.length = 10;
         int y = obj.width * obj.height * obj.length; 
         System.out.print(y);
    } 
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
26
What is the process of defining more than one method in a class differentiated by method signature?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
27
Which of the following statements is correct?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
28
Which of this statement is incorrect?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
29
Which concept of Java is achieved by combining methods and attribute into a class?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
30
What will be the output of the following Java program?
class recursion 
{
    int fact(int n) 
    {
        int result;
        if (n == 1)
            return 1;
        result = fact(n - 1) * n;
        return result;
    }
} 
class Output 
{
    public static void main(String args[]) 
    {
        recursion obj = new recursion() ;
        System.out.print(obj.fact(1));
    }
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board