adplus-dvertising

Welcome to the java lang and java io MCQs Page

Dive deep into the fascinating world of java lang and java io with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of java lang and java io, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of java lang and java io, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through java lang and java io. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of java lang and java io. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

java lang and java io MCQs | Page 10 of 26

Q91.
Which of these exceptions will be thrown if we use null reference for an arithmetic operation?
Discuss
Answer: (b).NullPointerException
Q92.
Which of these class is used to create user defined exception?
Discuss
Answer: (b).Exception
Q93.
What is the output of this program?
    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                int a[] = {1, 2,3 , 4, 5};
                for (int i = 0; i < 7; ++i) 
                    System.out.print(a[i]);
            }
            catch(ArrayIndexOutOfBoundsException e) 
            {
         System.out.print("0");         
            }
        }
    }
Discuss
Answer: (b).123450
Q94.
What is the output of this program?
    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                int a[] = {1, 2,3 , 4, 5};
                for (int i = 0; i < 5; ++i) 
                    System.out.print(a[i]);
                int x = 1/0;
            }
            catch(ArrayIndexOutOfBoundsException e) 
            {
         System.out.print("A");         
            }
            catch(ArithmeticException e) 
            {      
                System.out.print("B");
            }
        }
    }
Discuss
Answer: (c).12345B
Q95.
Which of these class provides various types of rounding functions?
Discuss
Answer: (a).Math
Q96.
Which of these methods return a smallest whole number greater than or equal to variable X?
Discuss
Answer: (a).double ceil(double X)
Q97.
Which of these method returns a largest whole number less than or equal to variable X?
Discuss
Answer: (b).double floor(double X)
Q98.
Which of function return absolute value of a variable?
Discuss
Answer: (a).abs()
Q99.
What is the output of this program?
    class A 
    {
         int x;
         int y;
         void display() 
         {
              System.out.print(x + " " + y);
         }
    }
    class Output 
    {
         public static void main(String args[]) 
         {
             A obj1 = new A();
             A obj2 = new A();
             obj1.x = 1;
             obj1.y = 2;
             obj2 = obj1.clone();
             obj1.display();
             obj2.display();
         }
    }
Discuss
Answer: (b).1 2 1 2
Q100.
What is the output of this program?
    class Output 
    {
         public static void main(String args[]) 
         {
             double x = 3.14;  
             int y = (int) Math.abs(x);
             System.out.print(y);
         }
    }
Discuss
Answer: (b).3

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!