|Language:||English, Spanish, French|
|Distribution:||Free* [*Sign up for free]|
This set of Advanced Java Multiple Choice Questions & Answers (MCQs) focuses on Advanced java programming multiple choice questions with answers pdf. Advanced java multiple choice questions and answers will help you to be more knowledgeable because they can give you ideas on questions and answers. Review the ebook Advanced Java Mcq Questions With Answers Pdf Msbte by domarepthestten.ml Study online at here. Next to, you could also.
Competitors may use any programming language and development environment to obtain their solutions. It's a global competitive programming platform and has a large community of programmers that helps students and professionals test and improve their coding skills.
Its objective is to provide a platform for practice, competition and improvement for both students and professional software developers. Apart from this, it aims to reach out to students while they are young and inculcate a culture of programming in India. It holds a staggering amount of problems prepared by its community of problem setters or taken from previous programming contests, some of which are great problems for practice refer to the Problem classifiers section. SPOJ also allows advanced users to organize contests under their own rules.
It's home to many classic problems from the Chinese IOI scene. It has a lot of great problems from programming competitions in Japan. Thousands of problems, including many classic ones, are featured here.
However, it is strongly advised that you practice with uHunt following its "Competitive Programming Exercise" section. Arrays Questions and Answers 1. Which of these operators is used to allocate memory to array variable in Java? Arrays Questions and Answers 2. Which of these is an incorrect array declaration? Arrays Questions and Answers 3. What will this code print? Which of these is an incorrect Statement?
Arrays Questions and Answers 5. Which of these is necessary to specify at time of array initialization? Collections Questions and Answers 1. Which of these packages contain all the collection classes? Collections Questions and Answers 2. Collections Questions and Answers 3.
Collections Questions and Answers 4. Which of these methods deletes all the elements from invoking collection?
Collections Questions and Answers 5. What is Collection in Java? When does Exceptions in Java arises in code sequence? Which of these keywords is not a part of exception handling? Which of these keywords must be used to monitor for exceptions? Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
Which of these keywords is used to manually throw an exception? Input Output Streams Questions and Answers 1. Input Output Streams Questions and Answers 2. Input Output Streams Questions and Answers 3. Which of these is a type of stream in Java? Input Output Streams Questions and Answers 4. Which of these classes are used by Byte streams for input and output operation? Input Output Streams Questions and Answers 5. Which of these classes are used by character streams for input and output operations?
Which of these keywords is used to define interfaces in Java? Which of these can be used to fully abstract a class from its implementation? Which of these access specifiers can be used for an interface? Using serialization, object's state is saved and converted into byte stream. The byte stream is transferred over the network and the object is re-created at destination. Ans: Try block needs to be followed by either Catch block or Finally block or both.
Any exception thrown from try block needs to be either caught in the catch block or else any specific tasks to be performed before code abortion are put in the Finally block. Is there any way to skip Finally block of exception even if some exception occurs in the exception block? Ans: If an exception is raised in Try block, control passes to catch block if it exists otherwise to finally block. Finally block is always executed when an exception occurs and the only way to avoid execution of any statements in Finally block is by aborting the code forcibly by writing following line of code at the end of try block: System.
When the constructor of a class is invoked? Ans: The constructor of a class is invoked every time an object is created with new keyword. For example, in the following class two objects are created using new keyword and hence, constructor is invoked two times. Can a class have multiple constructors? Ans: Yes, a class can have multiple constructors with different parameters.
Which constructor gets used for object creation depends on the arguments passed while creating the objects. Can we override static methods of a class? Ans: We cannot override static methods.
Static methods belong to a class and not to individual objects and are resolved at the time of compilation not at runtime. Even if we try to override static method,we will not get an complitaion error,nor the impact of overriding when running the code.
In the below example, what will be the output? Is String a data type in java? Ans: String is not a primitive data type in java. When a string is created in java, it's actually an object of Java.
String class that gets created. After creation of this string object, all built-in methods of String class can be used on the string object.
In the below example, how many String Objects are created? String class are created. Why Strings in Java are called as Immutable? Ans: In java, string objects are called immutable as once value has been assigned to a string, it can't be changed and if changed, a new object is created. In below example, reference str refers to a string object having value "Value one". What's the difference between an array and Vector? Ans: An array groups data of same primitive type and is static in nature while vectors are dynamic in nature and can hold data of different data types.
What is multi-threading? Ans: Multi threading is a programming concept to run multiple tasks in a concurrent manner within a single program.
Threads share same process stack and running in parallel. It helps in performance improvement of any program.
Why Runnable Interface is used in Java? Ans: Runnable interface is used in java for implementing multi threaded applications. Runnable interface is implemented by a class to support multi threading. What are the two ways of implementing multi-threading in Java? Ans: Multi threaded applications can be developed in Java by using any of the following two methodologies: 1. By using Java. Runnable Interface. Classes implement this interface to enable multi threading.
There is a Run method in this interface which is implemented. By writing a class that extend Java. Thread class. When a lot of changes are required in data, which one should be a preference to be used?
String or StringBuffer? Ans: Since StringBuffers are dynamic in nature and we can change the values of StringBuffer objects unlike String which is immutable, it's always a good choice to use StringBuffer when data is being changed too much. If we use String in such a case, for every data change a new String object will be created which will be an extra overhead. What's the purpose of using Break in each case of Switch Statement? Ans: Break is used after each case except the last one in a switch so that code breaks after the valid case and doesn't flow in the proceeding cases too.
If break isn't used after each case, all cases after the valid case also get executed resulting in wrong results. How garbage collection is done in Java? Ans: In java, when an object is not referenced any more, garbage collection takes place and the object is destroyed automatically.
For automatic garbage collection java calls either System. How we can execute any code even before main method? Ans: If we want to execute any statements before even creation of objects at load time of class, we can use a static block of code in the class. Any statements inside this static block of code will get executed once at the time of loading the class even before creation of objects in the main method. Can a class be a super class and a sub-class at the same time?
Ans: If there is a hierarchy of inheritance used, a class can be a super class for another class and a sub-class for another one at the same time. In the example below, continent class is sub-class of world class and it's super class of country class. How objects of a class are created if no constructor is defined in the class?