My Report

Java Programming Mock Test 9


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. What will be the output of the following Java program?

 
    package pkg;
    class output 
    {
        public static void main(String args[])
        {
            StringBuffer s1 = new StringBuffer("Hello World");
            s1.insert(6 , "Good ");
            System.out.println(s1);
        }
   }

Note : Output.class file is not in directory pkg.

Question 1 of 10

Question 2 of 10

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

public class Shape 
{
	public int area()
        {
		return 1;
	}
}
public class Square extends Shape 
{
	public int area()
        {
		return 2;
	}
}
public class Rectangle extends Shape 
{
	public int area()
        {
		return 3;
	}
}
public static void main(String[] args)
{
	 Shape square = new Square();
   	 Shape rect = new Rectangle();
     	 square = rect;
	 System.out.println(square.area());
}

Question 2 of 10

Question 3 of 10

3. What does an interface contain?

Question 3 of 10

Question 4 of 10

4. Which of this package is used for analyzing code during run-time?

Question 4 of 10

Question 5 of 10

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

    import java.util.*;
    class Output
    {
        public static void addNumbers(List<? super Integer> list)
        {
            for (int i = 1; i <= 10; i++)
            {
                list.add(i);
            }
        }
        public static void main(String args[])
        {
           List<Double> ld = Arrays.asList();
           addnumbers(10.4);
           System.out.println("getList(2)");
        }
    }

Question 5 of 10

Question 6 of 10

6. How can junits be implemented using maven?

Question 6 of 10

Question 7 of 10

7. Which jar provides FileUtils which contains methods for file operations?

Question 7 of 10

Question 8 of 10

8. Which of these Exception handlers cannot be type parameterized?

Question 8 of 10

Question 9 of 10

9. What is the return type of lambda expression?

Question 9 of 10

Question 10 of 10

10. Which of these type parameters is used for a generic methods to return and accept a number?

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.