Java Test .pdf

File information


Original filename: Java-Test.pdf

This PDF 1.5 document has been generated by / Skia/PDF m61, and has been sent on pdf-archive.com on 21/06/2017 at 07:51, from IP address 92.97.x.x. The current document download page has been viewed 690 times.
File size: 190 KB (7 pages).
Privacy: public file


Download original PDF file


Java-Test.pdf (PDF, 190 KB)


Share on social networks



Link to this file download page



Document preview


Java - Test Questions
Q 1 - What is the size of boolean variable?
A - 8 bit
B - 16 bit
C - 32 bit
D - not precisely defined
Q 2 - Static binding uses which information for binding?
A - type.
B - object.
C - Both of the above.
D - None of the above
Q 3 - When static binding occurs?
A - Static binding occurs during Compile time.
B - Static binding occurs during load time.
C - Static binding occurs during runtime.
D - None of the above
Q 4 - What happens when thread's yield() method is called?
A - Thread returns to the ready state.
B - Thread returns to the waiting state.
C - Thread starts running.
D - None of the above
Q 5 - Is it necessary that each try block must be followed by a finally block?
A - True.
B - False
Q 6 - Which of the following is true about private access modifier?
A - Variables, methods and constructors which are declared private can be accessed only by
the members of the same class.
B - Variables, methods and constructors which are declared private can be accessed by any
class lying in same package.
C - Variables, methods and constructors which are declared private in the superclass can be
accessed only by its child class.
D - None of the above

Q 7 - Which of the following is true about String?
A - String is mutable.
B - String is immutable.
C - String is a data type.
D - None of the above.
Q 8 - Primitive variables are stored on Stack.
A - True
B - False
Q 9 - This is the parent of Error and Exception classes.
A - Throwable
B - Catchable
C - MainError
D - MainException
Q 10 - What is the default value of double variable?
A - 0.0d
B - 0.0f
C-0
D - not defined
Q 11 - What is composition?
A - Composition is a data structure.
B - Composition is a way to create an object.
C - Holding the reference of the other class within some other class is known as composition.
D - None of the above
Q 12 - What is Deserialization?
A - Deserialization is the process of restoring state of an object from a byte stream.
B - Serialization is the process of restoring state of an object from an object.
C - Both of the above.
D - None of the above.
Q 13 - What is the default value of short variable?
A - 0.0
B-0
B - null
B - undefined
Q 14 - Can be constructor be made private?
A - True.

B - False
Q 15 - What is the default value of Boolean variable?
A - true
B - false
C - null
D - not defined
Q 16 - What is the size of byte variable?
A - 8 bit
B - 16 bit
C - 32 bit
D - 64 bit
Q 17 - What of the following is the default value of an instance variable?
A - null
B-0
C - Depends upon the type of variable
D - Not assigned
Q 18 - A class always has a default constructor.
A - True
B - False
Q 19 - What is runtime polymorphism?
A - Runtime polymorphism is a process in which a call to an overridden method is resolved at
runtime rather than at compile-time.
B - Runtime polymorphism is a process in which a call to an overloaded method is resolved at
runtime rather than at compile-time.
C - Both of the above.
D - None of the above.
Q 20 - What is function overriding?
A - If a subclass uses a method that is already provided by its parent class, it is known as
Method Overriding.
B - If a subclass provides a specific implementation of a method that is already provided by its
parent class, it is known as Method Overriding.
C - Both of the above.
D - None of the above
Q 21 - You want a class to have access to members of another class in the same
package. Which is the most restrictive access that accomplishes this objective?
A - Public

B - Private
C - Protected
D - Default access
Q 22 - Which method is executed when we start the thread?
A - start()
B - wait()
C - notify()
D - run()
Q 23 - Which collection class allows you to grow or shrink its size and provides indexed
access to its elements, but whose methods are not synchronized?
A - java.util.HashSet
B - java.util.LinkedHashSet
C - java.util.List
D - java.util.ArrayList
Q 24 - You need to store elements in a collection that guarantees that no duplicates are
stored and all elements can be accessed in natural order. Which interface provides that
capability
A - java.util.Map
B - java.util.Set
C - java.util.List
D - java.util.Collection
Q 25 - Which interface does ​java.util.Hashtable​ implement?
A - java.util.Map
B - java.util.List
C - java.util.HashTable
D - java.util.Collection
Q 26 - Which interface provides the capability to store objects using a key-value pair?
A - java.util.Map
B - java.util.Set
C - java.util.List
D - java.util.Collection
Q 27 - Which collection class allows you to associate its elements with key values, and
allows you to retrieve objects in FIFO (first-in, first-out) sequence?
A - java.util.ArrayList
B - java.util.LinkedHashMap
C - java.util.HashMap
D - java.util.TreeMap

Q 28 - Which statement is true?
A - All objects that are eligible for garbage collection will be garbage collected by the garbage
collector
B - Objects with at least one reference will never be garbage collected.
C - Objects from a class with the ​finalize()​ method overridden will never be garbage collected
D - Objects instantiated within anonymous inner classes are placed in the garbage collectible
heap.
Q 29 - What is the name of the method used to start a thread execution?
A - init()
B - start()
C - run()
D - resume()
Q 30 - Calling ​notify()​ method on an thread-object will stop the execution of thread.
A - True
B - False

Java - Practical
1. Create a class(SessionManager) which stores/manages session information using
collections.
It should have the following methods:
1. createSession(String userId)
a. Should create a usersession object and store in the collection
2. removeSession(sessionid): removes the matched session object
3. getSession(sessionid): returns the matched session object
4. getSessionCount(): returns the number of sessions in the collection
Note: The following is the session class.
class UserSession {
Int id;
// auto-generate
String userId;
long createdTime; // system time in milliseconds
}

2. Create a thread class which pings an ip address for every ​2 seconds​.
Note: use InetAddress class from java.net.*

3. Create an android app that brings the json msg from the server on button press
- It should have an activity with TextView and button
- The app should use volley library to send http-get requests to the server (
https://httpbin.org/get​ )

-

Display the response in the textview control.


Related documents


java test
win213r test1 review2016 02 19 1
c
textanddocmgt
midterm answer
paper 1

Link to this page


Permanent link

Use the permanent link to the download page to share your document on Facebook, Twitter, LinkedIn, or directly with a contact by e-Mail, Messenger, Whatsapp, Line..

Short link

Use the short link to share your document on Twitter or by text message (SMS)

HTML Code

Copy the following HTML code to share your document on a Website or Blog

QR Code

QR Code link to PDF file Java-Test.pdf