Java Quiz

0 votes, 0 avg
318

Java Questions

1 / 15

1. What does Object Oriented Programming means?

2 / 15

2. Which environment variable is used to set the java path?

3 / 15

3.  Which variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed?

4 / 15

4. Which constructor creates an empty string buffer with the specified capacity as length.

5 / 15

5. Find the output of the following code.

Public class Solution{
         Public static void main(String args[]){
                 Int i;
                 for(i = 1; i < 6; i++){ 
                     if(i > 3) continue;
                 }
                 System.out.println(i);
          }
}

6 / 15

6. Which of the following is a type of polymorphism in Java?

7 / 15

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

        class Output 

        {

            public static void main(String args[])

            {

                int arr[] = {1, 2, 3, 4, 5};

                for ( int i = 0; i < arr.length - 2; ++i)

                    System.out.println(arr[i] + " ");

            } 

        }

8 / 15

8. File class is included in which package?

9 / 15

9. Which of the following are not java modifiers?

10 / 15

10. What is true about final class?

11 / 15

11. Which of the following is true about public access modifier?

12 / 15

12. Where does the system stores parameters and local variables whenever a method is invoked?

13 / 15

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

        class output 

        {

            public static void main(String args[])

            {

                String a = "hello i love java";

                System.out.println(a.indexOf('i')+" "+a.indexOf('o') +" "+a.lastIndexOf('i')+" "+a.lastIndexOf('o'));

            }

        }

14 / 15

14. What is not the use of “this” keyword in Java?

15 / 15

15. Find the output of the following program.

public class Solution{
       public static void main(String[] args){
                     short x = 10;
                     x =  x * 5;
                     System.out.print(x);
       }
}

Your score is

The average score is 36%

0%