Que- Which of these packages contains abstract keyword?
a. java.lang
b. java.util
c. java.io
d. java.system
Answer- java.lang
Que- Which of this keyword must be used to inherit a class?
a. super
b. this
c. extent
d. extends
Answer- extends
Que- A class member declared protected becomes a member of subclass of which type?
a. public member
b. private member
c. protected member
d. static member
Answer- private member
Que- 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 {}
Answer- class B extends A {}
Que- What is not type of inheritance?
a. Single inheritance
b. Double inheritance
c. Hierarchical inheritance
d. Multiple inheritance
Answer- Double inheritance
Que- Using which of the following, multiple inheritance in Java can be implemented?
a. Interfaces
b. Multithreading
c. Protected methods
d. Private methods
Answer- Interfaces
Que- All classes in Java are inherited from which class?
a. java.lang.class
b. java.class.inherited
c. java.class.object
d. java.lang.Object
Answer- java.lang.Object
Que- In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?
a. Protected
b. Private
c. Public
d. Static
Answer- Private
Que- If super class and subclass have same variable name, which keyword should be used to use super class?
a. super
b. this
c. upper
d. classname
Answer- super
Que- Static members are not inherited to subclass.
a.TRUE
b.FALSE
c.Nothing Can be Said
d.None of the mentioned
Answer-FALSE
Que- Which of the following is used for implementing inheritance through an interface?
a. inherited
b. using
c. extends
d. implements
Answer- implements
Que- Which of the following is used for implementing inheritance through class?
a. inherited
b. using
c. extends
d. implements
Answer- extends
Que- What would be the result if a class extends two interfaces and both have a method with same name and signature? Lets assume that the class is not implementing that method.
a. Runtime error
b. Compile time error
c. Code runs successfully
d. First called method is executed successfully
Answer- Compile time error
Que- Which of these class is superclass of String and StringBuffer class?
a. java.util
b. java.lang
c. ArrayList
d. None of the mentioned
Answer- java.lang
Que- Which of this method of class String is used to obtain a length of String object?
a. get()
b. Sizeof()
c. lengthof()
d. length()
Answer- length()
Que- 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()
Answer- charAt()
Que- Which of these constructors is used to create an empty String object?
a. String()
b. String(void)
c. String(0)
d. None of the mentioned
Answer- String()
Que- Which of these is an incorrect statement?
a. String objects are immutable, they cannot be changed
b. String object can point to some other reference of String variable
c. StringBuffer class is used to store string in a buffer for later use
d. None of the mentioned
Answer- StringBuffer class is used to store string in a buffer for later use
Que- Which of these method of class String is used to extract more than one character at a time a String object?
a. getchars()
b. GetChars()
c. Getchars()
d. getChars()
Answer- getChars()
Que- Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?
a. getBytes()
b. GetByte()
c. giveByte()
d. Give Bytes()
Answer- getBytes()