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
disa [49]
3 years ago
14

Write a recursive function that receives an array of integers and a position as parameters and returns the count of odd numbers

in the array. Let each recursive call consider the next integer in the array.
Computers and Technology
1 answer:
Amiraneli [1.4K]3 years ago
8 0

Answer:

The following are the description of the recursive method:

public int recursive(int[] x1, int position) //defining a method recursive  

{

   if(position<x1.length) //defining if block that checks position value is less then array length

   {

       if(x1[position]%2==0) //defining if block that checks in array there is even number  

       {

           return 1+recursive(x1, position+1); //use return keyword to call method by incremnent value  

       }

       else//defining else block

       {

           return recursive(x1, position+1);//use return keyword to call method and add 1 in position value

       }

   }

   else//defining else block

   {

       return 0;//return value 0

   }

}

Explanation:

In the given code, a recursive method is declared, that accepts two integer variable "x1 and position", in which "x1" is an array variable, that pass in the function parameter.

In the method, the if block is used that checks the position values is less then array length. Inside this another, if block is used, that checks in the array there is an even number.

In the condition is true, it will call the method by adding the 1. otherwise, go to the else block, in this, it will call the method and add 1 in position variable.  

if the above condition is false, it will go to else block and return a value, that is "0".  

You might be interested in
A student is curious about how a Web site appears on his computer screen. On a piece of paper,
Temka [501]

Answer:

When you go out to open a web page then you should know that It’s not the OSI model that comes into the picture, and in fact, it is just for study purposes, and it does not work in real network work, The exact one used is the TCP/IP model. However, the OSI model separates the concepts into various layers, and hence used for study purposes.

When you try to open a web address through a web browser, then the web browser uses the HTTP that is an Application layer protocol.

The web browser thus finds the IP address of the URL through the Domain Name System. And this is as well the Application layer protocol.

However, you will find that the actual process is even more complex.

The browser now forms an HTTP packet which mentions, “Hello I would like to get the web page from the server”. Now the browser sends the HTTP packet to the TCP, which stands for Transmission control protocol, and is a transport layer protocol.

Here the adjacent layer interaction works. However, that is on the same device, and currently, the packet is on your PC only. The ALI states that the higher layer asks the next lower layer protocol to get done the service, and the lower layer delivers the service to the higher layer just above it. And this interaction gets repeated until the data finds itself at the lowest layer.

The main job of the TCP is to create a pipe in between you and the server, such that the data can be transferred via the pipe. And for this the TCP on your PC talks to the TCP on the server.

Now the TCP puts up its details over the HTTP packet. And these are necessary for managing the pipe/session.

Now the packet is handed to the IP process or the internet protocol, which is an internet layer protocol. The main task performed by the IP is addressing and routing. It's like a postal service, that routes the letter via various postal offices to reach the correct one. IP now puts its info on top of the TCP packet. This info is required for routing on the internet.

The packet is now handed over to the network access or the network interface layer. And this defines the hardware and protocols that are required for delivering the data via the physical network. The majority of the times the physical network used is the Ethernet.

Your PC now binds the IP packet in between the Ethernet header and the Ethernet trailer, and thus forms an Ethernet frame. You should know that Ethernet has a MAC address that is being made use of for sending the frame within the LAN.  And now the PC transmits the Ethernet frame bits physically with the help of the electricity that flows through the Ethernet Cables.

The packet now reaches the server. The web server recreates the bits through the interpretation of the electrical signals. And the webserver now removes and discards the ethernet header and trailer from the ethernet frame, and de encapsulates it. And in the same manner, it reads through the TCP data, and finally transfers that to the HTTP process which can figure out the HTTP get request.

Now the webserver in s similar manner sends back the detail. And this process can be repeated any number of times.

Also, keep in mind that in case of secure website, there is one extra step, and that is the verification of the SSL certificate, at both the client and server end. Rest of the process is same.

Explanation:

Please check the answer section.

6 0
3 years ago
Digital art is created by using __?
taurus [48]
A paint or art program on your computer.
7 0
3 years ago
Carbon monoxide poisoning can result from breathing
Mamont248 [21]
The answer is the letter a
6 0
3 years ago
Rose has a list of two columns of information separated by tabs. She wants to input this information into a table. What is the f
andreev551 [17]
I gotchu my bro!!
it would be D. " clicking Convert Text to Table"
7 0
3 years ago
Read 2 more answers
PLS HURRY!
Debora [2.8K]

Answer:

D. All of the options listed are correct.

Explanation:

A macro, in excel sheet, is an action or series of action that repeats the keystrokes or mouse actions as many times as one wants. To view macro, shortcut key is to Pres Alt+F8; to delete, one needs to select the macro one wants to delete and press Delete button.

The another way to view macro is to go to the Developer tab, and select the Macro option in Code group. And, then select macro need to delete, and press Delete button.

Another shortcut is to press Alt+F11, and click  on Tools tab, click on Macros and then select macro need to be deleted, and press Delete.

So, all the options stated above are correct.

Therefore, option D is correct answer.

8 0
3 years ago
Other questions:
  • When is a wrecker considered to be an emergency vehicle?
    12·1 answer
  • An investment website can tell what devices are used to access the site. The site managers wonder whether they should enhance th
    10·1 answer
  • Does anyone know websites that have free to use images, such as the website "wikimedia"? I like that one the best but it doesn't
    5·1 answer
  • Why is it preferable to code web pages in HTML format?
    6·2 answers
  • How do you give brainlest things out?
    14·2 answers
  • 2.11 (Separating the Digits in an Integer) Write a script that inputs a five-digit integer from the user. Separate the number in
    12·1 answer
  • 8.10 Code Practice Question 1
    12·1 answer
  • A Development team begins work on a new software application and decides to involve the client’s IT experts to ensure that secur
    12·1 answer
  • Can you help me with Computer issues graphic organizer?<br> Will give out brainly
    6·1 answer
  • Which coding manual contains three to seven character codes with a decimal after the third character
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!