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
Lunna [17]
3 years ago
14

What is the output of the following code? public class Test { public static void main(String[] args) { int list[] = {1, 2, 3, 4,

5, 6}; for (int i = 1; i < list.length; i++) list[i] = list[i - 1]; for (int i = 0; i < list.length; i++) System.out.print(list[i] + " "); } }
Computers and Technology
1 answer:
lyudmila [28]3 years ago
6 0

Answer:

1 1 1 1 1 1

Explanation:

You copy the first location to the second, and then the second to the third, and so on. Effectively the value of the first location (1) is copied to all locations.

You might be interested in
Write a Java program to count the characters in each word in a given sentence?Examples:Input : geeks for geeksOutput :geeks-&gt;
dimulka [17.4K]

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

   

    Scanner in = new Scanner(System.in);

   

    System.out.print("Enter a sentence: ");

    String sentence = in.nextLine();

   

    String[] words = sentence.split("\\s");

   

    for(String s : words)

     System.out.println(s + " -> " + s.length());

}

}

Explanation:

Ask the user to enter a sentence

Get each word in the sentence using split method and put them in words array

Loop through the words. Print each word and number of characters they have  using the length method in required format

4 0
4 years ago
Select the correct answer.
aleksandrvk [35]

Answer:

B.  color and painting tools

Explanation:

5 0
2 years ago
In the ______ stage of the systems development life cycle, the design specifications are translated into computer code.
faust18 [17]
In the Programming stage of the system development life cycle, the design specifications are translated into computer code
7 0
3 years ago
A student is curious about how a Web site appears on his computer screen. On a piece of paper,
nata0808 [166]

A student is curious about how a Web site appears on his computer screen. There is a communication between the client and the server in the Application Layer.

Explanation:

  • When we choose to open a webpage (in any browser) the seventh layer of the OSI model - called Application layer will help to do that.
  • What happens after we write the webpage address in address bar is that the Application layer protocol (also called HTTP) formats and sends the request from the client's browser (Internet Explorer, Mozilla Firefox , Opera, Safari etc.) to the server.
  • It also formats and sends the server's respond back to client's browser. This process happens very fast and all the OSI model layers are processing in it (not only the Application layer).
  • All the layers are working together and each of them is responsible for some particular job, but all together they work as one. The layers communicate with each other and in case of error they will retry and fix the error or if they are unable to do it, the responsible layer will inform the user about the source of the problem.
  • What happens when page is requested and received? If we will remove the graphical and visual image and look at the process that computer does. We will see a set of commands, mathematical algorithms, symbols, letters and not understandable codes and processes.
  • When data is sent from "A" to "B", a transport layer is responsible to send and deliver it correctly and exactly the same, what was requested.
  • If the request, processed by "A" (sender) is too long, the transport layer will divide it in segments (called segmentation process) to understand well and not make a mistake while sending the data to "B" (recipient). After this process data is travelling through the network to the "B" (recipient), if the sent data is segmented or divided, the transport layer is responsible for reassemble it again and "B" (recipient) receives its requested data (It can be web page or other data).
  • If the transport layer will not do the segmentation process, then the next - network layer - will check the data and if the requested message is too long it will fragment it (called fragmentation process) and will provide the same as transport layer had to do.
  • All the layers processes are connected to each other and work cooperatively.
5 0
3 years ago
Write a program that rolls two dice until the user gets snake eyes. You should use a loop and a half to do this. Each round you
marishachu [46]

import random

num_rolls = 0

while True:

   r1 = random.randint(1, 6)

   r2 = random.randint(1, 6)

   print("Rolled: " + str(r1) + "," + str(r2))

   num_rolls += 1

   if r1 == r2 == 1:

       break

print("It took you "+str(num_rolls)+" rolls")

I added the working code. You don't appear to be adding to num_rolls at all. I wrote my code in python 3.8. I hope this helps.

4 0
3 years ago
Other questions:
  • Typically, a CLEP exam is taken by students who
    8·1 answer
  • Choose the type of critical thinking demonstrated in the example:
    8·2 answers
  • In Java Write a program that prompts the user for a name (any String value would work for testing), and print a hello message to
    15·1 answer
  • Convert the following pseudi code to C++ code. BE sure to define the apprpriat evariables.
    9·1 answer
  • Anyone wanna join zoo m???????​
    10·2 answers
  • What creative commons license allow for the work to be copied, distributed, displayed, or performed but modifications may not be
    13·1 answer
  • 2. Discuss CORBA functions<br><br>​
    6·2 answers
  • If you forget your privacy password what will you do if the ask this question what is the name of one of your teacher?​
    12·1 answer
  • Capstone Project part 11 quiz
    6·1 answer
  • Consider the following variable declarations and initializations.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!