CoderMantra

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

java exam

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

Java Questions

1 / 15

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

        class Output 

        {

            public static void main(String args[]) 

            {

                Integer i = new Integer(257);  

                byte x = i.byteValue();

                System.out.print(x);

            }

        }

2 / 15

2. 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] + " ");

            } 

        }

3 / 15

3. Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?

4 / 15

4. What is the function of javap command?

5 / 15

5.  The following program is an example for?

class Student{
int id;
String name;

void display(){System.out.println(id+" "+name);}

public static void main(String args[]){
Student s1=new Student();
Student s2=new Student();
s1.display();
s2.display();
}
} 

6 / 15

6. What is garbage collection in the context of Java?

7 / 15

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

    class San

    {

     public void m1 (int i,float f)

     {

      System.out.println(" int float method");

     }

     

     public void m1(float f,int i);

      {

      System.out.println("float int method");

      }

     

      public static void main(String[]args)

      {

        San s=new San();

            s.m1(20,20);

      }

    }

8 / 15

8. What is the default value of String variable?

9 / 15

9. Which of the following is a superclass of every class in Java?

10 / 15

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

11 / 15

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

12 / 15

12. Which of these keywords is used to prevent content of a variable from being modified?

13 / 15

13. Choose the appropriate data type for this field: isSwimmer

14 / 15

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

class Char {
public static void main(String args[]) {
char ch1, ch2;
ch1 = 88; // code for X
ch2 = 'Y';
System.out.print("ch1 and ch2: ");
System.out.println(ch1 + " " + ch2);
}
} 

15 / 15

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

Your score is

The average score is 19%

LinkedIn Facebook Twitter VKontakte
0%

Category

  • Assignments
    • C Language Assignments
    • C++ Assignments
  • C Programming
  • c-plus-plus-Assignments
  • Core Java
  • How To
  • Java-Assignments
  • node js questions
  • nodejs assignments
  • nodejs Projects
  • Practice Questions
  • Python Tutorial
  • Python-Assignments
  • Questions
  • Quiz
  • Tkinter Tutorial
  • Uncategorized
  • What Is

Archives

  • 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
How to upload a file using Node js.? May 26, 2023
How to Create http module to transfer data over the Hyper Text Transfer Protocol? May 26, 2023
How to Create steps for forgot password link in node js ? May 26, 2023
How to send e-mail using node js? May 26, 2023
Contact Us

info@codermantra.com

admin@codermantra.com

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