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
lisov135 [29]
3 years ago
13

To print the last element in the array named ar, you can write :A. System.out.println(ar.length);

Computers and Technology
1 answer:
timofeeve [1]3 years ago
3 0

Answer:

Option (d) is the correct answer.

Explanation:

An Array is used to store multiple variables in the memory in the continuous memory allocation on which starting index value is starting from 0 and the last index value location is size-1.

In java programming language the array.length is used to tells the size of the array so when the user wants to get the value of the last element, he needs to print the value of (array.length-1) location so the correct statement for the java programming language is to print the last element in the array named ar is--

System.out.println(ar[ar.length-1]);

No option provides the above statement, so option d (None of these) is correct while the reason behind the other option is not correct is as follows--

  • Option a will prints the size of the array.
  • Option b also gives the error because length is an undeclared variable.
  • Option c will give the error of array bound of an exception because it begs the value of the size+1 element of the array.
You might be interested in
How do I type fast?<br><br> Give me an actual answer...
Ugo [173]
Practice!
And a good keyboard I recommend mechanical key boards
But the best way to improving your WPM is definitely practice one way you can practice is playing typeracer it’s pretty fun way

Hope this helps!
Brainliest is much appreciated!
7 0
2 years ago
Read 2 more answers
A job placement agency helps match job seekers with potential employers. The agency would like to design a simulation in order t
storchak [24]

Answer:C

Explanation:

The answer is C

6 0
2 years ago
Create an array to hold the rainfall values. Create a 2nd parallel array (as a constant) to hold the abbreviated names of the mo
Zarrin [17]

Answer:

#include <stdio.h>

int main()

{

//variable declaration

int low, high;

float lowRain, highRain, total, avg;

 

//array declaration

float rainfall[13];

char monthName[13][10] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

//get user input

for(int i=1; i<=12; i++)

{

printf("Enter the rainfall (in inches) for %s: ", monthName[i]);

scanf("%f", &rainfall[i]);

}

 

//display the monthly rainfall

printf("\nThe rainfall that was entered was:\n");

for(int i = 1; i<=6; i++)

printf("%s ", monthName[i]);

printf("\n");

for(int i = 1; i<=6; i++)

printf("%.1f ", rainfall[i]);

printf("\n");

for(int i = 7; i<=12; i++)

printf("%s ", monthName[i]);

printf("\n");

for(int i = 7; i<=12; i++)

printf("%.1f ", rainfall[i]);

 

//variable initialization

low = 1;

high = 1;

lowRain = rainfall[1];

highRain = rainfall[1];

total = 0;

 

//calculate the lowest, highest and averaage rainfall

for(int i=1; i<=12; i++)

{

if(lowRain>rainfall[i])

{

lowRain = rainfall[i];

low = i;

}

if(highRain<rainfall[i])

{

highRain = rainfall[i];

high = i;

}

total = total + rainfall[i];

}

 

avg = total / 12;

 

//display the result

printf("\n\nThe total rain that fell was %.1f inches", total);

printf("\nThe average monthly rainfall was %.1f inches.", avg);

printf("\nThe lowest monthly rainfall was %.1f inches in %s.", rainfall[low], monthName[low]);

printf("\nThe highest monthly rainfall was %.1f inches in %s.", rainfall[high], monthName[high]);

return 0;

}

4 0
3 years ago
Which framework can be used to develop cross-platform applications?
k0ka [10]

Answer:

Qt framework

Explanation:

3 0
3 years ago
A data visualization tool that updates in real time and gives multiple outputs is called
strojnjashka [21]

Answer:

A data dashboard

Explanation:

3 0
2 years ago
Other questions:
  • . When you create a template class, ___________.
    15·1 answer
  • Which of the following is a sigh that your computer may have been infected with malicious code
    12·1 answer
  • When looking to ensure your website is easily accessible by mobile users, what should you focus on doing first
    8·1 answer
  • Before his job interview, Shabnam took the time to carefully wash and iron his best khaki pants and a button-down shirt. He even
    15·2 answers
  • What should you rely on to determine when to change your oil? a. Oil color b. 6,000 miles since the last oil change c. Owners ma
    7·1 answer
  • As Alexa types a message, Outlook autosaves the message at various points. In which folder is the message located if Alexa wants
    15·2 answers
  • What do you think was the immediate effect of the introduction of handheld consoles and video games?
    6·1 answer
  • Define the missing function. licenseNum is created as: (100000 * customID) licenseYear, where customID is a function parameter.
    12·1 answer
  • What single awk command can be used to display all the login names and their associated numerical user IDs
    14·1 answer
  • When hacking a website to test a secure connection and ensure internet safety, what is a good way to check the coding of the web
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!