26. The enhanced for loop Select one: a. is convenient for traversing all elemen
ID: 3687808 • Letter: 2
Question
26.
The enhanced for loop
Select one:
a. is convenient for traversing all elements in an array
b. is convenient for traversing elements in a partially filled array
c. is only used for arrays of integers
d. is used to initialize all array elements to a common value
27.
Suppose that a program asks a user to enter multiple integers, either positive or
negative, to do some calculation. The data entry will stop when the user enters a
certain value to indicate the end of the data. What value should the code use as
the sentinel?
Select one:
a. 0
b. -1
c. 999
d. An alphabetic character
28.
An if statement inside another if statement is called a
Select one:
a. switch statement
b. nested if statement
c. break statement
d. syntax error, since that is not permitted in Java
29.
Which Java statement prints a blank line?
a. public static void main ( String [] args)
b. System.out.print ();
c. System.out. println();
d. System.out. Println();
30.
What is the output of the following code snippet?
public static void main(String[] args)
{
int num1 = 10;
int num2 = 5;
int num3 = 200;
num3 = num3 % (num1 * num2);
System.out.println(num3);
}
Select one:
a. 0
b. 4
c. 10
d. 250
Explanation / Answer
26.
The enhanced for loop
Select one:
a. is convenient for traversing all elements in an array
27.
Suppose that a program asks a user to enter multiple integers, either positive or
negative, to do some calculation. The data entry will stop when the user enters a
certain value to indicate the end of the data. What value should the code use as
the sentinel?
Select one:
b. -1
d. An alphabetic character
28.
An if statement inside another if statement is called a
Select one:
b. nested if statement
29.
Which Java statement prints a blank line?
c. System.out. println();
30.
What is the output of the following code snippet?
public static void main(String[] args)
{
int num1 = 10;
int num2 = 5;
int num3 = 200;
num3 = num3 % (num1 * num2);
System.out.println(num3);
}
Select one:
b. 4
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.