Find Valid Java Keywords

Q1) Find the valid Java keywords?
a) new
b) delete
c) both
d) None of these

 

Ans:- a) new

In Java, we have a “new” keyword to create objects but the “delete” keyword is not there. Because the destruction of the object is the responsibility of garbage collectors, not of programmers.


Q2) Find invalid Java keyword?
a) byte
b) Short
c) int
d) long

Ans:- b) Short; Java keywords doesn’t contain any uppercase letters


Q3) Find Invalid Java keyword?
a) break
b) continue
c) return
d) exit

Ans:- d) exit; Java have exit() method, not a keyword.


Q4) Find an invalid Java keyword?
a) instanceof
b) sizeof
c) strictfp
d) None of these

Ans:- b) sizeof


Q5) Find all invalid Java keywords?
a) throw
b) throws
c) thrown
d) through

Ans:- c) thrown and d) through are invalid Java keywords.


Q6) Which of the following are invalid Java Keywords?
a) final
b) finally
c) finalize
d) None of these

Ans:- c) finalize; it is a method defined in java.lang.Object class.


Q7) Find the valid Java keywords?
1) extend
2) implement
3) imports
4) synchronize
5) None of these

Ans:- 5) None of these. Observe keywords once again.

synchronized is a keyword, not synchronize
extends is a keyword, not extend
implements is a keyword, not implement
import is a keyword, not imports
instanceof is a keyword, not instanceOf
const is a keyword, not constant


Q8) Which of the following is not a Java reserved word?
a) public
b) static
c) void
d) main

Ans:- d) main; It is an identifier having special functionality, but it is not a reserved word.


Q9) Find the valid Java keywords?
a) null
b) true
c) false
d) None of these

Ans:- d) None of these; The null, true, and false are reserved literals, not a keywords. They can’t be used as an identifiers.


Q10) Which of the following keyword is not a data type in Java?
a) int
b) void
c) float
d) boolean

Ans:- b) void; The void keyword is a return type, not a data type.



Q11) Find out valid Java keywords.

  • main
  • String
  • static
  • synchronize
  • sizeof
  • finalize
  • strictf
  • Void
  • instanceOf
  • object
  • Public
  • imported
  • final
  • package
  • enumeration
  • do_while
  • true
  • array
  • null
  • Class
  • protect
  • implement
  • that
  • thrown
  • constant
  • requires
  • require
  • open
  • uses
  • to

Keyword contains only lowercase letters.

Ans:- Among these options, only 3 are valid Java keywords. those are:- static, final, and package


Also Learn,

Leave a Comment

Your email address will not be published. Required fields are marked *