Java Programming: Ultimate Quiz! MCQ

20 Questions | Total Attempts: 55

SettingsSettingsSettings
Please wait...
Java Programming: Ultimate Quiz! MCQ

.


Questions and Answers
  • 1. 
    Which of the following are legal lines of Java code? 1. int w = (int)888.8; 2. byte x = (byte)100L; 3. long y = (byte)100; 4. byte z = (byte)100L;  
    • A. 

      1 and 2

    • B. 

      2 and 3

    • C. 

      3 and 4

    • D. 

      All statements are correct.

  • 2. 
    Which of these values can a boolean variable contain?
    • A. 

      True and False

    • B. 

      0 and 1

    • C. 

      Any Integer value

    • D. 

      True

  • 3. 
    Which of these can be returned by the operator & ?
    • A. 

      Integer

    • B. 

      Boolean

    • C. 

      Character

    • D. 

      Integer or Boolean

  • 4. 
    What is the value stored in x in following lines of code?int x, y, z;x = 0;y = 1;x = y = z = 8;
    • A. 

      0

    • B. 

      1

    • C. 

      9

    • D. 

      8

  • 5. 
    Which of these are selection statements in Java?
    • A. 

      If()

    • B. 

      For()

    • C. 

      Continue

    • D. 

      Break

  • 6. 
    Which of the following is a method having same name as that of its class?
    • A. 

      Finalize

    • B. 

      Constructor

    • C. 

      Class

    • D. 

      Delete

  • 7. 
    On applying Left shift operator, <<, on an integer bits are lost one they are shifted past which position bit?
    • A. 

      1

    • B. 

      31

    • C. 

      32

    • D. 

      33

  • 8. 
    Which of these cannot be declared static?
    • A. 

      Class

    • B. 

      Object

    • C. 

      Variable

    • D. 

      Method

  • 9. 
     A class member declared protected becomes member of subclass of which type?
    • A. 

      Public member

    • B. 

      Private member

    • C. 

      Protected member

    • D. 

      Static member

  • 10. 
    Which of this method of an Object class can clone an object?
    • A. 

      Objectcopy()

    • B. 

      Copy()

    • C. 

      Object clone()

    • D. 

      Clone()

  • 11. 
    Which of this method of class String is used to obtain the length of String object?
    • A. 

      Get()

    • B. 

      Sizeof()

    • C. 

      Lengthof()

    • D. 

      Length()

  • 12. 
    Which of these method of class StringBuffer is used to concatenate the string representation to the end of invoking string?
    • A. 

      Concat()

    • B. 

      Append()

    • C. 

      Join()

    • D. 

      Concatenate()

  • 13. 
    Which of these keywords can be used to prevent Method overriding?
    • A. 

      Static

    • B. 

      Constant

    • C. 

      Protected

    • D. 

      Final

  • 14. 
    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()

  • 15. 
    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.

  • 16. 
    Which of these is an interface for control over serialization and deserialization?
    • A. 

      Serializable

    • B. 

      Externalization

    • C. 

      FileFilter

    • D. 

      ObjectInput

  • 17. 
    Which of these methods is used to compare a specific region inside a string with another the specific region in another string?
    • A. 

      RegionMatch()

    • B. 

      Match()

    • C. 

      RegionMatches()

    • D. 

      RegionMatches()

  • 18. 
    Which of these keywords is not a part of exception handling?
    • A. 

      Try

    • B. 

      Finally

    • C. 

      Thrown

    • D. 

      Catch

  • 19. 
    Which of these is a process of extracting/removing the state of an object from a stream?
    • A. 

      Serialization

    • B. 

      Externalization

    • C. 

      File Filtering

    • D. 

      Deserialization

  • 20. 
    Which of these is a super class of wrappers Double and Float?
    • A. 

      Long

    • B. 

      Digits

    • C. 

      Float

    • D. 

      Number

Back to Top Back to top