My Report

Java Programming Mock Test 2


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. When Overloading does not occur?

Question 1 of 10

Question 2 of 10

2. Which of the following is not a valid jump statement?

Question 2 of 10

Question 3 of 10

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

class San
{
     San()throws IOException
     {
  
     } 
 
}
class Foundry extends San
{
     Foundry()
     {

     }
     public static void main(String[]args)
     {
  
     }
}

Question 3 of 10

Question 4 of 10

4. What is the process of defining more than one method in a class differentiated by method signature?

Question 4 of 10

Question 5 of 10

5. How to get prints of shared object memory maps or heap memory maps for a given process?

Question 5 of 10

Question 6 of 10

6. What would be behaviour if the constructor has a return type?

Question 6 of 10

Question 7 of 10

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

    class box 
    {
        int width;
        int height;
        int length;
        int volume;
        box() 
        {
            width = 5;
            height = 5;
            length = 6;
        }
        void volume() 
        {
             volume = width*height*length;
        } 
    }    
    class constructor_output 
    {
        public static void main(String args[])
        {
            box obj = new box();
            obj.volume();
            System.out.println(obj.volume);
        }
   }

Question 7 of 10

Question 8 of 10

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

    class comma_operator 
    {
        public static void main(String args[]) 
        {    
             int sum = 0;
             for (int i = 0, j = 0; i < 5 & j < 5; ++i, j = i + 1)
                 sum += i;
 	     System.out.println(sum);
        } 
    }

Question 8 of 10

Question 9 of 10

9. Which of the following is used with the switch statement?

Question 9 of 10

Question 10 of 10

10. Which of the following modifier means a particular variable cannot be accessed within the package?

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.