Java Quiz
 
1. The following code will allow the program to obtain a name from the keyboard String name = Console.readLine("Enter name);

[a] true [b] false

2. The method length( ) will return an integer which represents the length of a string value.

[a] true [b] false

3. The name of a variable is known as its:

[a] identifier [b] constant [c] data type [d] base

4. All variables must be declared before they can be used.

[a] true [b] false

5. All strings end with a null zero inside memory.

[a] true [b] false

6. Variable names may begin with a number.

[a] true [b] false

7. The Console commands require that BreezyGUI be imported.

[a] true [b] false

8. In Java, 5/2 =

[a] 2 [b] 2.5 [c] 3 [d] none of the above

9. In Java, the % refers to

  [a] percentages [b] modulus operator [c] division [d] data storage

10. The method toLowerCase( ) changes all lowercase letters to uppercase and all uppercase letters to lowercase. [a] true [b] false

11. Variables that describe the data stored at that particular memory location are called [a] identifiers [b] constant variables [c] floating point variables [d] mnemonic variables

12. Array indexing always starts with the number

[a] 0 [b] 1 [c] 2 [d] /0

13. The following statement is valid double price = 7,450.98;

[a] true [b] false

14. In Java, 12%5 =

[a] 1 [b] 2 [c] 3 [d] 4

15. The method indexOf(",") will allow you to search for the location of a comma.

  [a] true [b] false

16. Mathematicians and computers interpret the equal sign (=) in the same way.

[a] true [b] false

17. A character variable may contain up to seven letters.

[a] true [b] false

18. When a data type must contain decimal numbers, assign the type

[a] int [b] char [c] double [d] long int

19. Variables that are declared, but not initialized, contain

[a] blank spaces

[b] zeros

[c] "garbage" values

[d] nothing - they are empty

 

20. A variable is given a value through

[a] osmosis

[b] as assignment statement

  [c] the import statements

[d] the public class declarations


(c) Shilpa Sayura Foundation 2006-2017