Deck 3: Java Programming: Data Types, Inheritance, Interfaces, Packages, and Exception Handling
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/25
Play
Full screen (f)
Deck 3: Java Programming: Data Types, Inheritance, Interfaces, Packages, and Exception Handling
1
A primitive data type can be passed as an argument into a method
A)By value
B)by reference
C)both a & b
D)none of these
A)By value
B)by reference
C)both a & b
D)none of these
By value
2
Which of these is used as default for a member of a class if no access specifier is used for it?
A)private
B)public
C)public, within its own package
D)protected
A)private
B)public
C)public, within its own package
D)protected
public, within its own package
3
Which of these keywords is used to refer to member of base class from a sub class?
A)upper
B)super
C)this
D)None of the mentioned
A)upper
B)super
C)this
D)None of the mentioned
super
4
Which of these is correct way of inheriting class A by class B?
A)class B + class A {}
B)class B inherits class A {}
C)class B extends A {}
D)class B extends class A {}
A)class B + class A {}
B)class B inherits class A {}
C)class B extends A {}
D)class B extends class A {}
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following are true about interfaces.
A)Methods declared in interfaces are implicitly private.
B)Variables declared in interfaces are implicitly public, static, and final.
C)An interface contains any number of method definitions.
D)The keyword implements indicate that an interface inherits from another.
A)Methods declared in interfaces are implicitly private.
B)Variables declared in interfaces are implicitly public, static, and final.
C)An interface contains any number of method definitions.
D)The keyword implements indicate that an interface inherits from another.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
6
Which of these keywords is used to define interfaces in Java?
A)interface
B)Interface
C)intf
D)implements
A)interface
B)Interface
C)intf
D)implements
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
7
Which of these can be used to fully abstract a class from its implementation?
A)Objects
B)Packages
C)Interfaces
D)None of the Mentione
A)Objects
B)Packages
C)Interfaces
D)None of the Mentione
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
8
Which of these access specifiers can be used for an interface?
A)Public
B)Protected
C)private
D)All of the mentioned
A)Public
B)Protected
C)private
D)All of the mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
9
Which of these keywords is used by a class to use an interface defined previously?
A)import
B)Import
C)implements
D)Implements
A)import
B)Import
C)implements
D)Implements
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following is correct way of implementing an interface salary by class manager?
A)class Manager extends salary {}
B)class Manager implements salary {}
C)class Manager imports salary {}
D)None of the mentioned
A)class Manager extends salary {}
B)class Manager implements salary {}
C)class Manager imports salary {}
D)None of the mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
11
The keyword used to create a package is
A)import
B)package
C)classpath
D)public
A)import
B)package
C)classpath
D)public
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
12
The modifier which specifies that the member can only be accessed in its own class is
A)public
B)private
C)protected
D)None of above
A)public
B)private
C)protected
D)None of above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following package stores all the standard java classes?
A)lang
B)java
C)util
D)java.packages
A)lang
B)java
C)util
D)java.packages
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
14
Which of these is a mechanism for naming and visibility control of a class and its content?
A)Object
B)Packages
C)Interfaces
D)None of the Mentioned
A)Object
B)Packages
C)Interfaces
D)None of the Mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
15
Which of this access specifies can be used for a class so that its objects can be created by a different class in another package?
A)Public
B)Protected
C)No Modifier
D)All of the mentioned
A)Public
B)Protected
C)No Modifier
D)All of the mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following is correct way of importing an entire package 'pkg'?
A)import pkg.
B)Import pkg.
C)import pkg.*
D)Import pkg.*
A)import pkg.
B)Import pkg.
C)import pkg.*
D)Import pkg.*
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the following is incorrect statement about packages?
A)Package defines a namespace in which classes are stored.
B)A package can contain other package within it.
C)Java uses file system directories to store packages.
D)A package can be renamed without renaming the directory in which the classes are stored.
A)Package defines a namespace in which classes are stored.
B)A package can contain other package within it.
C)Java uses file system directories to store packages.
D)A package can be renamed without renaming the directory in which the classes are stored.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
18
Which of these method of class String is used to extract a single character from a String object?
A)CHARAT()
B)chatat()
C)charAt()
D)ChatAt()
A)CHARAT()
B)chatat()
C)charAt()
D)ChatAt()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
19
Which of these method of class String is used to obtain length of String object?
A)get()
B)Sizeof()
C)lengthof()
D)length()
A)get()
B)Sizeof()
C)lengthof()
D)length()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
20
Which of these keywords is not a part of exception handling?
A)try
B)finally
C)thrown
D)catch
A)try
B)finally
C)thrown
D)catch
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
21
The code within the ----------- block will always be executed whether or not an exception is thrown.
A)try..catch
B)finally
C)throw
D)throws
A)try..catch
B)finally
C)throw
D)throws
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
22
Which of these keywords must be used to monitor for exceptions?
A)try..catch
B)finally
C)throw
D)throws
A)try..catch
B)finally
C)throw
D)throws
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
23
Which of these keywords is used to manually throw an exception?
A)try
B)finally
C)throw
D)catch
A)try
B)finally
C)throw
D)catch
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
24
Which of these classes is related to all the exceptions that can be caught by using catch?
A)Error
B)Exception
C)None of these
D)a & b
A)Error
B)Exception
C)None of these
D)a & b
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
25
Which of these classes is related to all the exceptions that cannot be caught?
A)Error
B)Exception
C)None of these
D)a & b
A)Error
B)Exception
C)None of these
D)a & b
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck