.
  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 » Newgen Placement Papers » Newgen Previous Year Placement Paper

 

Newgen Placement Paper -: Java Questions With Answers


Advertisements
Advertisements




Newgen Previous Years Solved Sample Placement Papers

  1. What will be the output of the following Java program?
        import java.net.*;
        class networking 
        {
            public static void main(String[] args) throws Exception 
            {
                URL obj = new URL("https://www.sanfoundry.com/javamcq");
                URLConnection obj1 = obj.openConnection();
                int len = obj1.getContentLength();
                System.out.print(len);
            }
        }
        
    Answer: b) 127 Explanation: The length of the content returned by the host URL is 127.
  2. Which of the below is not a Java Profiler?
        a) JProfiler
        b) Eclipse Profiler
        c) JVM
        d) JConsole
        
    Answer: c) JVM Explanation: JVM is not a profiler. JProfiler, Eclipse Profiler, and JConsole are used to analyze and profile Java applications.
  3. What will be the output of the following Java program?
        import java.net.*;
        class networking
        {
            public static void main(String[] args) throws MalformedURLException
            {
                URL obj = new URL("https://www.sanfoundry.com/javamcq");
                System.out.print(obj.toExternalForm());
            }
        }
        
    Answer: b) https://www.sanfoundry.com/javamcq Explanation: The toExternalForm() method returns the full URL as a string, including the protocol.
  4. What will be the output of the following Java code snippet?
        import java.util.*;
        class Arraylists 
        {
            public static void main(String args[]) 
            {
                ArrayLists obj = new ArrayLists();
                obj.add("A");
                obj.add("B");
                obj.add("C");
                obj.add(1, "D");
                System.out.println(obj);
            }
        }
        
    Answer: d) [A, D, B, C] Explanation: The element "D" is inserted at index 1, shifting "B" and "C" one position forward.
  5. Which of these packages contains the exception Stack Overflow in Java?
        a) java.io
        b) java.system
        c) java.lang
        d) java.util
        
    Answer: c) java.lang Explanation: StackOverflowError is a part of the java.lang package.
  6. What will be the output of the following Java program?
        import java.util.*;
        class Collection_iterators 
        {
            public static void main(String args[]) 
            {
                LinkedList list = new LinkedList();
                list.add(new Integer(2));
                list.add(new Integer(8));
                list.add(new Integer(5));
                list.add(new Integer(1));
                Iterator i = list.iterator();
                Collections.reverse(list);
                Collections.sort(list);
                while(i.hasNext())
                    System.out.print(i.next() + " ");
            }
        }
        
    Answer: a) 1 2 5 8 Explanation: The Collections.sort() method sorts the list, and Collections.reverse() reverses it before sorting, giving the final order: 1, 2, 5, 8.
  7. Which of these statements is incorrect about Thread?
        a) start() method is used to begin execution of the thread
        b) run() method is used to begin execution of a thread before start() method in special cases
        c) A thread can be formed by implementing Runnable interface only
        d) A thread can be formed by a class that extends Thread class
        
    Answer: b) run() method is used to begin execution of a thread before start() method in special cases Explanation: The run() method defines the task for the thread, but the start() method must be called to begin execution. run() is never used for starting execution directly.
  8. Which of these keywords are used for the block to be examined for exceptions?
        a) check
        b) throw
        c) catch
        d) try
        
    Answer: d) try Explanation: The try block is used to define the code that will be examined for exceptions.




 


.

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-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved. Read our Privacy Policy