Consider the following incomplete method, which is intended to return the longest string in the string array words. Assume that the array contains at least one element.

public static String longestWord(String[] words)
{
/* missing declaration and initialization */
for (int k = 1; k < words.length; k++)
{
if (words[k].length() > longest.length())
{
longest = words[k];
}
}
return longest;
}

Which of the following can replace /* missing declaration and initialization */ so that the method will work as intended?

a. int longest = 0;
b. int longest = words[0].length();
c. String longest = "";
d. String longest = words[0];
e. String longest = words[1];

Answers

Answer 1

Answer:

String longest = "";

Explanation:

The initialization that would allow the method to work as intended would be the following

String longest = "";

This is because the method is looping through the array provided as an argument and comparing each word in the array with the word saved inside the variable called longest. The length of both are compared and if the word in the array is longer than the string saved in the variable longest then it is overwritten with the word in the array.


Related Questions

What Game is better Vacation Simulator Or Beat Saber

Answers

Answer:

I love Beat Saber and Beat Saber is the best!!!!

Explanation:

Answer:

I would have to agree with the other person I think Beat Saber is better than Vacation Simulator

Explanation:  

                               ~Notify me if you have questions~

                               have a nice day and hope it helps!

                                                         ^ω^

-- XxFTSxX

What do network operating systems use? Check
all of the boxes that apply.
hardware
software
plant material
desks
sunlight

Answers

Answer:

1 and 2Explanation:

Assume that you are working with spreadsheets, word processing documents, presentation slides, images, and sound files for a school project. You stored all your files in a folder named “untitled” on your laptop. Now, you cannot locate a particular document in this folder and you realize that you need to organize your files properly.
Write down the steps that you will take to organize your files.

Answers

Answer:

See explanation below.

Explanation:

File organization is very important especially when one is working with numerous files from different applications.

When you are working with spreadsheets, word processing documents, presentation slides, images and sound files, it is important to create folders and sub-folders to make locating your files a lot easier.

Make sure you have all your files saved with names that are relevant to your school project.Create a sub-folder to store all spreadsheets files, create a sub-folder to store all word processing files, create a sub-folder to store all presentation slides and create another folder to store images and sound files. You do this to make it easy for you to locate whichever file you want. You create the sub-folder by right clicking on your documents section and clicking on new folder. Type in the name of the folder and save.After creating sub-folders,  create a general folder for all your folders by using the same method in step 3. Copy all your sub-folders into this major folder. You can name this folder the name of your school project.

This way, you never have to look for any files for your school project.

You've created a new programming language, and now you've decided to add hashmap support to it. Actually you are quite disappointed that in common programming languages it's impossible to add a number to all hashmap keys, or all its values. So you've decided to take matters into your own hands and implement your own hashmap in your new language that has the following operations:
insert x y - insert an object with key x and value y.
get x - return the value of an object with key x.
addToKey x - add x to all keys in map.
addToValue y - add y to all values in map.
To test out your new hashmap, you have a list of queries in the form of two arrays: queryTypes contains the names of the methods to be called (eg: insert, get, etc), and queries contains the arguments for those methods (the x and y values).
Your task is to implement this hashmap, apply the given queries, and to find the sum of all the results for get operations.
Example
For queryType = ["insert", "insert", "addToValue", "addToKey", "get"] and query = [[1, 2], [2, 3], [2], [1], [3]], the output should be hashMap(queryType, query) = 5.
The hashmap looks like this after each query:
1 query: {1: 2}
2 query: {1: 2, 2: 3}
3 query: {1: 4, 2: 5}
4 query: {2: 4, 3: 5}
5 query: answer is 5
The result of the last get query for 3 is 5 in the resulting hashmap.
For queryType = ["insert", "addToValue", "get", "insert", "addToKey", "addToValue", "get"] and query = [[1, 2], [2], [1], [2, 3], [1], [-1], [3]], the output should be hashMap(queryType, query) = 6.
The hashmap looks like this after each query:
1 query: {1: 2}
2 query: {1: 4}
3 query: answer is 4
4 query: {1: 4, 2: 3}
5 query: {2: 4, 3: 3}
6 query: {2: 3, 3: 2}
7 query: answer is 2
The sum of the results for all the get queries is equal to 4 + 2 = 6.
Input/Output
[execution time limit] 4 seconds (py3)
[input] array.string queryType
Array of query types. It is guaranteed that each queryType[i] is either "addToKey", "addToValue", "get", or "insert".
Guaranteed constraints:
1 ≤ queryType.length ≤ 105.
[input] array.array.integer query
Array of queries, where each query is represented either by two numbers for insert query or by one number for other queries. It is guaranteed that during all queries all keys and values are in the range [-109, 109].
Guaranteed constraints:
query.length = queryType.length,
1 ≤ query[i].length ≤ 2.
[output] integer64
The sum of the results for all get queries.
[Python3] Syntax Tips
# Prints help message to the console
# Returns a string
def helloWorld(name):
print("This prints to the console when you Run Tests")
return "Hello, " + name

Answers

Answer:

Attached please find my solution in JAVA

Explanation:

long hashMap(String[] queryType, int[][] query) {

       long sum = 0;

       Integer currKey = 0;

       Integer currValue = 0;

       Map<Integer, Integer> values = new HashMap<>();

       for (int i = 0; i < queryType.length; i++) {

           String currQuery = queryType[i];

           switch (currQuery) {

           case "insert":

               HashMap<Integer, Integer> copiedValues = new HashMap<>();

               if (currKey != 0 || currValue != 0) {

                   Set<Integer> keys = values.keySet();

                   for (Integer key : keys) {

                       copiedValues.put(key + currKey, values.get(key) + currValue);

                   }

                   values.clear();

                   values.putAll(copiedValues);

                   currValue = 0;

                   currKey = 0;

               }

               values.put(query[i][0], query[i][1]);

               break;

           case "addToValue":

               currValue += values.isEmpty() ? 0 : query[i][0];

               break;

           case "addToKey":

               currKey += values.isEmpty() ? 0 : query[i][0];

               break;

           case "get":

               copiedValues = new HashMap<>();

               if (currKey != 0 || currValue != 0) {

                   Set<Integer> keys = values.keySet();

                   for (Integer key : keys) {

                       copiedValues.put(key + currKey, values.get(key) + currValue);

                   }

                   values.clear();

                   values.putAll(copiedValues);

                   currValue = 0;

                   currKey = 0;

               }

               sum += values.get(query[i][0]);

           }

       }

       return sum;

   }

Implement the function charCnt. charCnt is passed in a name of a file and a single character (type char). This function should open the file, count the number of times the character is found within the file, close the file, and then return the count. If the file does not exist, this function should output an error message and then call the exit function to exit the program with an error value of 1.

Answers

Answer:

Answered below

Explanation:

//Program is written in Python programming language

def charCnt( fileName, char){

if not fileName.exists( ):

return sys.exit(1)

else:

openFile = open("$fileName.txt", "r")

readFile = openFile.read( )

fileLength = len (readFile)

count = 0

for character in range(fileLength):

if readFile[character] == char:

count++

openFile.close( )

return count

}

Python (and most programming languages) start counting with 0.
True
False

Answers

True....................

Answer:

yes its true  :)

Explanation:

Write a program, named NumDaysLastNameFirstName.java, which prompts the user to enter a number for the month and a number for the year. Using the information entered by the user and selection statements, display how many days are in the month. Note: In the name of the file, LastName should be replaced with your last name and FirstName should be replaced with your first name. When you run your program, it should look similar to this:

Answers

Answer:

Explanation:

The following code is written in Java and uses Switch statements to connect the month to the correct number of days. It uses the year value to calculate the number of days only for February since it is the only month that actually changes. Finally, the number of days is printed to the screen.

import java.util.Scanner;

public class NumDaysPerezGabriel {

   public static void main(String args[]) {

       int totalDays = 0;

       Scanner in = new Scanner(System.in);

       System.out.println("Enter number for month (Ex: 01 for January or 02 for February): ");

       int month = in.nextInt();

       System.out.println("Enter 4 digit number for year: ");

       int year = in.nextInt();

       switch (month) {

           case 1:

               totalDays = 31;

               break;

           case 2:

               if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {

                   totalDays = 29;

               } else {

                   totalDays = 28;

               }

               break;

           case 3:

               totalDays = 31;

               break;

           case 4:

               totalDays = 30;

               break;

           case 5:

               totalDays = 31;

               break;

           case 6:

               totalDays = 30;

               break;

           case 7:

               totalDays = 31;

               break;

           case 8:

               totalDays = 31;

               break;

           case 9:

               totalDays = 30;

               break;

           case 10:

               totalDays = 31;

               break;

           case 11:

               totalDays = 30;

               break;

           case 12:

               totalDays = 31;

       }

       System.out.println("There are a total of " + totalDays + " in that month for the year " + year);

   }

}

Write a method that extracts the dollars and cents from an amount of money given as a floating-point value. For example, an amount 2.95 yields values 2 and 95 for the dollars the cents. You may assume that the input is always a valid non-negative monetary amount.

Answers

Answer:

The method in C++ is as follows:

void dollarextract(double money){

int dollar = int (money);

int cent = (money - dollar) * 100;

cout<<dollar<<" dollar "<<cent<<" cent";

}

Explanation:

This defines the method

void dollarextract(double money){

This gets the dollar part of the amount

int dollar = int (money);

This gets the cent part of the amount

int cent = (money - dollar) * 100;

This prints the amount in dollars and cent

cout<<dollar<<" dollar "<<cent<<" cent";

}

To call the method from main, use:  

dollarextract(2.95);

The above will return 2 dollar 95 cent

The cafeteria offers a discount card for sale that entitles you, during a certain period, to a free meal whenever you have bought a given number of meals at the regular price. The exact details of the offer change from time to time. Describe an algorithm that lets you determine whether a particular offer is a good buy. What other inputs do you need

Answers

Answer:

Explanation:

The algorithm can be described as follows

The first process is to ensure that the constraints for the time at which the offers begin is well defined.

TIME1 = 14:00

TIME2 = 16:00

TIME3 = 18:00

Then, decide the final number of meal following the free meal that has been offered.

NUMBER_OF_MEALS=4;

Then; decide the prices attached to the meal at regular times.

PRICE = 200;

At regular mode, decide the prices attached to the meal and as well as when the offer time commences.

PRICE_OFFER = 160;

Then ask the client(i.e the user) to put in the value required for the number of meals they desire to order.

Input values in n

Suppose (the value exceeds 8)

Then proceed to enquire from the client if they wish to go for the offer.

If not, use the regular price for the order.

Assume the client asks if the offer is a good one to bid for.

You are to show then the analysis of the calculation.

regular = 8 × PRICE

offer = 8 × PRICE_OFFER

profit = regular - offer

Finally, show the profit to the client which will let them know if it is good to bid for it or not.

Computing devices translate digital to analog information in order to process the information


Computing devices are electronic.


The CPU processes commands.


The memory uses binary numbers

Answers

Complete Question:

Which of the following about computers is NOT true?

Group of answer choices.

A. Computing devices translate digital to analog information in order to process the information.

B. Computing devices are electronic.

C. The CPU processes commands.

D. The memory uses binary numbers

Answer:

A. Computing devices translate digital to analog information in order to process the information.

Explanation:

Computing is the process of using computer hardware and software to manage, process and transmit data in order to complete a goal-oriented task.

The true statements about computers are;

I. Computing devices are electronic: the components and parts which makes up a computer system are mainly powered by a power supply unit and motherboard that typically comprises of electronic components such as capacitors, resistors, diodes etc.

II. The CPU processes commands: the central processing unit (CPU) is responsible for converting or transforming the data from an input device into a usable format and sent to the output device.

III. The memory uses binary numbers: computer only understand ones and zeros.

udsvb kbfnsdkmlfkmbn mk,dsldkfjvcxkm ,./ss.dskmcb nmld;s,fknvjf

Answers

Answer:

not sure what language it is

Explanation:

In the ( ) Model, each in a network can act as a server for all the other computers sharing files and acsess to devices

A host server
B client server
C peer to peer

Answers

Answer:

C peer to peer

Explanation:

A peer to peer is a computer network in a distributed architecture that performs various tasks and workload amount themselves. Peers are both suppliers and consumers of resources. Peers do similar things while sharing resources, which enables them to engages in greater tasks.

Answer:

C. Peer-to-peer

Explanation:

On Edge, it states, "In a peer-to-peer model, each computer in a network can act as a server for all the other computers, sharing files and access to devices."

I hope this helped!

Good luck <3

Your class is in groups, working on a sets worksheet. Your classmate suggests that if the union of two non-empty sets is the empty set, then the sets must be disjoint. What would you say to explain how this statement is false, and how would you help correct them

Answers

Answer:

The answer is "[tex]\bold{A \cap\ B=\phi}[/tex]"

Explanation:

let

[tex]A=\{1,2,3\}\\\\B=\{4,5,6\}[/tex]

A and B are disjoint sets and they are not an empty set  then:

[tex]A\cup\ B=\{1,2,3,4,5,6\} \\\\A\cup\ B\neq 0[/tex]

therefore if the intersection of the two non-empty sets is the empty set then its disjoint set, which is equal to [tex]\bold{A \cap\ B=\phi}[/tex].

what is used to manufacture chips in computer​

Answers

Answer:

The process of creating a computer chip begins with a type of sand called silica sand, which is comprised of silicon dioxide. Silicon is the base material for semiconductor manufacturing and must be pure before it can be used in the manufacturing process.

Explanation:

what if an html code became cracked and formed a bug how can i repair that

Answers

I suggest you look up a video for it ofc

What is the relationship between an object and class in an OOP program?


The object contains classes.

The object and class are the same thing.

The object is used to create a class.

The object in a program is called a class.

Answers

Answer:

D. The object in a program is called a class.

Explanation:

Java is a object oriented and class-based programming language. It was developed by Sun Microsystems on the 23rd of May, 1995. Java was designed by a software engineer called James Gosling and it is originally owned by Oracle.

In object-oriented programming (OOP) language, an object class represents the superclass of every other classes when using a programming language such as Java. The superclass is more or less like a general class in an inheritance hierarchy. Thus, a subclass can inherit the variables or methods of the superclass.

Basically, all instance variables that have been used or declared in any superclass would be present in its subclass object.

Hence, the relationship between an object and class in an OOP program is that the object in a program is called a class.

For example, if you declare a class named dog, the objects would include barking, color, size, breed, age, etc. because they are an instance of a class and as such would execute a method defined in the class.

Write a program to help a local restaurant automate its breakfast billing system. The program should do the following:

Show the customer the different breakfast items offered by the restaurant.
Allow the customer to select more than one item from the menu.
Calculate and print the bill.
Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item):

Food Price
Plain Egg $1.45
Bacon and Egg $2.45
Muffin $0.99
French Toast $1.99
Fruit Basket $2.49
Cereal $0.69
Coffee $0.50
Tea $0.75

Use an array menuList of type menuItemType, as defined in Programming Exercise 3. Your program must contain at least the following functions:

Function getData: This function loads the data into the array menuList.
Function showMenu: This function shows the different items offered by the restaurant and tells the user how to select the items.
Function printCheck: This function calculates and prints the check. (Note that the billing amount should include a 5% tax.)

A sample output is:

Welcome to Johnny's Resturant

----Today's Menu----

1: Plain Egg $1.45
2: Bacon and Egg $2.45
3: Muffin $0.99
4: French Toast $1.99
5: Fruit Basket $2.49
6: Cereal $0.69
7: Coffee $0.50
8: Tea $0.75

You can make up to 8 single order selections
Do you want to make selection Y/y (Yes), N/n (No): Y
Enter item number: 1
Select another item Y/y (Yes), N/n (No): Y
Enter item number: 2
Select another item Y/y (Yes), N/n (No): N
Welcome to Johnny's Resturant
Plain Egg $1.45
Bacon and Egg $2.45
Tax $0.20
Amount Due $4.10

Format your output with two decimal places. The name of each item in the output must be left justified. You may assume that the user selects only one item of a particular type.

Answers

Answer:

Please find the code and its output in the attached file:

Explanation:

In this code a structure "menuItemType" is defined that declared float and integer variable and outside the structure its list type variable "menuList" is defined that holds and calculates its value.

In the next step, a class "Rest" is defined, and inside the class a method "getData", "showMenu", and "printCheck" is defined, in which the above methods uses the switch for input and calculate the value and the last "printCheck" calculates the Tax and Amount Due value.

In the main method, a class object is created that prints message and call the above method.

Draw TOUT Uw Use the space below to draw your own image with the shapes. Then see if you can communicate it to your partner to draw using the shape drawing tool in Game Lab. You can also give your drawing to another group to use as a challenge 0 50 100 150 200 250 300 350 400 Shape Size These shapes are the correct size 50 100 Pattern Reference If you don't have red, green, or blue to draw with fill in the patterns or colors you'll use instead 150 200 Red 250 Green 300​

Answers

Answer:

um

Explanation:

Mark is a stockbroker in New York City. He recently asked you to develop a program for his company. He is looking for a program that will calculate how much each person will pay for stocks. The amount that the user will pay is based on:


The number of stocks the Person wants * The current stock price * 20% commission rate.


He hopes that the program will show the customer’s name, the Stock name, and the final cost.


The Program will need to do the following:


Take in the customer’s name.

Take in the stock name.

Take in the number of stocks the customer wants to buy.

Take in the current stock price.

Calculate and display the amount that each user will pay.

A good example of output would be:

May Lou
you wish to buy stocks from APPL
the final cost is $2698.90

Answers

ok sorry i cant help u with this


Effects of disregarding to ignoring computer problems

Answers


-It can cause damage to essential computer hardware.

-It can also lead to electric shock circuit that may cause fire.

-Loss of information and data.

Consider the definition of the Person class below. The class uses the instance variable adult to indicate whether a person is an adult or not.

public class Person
{
private String name;
private int age;
private boolean adult;
public Person (String n, int a)
{

name = n;
age = a;
if (age >= 18)
{
adult = true;
}
else
{
adult = false;
}
}
}

Which of the following statements will create a Person object that represents an adult person?

a. Person p = new Person ("Homer", "adult");
b. Person p = new Person ("Homer", 23);
c. Person p = new Person ("Homer", "23");
d. Person p = new Person ("Homer", true);
e. Person p = new Person ("Homer", 17);

Answers

Answer:

b. Person p = new Person ("Homer", 23);

Explanation:

The statement that will create an object that represents an adult person would be the following

Person p = new Person ("Homer", 23);

This statement creates a Person object by called the Person class and saving it into a variable called p. The Person method is called in this object and passed a string that represents the adult's name and the age of the adult. Since the age is greater than 18, the method will return that adult = true.

The other options are either not passing the correct second argument (needs to be an int) or is passing an int that is lower than 18 meaning that the method will state that the individual is not an adult.

Drag the tiles to the correct boxes to complete the pairs.
Match each type of database to its application
Multistage
Stationary
Distributed
Virtual
used for concise as well as detailed
historical data
arrowRight
used where access to data is rare
arrowRight
used for accessing data in diverse
applications using middleware
arrowRight
used by an organization that runs
several businesses
arrowRight

Answers

Answer:

1. Multistage database.

2. Stationary database.

3. Virtual database.

4. Distributed database.

Explanation:

A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to create, store, modify, retrieve and manage data or informations in a database. Generally, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.

There are four (4) major types of database in a data warehouse and these are;

1. Multistage database: used for concise as well as detailed historical data. It provides summarized data which can be used by an employee for short-term decision making.

2. Stationary database: used where access to data is rare i.e business firms who do not access data frequently. In order to use this database, the users must have an access to metadata store and thus, directly having access to the data on a source system.

3. Virtual database: used for accessing data in diverse applications using middleware. This type of database is dependent on having access to information on various databases.

4. Distributed database: used by an organization that runs several businesses. Therefore, this type of database are usually located or situated in various geographical regions.

Write a function called is_present that takes in two parameters: an integer and a list of integers (NOTE that the first parameter should be the integer and the second parameter should be the list) and returns True if the integer is present in the list and returns False if the integer is not present in the list. You can pick everything about the parameter name and how you write the body of the function, but it must be called is_present. The code challenge will call your is_present function with many inputs and check that it behaves correctly on all of them. The code to read in the inputs from the user and to print the output is already written in the backend. Your task is to only write the is_present function.

Answers

Answer:

The function in python is as follows

def is_present(num,list):

    stat = False

    if num in list:

         stat = True

       

    return bool(stat)

Explanation:

This defines the function

def is_present(num,list):

This initializes a boolean variable to false

    stat = False

If the integer number is present in the list

    if num in list:

This boolean variable is updated to true

         stat = True

This returns true or false        

    return bool(stat)

In this programming assignment, you will write a simple program in C that outputs one string. This assignment is mainly to help you get accustomed to submitting your programming assignments here in zyBooks. Write a C program using vim that does the following. Ask for an integer input from the user. Do not print any prompt for input. If the number is divisible by 3, print the message CS If the number is divisible by 5, print the message 1714 If the number is divisible by both 3

Answers

Answer:

In C:

#include <stdio.h>

int main() {

   int mynum;

   scanf("%d", &mynum);

   if(mynum%3 == 0 && mynum%5 != 0){

       printf("CS");    }

   else if(mynum%5 == 0 && mynum%3 != 0){

       printf("1714");    }

   else if(mynum%3 == 0 && mynum%5 == 0){

       printf("CS1714");    }

   else    {

       printf("ERROR");   }

   return 0;

}

Explanation:

This declares mynum as integer

   int mynum;

This gets user input

   scanf("%d", &mynum);

This condition checks if mynum is divided by 3. It prints CS, if true

   if(mynum%3 == 0 && mynum%5 != 0){

       printf("CS");    }

This condition checks if mynum is divided by 5. It prints 1714, if true

   else if(mynum%5 == 0 && mynum%3 != 0){

       printf("1714");    }

This condition checks if mynum is divided by 3 and 5. It prints CS1714, if true

   else if(mynum%3 == 0 && mynum%5 == 0){

       printf("CS1714");    }

This condition checks if num cannot be divided by 3 and 5. It prints ERROR, if true

   else    {

       printf("ERROR");    }

Please help! I don’t know the answer to it :( it’s Fashion marketing

Answers

Answer:

I believe the answer should be C)

Sorry if it’s wrong,but hope it helps

The default print setting for worksheets is________
Print Vertically
Print Selection
Print Entire Workbook
Print Active Sheets

Answers

Answer:

Print Active Sheets .

Explanation:

This question refers to the default printing system of the Excel program. Thus, when printing a job using this program, the default option will print all the active sheets, that is, all those spreadsheets where information has been entered. To be able to print in another option, such as selecting certain cells, rows or columns, you must configure the printing for this purpose.

Write a method that evaluates to true or false depending on whether a box completely fits inside another:
public boolean nests( Box outsideBox )
This is potentially a difficult method, since the box may fit or not fit depending on how it is rotated. To simplify the method, write it so that it returns true if the two boxes nest without considering rotations (so height is compared to height, length compared to length, and so on.)

Answers

Answer:

box outside box

Explanation:

It is used to display a window with many options, or buttons, in Easy GUI. It can be used in situations when it is necessary to determine which option is the first selection because it returns 1 for buttons with index 0 and 0 for buttons with other indexes.

What public boolean nests contain box outside box?

One of the built-in data types in Python is the Boolean type. It serves as a representation of an expression's truth value. For instance, the statement 0 == 1 is False while the statement 1 = 2 is True.

To write effective Python code, one must have a solid understanding of how Python's Boolean values operate.

A boolean value describes the checked attribute. Whenever it is present, it indicates that a checkbox next to an input> element should be selected (checked) before the page loads.

Therefore,  The checked attribute can be applied to both checkbox and radio input types. Additionally, JavaScript can be used to modify the checked attribute after the page has loaded.

Learn more about boolean nests here:

https://brainly.com/question/28660200

#SPJ5

Which of the statements below are true? Which are false?

a. In polling, I/O devices set flags that must be periodically checked by the CPU.
b. When using interrupts, the CPU interrupts I/O devices when an I/O event happens.
c. The overhead of polling depends on the polling frequency.
d. Polling is often a viable option for slow and asynchronous devices.
e. Synchronous I/O cannot be done with interrupts.
f. User processes are always blocked during asynchronous I/O operations.
g. Traps are software-generated interrupts.
h. System-calls can be implemented using either traps or polling.
i. DMA usually improves the overall system performance.
j. DMA is necessary for asynchronous I/O transfers

Answers

Answer:

a. True

b. False

c. False

d. True

e. True

f. True

g. False

h. True

i. False

j. False

Explanation:

Polling is a technique in which users are connect externally and programs are run by synchronization activity. The users are allowed to set flags for devices which are periodically checked. The end user can implement system calls using the polling technique.

PLEASE HELP
This graph shows the efficiencies of two different algorithms that solve the same problem. Which of the following is most efficient?

Answers

Answer:

D is correct

Explanation:

Think of it by plugging in values. Clearly the exponential version, according the graph, is more efficient with lower values. But then it can be seen that eventually, the linear will become more efficient as the exponential equation skyrockets. D is the answer.

In the following code segment, assume that the ArrayList numList has been properly declared and initialized to contain the Integer values [1, 2, 2, 3]. The code segment is intended to insert the Integer value val in numList so that numList will remain in ascending order. The code segment does not work as intended in all cases.

int index = 0;
while (val > numList.get(index))
{
index++;
}
numList.add(index, val);

For which of the following values of val will the code segment not work as intended?

a. 0
b. 1
c. 2
d. 3
e. 4

Answers

Answer:

e. 4

Explanation:

The code segment will not work as intended if the value of the variable val is 4. This is because the while loop is comparing the value of the variable val to the value of each element within the numList. Since there is no element that is bigger than or equal to the number 4, this means that if the variable val is given the value of 4 it will become an infinite loop. This would cause the program to crash and not work as intended.

The program illustrates the use of while loops.

The code segment will not work as intended when the value of val is 4

Loops

Loops are used to perform repeated operations

The program

From the program, the while loop is repeated under the following condition:

val > numList.get(index)

This means that:

The loop is repeated as long as val has a value greater than the index of numList (i.e. 3)

From the list of options, 4 is greater than 3.

Hence, the code segment will not work as intended when the value of val is 4

Read more about loops at:

https://brainly.com/question/19344465

Other Questions
The Mesozoic era is known as the Age of Reptiles because dinosaurs were common throughout the era. Why are no dinosaur fossils found in rocks that are younger than those formed during the Mesozoic era?A.Dinosaurs became extinct.B.Dinosaurs moved to other areas.C.Dinosaurs evolved into mammals.D.Dinosaurs stopped fossilizing. Evaluate the expression when b=-6 and y=4.b-6y Imagine you wrote a book about yourself and you have to come up with a title of your book....what would it be? There are 60 markers in a bucket and 15% of them don't work. How many markers DO work? 2.5% of what number is 14? Tamu ran 30 minutes and burned 170 calories. PART B: How many calories did Tamu burn per minute? Write your answer as a decimal. * What is 1 whole and 1/3 - 5/6? list the three conflict management types and explain thedifferences between them: The following question references the novel The Call of the Wild by Jack London.What does Buck do to symbolize that he has joined the call?a. He kills a moose.C. He eats a deer with the timber wolf pack.b. He sits and howls. d. He returns to the camp and lays near the fire.Please select the best answer from the choices providedBD who fought in the peloponnesian war? Dawg Town produces dog tags and bowls with the name of your dog permanently etched into a stainless steel label. Indirect etching costs are allocated to tags and bowls based on the amount of time spent on the laser etching machine. The company has budgeted etching costs of $4,224 per month and expects to spend 4,800 hours on the etching labels each month. Each dog tag uses 24 minutes and each bowl uses 6 minutes of laser etching time. How much of the etching costs will be allocated to each dog tag Humans have three types of cone cells in their eyes, which are responsible for color vision. Each type absorbs a certain part of the visible spectrum. Suppose a particular cone cell absorbs light with a wavelength of 519.nm. Calculate the frequency of this light. Round your answer to 3 significant digits. A line segment has the endpoints (-7, -4) and (9,8). What are the coordinates of the midpointof this line segment?A. (2, 4)B.(-1,2)C. (-1,-6)D.(-8, 2)E.(-2,-4)F.(1, 2) What is the solution to the inequality -7(1+5m)-29 PLEASE HELP ASAPAnswer correctly Alton planted a 4 1/6 foot poplar tree in his front yard last year. This year the tree is 8 3/4 feet tall. How manu getting has it grown this year 5x - 70 = 10 X = Ill give brainliest for first answer Choose the term that best matches the definition.v rules used by a computer network.A. Network protocolB. Hierarchy protocol C. Procedure Which best describes an employer of Consumer Services Workers? a manager of a retail store a principal of a private school a worker in a spa archbishop in a church Complete the sentence with the correct form of aimer:Alex et moi n' pas les films.aimezO aimentaimesaimons