Sail E0 Webinar

MCQs

Total Questions : 12 | Page 1 of 2 pages
Question 1. What is the range of data type short in Java?
  1.    -128 to 127
  2.    -32768 to 32767
  3.    -2147483648 to 2147483647
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> -32768 to 32767


Short occupies 16 bits in memory. Its range is from -32768 to 32767.


Question 2. What is the range of data type byte in Java?
  1.    -128 to 127
  2.    -32768 to 32767
  3.    -2147483648 to 2147483647
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> -128 to 127


Byte occupies 8 bits in memory. Its range is from -128 to 127.


Question 3. Which data type value is returned by all transcendental math functions?
  1.    int
  2.    float
  3.    double
  4.    long
 Discuss Question
Answer: Option C. -> double


double


Question 4. An expression involving byte, int, and literal numbers is promoted to which of these?
  1.    int
  2.    long
  3.    byte
  4.    float
 Discuss Question
Answer: Option A. -> int


An expression involving bytes, ints, shorts, literal numbers, the entire expression is promoted to int before any calculation is done.


Question 5. Which of these literals can be contained in a data type float variable?
  1.    1.7e-308
  2.    3.4e-038
  3.    1.7e+308
  4.    3.4e-050
 Discuss Question
Answer: Option B. -> 3.4e-038


Range of data type float is 3.4e-038 to 3.4e+308.


Question 6. Which of these coding types is used for data type characters in Java?
  1.    ASCII
  2.    ISO-LATIN-1
  3.    UNICODE
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> UNICODE


Unicode defines fully international character set that can represent all the characters found in all human languages. Its range is from 0 to 65536.


Question 7. What is the numerical range of a char in Java?
  1.    -128 to 127
  2.    0 to 256
  3.    0 to 32767
  4.    0 to 65535
 Discuss Question
Answer: Option D. -> 0 to 65535


Char occupies 16-bit in memory, so it supports 2^16 i:e from 0 to 65535.


Question 8. Which of these occupy first 0 to 127 in Unicode character set used for characters in Java?
  1.    ASCII
  2.    ISO-LATIN-1
  3.    None of the mentioned
  4.    Both a & b
 Discuss Question
Answer: Option D. -> Both a & b


First 0 to 127 character set in Unicode are same as those of ISO-LAIN-1 and ASCII.


Question 9. Which of these values can a boolean variable contain?
  1.    True & False
  2.    0 & 1
  3.    Any integer value.
  4.    Both a & b
 Discuss Question
Answer: Option A. -> True & False


Boolean variable can contain only one of two possible values, true and false.


Question 10. Which one is a valid declaration of a boolean?
  1.    boolean b1 = 1;
  2.    boolean b2 = 'false';
  3.    boolean b3 = false;
  4.    boolean b4 = 'true'
 Discuss Question
Answer: Option C. -> boolean b3 = false;


Boolean can only be assigned true or false literals.


Latest Videos

Latest Test Papers