What is the number of iterations in the following loop?

for (int i = 1; i <= n; i++) {
// iteration
}

a. 2*n
b. n
c. n - 1
d. n + 1

b The loop is executed n times for i from 1 to n. So, the correct answer is B.

Computer Science & Information Technology

You might also like to view...

An Ethernet network would be considered a type of LAN

Indicate whether the statement is true or false

Computer Science & Information Technology

Identify the letter of the choice that best matches the phrase or definition.



1. Includes tools for zooming, panning, and selecting

2. The smallest element in a digital picture

3. Includes commands for managing files, panels, and windows

4. Lets you modify your images by changing different settings

5. Displays samples of colors

6. Is also called a raster graphic

7. A line that you draw to aid in aligning and moving objects

8. Displays information about the current file

9. Divides your document into squares that you can use for guidance

10. Displays a group of complementary panels, one on top of the other, using tabs

11. Displays the settings for the currently selected tool

12. A collection of points, lines, curves, and shapes

Computer Science & Information Technology