Java True False questions | True-False questions Java

1. James Gosling is father of Java.

a. True

b. False

2. Java programming language was invented by Dennis Ritchie.

a. True

b. False

3. Java was developed by Sun MicroSystem.

a. True

b. False

4. Java is considered a low-level programming language.

a. True

b. False

5. Java is a case-sensitive language.

a. True

b. False

6. Java is a pure object-Oriented programming language.

a. True

b. False

7. Java is a platform independent language.

a. True

b. False

8. Java is not a case-sensitive language.

a. True

b. False

9. JDK stands for Java Development Kit.

a. True

b. False

10. Full form of JVM is Java Virtual Machine.

a. True

b. False

11. A class is an instance of its object.

a. True

b. False

12. In object-oriented programming, a class is a data type and an object is an instance of such type.

a. True

b. False

13. Garbage collection is manual process

a. True

b. False

14. Java programs are compiled into bytecode.

a. True

b. False

15. Java bytecode is machine-specific code.

a. True

b. False

16. The extension of a Java source code file is .java

a. True

b. False

17. A .class file contains bytecodes.

a. True

b. False

18. The JVM (Java virtual machine) interprets Java bytecode at run time.

a. True

b. False

19. Every statement in Java ends with a semicolon.

a. True

b. False

20. It is OK to have the Java source code file named differently from the public class name.

a. True

b. False

21. The “main” method is optional for Java Programs.

a. True

b. False

22. Variable name can begin with a letter, “$”, or “_”

a. True

b. False

23. Java programming is not statically typed, means all variables should not first be declared before they can be used

a.    True

b.   False

24. User can’t create objects in java programming

a. True

b. False

25. In your Java program, you can use reserved words as variable names.

a. True

b. False

26. We can’t declare variables in java code blocks.

a. True

b. False

27. Java supports implicit declarations of data types

a. True

b. False

28. Java supports explicit declarations of variables

a. True

b. False

29. Assignment operator is evaluated Left to Right.

a. True

b. False

30. All binary operators except for the assignment operators are evaluated from Left to Right.

a. True

b. False

31. The operator = is used for assignment and initialization but not to test for equality.

a. True

b. False

32. The == operator can be used to compare two String objects. The result is always true if the two strings are identical.

a.    True

b.   False

33. Whenever the “&&” operator is used, such as in:

exp1 && exp2

where exp1 and exp2 are Boolean expressions, both the Boolean expressions are not always evaluated

a. True

b. False

34. Consider the statement “x = (a > b) ? a : b”; then the value of x is 27, if a = 18 and b = 27.

a.    True

b.   False

35. Java program processing always starts with main() method.

a.    True

b.   False

36. Using “System.out.println()” we display the output for java programs.

a. True

b. False

37. Scanner class in Java is used to take input from the user.

a. True

b. False

38. nextInt() is a Scanner method for inputting an integer value.

a. True

b. False

39. Else part is mandatory for if condition blocks in Java.

a. True

b. False

40. The “switch” selection structure must end with the default case.

a. True

b. False

41. A break statement must always be present in the default case of a “switch” selection structure.

a. True

b. False

42. A loop is a control structure used for repetition of certain statements.

a. True

b. False

43. Loop statements are used for code repetition in java programs.

a. True

b. False

44. Variables declared inside  a for loop are limited in scope  to the loop.

a. True

b. False

45.  The statements in the body of a do…while loop execute at least once.
a.  True
b.   False

46. Using the continue keyword stops executing the current loop iteration and proceeds to the next loop iteration.

a. True

b. False

47. An array in the Java programming language has the ability to store many different types of values.

a. True

b. False

48. int x[]=new int[]{10,20,30};

Array can also be created and initialize as in above statement.

  1. True
  2. False

49.  We can write condition and loop blocks in Java methods.

a.    True

b.   False 

50.  We declare/write methods outside of the main method in java programs.

a.    True

b.   False 

Leave a Comment