Tuesday, January 12, 2010

II. Each Question Carries 2 Mark.
1) class test
{ private int b;
}
class testdemo
{ void aa()
{ test t = new test();
t. b = 10;
System.out.println(t.b);
}
}
a) Error b) 10 c) 0 d) None

2) class A
{ }
class B extends A
class A is called

a) super class b) base class c) subclass d)child class


3) Static methods can run only other static methods. Variables are three types such as class variables, loca variables, instance variables .
a. True b) False

4) 4.Static data must access only static data. Variables defined with in the methods are called loca variables. Their scope is limited to with in the method jin which they are defined.
a. True b False

5) class A {final void add() { System.out.println(“This is a final method”); }
class B extends A {void add() { ……..} }

a) Can’t override final method b) Can override the final method
c) Runtime error d) None

6) final class A {//…… }
class B extends A { // ……. }
a) can’t subclass A b) can subclass A. c) Runtime error d) None

1) A clas is defined by the class key word followed by the name of class, by default clases inherit from Object class. Object class is the subclass of all classes.
a) True b) False

8). A class is a _________ which represents a __________ object.
a) framework, general b) general, framework c) instance, static d) None

9) Instance of the classes represent individual objects, a class can contain properties and methods. Java file should be the same as the class name.
a) True b) False

10) A constructor which does not take any parameter is called as default constructor, It is __________ provided by java.
a) explicitly b) implicitly c) runtime d) None

1) Variables declared out side the method definitions are called __________.
Generally they are defined immediately after the first line of the class definition.
a) class variables b) local variables c) instance variables d) None

2) class variables apply to a class as a whole. All instances of the class have to access to the same copy. The static keyword is used to declare a class variable
a) False b) True

3) return key word has to be used with in the body of the method to return the value. The name of the method and the list of parameters is called as the __________of the method.
a) Argument b) signature c) return type d) None

4) The declaration of local variable hides the value of instance of class variables. The values of instance or class variables can be accessed by using this keyword.
a) True b) False

5) Instance methods can be used only with respect to the instance of the class. An object has to be created in order to use the instance method.
a) True b) False


II. Answer – 2 Mark.

1. A 2. B 3. A 4. A 5. A 6. A 7. A
8. A 9. A 10. B 11. C 12. B 13. B 14. A
15.A