Given the following: int funcOne(int n) { n *= 2; return n; } int funcTwo(int &n) { n *= 10; return n; } What will the following code output? int n = 30; n = funcOne(funcTwo(n)); cout << "num1 = " << n << endl; Group of answer choices Error num1 = 60 num 1 = 30 num1 = 600 num1 = 300

Answers

Answer 1
Answer:

Answer:

num1 = 600

Explanation:

Given

The attached code snippet

Required

The output of n = funcOne(funcTwo(n));  when n = 30

The inner function is first executed, i.e.

funcTwo(n)

When n = 30, we have:

funcTwo(30)

This returns the product of n and 10 i.e. 30 * 10 = 300

So:

funcTwo(30) = 300

n = funcOne(funcTwo(n)); becomes: n = funcOne(300);

This passes 300 to funcOne; So, we have:

n = funcOne(300);

This returns the product of n and 2 i.e. 300 * 2 = 600

Hence, the output is 600


Related Questions

Write a program that asks the user to enter two numbers,obtains the two numbers from the user and prints the sum,product,difference, and quotient of the two numbers
No Browsing History While using the browser on your tablet, you realize that it is not keeping a history of websites you have visited. Why might this be happening, and what is the first step you will take to correct this problem? Phishing Scam You just received an email message from someone requesting personal identification information. Believing the message was legitimate, you provided the requested information to the original sender. You now realize, however, that you might have fallen victim to a phishing scam. What are your next steps? Suspicious File Attachment You receive an email message that appears to be from someone you know. When you try to open the attachment, nothing happens. You attempt to open the attachment two more times without any success. Several minutes later your computer is running slower and you are having trouble running apps. What might be wrong? Antivirus Software Outdated After starting your computer and signing in to the operating system, a message is displayed stating that your virus definitions are out of date and need to be updated. What are your next steps? Laptop's Physical Security You plan to start taking your laptop to school so that you can record notes in class. You want to make sure, however, that your computer is safe if you ever step away from it for a brief period of time. What steps can you take to ensure the physical security of your laptop?
A firewall is either software or dedicated hardware that exists between the __________ being protected.
Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing lines of asterisks. The first line will have one asterisk, the next two, and so on, with each line having one more asterisk than the previous line, up to the number entered by the user. On the next line write one fewer asterisk and continue by decreasing the number of asterisks by 1 for each successive line until only one asterisk is displayed. (Hint: Use nested for loops; the outside loop controls the number of lines to write, and the inside loop controls the number of asterisks to display on a line.) For example, if the user enters 3, the output would be:_______.a. *b. **c. ***d. **e. *
Perform depth-first search on each of the following graphs; whenever there's a choice of vertices, pick the one that is alphabetically first. Classify each edge as a tree edge, forward edge, back edge, or cross edge, and give the pre and post number of each vertex.

Constructing a concurrent server by spawning a process has some advantages and disadvantages compared to multithreaded servers. Discuss a few.

Answers

Answer:

The advantage and the disadvantage of the relevant query are illustrated in the explanation in the paragraph below.

Explanation:

Advantage:

  • The benefit of creating a simultaneous server through spawning a mechanism seems to be that alternative methods are shielded against everyone else, which would be very necessary whenever the extremely database manages communication services entirely.

Disadvantage:

  • The downside about creating a concurrent system through spawning a methodology seems to be that this process seems to be very expensive but using multicore processing systems should save this expense. It is also easier when using threads again for the aim of communicating between two or even more participants although we stop the kernel executing the correspondence.

When pasting a range cells click the paste options button and then select the transpose option to

Answers

Answer:

Switch rows to column and vice versa

Explanation:

Transpose "pasting option" is used to switch positions of cells from rows to column or from columns to rows depending on the current position of the cells being highlighted.

This can be done in two ways

1. Follow the steps as it is in the question above

2. Use the excel transpose inbuilt function.

Either of these two ways will give the desired result.

But is should be noted that, the transposing cells will not copy the formats (bold, italics, underline, etc.) of the selected range of cells; buy rather only the cell values will be copied.

Lastly, when making use of transpose, cells at the first rows will maintain the first column, those at the second row will maintain the second column, those at the third row will maintain the third column till it gets to the last row and column.

Give a non-network example of hierarchical addressing and discuss how it reduces the amount of work needed in physical delivery. Do not use the postal service, or the telephone network..

Answers

HIERARCHICAL EXAMPLE.

Many examples of hierarchical addressing exists which reduces the amount of work needed in locating or in delivering,and one of such examples is the 'sorting of books in a library'.

Looking at a library having books kept randomly on any stack and shelf,it will make it difficult finding any book easily or locating any book of a specific genre.so,to avoid such problems, books are orderly sorted in a library and each book is given or has a unique identification number.

Books that has the same or related subject are kept in the same stack and books of the same genre are also kept together.

In a library,there are many stacks having different rows.

Take for an example; If one need to find a book on computer network,the user can search for the books in stacks of books that are related to Computer Science instead of searching the whole library for the book.

So,the hierarchical addressing saves lots of work and also time required for searching a specific book in the library.

Python code 100 Random Numbers (twice)python code

instructions:
You need to write code that will print two bricks of numbers, one with integers, one with decimals.

Answers

import random

i = 1

while i <= 100:

   print("#"+str(i)+": "+str(random.randint(1,100)), end=", ")

   i+=1

print()

i = 1

while i <= 100:

   print("#"+str(i)+": "+str(random.uniform(1,100)), end=", ")

   i += 1

I hope this helps!

Which is an example of an operating systema
Adobe Photoshop

b
Internet Explorer

c
Windows

d
Microsoft Word

Answers

Answer:

windows

Explanation:

Examples of Operating Systems

Some examples include versions of Microsoft Windows (like Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP), Apple's macOS (formerly OS X), Chrome OS, BlackBerry Tablet OS, and flavors of Linux, an open-source operating system.

This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width.(1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt)
(2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow base. (1 pt)
(3) Modify the given program to use a loop to output an arrow head of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow head. (2 pts)
(4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow base width. (1 pt)
while (arrowHeadWidth <= arrowBaseWidth) {
// Prompt user for a valid arrow head value
}
Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4:
Enter arrow base height:
5
Enter arrow base width:
2
Enter arrow head width:
4

**
**
**
**
**
****
***
**
*
This is what I have:
import java.util.Scanner;
public class DrawHalfArrow
{
public static void main(String[] args)
{
Scanner scnr = new Scanner(System.in);
int arrowBaseHeight = 0;
int arrowBaseWidth = 0;
int arrowHeadWidth = 0;
System.out.println("Enter arrow base height:");
arrowBaseHeight = scnr.nextInt();
System.out.println("Enter arrow base width:");
arrowBaseWidth = scnr.nextInt();
while (arrowHeadWidth >= arrowBaseWidth)
{
System.out.println("Enter arrow head width:");
arrowHeadWidth = scnr.nextInt();
}
// Draw arrow base (height = 3, width = 2)
for(int i=0; i < arrowBaseHeight; ++i)
{
for(int j=0; j < arrowBaseWidth; ++j)
{
System.out.print("*");
}
System.out.println();
}
// Draw arrow head (width = 4)
for(int i=0; i < arrowHeadWidth; ++i)
{
for(int j=0; j < arrowHeadWidth-i; ++j)
{
System.out.print("*");
}
System.out.println();
}
return;
}
}

Answers

Answer:

The modified program in Java is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

 int arrowHeadWidth, arrowBaseWidth, arrowBaseHeight;

 System.out.print("Head Width: "); arrowHeadWidth = input.nextInt();

 System.out.print("Base Width: "); arrowBaseWidth = input.nextInt();

 System.out.print("Base Height: "); arrowBaseHeight = input.nextInt();

 while (arrowHeadWidth <= arrowBaseWidth) {

       System.out.print("Head Width: "); arrowHeadWidth = input.nextInt();

 System.out.print("Base Width: "); arrowBaseWidth = input.nextInt();      }

 for(int i = 0; i<arrowBaseHeight; i++){

     for(int j = 0; j<arrowBaseWidth;j++){

         System.out.print("*");        }

         System.out.println();    }

 for(int i = arrowHeadWidth; i>0;i--){

     for(int j = 0; j<i;j++){

         System.out.print("*");        }

         System.out.println();    }

}

}

Explanation:

This declares the arrow dimensions

 int arrowHeadWidth, arrowBaseWidth, arrowBaseHeight;

This get input for the head width

 System.out.print("Head Width: "); arrowHeadWidth = input.nextInt();

This get input for the base width

 System.out.print("Base Width: "); arrowBaseWidth = input.nextInt();

This get input for the base height

 System.out.print("Base Height: "); arrowBaseHeight = input.nextInt();

This loop is repeated until the head width is greater than the base width

 while (arrowHeadWidth <= arrowBaseWidth) {

       System.out.print("Head Width: "); arrowHeadWidth = input.nextInt();

 System.out.print("Base Width: "); arrowBaseWidth = input.nextInt();      }

This iterates through the base height

 for(int i = 0; i<arrowBaseHeight; i++){

This iterates through the base width

     for(int j = 0; j<arrowBaseWidth;j++){

This fills the base

         System.out.print("*");        }

This prints a new line

         System.out.println();    }

These iterate through the arrow head

 for(int i = arrowHeadWidth; i>0;i--){

     for(int j = 0; j<i;j++){

This fills the arrow head

         System.out.print("*");        }

This prints a new line

         System.out.println();    }