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
navik [9.2K]
3 years ago
15

Consider the following incomplete method. Method findNext is intended to return the index of the first occurrence of the value v

al beyond the position start in array arr. I returns index of first occurrence of val in arr /! after position start; // returns arr.length if val is not found public int findNext (int[] arr, int val, int start) int pos = start + 1; while condition '/ ) pos++ return pos; For example, consider the following code segment. int [ ] arr {11, 22, 100, 33, 100, 11, 44, 100); System.out.println(findNext (arr, 100, 2)) The execution of the code segment should result in the value 4 being printed Which of the following expressions could be used to replace /* condition */ so that findNext will work as intended?
(A) (posarr.length) &&(arr [pos]- val)
(B) (arr [pos] != val) && (pos < arr. Îength)
(C) (pos (D) (arr [pos} == val) && (pos < arr. length)
(E) (pos
Computers and Technology
1 answer:
inna [77]3 years ago
8 0

Answer:

B)

Explanation:

The while loop runs as long as two conditions are satisfied, as indicated by the && logical operator.

The first condition- arr[pos] != val

checks to see if the value in the array index, pos, is equal to the given value and while it is not equal to it, the second condition is checked.

The second condition(pos < are.length), checks to see if the index(pos) is less than the length of the array. If both conditions are true, the program execution enters the while loop.

The while loop is only terminated once arr[pos] == Val or pos == arr.length.

You might be interested in
To increase security on your company's internal network, the administrator has disabled as many ports as possible. Now, however,
tia_tia [17]

Answer: 443

Explanation:

Port 443 will need to be enabled for secure transactions to go through because it is the default port for HTTPS which is the transfer protocol for secure communication.

This way your credit card transactions will be encrypted to ensure protection from those who would seek to steal your data and your money.  

8 0
3 years ago
What type of device does a computer turn to first when attempting to make contact with a host with a known IP address on another
mihalych1998 [28]

Answer: the DNS server

Explanation:

4 0
3 years ago
Read 2 more answers
In Java an abstract class cannot be sub-classed<br><br> ?? True<br><br> ?? False
mojhsa [17]

Answer:

False

Explanation:

An abstract class is a class declared abstract — it may or may not include abstract techniques. It is not possible to instantiate abstract classes, but they can be sub-classed.

<u></u>

<u>Abstract method declaration</u>

             

         abstract void moveTo(double X, double Y);

Usually the subclass offers solutions for all of the abstract techniques in its parent class when an abstract class is sub-classed. If not, however, the subclass must be declared abstract as well.

<u>Example</u>

public abstract class GraphicObject {

  // declaring fields

  // declaring non-abstract methods

  abstract void draw();

}

8 0
4 years ago
PLEASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! THIS IS A PRETTY SIMPLE QUESTION, BUT FOR SOME REASON THEY'RE GIVING ME QUESTIONS
vichka [17]

I think it's C because he upgraded from a slower one

5 0
3 years ago
Initialize an int variable named as sum to 0. Write the while loop that lets the user enter a number. The number should be added
FromTheMoon [43]

Answer:

Following are the program to this question:

#include<iostream> //defining header file

using namespace std;  

int main() //defining main method

{

int sum = 0, num; //defining integer variable  

cout << "Enter a number :"; // print message

cin >> num; //input number

sum=sum+num;

while (sum < 200)  //defining loop that check sum value is less then 200

{

cin >> num; //input number by user

sum =sum+num; //add values

}

cout << "Sum = " << sum <<" the loop stops"; //print values

return 0;

}

output:

Enter a number :44

66

90

Sum = 200 the loop stops

Explanation:

In the given C++ program, the main method is declared, inside the method two integer variable "sum and num" is declared, in which sum variable assign a value, that is 0, and num is used to take input from the user end.

  • In the next step, a sum variable adds num variable value and use a while loop that checks value is less than 200.  
  • In this condition is not true so, inside the loop, it takes value from the user and into the sum variable when its value is above 200, it will exit the loop and prints its total value.
8 0
4 years ago
Other questions:
  • The key to security policy is being able to measure compliance against a set of controls. Security controls define _____ ______
    11·1 answer
  • A recent antivirus scan on a server detected a Trojan. A technician removed the Trojan, but a security administrator expressed c
    6·1 answer
  • What is a detailed and thorough review of the deployed security infrastructure compared with the organization’s security policy
    5·1 answer
  • [c++] Write a recursive function takes a word string as input argument and reverse the word. Print out the results of recursive
    14·1 answer
  • What is virtual office?
    11·1 answer
  • Start with the following Python code. alphabet = "abcdefghijklmnopqrstuvwxyz" test_dups = ["zzz","dog","bookkeeper","subdermatog
    13·1 answer
  • Michael’s team is presenting a robot before their examiners. What do they need which is a definitive description of the final pr
    6·1 answer
  • State two ways of preventing virus attack on a computer.​
    12·1 answer
  • How would you identify communication equipment?
    10·1 answer
  • Define horizontal scroll bar​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!