.
  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 is the output of the following program?
        public class Question {
        public static void main(String args[]) {
            String s1 = "abc";
            String s2 = "def";
            String s3 = s1.concat(s2.toUpperCase());
            System.out.println(s1 + s2 + s3);
        }
        }
        
    a) abcdefabcdef b) abcabcDEFDEF c) abcdefabcDEF d) None of the above Answer: c) abcdefabcDEF Explanation: The string s3 is formed by concatenating s1 and the uppercase of s2, resulting in "abc" + "def" + "DEF", so the output is "abcdefabcDEF".
  2. Which one of the following is not an access modifier?

    A: Protected

    B: Void

    C: Public

    D: Private

    Ans: B

    Explanation:

    Public, private, protected and default are the access modifiers.

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

    
    final class A 
    {
        int i;
    }    
    class B extends A 
    {
        int j;
        System.out.println(j + " " + i);  
    }    
    class inheritance 
    {
        public static void main(String args[])
        {
            B obj = new B();
            obj.display();     
        }
    }
        

    A: 2 2

    B: 3 3

    C: Runtime Error

    D: Compilation Error

    Ans: D

    Explanation:

    Class A has been declared final hence it cannot be inherited by any other class. Hence class B does not have member i, giving compilation error.

    Output:

    
    $ javac inheritance.java
    Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
        i cannot be resolved or is not a field
        
  4. What is the numerical range of a char data type in Java?

    A: 0 to 256

    B: -128 to 127

    C: 0 to 65535

    D: 0 to 32767

    Ans: C

    Explanation:

    Char occupies 16-bit in memory, so it supports 216 i:e from 0 to 65535.

  5. Which class provides system independent server side implementation?

    A: Server

    B: ServerReader

    C: Socket

    D: ServerSocket

    Ans: D

    Explanation:

    ServerSocket is a java.net class which provides system independent implementation of server side socket connection.

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

    
    class newthread extends Thread
    {
        Thread t;
        newthread()
        {
            t1 = new Thread(this, "Thread_1");
            t2 = new Thread(this, "Thread_2");
            t1.start();
            t2.start();
        }
        public void run()
        {
            t2.setPriority(Thread.MAX_PRIORITY);    
            System.out.print(t1.equals(t2));
        }    
    }
    class multithreaded_programing
    {
        public static void main(String args[])
        {
            new newthread();        
        }
    }
        

    A: truetrue

    B: falsefalse

    C: true

    D: false

    Ans: B

    Explanation:

    This program was previously done by using Runnable interface, here we have used Thread class. This shows both methods are equivalent, we can use any of them to create a thread.

    Output:

    
    $ javac multithreaded_programing.java
    $ java multithreaded_programing
    falsefalse
        
  7. When do exceptions in Java arise in the code sequence?
        a) Run Time
        b) Compilation Time
        c) Can Occur Any Time
        d) None of the mentioned
        
    Answer: a) Run Time Explanation: Exceptions in Java are run-time errors that occur when the program is executing.
  8. Which of these keywords is not a part of exception handling?
        a) try
        b) finally
        c) thrown
        d) catch
        
    Answer: c) thrown Explanation: The five main keywords for exception handling are: try, catch, throws, throw, and finally.
  9. Which of these keywords must be used to monitor for exceptions?
        a) try
        b) finally
        c) throw
        d) catch
        
    Answer: a) try Explanation: The try block is used to monitor for exceptions in Java.
  10. Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
        a) try
        b) finally
        c) throw
        d) catch
        
    Answer: d) catch Explanation: If an exception occurs in the try block, it is handled by the catch block.
  11. Which of these keywords is used to manually throw an exception?
        a) try
        b) finally
        c) throw
        d) catch
        
    Answer: c) throw Explanation: The throw keyword is used to manually throw an exception in Java.
  12. 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
        




 


.

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