DEV Community

Abishek
Abishek

Posted on • Edited on

Today session

  1. What is the range of short data type in Java?
    a) -128 to 127
    b) -32768 to 32767
    c) -2147483648 to 2147483647
    d) None of the mentioned

  2. What is the range of byte data type in Java?
    a) -128 to 127
    b) -32768 to 32767
    c) -2147483648 to 2147483647
    d) None of the mentioned

  3. 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

  1. Which of the following is not true about Java?
    a) Object oriented language
    b) High level language
    c) 4th generation language
    d) Computer language

  2. Which of these coding types is used for data type characters in Java?
    a) ASCII
    b) ISO-LATIN-1
    c) UNICODE
    d) None of the mentioned

  3. What is the default value of boolean literal?
    a) true
    b) 1
    c) 0
    d) false

  4. Which of these occupy first 0 to 127 in Unicode character set used for characters in Java?
    a) ASCII
    b) ISO-LATIN-1
    c) None of the mentioned
    d) ASCII and ISO-LATIN1

  5. Which one is a valid declaration of a boolean?
    a) boolean b1 = 1;
    b) boolean b2 = ‘false’;
    c) boolean b3 = false;
    d) boolean b4 = ‘true’;

  6. Which of these is long data type literal?
    a) 9967124623
    b) ABCDEFG
    c) abcdefg
    d) 9967124623L

  7. Which of these can be returned by the operator &&?
    a) Integer
    b) Boolean
    c) Character
    d) String

  8. Long literal should be suffixed with ?
    a) L or l
    b) F or f
    c) D or d
    d) I or i

  9. Floating point literal should be suffixed with?
    a) L or l
    b) F or f
    c) D or d
    d) I or i

  10. Which of these cannot be used for a variable name in Java?
    a) identifier
    b) keyword
    c) identifier & keyword
    d) none of the mentioned

  11. JDK is platform dependent ?
    a) true
    b) false

  12. JRM is inside JVM ?
    a) true
    b) false

  13. Java is case in-sensitive language ?
    a) true
    b) false

  14. Python is derived from java ?
    a) true
    b) false

  15. Java is 25 times faster than Python in 1995 ?
    a) true
    b) false

19.Java is derived from C++ ?
a) true
b) false

  1. What is type conversions in Java ? a) Both type casting and type promotion b) Type casting only c) Type promotion only d) None of the above

Match the following

  1. James Gosling - a) Write Once Run Anywhere
  2. Cup and saucer - b) 23-May-1995
  3. Java slogan - c) Father of Java
  4. Java DOB - d) Oracle
  5. Java current owner - e) Symbol of Java

this are the questions we had answer
Answers:

  1. Range of short? → b) -32768 to 32767
  2. Range of byte? → a) -128 to 127
  3. Legal lines? → d) All statements are correct
  4. Not true about Java? → c) 4th generation language
  5. Character coding? → c) UNICODE
  6. Default boolean? → d) false
  7. 0–127 Unicode? → a) ASCII
  8. Valid boolean? → c) boolean b3 = false;
  9. Long literal? → d) 9967124623L
  10. && returns? → b) Boolean
  11. Long suffix? → a) L or l
  12. Float suffix? → b) F or f
  13. Invalid variable name? → b) keyword
  14. JDK platform dependent? → a) true
  15. JRE inside JVM? → a) true
  16. Java case-insensitive? → b) false
  17. Python from Java? → b) false
  18. Java 25× faster than Python (1995)? → b) false
  19. Java derived from C++? → b) false
  20. Type conversions? → a) Both casting & promotion

Match the following:

  1. James Gosling → c) Father of Java
  2. Cup & saucer → e) Symbol of Java
  3. Java slogan → a) Write Once Run Anywhere
  4. Java DOB → b) 23-May-1995
  5. Java owner → d) Oracle

After the test

  • we learn about typecasting their are two type in typecasting

1.widening casting (smaller type to larger type size)

  • Widening casting is done automatically when passing a smaller size type to a larger size type

2.narrowing casting (larger type to smaller tupe size)

  • Narrowing casting must be done manually by placing the type in parentheses () in front of the value

signing off!!

Top comments (0)