1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gavmur [86]
3 years ago
7

Assume that you have an array of integers named arr. Which of these code segments print the same results? int i = 0; while (i &l

t; arr.length) { System.out.println(arr[i]); i++; } int i; for (i = 0; i <= arr.length; i++) { System.out.println(arr[i]); } for (int i : arr) { System.out.println(i); }
Computers and Technology
1 answer:
otez555 [7]3 years ago
6 0

Answer:

2.    int i; for (i = 0; i <= arr.length; i++) { System.out.println(arr[i]); }

3. for (int i : arr) { System.out.println(i); }

second and third code segments print the same output.

Explanation:

In first code segment, while loop starts printing from arr[0] and it continues till the second last element of the the array as in statement of while loop i<arr.length. Which print till arr[length - 1].

In second code, for loop starts from 0 and ends at the last element of the array. which prints from arr[0] to arr[length].

In third code segment, it also print from arr[0] to arr[length]. In this case      for (int i : arr)  means start from first value of array and continues till last element of the array.

You might be interested in
The ________ model allows the owner of a resource to manage who can or cannot access the item. Owners maintain this access throu
blagie [28]

Answer:

Discretionary Access Control model

Explanation:

Discretionary Access Control (DAC) gives owners of a resource full control of objects/items they have created or been given access to, this also includes sharing the objects/items with other subjects. These owners have control over their data and maintain access through ACLs. The access-control list (ACL), is a list of permissions attached to an object in a computer file system.

The Owners can decide to grant other users access to their files, change their attributes, alter them, or delete them. DACs are discretionary because the owner can transfer information access to other users.

5 0
3 years ago
When pasting a circle drawn by the presentation software drawing tool into a spreadsheet, that circle will go into the selected
ivann1987 [24]
The answer is ............................ False
6 0
3 years ago
Read 2 more answers
Date Time Manipulation Exploration If you start from Jan 1st, 1757, and repeatedly add 8 days, until you hit 1800, how many time
zimovet [89]

Answer:

from datetime import datetime, date, timedelta

def count_weekdays(start_date, add_days, stop_year, weekday):

   my_date = start_date

   m = 0  

   while my_date.year != stop_year:  

       my_date = my_date + timedelta(days = add_days)

       if my_date.isoweekday() == weekday:

           m += 1

   return m

date_val = date(1757,1,1)

try:

   date_val = datetime.fromisoformat(input("Enter date in the format yyyy-mm-dd: "))

except ValueError:

   print("Wrong isoformat string")

print(count_weekdays(date_val, 8, 1800, 1))

Explanation:

The datetime package of the python programming language has several time modules like the date, datetime, pytz, timedelta, etc, used to manipulate date and time in documents. The function count_weekdays has four parameters and returns the number of a specified weekday in a period of time.

4 0
3 years ago
Suppose that the following elements are added in the specified order to an empty binary search tree: Lisa, Bart, Marge, Homer, M
Alecsey [184]

Answer:

Pre-order: Lisa, Bart, Homer, Flanders, Marge, Maggie, Smithers, Milhouse

In-order: Bart, Flanders, Homer, Lisa, Maggie, Marge, Milhouse, Smithers

Post-order: Flanders, Homer, Bart, Maggie, Milhouse, Smithers, Marge, Lisa

Explanation:

The required orders are mentioned.

4 0
3 years ago
Tim is in charge of the upcoming interschool baketball tournamnent. He wants to arrange all of the teams and their members in al
Scorpion4ik [409]
C sort will be the answer
5 0
3 years ago
Other questions:
  • Which of the following accurately completes this sentence? The Internet is ____.
    6·2 answers
  • You need to put cabling for connecting two new computers in a room, which did not have any network infrastructure. Because of th
    9·2 answers
  • The ____ file permission category in unix/linux systems typically entails all permissions and is designated by the letter u.
    7·1 answer
  • What term is used to refer to the merging of government services with information technology?
    11·1 answer
  • Information about hardware engineers?
    9·1 answer
  • Explain what an IM is, and what is the technology shown in the accompanying figure
    7·2 answers
  • Launa is reviewing several videos from her friends doing the latest dance challenge before they are published on their own
    11·1 answer
  • 15 _____ 3 = 0 Question 11 options: a) / b) % c) * d) //
    12·1 answer
  • What are the sectors of the buisness enviornment
    15·1 answer
  • Discuss the concept of the “state of a process”. Give examples to illustrateyour answers?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!