Java Quiz

0 votes, 0 avg
398

Java Questions

1 / 15

1. How is Date stored in database?

2 / 15

2. The concept of multiple inheritances is implemented in Java by

I. Extending two or more classes.
II. Extending one class and implementing one or more interfaces.
III. Implementing two or more interfaces.

3 / 15

3. Find the output of the following program.

class increment {
public static void main(String args[]) 
            {        
                 int g = 3;
                 System.out.print(++g * 8);
            } 
        }

4 / 15

4. What is Recursion in Java?

5 / 15

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

class multidimention_array 
    {
        public static void main(String args[])
        {
            int arr[][] = new int[3][];
            arr[0] = new int[1];
            arr[1] = new int[2];
            arr[2] = new int[3];               
	    int sum = 0;
	    for (int i = 0; i < 3; ++i) 
	        for (int j = 0; j < i + 1; ++j)
                    arr[i][j] = j + 1;
	    for (int i = 0; i < 3; ++i) 
	        for (int j = 0; j < i + 1; ++j)
                    sum + = arr[i][j];
	    System.out.print(sum); 	
        } 
    }

6 / 15

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

7 / 15

7. Which of these can be used to differentiate two or more methods having the same name?

8 / 15

8. Identify the output of the following program.

String str = “Hellow”;
System.out.println(str.indexOf(‘t));

9 / 15

9. What is the function of javap command?

10 / 15

10. What is the process of defining two or more methods within same class that have same name but different parameters declaration?

11 / 15

11. How to sort an array?

12 / 15

12. Which of these is correct about passing an argument by call-by-value process?

13 / 15

13. Which exception is thrown when java is out of memory?

14 / 15

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

        class String_demo 

        {

            public static void main(String args[])

            {

                int ascii[] = { 65, 66, 67, 68};

                String s = new String(ascii, 1, 3);

                System.out.println(s);

            }

       }

15 / 15

15. Find the output of the following code.

        class leftshift_operator 

        {

            public static void main(String args[]) 

            {        

                 byte x = 64;

                 int i;

                 byte y; 

                 i = x << 2;

                 y = (byte) (x << 2);

                 System.out.print(i + " " + y);

            } 

        }

Your score is

The average score is 35%

0%

Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.

Scroll to Top