1 The correct output of the following poorly indented progr

1. The correct output of the following (poorly - indented) program segment is :

int num = 4;

double a = -1.0;

if (num > 0)

if (a > 0)

System.out.println(\"first\");

else

System.out.println (\"Second\");

first (b) last (c) second (d) 4 (e) 1.0

2. Fill in the blank with the keyword that belongs in the following program segment:

______ (menuChoice) {

case ‘Y’:

System.out.println(“Yes!);

Break;

Case ‘N’ :

System.out.println(“No.”);

}

super (b) case (c) static (d) default (e) switch

3. Match following operators with its corresponding classification:

==

<=

!=

4. What will the following statement evaluate to? T OR F?

(‘M’ > ‘S’) && (5 < = 8)

5. What is NOT the name of a Java primitive data type?

(a) int (b) string (c) double

6. How many times will outputLabel be called?

        

         for(customer =1; customer <= 30; ++customer)

         for(color =1; color <= 4; ++color)

         outputLabel();

0 (b) 120 (c) 360 (d) 60

7. The expression b =9 and c = - - b, what value will be assigned to the variable c?

(a) b (b) 9 (c) 7 (d) 10

8. What method returns the length of a string?

(a) getSize() (b) size() (c) getLength() (d)length()

9. When you place a block within an if statement, it is crucial to place the ___ correctly.

(a) curly braces (b) commas (c) angle brackets (d) periods

10. Methods used with object instantiations are called ___ methods

(a) static (b) commas (c) angle brackets (d) periods

11. __ involves using one term to indicate diverse meanings, or writing multiple methods with the same name but with different parameter lists.

(a) Signing (b) Overloading (c) Referencing (d) Nesting

12. A ____ consists of written steps in diagram form, as a series of shapes connected by arrows.

(a) flowchart (b) pseudocode chart (c) sequence structure (d) decision structure

13. Strings and other objects that can’t be changed are known as ___

(a) accessor methods (b) garbage (c) string constants (d) decision structure

14. When you overload a Java method, you write multiple methods with a shared name.

(a) true (b) false

15. Which term identifies the access specifier?

{

public static void main (String [] args)

{

System.out.println(“java applivation”);

}
}

identify:

Returns the lower case equivalent of the argument

A named object of the String class

Change the length of a string in a StringBuilder object

Determines whether a specific character occurs within a String

Takes two integer arguments: a start position and an end position

Takes a String argument and returns its double value

A memory block

Add characters to the end of a StringBuilder object

Add characters at a specific location within a StringBuilder object

ParseDouble() , String variable , toLowerCase () , substring () , buffer, append () , getLength () , indexOf() , insert()

Solution

identify:
Returns the lower case equivalent of the argument -- toLowerCase ()
A named object of the String class -- String variable
Change the length of a string in a StringBuilder object
Determines whether a specific character occurs within a String -- indexOf()
Takes two integer arguments: a start position and an end position -- substring()
Takes a String argument and returns its double value -- ParseDouble()
A memory block -- buffer
Add characters to the end of a StringBuilder object -- append()
Add characters at a specific location within a StringBuilder object -- insert()

1. The correct output of the following (poorly - indented) program segment is : int num = 4; double a = -1.0; if (num > 0) if (a > 0) System.out.println(\
1. The correct output of the following (poorly - indented) program segment is : int num = 4; double a = -1.0; if (num > 0) if (a > 0) System.out.println(\
1. The correct output of the following (poorly - indented) program segment is : int num = 4; double a = -1.0; if (num > 0) if (a > 0) System.out.println(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site