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
What is network topology? PLZZZ HURRY
Mashcka [7]

Answer:

Network topology is the arrangement of the elements (links, nodes, etc.) of a communication network. Network topology can be used to define or describe the arrangement of various types of telecommunication networks, including command and control radio networks, industrial field busses and computer networks.

7 0
3 years ago
8. Given the array String[] words, which already contains 1 or more values, write a block of code which counts and returns the n
Vikentia [17]

Answer:

Following are the code to this question:

public class Main//defining a class

{

public static void main(String[] arg)//defining main method

{

  String[] words={"Key","day", "Know", "kind"};//defining array of String words

  int x=0;//defining integer variable for count value

  for(int i=0;i<words.length;i++)//defining for loop for count value

  {

 if(words[i].startsWith("k")||words[i].startsWith("K"))//use if block to check word start from k

  x=x+1;//increment the value of x

  }

System.out.print("The number of letters which starts from k is: "+ x);//print value with message

}

}

Output:

The number of letters which starts from k is: 3

Explanation:

In this code, inside the main method an array of String "words" is defined that hold a value, and in the next step an integer variable "x" is defined, which is used to count the letters, which starts from k.

For this, a for loop is used that counts the value and in this an, if block is defined that uses the "startsWith" method to check the value and increment the value of x and at the last, it prints its value.

7 0
3 years ago
Hi Lesiana, After your presentation last week, the manager thinks an in-house solution is the way to go. Although our programmer
zlopas [31]

The Hierarchical drawing of the In- House solutions includes Four categories such as product, service, training, support and about.

<h3>What is Hierarchical drawing?</h3>

Hierarchical drawing is also known as Layered Graph Drawing which includes the drawing in the vertices and are made on the Horizontal rows and layers.

The complete solution is attached below.

The In-House solutions' hierarchical diagram covers four categories, including product, service, training, support, and about.

Learn more about Hierarchical drawing here:

brainly.com/question/26031625

#SPJ1

 

3 0
2 years ago
Which of the following statements is NOT a valid way to create a date object named birthday?
dem82 [27]

Answer:

var birthday = "12/2/1978";

Explanation:

It does not create a date object named birthday because in this statement the birthday is a string which contains 12/2/1978 a date it is not date object it is a string.All other three options are correct way to create a date object.

var birthday = new Date();

creates a date object with the current date and time.

we can also pass date string in the new Date().So var birthday = new Date("12/2/1978"); is also correct.

we can also pass year,month,day in new Date() In this order only.So option fourth is also correct.

4 0
3 years ago
When is an original work considered Public Domain? A. When posted via social media. B. When is it posted on the internet C. When
I am Lyosha [343]
<span>Best Answer is (D)
</span>

Any<span> materials not protected by copyright, patent laws or trademark are referred to as copyright. Generally, the public owns these works, and anyone is allowed to use public domain works without obtaining permission. There are various common ways that these works may end up arriving in the public domain. One of those ways includes the expiration of copyright. The copyright owner may also fail to follow renewal rules that govern copyright. </span>The copyright owner may as well decide to place his or her works deliberately in the public <span>domain.</span>

3 0
4 years ago
Other questions:
  • A ___ is the basic collective unit of data in a computer.
    12·1 answer
  • What are some of the potential sources of risk in a systems analysis and design project? How does the project manager cope with
    6·1 answer
  • What question should you ask yourself to determine if a story is newsworthy
    11·2 answers
  • In C, how could I use a command line input to remove certain characters from an existing string? For example, if I have string '
    8·1 answer
  • Which of the following is constantly changing and advancing?
    11·1 answer
  • Global address list characteristics
    11·1 answer
  • What is the next line?
    7·1 answer
  • Find the max and min of a set of values using recursion Find the max and min of a set of values using recursion. First input the
    5·1 answer
  • What is a cpu in full explanation?
    7·2 answers
  • What is the difference between algorithm and program?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!