22412 JAVA PROGRAMMING MCQ QB 2
Unit 2: Derived Syntactical Construct in Java
4th SEM ALL SUBJECT MCQ: click here
1. Range of short variable is ______________
a) -128 to 128
b) -128 to 127
c) -32768 to 32767
d) -32768 to 32768
2 _______________ is the default access specifier in JAVA.
a)friendly
b) private
c) protected
d) public
3 __________ variables and methods can be called without using the objects.
a)static
b) final
c)abstract
d) none of the above
4 Which of the following statements is true?
a)Java supports operator overloading
b) Java supports interfaces
c) Java supports pointers
d) Java supports multiple inheritances
5 What keyword is used in Java to define a constant?
a) static
b) final
c) abstract
d) private
6 If two methods have the same name but a different parameter list then it is
called___________
a) Method overriding
b) Method overloading
c)Operator overloading
d) None of these
7 ______________ constructor is created when an object of a particular class is created.
a)Default
b) Parameterized
c)Copy
d) None of these
8 _______________ inheritance is not supported by JAVA.
a)Multiple
b) Multi level
c)Hierarchical
d) Hybrid
9 The mechanism of deriving a new class from an old one is called ______________.
a)Method overriding
b) Method overloading
c)Operator overloading
d) Inheritance
10 ________ keyword does not allow a method to be overridden in the subclass.
a)public
b) abstract
c)final
d) static
11 ________ methods must be overridden in the subclass.
a)public
b) final
c)abstract
d) static
12 The subclass constructor uses the ________ keyword to invoke the constructor of the
superclass.
a)super
b) Final
c)static
d) public
13 __________ is a special method in java that enables an object to initialize itself when
it is created.
a)constructor
b) destructor
c)static
d) final
14 ________ defines only abstract methods and final fields.
a)Interface
b) Final class
c)Abstract class
d) Class
15 __________ keyword is used to inherit a class.
a)extend
b) extends
c)implement
d) implements
16 We cannot create a subclass of _________ class.
a)Abstract
b) public
c)static
d) final
Answers of MCQ:
1. (c), 2. (a), 3. (a), 4. (b), 5. (b), 6. (a), 7. (a), 8. (a), 9. (d), 10. (c), 11. (c), 12. (a),
13. (a), 14. (a), 15. (b), 16. (d)
17. Which of the following declaration of the array contains the error?
A) int x[ ]= int[10];
B) int [ ] y=new int[5];
C) float d[ ]= {1,2,3};
D) int a[ ] = {1, 2,3; int b[ ]; b=a;
18. There is a companion class to string called ………………….., whose objects contain strings that can be modified after they are created.
A) stringBuffer
B) stringClass
C) toString( )
D) stringChar
19. Which of the following classes are available in the java.lang package?
i) Stack ii) Object
iii) Math iv) Random
A) i and ii only
B) ii and iii only
C) ii and iv only
D) i and iv only
20. Consider the following code,
string s=new String(); will create an instance of string with
A) at least one character
B) a default character
C) no characters in it
D) number of characters in it
21. …………………. returns a sting that contains the human-readable equivalent of the value with which it is called.
A) toValue()
B) value()
C) valueOf()
D) getValue()
22. The…………………… method simply returns a string that appropriately describes an object of your class.
A) getChars()
B) toString()
C) toCharArray()
D) getString()
Download MCQ PDFHappy Learning!
My commentπππ
ReplyDeleteExcellent π
ReplyDeleteBest
ReplyDelete