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
madreJ [45]
3 years ago
7

What is the output of the following program? #include using namespace std; void doSomething(int&); int main() { int x = 2; c

out << x << endl; doSomething(x); cout << x << endl; return 0; } void doSomething(int& num) { num = 0; cout << num << endl; }
Computers and Technology
1 answer:
Whitepunk [10]3 years ago
4 0

Answer:

The output will be as following:-

2

0

0

Explanation:

The function doSomething accepts the argument as reference.So whatever changes are made in the function to the argument the changes will be reflected onto the original arguments.

First the value of x is 2.Hence  2 is printed first.

Then function doSomething is called that changes the value of x from 2 to 0 and then prints it.Hence 0 is printed in the newline.

Then in the main function x is printed again the function changed it's value so 0 is printed.

You might be interested in
Which of the following is NOT shown on a PERT chart? (Points : 2) Scheduled start date
Reptile [31]

Answer:

Estimated Duration

Explanation:

A PERT Chart is a tool in Project Management that gives a graphical portrayal of an undertaking's timetable. The Program Evaluation Review Technique abbreviated as PERT separates the individual assignments of a venture for investigation.  

The most widely recognized components utilized in a PERT chart are:  

  • Span time.  
  • Activity
  • Early finish time.  
  • Early Ending time
  • Late initiation time.  
  • Late completion time.  
  • Critical path
  • Slack.  

It does not include the Estimated span of time.

4 0
3 years ago
Write a function named countEvens that counts and returns the number of even integers in an array. The function must have this h
skelet666 [1.2K]

Answer:

function countEvens(list) {

   // IMPLEMENT THIS FUNCTION!

var even = [];

 

for(var i = 0; i < list.length; i++){

 if (list[i] % 2 == 0){

   even.push(list[i]);

   

 }

}

 return console.log(even)

}

var list = [ 17, 8, 9, 5, 20 ];

var count = countEvens(list);

Explanation:

The programming language used is JavaScript.

An even variable is initialized, to hold  the even variables within list.

A FOR loop loop iterates through all the elements in the list, an IF statement is used to check using the modulo division to check if the elements in the list are even.

The even elements are appended to the even list using .push() method.

Finally, the function returns the even list and outputs the list to the log using console.log(even) .

A list is created and the function is called.

4 0
3 years ago
Password procedures, information encryption software, and firewalls are examples of measures taken to address:
Gnoma [55]
<span>Password procedures, information encryption software, and firewalls are examples of measures taken to address are all measures taken to safeguard information security and protect users data from being tampered or manipulated by invaders. 

In web, if we leave our information without encryption or if we leave our system without firewall, different types of security threats might arise: such as, information being hacked, manipulated or sent to wrong places. To avoid this information encryption is done. We might also need to firewall our system so that we can avoid unwanted access and invading of our privacy using malwares and other tools. </span>
5 0
4 years ago
Hi I legit hate coding idk y
Anton [14]
Don’t worry dude I don’t either lol
8 0
3 years ago
What should you do with a wireless-capable laptop if you connect a lan cable to it?
marusya05 [52]
A local-area network (LAN<span>)  cable is used in LAN networks to connect several computers or other networking devices.</span>
If you connect a LAN cable to a wireless-capable laptop you should turn the wireless capability off to maximize security, because through the LAN cable viruses can be transmitted, than can harm your computer.

6 0
3 years ago
Read 2 more answers
Other questions:
  • How do you jumpstart a car in the middle of nowhere??? Explain using 2 paragraphs.
    14·2 answers
  • What does Tristan need to do to add a row at the<br> bottom of the table shown?
    6·1 answer
  • The fastest way to get help is to type a word or two in the search box.
    7·1 answer
  • A _______ is a shortcut to a web page saved in a list in the internet explorer desktop application.
    14·1 answer
  • Help with computer. homework
    15·1 answer
  • PowerPoint is a visual aid for many speakers. Discuss some points to remember when adding text to a PowerPoint presentation. How
    8·1 answer
  • Which information can you apply to every page of your document with the page layout options?
    9·1 answer
  • 500 word career report, auto care
    15·1 answer
  • In a complex formula, how does excel determine which calculation to perform first?.
    10·1 answer
  • A web server on your network hosts your company's public website. You want to make sure that an NIC failure doesn't prevent the
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!