Top 20 Java Programming MCQ’s Questions and Answers
By Team Alpha | General knowledge | Jun 12, 2019
- What is the range of short data type in Java?
- -32768 to 32767
- -128 to 127
- -2147483648 to 2147483647
- None of the mentioned Ans a.( -32768 to 32767)
- Which of these literals can be contained in float data type variable?
- +1.7e+308
- -1.7e+308
- -3.4e+050
- -3.4e+038 Ans d.( -3.4e+038)
- Which data type value is returned by all transcendental math functions?
- double
- int
- long
- float Ans a.( double)
- Decrement operator, −−, decreases value of variable by what number?
- 4
- 2
- 3
- 1 Ans d.( 1)
- Can 8 byte long data type be automatically type cast to 4 byte float data type?
- True
- False Ans a.(True)
- Which of these is not a bitwise operator?
- |=
- <=
- &
- <&= Ans b.(<=)
- Which operator is used to invert all the digits in binary representation of a number?
- <<<
- >>>
- ~
- ^ Ans c.(~)
- Which right shift operator preserves the sign of the value?
- >>
- <<
- >>=
- <<= Ans a.(>>)
- What is the output of relational operators?
- Characters
- Double
- Boolean
- Integer Ans c.( Boolean)
- Is SimpleDateFormat thread safe?
- True
- False Ans b.(False)
- How is Date stored in database?
- sql.DateTime
- util.DateTime
- sql.Date
- util.Date Ans c.( java.sql.Date)
- What does LocalTime represent?
- Time without Date
- Date and Time
- Date and Time with timezone
- Date without time Ans a.( Time without Date)
- How to get UTC time?
- getUTC();
- now();
- getUTC();
- getUTC(); Ans b.( Instant.now();)
- toRadian() and toDegree() methods were added by which version of Java?
- Java 1.5
- Java 3.0
- Java 2.0
- Java 1.0 Ans c.(Java 2.0)
- Which of these keywords are used to define an abstract class?
- abstract class
- Abstract
- abstract
- abst Ans c.( abstract)
- Which of these is not abstract?
- AbstractList
- Thread
- List
- None of the Mentioned Ans b.(Thread)
- Which of these packages contains abstract keyword?
- system
- io
- util
- lang Ans d.( java.lang)
- Which of these keyword can be used in subclass to call the constructor of superclass?
- extends
- extent
- this
- super Ans d.( super)
- Which of these keywords can be used to prevent Method overriding?
- protected
- constant
- static
- final Ans d.( final)
- Which of these is supported by method overriding in Java?
- Encapsulation
- Abstraction
- Polymorphism
- None of the mentioned Ans c.( Polymorphism)