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
Stolb23 [73]
4 years ago
10

c++: The variables arr1 and arr2 have been declared as pointers to integers . An array of 10 elements has been allocated, its po

inter assigned to arr1, and the elements initialized to some values . Allocate an array of 20 elements , assign its pointer to arr2, copy the 10 elements from arr1 to the first 10 elements of arr2, and initialize the remainder of the elements of arr2 to 0.
Computers and Technology
1 answer:
amm18124 years ago
6 0

Explanation:

Two variables named arr1 and arr2 have been declared as pointers to integers and arr1 is allocated 10 elements and initialized to some values.

Lets allocate 20 elements to arr2  

int *arr2 = new int[20];

Now using for loop we can copy 10 elements from arr1 to the first 10 elements of arr2

start from k = 0 and k < 10

for (int k = 0; k < 10; k++)

{

arr2[k] = arr1[k];

}

Again using for loop we can initialize the last 10 elements of arr2 to zero.

start from k = 10 and k < 20

for (int k = 10; k < 20; k++)

{

arr2[k] = 0;

}

You might be interested in
Consider the following method, which is intended to return the number of local maximum values in an array Local maximum values a
Setler79 [48]

Answer:

Replace the comment with:

int p = 1; p < data.length - 1; p++

Explanation:

See attachment for proper format of the code

The loop header is expected to test if the current element is greater than the adjacent elements (i.e. array elements before and after it)

It should be noted that the first element of the array (index 0) has not element before it and the last element of the array has no element after it.

So, the loop header must start from index 1 and end at the last index - 1

The option that illustrates this is:

int p = 1; p < data.length - 1; p++

4 0
3 years ago
What is one of the benefits of using a library in a program?
Phoenix [80]

Answer:

Simplifies creating a complex program

Explanation:

7 0
3 years ago
What type of network does not have centralized control, such as one in a small office or home office?
ella [17]
The answer is P.2.P

:)
7 0
4 years ago
Which best compares portrait and landscape orientations?
julsineya [31]
#2: Portrait taller than wide & landscape wider than tall
8 0
3 years ago
Whichof the following is not a standard method called as part of the JSPlife cycle?jspInit()jspService()_jspService()jspDestroy(
olga nikolaevna [1]

Answer:

jspService()

Explanation:

These are the steps in JSP life cycle-

1. We have to convert JSP page to Servlet.

2.Then we compile the JSP page which convert it into test.java

3. In test.java ,we load the classes(test.class) in container.

4. Object(instance) is created in container .

5. Then, we initialize the init() method at the time of servlet generation.  

6. After the initialization,for the requests we use _jspService() method to serve the incoming requests from JSP.

7. When the work of JSP is completed, we remove it from container by the help of jspDestroy() method.

There is no jspService() method in the JSP life cycle.

7 0
3 years ago
Other questions:
  • Using the CPI to calculate the inflation rate​ _______________ the underlying inflation​ rate, and using the core inflation rate
    7·2 answers
  • Alto Innovations creates custom software for organizations. The company's managers want to build a high-performance culture in t
    11·1 answer
  • A database administrator (DBA) must have a clear understanding of the fundamental business of an organization, be proficient in
    11·1 answer
  • What are three to five (3-5) key differences and features in Windows Server 2016 versus 2012?
    14·1 answer
  • In graphical linear programming to maximize profit, the objective function is: I. a family of parallel lines. II. a family of is
    11·1 answer
  • 6-1) (Math: pentagonal numbers) A pentagonal number is defined as n(3n–1)/2 for n = 1, 2, . . ., and so on. Therefore, the first
    10·1 answer
  • Finish the program to compute how many gallons of paint are needed to cover the given square feet of walls. Assume 1 gallon can
    9·1 answer
  • It is acceptable to create two TCP connections on the same server/port doublet from the same client/port doublet. True False
    9·1 answer
  • You are configuring a network and have been assigned the network address of 221.12.12.0. You want to subnet the network to allow
    7·1 answer
  • Two negative reviews and no positive reviews is enough to consider the website to have a negative reputation.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!