CoderMantra

Menu
  • Home
  • Quiz
  • How-To
  • Q/A
  • Blog

java exam

0 votes, 0 avg
371
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Java Questions

1 / 15

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

2 / 15

2. Find the output of the following program.

public class Solution{
       public static void main(String[] args){
               int[]  x = {120, 200, 016};
               for(int i = 0; i < x.length; i++){
                        System.out.print(x[i] + “ “);
               }                   
       }
}

3 / 15

3. From the following statements which is a disadvantage of an java array?

4 / 15

4. Which data type value is returned by all transcendental math functions?

5 / 15

5. Which of these keywords are used for the block to be examined for exceptions?

6 / 15

6. Find the output of the following code.

        class output 

        {

            public static void main(String args[])

            { 

               StringBuffer s1 = new StringBuffer("Quiz");

               StringBuffer s2 = s1.reverse();

               System.out.println(s2);

            }

        }

7 / 15

7. Which mechanism is used when a thread is paused running in its critical section and another thread is allowed to enter (or lock) in the same critical section to be executed?

8 / 15

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

9 / 15

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

10 / 15

10. Find the output of the following code.

        class box 

        {

            int width;

            int height;

            int length;

        } 

        class main

        {

            public static void main(String args[]) 

            {        

                 box obj = new box();

                 obj.width = 10;

                 obj.height = 2;

                 obj.length = 10;

                 int y = obj.width * obj.height * obj.length; 

                 System.out.print(y);

            } 

        }

11 / 15

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

        class A 

        {

            int i;

            public void display() 

            {

                System.out.println(i);

            }    

        }    

        class B extends A 

       {

            int j;

            public void display() 

            {

                System.out.println(j);

            } 

        }    

        class Dynamic_dispatch 

       {

            public static void main(String args[])

            {

                B obj2 = new B();

                obj2.i = 1;

                obj2.j = 2;

                A r;

                r = obj2;

                r.display();     

            }

       }

12 / 15

12. Which of these statements is incorrect about Thread?

13 / 15

13. In Iterator, hasMoreElements() method of Enumeration has been changed to:

14 / 15

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

15 / 15

15. How to sort an array?

Your score is

The average score is 36%

LinkedIn Facebook VKontakte
0%

By Wordpress Quiz plugin

Category

  • AI
  • Assignments
    • C Language Assignments
    • C++ Assignments
    • Java Assignments
    • Python Assignments
  • C Programming
  • c-plus-plus-Assignments
  • C++
  • Core Java
  • Data Structure
  • Data Structure In C++
  • data structures
  • How To
  • Java-Assignments
  • node js questions
  • nodejs assignments
  • nodejs Projects
  • Practice Questions
  • Python Tutorial
  • Python-Assignments
  • Questions
  • Quiz
  • sql-functions
  • SQL-Tutorial
  • Tkinter Tutorial
  • Uncategorized
  • What Is
  • Why

Archives

  • February 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • July 2025
  • April 2025
  • October 2024
  • September 2024
  • June 2024
  • April 2024
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • May 2022
  • November 2021
  • May 2021
  • March 2021
  • November 2020
  • October 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • September 2019
  • August 2019
  • May 2019
  • March 2019
  • February 2019
  • January 2019
About CoderMantra

Coder Mantra is a unique e-learning website, offers a tutorial of different popular programming languages with examples. The code on this popular tutorial website is tested and executed.

Latest Posts
Graph in Data Structures February 26, 2026
Heap in Data Structures December 31, 2025
AVL Tree in Data Structures December 29, 2025
Binary Search Tree (BST) in Data Structures December 24, 2025
Contact Us

info@codermantra.com

admin@codermantra.com

© 2020 Coder Mantra . All Rights Reserved
About | Privacy Policy | Terms | Contact