.
  Vyom World.com . Let's Touch the Sky Together!  
.

Home
VyomWorld.com Home
Interview Questions
VyomLinks.com Home
JobsAssist.com Home
Vyom Network
Contact Us
Jobs & Careers
Resume Submitter
Placement Papers
IT Companies Directory
Computer Jobs
Interview Questions
Online Exams
Vyom Career eMag.
Fun
Send FREE SMS!
SMS Jokes
Source Codes Library
Source Codes Home
ASP Source Codes
C Source Codes
C++ Source Codes
COBOL Source Codes
Java Source Codes
Pascal Source Codes
Submit Source Codes
GATE
GATE an Overview
GATE Preparation
Study Materal
GRE
GRE an Overview
GRE Questions
GRE Preparation
GRE Universities
TOEFL Preparation
TOEFL Resources
GMAT Preparation
GMAT Resources
MBA Preparation
MBA Resources
Networking Concepts
Networking Concepts
Testing Preparation
Testing Resources
Webmasters
Free Traffic Builder
Webmaster Articles
Web Hosting
Tutorials
Hardware Tutorial
1500 Free eBooks New!


Home » Placement Papers » Ubinetics Placement Papers » Ubinetics Previous Year Placement Paper

 

Ubinetics Placement Paper -: Java Questions And Answers


Advertisements
Advertisements




Ubinetics Previous Years Solved Sample Placement Papers

  1. What will be the output of the following Java program?
        class exception_handling 
        {
            public static void main(String args[]) 
            {
                try 
                {
                    int a, b;
                    b = 0;
                    a = 5 / b;
                    System.out.print("A");
                }
                catch(ArithmeticException e) 
                {
                    System.out.print("B");
                }
            }
        }
        
    a) A b) B c) Compilation Error d) Runtime Error Answer: b) B Explanation: A division by zero causes an ArithmeticException, which is caught by the catch block, printing "B". Output:
        $ javac exception_handling.java
        $ java exception_handling
        B
        
  2. What will be the output of the following Java program?
        class exception_handling 
        {
            public static void main(String args[]) 
            {
                try 
                {
                    int a, b;
                    b = 0;
                    a = 5 / b;
                    System.out.print("A");
                }
                catch(ArithmeticException e) 
                {
                    System.out.print("B");
                }
                finally 
                {
                    System.out.print("C");
                }
            }
        }
        
    a) A b) B c) AC d) BC Answer: d) BC Explanation: The ArithmeticException is caught by the catch block, printing "B", and the finally block is executed, printing "C". Output:
        $ javac exception_handling.java
        $ java exception_handling
        BC
        
  3. What will be the output of the following Java program?
        class exception_handling 
        {
            public static void main(String args[]) 
            {
                try 
                {
                    int i, sum;
                    sum = 10;
                    for (i = -1; i < 3 ;++i)
                        sum = (sum / i);
                }
                catch(ArithmeticException e) 
                {
                    System.out.print("0");
                } 
                System.out.print(sum);
            }
        }
        
    a) 0 b) 05 c) Compilation Error d) Runtime Error Answer: c) Compilation Error Explanation: The variable sum is declared inside the try block, making it out of scope when accessed outside the try block, resulting in a compilation error. Output:
        $ javac exception_handling.java
        Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
        sum cannot be resolved to a variable
        
  4. Which of the following is true about servlets?
        a) Servlets can use the full functionality of the Java class libraries
        b) Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries
        c) Servlets execute within the address space of web server
        d) Servlets are platform-independent because they are written in java
        
    Answer: b) Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries Explanation: Servlets execute within the address space of a web server. Since they are written in Java, they are platform-independent, and the full functionality of Java class libraries is available.
  5. What will be the output of the following Java program?
        class exception_handling 
        {
            public static void main(String args[]) 
            {
                try 
                {
                    System.out.print("Hello" + " " + 1 / 0);
                }
                catch(ArithmeticException e) 
                {
                    System.out.print("World");
                }
            }
        }
        
    Answer: b) World Explanation: The 1 / 0 causes an ArithmeticException, which is caught by the catch block, printing "World". Output:
        $ javac exception_handling.java
        $ java exception_handling
        World
        
  6. The word synchronized can be used with only a method. True/False

    A: False

    Ans: False
  7. What are all the four states associated in the thread?

    A: 1. new 2. runnable 3. blocked 4. dead

    Ans: 1. new 2. runnable 3. blocked 4. dead
  8. The suspend() method is used to terminate a thread. True/False

    A: False

    Ans: False
  9. The run() method should necessarily exist in classes created as subclass of thread. True/False

    A: True

    Ans: True
  10. Garbage collector thread belongs to which priority?

    A: low-priority

    Ans: low-priority
  11. What is the difference between superclass & subclass?

    A: A superclass is a class that is inherited whereas subclass is a class that does the inheriting.

    Ans: A superclass is a class that is inherited whereas subclass is a class that does the inheriting.
  12. Which keyword is used to inherit a class?

    A: extends

    Ans: extends
  13. Object class is a superclass of all other classes? True/False

    A: True

    Ans: True
  14. Java supports multiple inheritance? True/False

    A: False

    Ans: False
  15. What is inheritance?

    A: Deriving an object from an existing class. In other words, inheritance is the process of inheriting all the features from a class.

    Ans: Deriving an object from an existing class. In other words, inheritance is the process of inheriting all the features from a class.
  16. What are the advantages of inheritance?

    A: Reusability of code and accessibility of variables and methods of the superclass by subclasses.

    Ans: Reusability of code and accessibility of variables and methods of the superclass by subclasses.
  17. Which methods are used to destroy the objects created by the constructor methods?

    A: finalize()

    Ans: finalize()
  18. What are abstract classes?

    A: Abstract classes are those for which instances can’t be created.

    Ans: Abstract classes are those for which instances can’t be created.
  19. What must a class do to implement an interface?

    A: It must provide all of the methods in the interface and identify

  20. What is the method available for setting the priority?

    A: setPriority()

    Ans: setPriority()
  21. What is the default thread at the time of starting the program?

    A: main thread

    Ans: main thread




 


.

Recently Updated: New Placement Papers added.
Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Programming & Source Codes | GRE Preparation | Jobs, Discussions | Software Listing | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | International Business Information | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | FAQs | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Excellent Mobiles | Software Testing | Interview Questions | Freshers Jobs | Server Insiders | File Extension Directory

Copyright ©2003-2025 Vyom Technosoft Pvt. Ltd., All Rights Reserved. Read our Privacy Policy