ANSWER KEY (8) - 70 Que
ANSWER KEY (8) - 70 Que
ANSWER KEY (8) - 70 Que
Textbook Exercise
Page 1
(13) In Java which method is invoked automatically with creation of an object ?
(A) Instance method (B) Constructor
(C) Class method (D) All of these
(14) How does the Constructor differ from general method in Java ?
(A) It must have the same name as class.
(B) It does not have return type.
(C) It can’t be invoked explicitly in the program.
(D) All of these
(15) How many levels of visibility are used to protect a method or variable from such reference
in Java?
(A) 1 (B) 2 (C) 3 (D) 4
(16) From which of the following operators can we access instance variables and instance
methods?
(A) , (Comma) (B) . (Full stop) (C) : (Colon) (D) ; (Semi colon)
(17) In Java class, in which step a new keyword is used to create the object by allocating
memory ?
(A) Declaration (B) Instantiation (C) Initialization (D) All of these
(18) In Java, by which component is the class generally made up of ?
(A) Attributes (B) Behaviour (C) Both (A) and (B) (D) Variable
(19) How do you identify the variable which is define with in a class, out-side any method with
the static key word in Java ?
(A) Local variables (B) Instance variables
(C) Class variables (D) None of these
(20) In Java, which of the following defines attributes and methods?
(A) Class (B) Object (C) Instance (D) Variable
12 (Science) | March – 2015
Page 2
(28) Instance variables and instance methods are accessed via objects. They can be referred by
using which operator?
(A) // (B) dot (.) (C) $ (D) #
(29) Which type of variables are defined within a class but outside any method?
(A) Class variable (B) Empty variable
(C) Local variable (D) Instance variable
(30) In Java, we can have different methods that have the same name but a different signature
is also called as what ?
(A) Method overloading (B) Variable overloading
(C) Class overloading (D) Signature overloading
(31) To provide an user defined no-argument constructors, which of the following command is
used ?
(A) school (float I, float j); (B) school (int i);
(C) school ( ) { }; (D) school { } ( );
(32) Who established a “has – a” relationship between class?
(A) Composition and Aggregation (B) Method and Object
(C) Relation and Method (D) Inheritance and Aggregation
(33) Java have a ..... that looks for unused objects and reclaims the memory that those objects
are using.
(A) reclaim collector (B) unused collector
(C) memory collector (D) garbage collector
(34) The word polymorphism means what?
(A) Many forms (B) Virtual forms (C) One form (D) User forms
(35) Which of the following is syntax of package?
(A) package {Name} (B) package (Name);
(C) package <Package Name>; (D) package [Variable name];
(36) Which of the following is special kind of method that is invoked when a new object is
created?
(A) Common class (B) Super class (C) Composition (D) Constructors
(37) Which are the for P’s used in the four levels of visibility to provide necessary protection?
(A) Process, Private, Protected, Public (B) Public, Package, Protected, Private
(C) Public, Package, Protected, Process (D) Private, Package, Protected, Public
(38) Highest level of protection can be achieved by using which protection level?
(A) Private (B) Public (C) Protected (D) Package
(39) If we wan to follow other methods to read only the data value ..... method can be used.
(A) setter (B) updater (C) reader (D) getter
(40) Who allows us to build new class with added capabilities by extending existing class?
(A) Inheritage (B) Instant (C) Inheritance (D) Instance
12 (General) | March – 2016
(41) In Java, a class is defined using which keyword?
(A) class (B) public (C) static (D) main
(42) Which steps are followed to create an object from a class?
(A) Declaration (B) Instantiation (C) Initialization (D) All of these
(43) In Object oriented programming (OOP) languages what is known for creating an object?
(A) Object Instantiation (B) Object creation
(C) Object Making (D) None of these
Page 3
(44) Variables defined inside methods or blocks are known as which type of variable?
(A) Local variables (B) Instance variables
(C) Class variables (D) Block variables
(45) Which word means “many forms”, different forms of methods with same name in Java?
(A) Inheritance (B) Polymorphism (C) Aggregation (D) Composition
(46) In Java, from the following which visibility modifiers are used to protect a method or
variable from another class ?
(A) Public (B) Package
(C) Protected and Private (D) All of these
(47) In Java class, which operator is used to access instance variable and instance method via
object ?
(A) : (colon) (B) ; (semicolon) (C). (dot) (D) , (comma)
(48) If we want to allow data to be used by others we write which type of method in Java?
(A) getter (B) setter (C) main (D) void
(49) In Java, which type of visibility modifier level of protection is used to allow the access only
to sub classes or to share with the methods declared as “friend” ?
(A) Public (B) Package (C) Protected (D) Private
(50) Highest level of protection can be achieved by using which visibility modifiers protection
level in Java?
(A) Public (B) Package (C) Protected (D) Private
12 (Science) | March – 2016
(51) In Java, which of the following consist of attributes and methods?
(A) Instance (B) Variables (C) Object (D) Class
(52) Which keyword is used to create the object which allocates memory in Java?
(A) new (B) add (C) int (D) create
(53) In Java, what is called to initialize the newly created object?
(A) Classes (B) Reference variable
(C) Syntax variable (D) Constructor
(54) All instances of class allocated memory in data structure in Java and it is known as which
of the following ?
(A) Directory (B) File (C) Heap (D) Buffer
(55) Instance variables and instance methods in Java are accessed via objects and they can be
referred by using which operator?
(A) Arithmetic operator (+) (B) Dot operator (.)
(C) Assignment operator (=) (D) Colon operator (:)
(56) Values of class variables are stored where in Java?
(A) Class (B) File (C) Instance (D) Dir
(57) In Java, variables defined inside methods or blocks are called which variables?
(A) Global variable (B) Instance variable
(C) Class variable (D) Local variable
(58) In Java, different forms of methods with same name is known as which of the following?
(A) Composition (B) Polymorphism (C) Mutators (D) Inheritance
(59) Which access modifiers can be used before the type of variable or method in Java?
(A) Public (B) Protected (C) Private (D) All of these
(60) By using which access modifier, allows access only to subclass or to share with the
methods declared as “friend” in Java ?
(A) Package (B) Protected (C) Private (D) Public
Page 4
(61) In Java, if we want protected data to be modified by others then which methods are to be
written?
(A) Accessor (B) Getter (C) Mutator (D) Both (A) and (B)
(62) In Java, if we want to allow other methods to read only data value, if our program we
should use which method ?
(A) Setter (B) Getter (C) Mutator (D) Both (A) and (B)
(63) In Java, which of the following allows us to build new class with added capabilities by
extending existing class?
(A) Aggregation (B) Polymorphism
(C) Composition (D) Inheritance
(64) Inheritance model consist of which type of relationship between two classes in Java?
(A) is – a (B) has – a (C) have – a (D) was – a
(65) In Java, a sub class inherits all instance variables and methods from which class?
(A) Derived class (B) Instance class (C) Super class (D) Child class
(66) Composition and Aggregation establish which type of relationship between classes in Java?
(A) has - a (B) is – a (C) was – a (D) as – a
(67) In Java, ‘Visibility Modifiers’ – ‘Protected’ members are available as which members in the
inherited subclass?
(A) Object (B) Public (C) Instance (D) Private
(68) In Java, while using inheritance – “Child class” can be referred to as which of the following?
(A) Sub class (B) Derived class (C) Extended class (D) All of these
(69) Which of the following is the keyword used to refer a super class constructor in sub class
constructor?
(A) Name of subclass (B) New
(C) Super (D) Extends
(70) In Java, which variable are defined with in a class, outside any method with static
keyword?
(A) Global variable (B) Class variable
(C) Instance variable (D) Local variable
Page 5