Deck 2: Java Object-Oriented Programming

Full screen (f)
exit full mode
Question
Which of the following is a valid declaration of an object of class Box?

A)Box obj = new Box();
B)Box obj = new Box;
C)obj = new Box();
D)new Box obj;
Use Space or
up arrow
down arrow
to flip the card.
Question
Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class.

A)static
B)final
C)abstract
D)public
Question
Variables declared with in a class are called

A)Identifier
B)local variable
C)instance variable
D)global variable
Question
Variables declared within a method or block are called

A)Static variable
B)local variable
C)instance variable
D)global variable
Question
Defining methods with same name and different no. of parameters are called

A)Method overriding
B)method overloading
C)Dynamic method dispatch
D)none of the above
Question
_________ is used to initialize objects.

A)Methods
B)arguments
C)constructors
D)new keyword
Question
Which of the following is a method having same name as that of its class?

A)finalize
B)delete
C)class
D)constructor
Question
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?

A)delete
B)free
C)new
D)None of the mentione
Question
Which of these access specifiers must be used for main() method?

A)private
B)public
C)protected
D)None of the mentioned
Question
Which of these is used to access member of class before object of that class is created?

A)public
B)private
C)static
D)protected
Question
The keyword used to create an object

A)class
B)this
C)new
D)malloc
Question
The keyword used to refer the current object

A)class
B)this
C)new
D)malloc
Question
The method which is automatically invoked during garbage collection.

A)destructor
B)terminate()
C)finalize()
D)destroy()
Question
Which class cannot have a subclass in java

A)abstract class
B)parent class
C)final class
D)None of above
Question
Which is the keyword used to inherit a class to another?

A)Inherits
B)extends
C)implements
D)import
Question
The use of final keyword with method definition

A)Supports method overriding
B)implements dynamic method dispatch
C)Prevents method overriding
D)none of these
Question
Identify the type of inheritance when two or more subclasses inherit the properties of a super class.

A)Multiple inheritance
B)Single inheritance
C)Multilevel inheritance
D)Hierarchical inheritance
Question
The keyword used inside a class to refer to its immediate super class is

A)super
B)parent
C)base
D)none of these
Question
Which of the following is true in the case of abstract class

A)Abstract constructors cannot be created.
B)Abstract classes can not be inherited.
C)An abstract class contains only abstract methods.
D)All of the above.
Question
Which of these keywords are used to define an abstract class?

A)abst
B)abstract
C)Abstract
D)abstract class
Question
If a class inheriting an abstract class does not define all of its function then it will be known as?

A)abstract
B)A simple class
C)Static class
D)None of the mentioned
Question
Which of these is not a correct statement?

A)Every class containing abstract method must be declared abstract.
B)Abstract class defines only the structure of the class not its implementation.
C)Abstract class can be initiated by new operator.
D)Abstract class can be inherited.
Question
Which method defined in Integer class can be used to convert a whole number in string type to primitive int type.

A)valueOf()
B)intValue()
C)parseInt()
D)getInteger()
Question
The method sqrt() is defined in the class

A)System
B)Root
C)Math
D)Arithmetic
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/24
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 2: Java Object-Oriented Programming
1
Which of the following is a valid declaration of an object of class Box?

A)Box obj = new Box();
B)Box obj = new Box;
C)obj = new Box();
D)new Box obj;
Box obj = new Box();
2
Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class.

A)static
B)final
C)abstract
D)public
static
3
Variables declared with in a class are called

A)Identifier
B)local variable
C)instance variable
D)global variable
instance variable
4
Variables declared within a method or block are called

A)Static variable
B)local variable
C)instance variable
D)global variable
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
5
Defining methods with same name and different no. of parameters are called

A)Method overriding
B)method overloading
C)Dynamic method dispatch
D)none of the above
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
6
_________ is used to initialize objects.

A)Methods
B)arguments
C)constructors
D)new keyword
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following is a method having same name as that of its class?

A)finalize
B)delete
C)class
D)constructor
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
8
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?

A)delete
B)free
C)new
D)None of the mentione
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
9
Which of these access specifiers must be used for main() method?

A)private
B)public
C)protected
D)None of the mentioned
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
10
Which of these is used to access member of class before object of that class is created?

A)public
B)private
C)static
D)protected
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
11
The keyword used to create an object

A)class
B)this
C)new
D)malloc
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
12
The keyword used to refer the current object

A)class
B)this
C)new
D)malloc
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
13
The method which is automatically invoked during garbage collection.

A)destructor
B)terminate()
C)finalize()
D)destroy()
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
14
Which class cannot have a subclass in java

A)abstract class
B)parent class
C)final class
D)None of above
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
15
Which is the keyword used to inherit a class to another?

A)Inherits
B)extends
C)implements
D)import
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
16
The use of final keyword with method definition

A)Supports method overriding
B)implements dynamic method dispatch
C)Prevents method overriding
D)none of these
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
17
Identify the type of inheritance when two or more subclasses inherit the properties of a super class.

A)Multiple inheritance
B)Single inheritance
C)Multilevel inheritance
D)Hierarchical inheritance
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
18
The keyword used inside a class to refer to its immediate super class is

A)super
B)parent
C)base
D)none of these
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
19
Which of the following is true in the case of abstract class

A)Abstract constructors cannot be created.
B)Abstract classes can not be inherited.
C)An abstract class contains only abstract methods.
D)All of the above.
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
20
Which of these keywords are used to define an abstract class?

A)abst
B)abstract
C)Abstract
D)abstract class
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
21
If a class inheriting an abstract class does not define all of its function then it will be known as?

A)abstract
B)A simple class
C)Static class
D)None of the mentioned
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
22
Which of these is not a correct statement?

A)Every class containing abstract method must be declared abstract.
B)Abstract class defines only the structure of the class not its implementation.
C)Abstract class can be initiated by new operator.
D)Abstract class can be inherited.
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
23
Which method defined in Integer class can be used to convert a whole number in string type to primitive int type.

A)valueOf()
B)intValue()
C)parseInt()
D)getInteger()
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
24
The method sqrt() is defined in the class

A)System
B)Root
C)Math
D)Arithmetic
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 24 flashcards in this deck.