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
vovikov84 [41]
3 years ago
5

Consider the following code segment. int[] seq = {3, 1, 8, 4, 2, 5}; for (int k = 1; k < seq.length; k++) { if (seq[k] >=

seq[0]) System.out.print(seq[k] + " " + k + " "); } What will be printed as a result of executing the code segment?
Computers and Technology
1 answer:
Setler79 [48]3 years ago
4 0

Answer:

This program will complete in 5 iterations,

initially

Seq[0]=3

Iteration 1:

loop starting from 1 and ends at 5 so

when  K=1,   then seq[1]=1

if seq[1]>=Seq[0]    ==>     1 is not greater than equal to 3

so "nothing to print because condition not true"

Iteration 2:

Now

K=2 so seq[2]=8

if seq[2]>=Seq[0]    ==>     8 is greater than equal to 3

so "condition is true" the output will be

output="8","2" means seq[k]=8 and K=2

Iteration 3:

Now

K=3 so seq[3]=4

if seq[3]>=Seq[0]    ==>     4 is greater than equal to 3

so "condition is true" the output will be

output="4","3"  means seq[k]=4 and K=3

Iteration 4:

Now

K=4 so seq[4]=2

if seq[4]>=Seq[0]    ==>     2 is not greater than equal to 3

so "condition is not true" the output will be

output=nothing

Iteration 5:

Now

K=5 so seq[5]=5

if seq[5]>=Seq[0]    ==>     5 is greater than equal to 3

so "condition is true" the output will be

output="5","5"    means seq[k]=5 and K=5

Explanation:

You might be interested in
What is the central idea of the second section:
Ivanshal [37]

Answer:

The second is that laughter prepares us for tough conditions. And it does always ensure good things for us, and there are many real advantages of the laughter that we can trace out. And all those can be parsed from our real life. We just need to think of a sad situation and try to realize how laughter helps us get rid of that sad situation. And that is what is the central idea of the second section.

Explanation:

Please check the answer section.

7 0
2 years ago
Create a simple JavaScript calculator.
Gre4nikov [31]

Answer: edit out anything you dont need

<!DOCTYPE html>  

<html lang = "en">  

<head>  

<title> JavaScript Calculator </title>  

 

<style>  

h1 {  

   text-align: center;  

   padding: 23px;  

   background-color: skyblue;  

   color: white;  

   }  

 

#clear{  

width: 270px;  

border: 3px solid gray;  

   border-radius: 3px;  

   padding: 20px;  

   background-color: red;  

}  

 

.formstyle  

{  

width: 300px;  

height: 530px;  

margin: auto;  

border: 3px solid skyblue;  

border-radius: 5px;  

padding: 20px;  

}  

 

 

 

input  

{  

width: 20px;  

background-color: green;  

color: white;  

border: 3px solid gray;  

   border-radius: 5px;  

   padding: 26px;  

   margin: 5px;  

   font-size: 15px;  

}  

 

 

#calc{  

width: 250px;  

border: 5px solid black;  

   border-radius: 3px;  

   padding: 20px;  

   margin: auto;  

}  

 

</style>  

 

</head>  

<body>  

<h1> Calculator Program in JavaScript </h1>  

<div class= "formstyle">  

<form name = "form1">  

     

   <!-- This input box shows the button pressed by the user in calculator. -->  

 <input id = "calc" type ="text" name = "answer"> <br> <br>  

 <!-- Display the calculator button on the screen. -->  

 <!-- onclick() function display the number prsses by the user. -->  

 <input type = "button" value = "1" onclick = "form1.answer.value += '1' ">  

 <input type = "button" value = "2" onclick = "form1.answer.value += '2' ">  

 <input type = "button" value = "3" onclick = "form1.answer.value += '3' ">  

  <input type = "button" value = "+" onclick = "form1.answer.value += '+' ">  

 <br> <br>  

   

 <input type = "button" value = "4" onclick = "form1.answer.value += '4' ">  

 <input type = "button" value = "5" onclick = "form1.answer.value += '5' ">  

 <input type = "button" value = "6" onclick = "form1.answer.value += '6' ">  

 <input type = "button" value = "-" onclick = "form1.answer.value += '-' ">  

 <br> <br>  

   

 <input type = "button" value = "7" onclick = "form1.answer.value += '7' ">  

 <input type = "button" value = "8" onclick = "form1.answer.value += '8' ">  

 <input type = "button" value = "9" onclick = "form1.answer.value += '9' ">  

 <input type = "button" value = "*" onclick = "form1.answer.value += '*' ">  

 <br> <br>  

   

   

 <input type = "button" value = "/" onclick = "form1.answer.value += '/' ">  

 <input type = "button" value = "0" onclick = "form1.answer.value += '0' ">  

   <input type = "button" value = "." onclick = "form1.answer.value += '.' ">  

   <!-- When we click on the '=' button, the onclick() shows the sum results on the calculator screen. -->  

 <input type = "button" value = "=" onclick = "form1.answer.value = eval(form1.answer.value) ">  

 <br>  

 <!-- Display the Cancel button and erase all data entered by the user. -->  

 <input type = "button" value = "Clear All" onclick = "form1.answer.value = ' ' " id= "clear" >  

 <br>  

   

</form>  

</div>  

</body>  

</html>  

Explanation:

3 0
2 years ago
When issued a GFE device, you are required to sign an AUP
pav-90 [236]
GFE stands for Government Furnished Equipment. While AUP is Acceptable Use Policy (AUP). The AUP  should be read and signed by employees annually.  <span><span> </span></span>The statement that "When issued a GFE device, you are required to sign an AUP" is true. 
7 0
2 years ago
Read 2 more answers
What is the best Describe an integer data type
kolbaska11 [484]

Answer:

It is a data type that only holds whole numbers, a.k.a. integers.

what is the picture about?

3 0
2 years ago
Hello guys. .... ............ .is a camputer that stores data and programs that people on a network can access? What is the answ
Vikentia [17]
I do t know the answer to this but i think tou can firger it iut food luck so good luck on it also I think it can be done it is Poe Poe is your answer
4 0
2 years ago
Other questions:
  • Cuales son los accesorios electronicos mas recomendados?
    6·1 answer
  • The ________ contains the central electronic components of the computer. select one:
    14·1 answer
  • Define the following term. data, database, DBMS, database system, data- base catalog, program-data independence, user wen', DBA,
    12·1 answer
  • 50 POINTS! What can be viewed in the Tasks folder? Check all that apply.
    13·2 answers
  • Which finger presses the Shift key on the keyboard?
    6·2 answers
  • Which of the following is NOT true about a flow chart?
    8·1 answer
  • A program that allows employees to choose their starting and ending times, as long as they are at work during a specified core p
    8·1 answer
  • What should you do if your computer is running slower
    12·1 answer
  • Among your selection in different online interfaces, which are your top three favorites?​
    7·2 answers
  • which one of the following would not normally be found in an organization's information security policy?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!