Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the following keywords is useful for skipping to the next

Question 1

Not yet answered

Marked out of 1.00

Flag question

Question text

Which of the following keywords is useful for skipping to the next iteration of a loop?

Select one:

a. do

b. break

c. switch

d. continue

e. while

Clear my choice

Question 2

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following line of Java code. System.out.println("Hello, World!"); "out" is which of the following?

Select one:

a. a statement

b. a class

c. a parameter

d. a method (subroutine)

e. an object

Clear my choice

Question 3

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following block of Java code. How many times will it output "Hello"? for (int i = 1; i < 10; i--) { System.out.println("Hello"); }

Select one:

a. 0

b. 9

c. 1

d. 10

e. Way too many!

Clear my choice

Question 4

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following class definition. Which variables can be used in the missing "println" expression on line 17? public class PrintStuff 2 { 3 public static void main() 4 { 6 { 7 int i = -1; 8 System.out.println(_____); 9 } 10 int j = 1; 11 for (j = 0; j < 10; j++) { 12 System.out.println(_____); 13 } 14 { 15 int k; 16 for (k = 0; k < 10; k++) { 17 System.out.println(_____); 18 } 19 } 20 System.out.println(_____); 21 } 22 }

Select one:

a. Only "j"

b. "j" and "k"

c. Only "i"

d. "i" and "j"

e. Only "k"

Clear my choice

Question 5

Not yet answered

Marked out of 1.00

Flag question

Question text

In a for loop, how many times does the update run?

Select one:

a. At least once, at the end of each iteration.

b. Zero or more times, at the end of each iteration.

c. Exactly once.

d. Zero or more times, at the beginning of each iteration.

e. At least once, at the beginning of each iteration.

Clear my choice

Question 6

Not yet answered

Marked out of 1.00

Flag question

Question text

Which of the following keywords is useful for making a loop that may execute forever or may not execute at all?

Select one:

a. do

b. continue

c. break

d. switch

e. while

Clear my choice

Question 7

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following Java program:

1 public class HelloWorld { 2 // My first program! 3 public static void main(String[] args) { 4 System.out.println("Hello, World!"); 5 } 6 }

What starts on line 1?

Select one:

a. a method (subroutine) definition

b. a comment

c. a statement

d. a variable declaration

e. a class definition

Clear my choice

Question 8

Not yet answered

Marked out of 1.00

Flag question

Question text

What is output by the following Java program?

class Compute { static int compute() { return 42; } static int compute(int i) { return i+1; } public static void main(String[] args) { System.out.println(compute(compute(0))); } }

Select one:

a. 0

b. 42

c. 43

d. 1

e. 2

Clear my choice

Question 9

Not yet answered

Marked out of 1.00

Flag question

Question text

Which one of the following is used in Java programming to handle asynchronous events?

Select one:

a. event handlers

b. short circuits

c. protocols

d. reserved words

e. pragmatics

Clear my choice

Question 10

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following Java declaration and assignment statement. float x = y; Which one of the following types is "y" NOT allowed to be?

Select one:

a. long

b. float

c. short

d. double

e. int

Clear my choice

Question 11

Not yet answered

Marked out of 1.00

Flag question

Question text

In a for loop, how many times does the continuation condition run?

Select one:

a. Exactly once.

b. Zero or more times, at the end of each iteration.

c. At least once, at the end of each iteration.

d. Zero or more times, at the beginning of each iteration.

e. At least once, at the beginning of each iteration.

Clear my choice

Question 12

Not yet answered

Marked out of 1.00

Flag question

Question text

Assume "test" is a boolean variable. Which of the following expressions is equivalent to "test == false"?

Select one:

a. !test

b. test = true

c. test

d. test.equals(true)

Clear my choice

Question 13

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following Java program:

1 public class HelloWorld { 2 // My first program! 3 public static void main(String[] args) { 4 System.out.println("Hello, World!"); 5 } 6 }

What is on line 3?

Select one:

a. a comment

b. a statement

c. a variable declaration

d. a class definition

e. a method (subroutine) definition

Clear my choice

Question 14

Not yet answered

Marked out of 1.00

Flag question

Question text

Assume that the variables "x" and "y" both have type "int". Which one of the following is NOT a boolean expression?

Select one:

a. x = y

b. x >= y

c. ((x > 0) && (y > 0))

d. (x > 0) ? (x > y) : (x < y)

Clear my choice

Question 15

Not yet answered

Marked out of 1.00

Flag question

Question text

Which one of the following lines of Java code does NOT include a method call?

Select one:

a. compute();

b. int x = compute(y);

c. compute(x,y,z);

d. void compute() {}

e. if (i < 1) { compute(); }

Clear my choice

Question 16

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following Java program:

1 public class HelloWorld { 2 // My first program! 3 public static void main(String[] args) { 4 System.out.println("Hello, World!"); 5 } 6 }

What starts on line 4?

Select one:

a. a variable declaration

b. a method (subroutine) definition

c. a class definition

d. a comment

e. a statement

Clear my choice

Question 17

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following line of Java code. System.out.println("Hello, World!"); "println" is which of the following?

Select one:

a. a class

b. a method (subroutine)

c. an object

d. a parameter

e. a statement

Clear my choice

Question 18

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following line of Java code. System.out.println("Hello, World!"); "Hello ,World" is which of the following?

Select one:

a. a class

b. a method (subroutine)

c. an object

d. a parameter

e. a statement

Clear my choice

Question 19

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following Java method, which term best describes "'System.out.println("Hello, World!")"?

public static void main(String[] args) { System.out.println("Hello, World!"); }

Select one:

a. actual parameter or argument

b. return type

c. modifier

d. formal parameter

e. method call

Clear my choice

Question 20

Not yet answered

Marked out of 1.00

Flag question

Question text

Consider the following class definition. Which variables can be used in the missing "println" expression on line 20? public class PrintStuff 2 { 3 public static void main() 4 { 6 { 7 int i = -1; 8 System.out.println(_____); 9 } 10 int j = 1; 11 for (j = 0; j < 10; j++) { 12 System.out.println(_____); 13 } 14 { 15 int k; 16 for (k = 0; k < 10; k++) { 17 System.out.println(_____); 18 } 19 } 20 System.out.println(_____); 21 } 22 }

Select one:

a. "j" and "k"

b. Only "j"

c. Only "k"

d. Only "i"

e. "i" and "j"

Clear my choice

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

What is the name of the program?

Answered: 1 week ago