0% found this document useful (0 votes)
17 views

Java Programming MCQ Qb2

Uploaded by

kush6191
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Java Programming MCQ Qb2

Uploaded by

kush6191
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

22412 JAVA PROGRAMMING MCQ QB

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 inheritance

5 What keyword is used in Java to define a constant?


a) static
b) final
c) abstract
d) private
6 If two methods have same name but 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. …………………… method simply return a string that appropriately describes an


object of your class.

A) getChars()

B) toString()

C) toCharArray()

D) getString()

Happy Learning!

You might also like