1. In this example class-var = new classname( );
The classname is the name of the class that is being instantiated.
A) True
B) False

whan we create an object so code are classname obj=new classname();classname is name of the classobj is objectnew is create new instances of class classnameso that ans is true...........what u say

2. Tell me Is it possible to declare an anonymous class while implementing an interface?

Interface i = new Interface(){/* Code}The above statement creates an instance of a class which implements the Interface "Interface". As name of class is not specified hence it is anonymous.

4. How to call two interfaces in one interface?

You can not call 2 interface in interface but you can extend interfaces in your interface.Example :
Interface I1{..}Interface I2 extends I1{..}Interface I3 extends I2{}

5. Explain when we are overloading or overriding the methods how we want to take care about the acess specifiers?

When we override a method in the child class, that method sould not be a private in parent class, but that method should be public or protected or default, those methods should have the same signature.

But we can overload the method within the same class or in the child class but they have some difference in having no of arguments or type of arguments. if we overload the method within the class we can use any access specifier, if we overload in child class dont use private.

6. What is enumeration?

public interface Enumeration . An object that implements the Enumeration interface generates a series of elements, one at a time. Successive calls to the nextElement method return successive elements of the series.

9. in Java, all class objects need not be dynamically allocated
A) True
B) False

I think it is true. Because, we use initalize some variables which are not dynamic.

For eg: int i = 10;

10. Static and Non-Static are the two types of nested classes
A) True
B) False

true.....class declared with static called static inner class....with out static called non static inner class..

14. The Code in java is contained within Methods
A) True
B) False

Source Code is normally an entire file.

In Java the actual execution (or result preparation) would be there in methods only.Method will return exact one return value / 0(void).

Methods will change the behaviour of an object (Operations).

Fields contains value or state of an object.

15. Explain how to declare and defile a final class without use of final keyword?

By making constructor as 'private', we can make a final class.

16. When we create a class, we are creating a new data type
A) True
B) False

well, it isn't /quite/ the same as a struct. A class can contain methods as well as state, remember...

17. A class is declared by use of the ________ keyword.
A) Object
B) Class
C) Instance
D) None of the above

D)None of the above.This is because the class is a valid keyword and not Class.This might catch inexperienced programmers who are taught the first letter of the class by convention is capital.

18. Java allows objects to initialize themselves when they are created using _________
A) Arguments
B) Classes
C) Constructors
D) Parameters

Ans is constructer.

B'coz When a object is created following things are happen:

1) Memory gets allocated to the object

2) Constructer gets called.

3) In constructer the object gets initialize.

i think this will be sufficient to clear the topic..

20. What is Class Loader?

Class loaders are one of the cornerstones of the Java virtual machine (JVM) architecture. They enable the JVM to load classes without knowing anything about the underlying file system semantics, and they allow applications to dynamically load Java classes as extension modules.A class loader is an object that is responsible for loading classes. The class ClassLoader is an abstract class. Given the name of a class, a class loader should attempt to locate or generate data that constitutes a definition for the class. A typical strategy is to transform the name into a file name and then read a "class file" of that name from a file system.

21. In general, there are _________ ways that a computer language can pass an argument to a subroutine
A) One
B) Two
C) Three
D) Four

Explanation: In general, there are two ways that a computer language can pass an argument to a subroutine. The first way is call-by-value. The second way an argument can be passed is call-by-reference.

24. A variable declared as final prevents its contents from being modified
A) True
B) False

ans is true.

when we a final keyword to a variable the value of the variable can't change.

28. finalize( ) is only called just prior to _________
A) Initialisation
B) Runtime
C) Garbage Collection
D) None of the above

Ans is : Garbage Collection

b'coz the finalize() method is called by the garbage collector when it determines no more references to the object exist.

30. How to create console or how i can take result with the help of console?

we can create console by using system.in class.

and also readline().

for example

BufferedInputStream br=new BuffereInputStream(new InputstreamReader(System.in));

br.readLine();//reading the values from console.

32. What is the significance of wait() method with respect to Object class, not in Thread class?

the wait() method is defined in the java.lang.OBject() class and not in the java.lang.Thread()class. it's signature is public static void wait(). we do have some overloaded versions of the wait() method. when an wait method is called by an thread on a object it release the lock on the object and goes to an WAIT/BLOCKED state inorder to let the other threads to enter the RUNNING state. However it regains the Lock on the object after sometime when it moves from the WAIT/BLOCKED state to RUNNABLE state . that can happen due to the call of notify(),notifyAll() methods by other threads holding of the respective objects Lock.

33. What is singleton class and how can we get it from a general class,explain with examples(program)?

In computer science, the singleton design pattern is designed to restrict instantiation of a class to one (or a few) objects. This is useful when exactly one object is needed to coordinate actions across the system. Sometimes it is generalized to systems that operate more efficiently when only one or a few objects exist.

The singleton pattern is implemented by creating a class with a method that creates a new instance of the object if one does not exist. If one does exist it returns a reference to the object that already exists. To make sure that the object cannot be instantiated any other way the constructor is made either private or protected.

The singleton pattern must be carefully constructed in multi-threaded applications. If two threads are to execute the creation method at the same time when a singleton does not yet exist, they both must check for an instance of the singleton and then only one should create the new one.

The classic solution to this problem is to use mutual exclusion on the class that indicates that the object is being instantiated.

A Java programming language solution is as follows. It is based on the Q&A link found below, modified for multi-threading, however, it is still vulnerable to the double-checked locking anti-pattern, also found below:

public class Singleton {
private static Singleton INSTANCE = null;

// Private constructor suppresses
// default public constructor
private Singleton() {}

//synchronized creator to defend against multi-threading issues
//another if check here to avoid multiple instantiation
private synchronized static void createInstance() {
if (INSTANCE == null) {
INSTANCE = new Singleton();
}
}

public static Singleton getInstance() {
if (INSTANCE == null) createInstance();
return INSTANCE;
}
}

34. When a member is declared static, it CANNOT be accessed before any objects of its class are created, and without reference to any object
A) True
B) False

Explanation: When a member is declared static, it can be accessed before any objects of its class are created, and without reference to any object. You can declare both methods and variables to be static.