Java Questions & Answers – Assignment Operators and Operator Precedence

This section of our 1000+ Java MCQs focuses on assignment operators and operator precedence in Java Programming Language. 1. Which of these have highest precedence? a) () b) ++ c) * d) >> 2. What should be expression1 evaluate to in using ternary operator as in this line? expression1 ? expression2 : expression3 a) Integer … Read more

advertisement

Java Questions & Answers – Relational Operators and Boolean Logic Operators

This section of our 1000+ Java MCQs focuses on relational operators and boolean logic operators of Java Programming Language. 1. What is the output of relational operators? a) Integer b) Boolean c) Characters d) Double 2. Which of these is returned by “greater than”, “less than” and “equal to” operators? a) Integers b) Floating – … Read more

advertisement

Java Questions & Answers – Bitwise Operators

This section of our 1000+ Java MCQs focuses on Bitwise operators of Java Programming Language. 1. Which of these is not a bitwise operator? a) & b) &= c) |= d) <= 2. Which operator is used to invert all the digits in a binary representation of a number? a) ~ b) <<< c) >>> … Read more

advertisement

Java Questions & Answers – Arithmetic Operators

This section of our 1000+ Java MCQs focuses on Arithmetic Operators of Java Programming Language. 1. Which of the following can be operands of arithmetic operators? a) Numeric b) Boolean c) Characters d) Both Numeric & Characters 2. Modulus operator, %, can be applied to which of these? a) Integers b) Floating – point numbers … Read more

advertisement

Java Questions & Answers – Data Structures-Arrays

This set of Tricky Java Questions and Answers focuses on “Data Structures-Arrays”. 1. What is the type of variable ‘b’ and ‘d’ in the following Java snippet? int a[], b; int []c, d; a) ‘b’ and ‘d’ are int b) ‘b’ and ‘d’ are arrays of type int c) ‘b’ is int variable; ‘d’ is … Read more

advertisement

Java MCQ – Array

This section of our 1000+ Java MCQs focuses on “Array” 1. Which of these operators is used to allocate memory to array variable in Java? a) malloc b) alloc c) new d) new malloc 2. Which of these is an incorrect array declaration? a) int arr[] = new int[5] b) int [] arr = new … Read more

advertisement

Java Questions & Answers – Type Conversions, Promotions and Castings

This section of our 1000+ Java MCQs focuses on Type conversions, promotions and castings of Java Programming Language. 1. Which of these is necessary condition for automatic type conversion in Java? a) The destination type is smaller than source type b) The destination type is larger than source type c) The destination type can be … Read more

advertisement

Java Questions & Answers – Literals & Variables

This section of our 1000+ Java MCQs focuses on literals & variables of Java Programming Language. 1. Which of these is long data type literal? a) 0x99fffL b) ABCDEFG c) 0x99fffa d) 99671246 2. Which of these can be returned by the operator &? a) Integer b) Boolean c) Character d) Integer or Boolean 3. … Read more

advertisement

Java Questions & Answers – Data Type-Date, TimeZone

This set of Java Multiple Choice Questions & Answers (MCQs) focuses on “Data Type – Date and TimeZone”. 1. How to format date from one form to another? a) SimpleDateFormat b) DateFormat c) SimpleFormat d) DateConverter 2. How to convert Date object to String? a) SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-mm-dd”); sdf.parse(new Date()); b) SimpleDateFormat sdf … Read more

advertisement

Java Questions & Answers – Data Type-BigDecimal

This set of Tough Java Questions and Answers focuses on “Data Type-BigDecimal”. 1. Which of the following is the advantage of BigDecimal over double? a) Syntax b) Memory usage c) Garbage creation d) Precision 2. Which of the below data type doesn’t support overloaded methods for +,-,* and /? a) int b) float c) double … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.