Questions from Starting Out With Java


Q: 1. What will the println statement in the following program segment

1. What will the println statement in the following program segment display? int x = 5; System.out.println(x++); 1. 5 2. 6 3. 0 4. None of these 2. What will the println statement in the following pr...

See Answer

Q: 11. This expression is executed by the for loop only once

11. This expression is executed by the for loop only once, regardless of the number of iterations. 1. initialization expression 2. test expression 3. update expression 4. pre-increment expression 12....

See Answer

Q: 21. True or False: The for loop is a posttest

21. True or False: The for loop is a posttest loop. 22. True or False: It is not necessary to initialize accumulator variables. 23. True or False: One limitation of the for loop is that only one var...

See Answer

Q: 1. This type of method does not return a value.

1. This type of method does not return a value. 1. null 2. void 3. empty 4. anonymous 2. This appears at the beginning of a method definition. 1. semicolon 2. parentheses 3. body 4. header 3. The bo...

See Answer

Q: 11. True or False: When passing an argument to a

11. True or False: When passing an argument to a method, Java will automatically perform a widening conversion (convert the argument to a higher-ranking data type), if necessary. 12. True or False: W...

See Answer

Q: 1. This is a collection of programming statements that specify the

1. This is a collection of programming statements that specify the fields and methods that a particular type of object may have. 1. class 2. method 3. parameter 4. instance 2. A class is analogous to...

See Answer

Q: 11. This is automatically provided for a class if you do

11. This is automatically provided for a class if you do not write one yourself. 1. accessor method 2. default instance 3. default constructor 4. variable declaration 12. Two or more methods in a cla...

See Answer

Q: 1. In an array declaration, this indicates the number of

1. In an array declaration, this indicates the number of elements that the array will have. 1. subscript 2. size declarator 3. element sum 4. reference variable 2. Each element of an array is accesse...

See Answer

Q: 11. To insert an item at a specific location in an

11. To insert an item at a specific location in an ArrayList object, you use this method. 1. store 2. insert 3. add 4. get 12. To delete an item from an ArrayList object, you use this method. 1. remo...

See Answer

Q: 21. True or False: The first size declarator in the

21. True or False: The first size declarator in the declaration of a two-dimensional array represents the number of columns. The second size declarator represents the number of rows. 22. True or Fals...

See Answer