My Report

Java Programming Mock Test 3


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement
 10%

Question 1 of 10

1. Which class allows parsing of command line arguments?

Question 1 of 10

Question 2 of 10

2. If super class and subclass have same variable name, which keyword should be used to use super class?

Question 2 of 10

Question 3 of 10

3. Which of these is not a correct statement?

Question 3 of 10

Question 4 of 10

4. 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]);
        }
    }

Question 4 of 10

Question 5 of 10

5. Static members are not inherited to subclass.

Question 5 of 10

Question 6 of 10

6. What will be the output of the following Java program?

 
   class A 
   {
	int i;
	int j;
        A() 
        {
            i = 1;
            j = 2;
        }
   }
   class Output 
   {
        public static void main(String args[])
        {
             A obj1 = new A();
             A obj2 = new A();
	     System.out.print(obj1.equals(obj2));
        }
   }

Question 6 of 10

Question 7 of 10

7. What is Recursion in Java?

Question 7 of 10

Question 8 of 10

8. Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?

Question 8 of 10

Question 9 of 10

9. What will be the output of the following Java program?

   
    class output 
    {
        public static void main(String args[])
        { 
             StringBuffer c = new StringBuffer("Hello");
             StringBuffer c1 = new StringBuffer(" World");
             c.append(c1);
             System.out.println(c);
        }
    }

Question 9 of 10

Question 10 of 10

10. What will be the output of the following Java code?

 
    class A 
    {
        public int i;
        public int j;
        A() 
       {
            i = 1;
            j = 2;
	}
    }    
    class B extends A 
    {
        int a;
	B() 
        {
            super();
        } 
    }    
    class super_use 
    {
        public static void main(String args[])
        {
            B obj = new B();
            System.out.println(obj.i + " " + obj.j)     
        }
   }

Question 10 of 10


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.