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
muminat
3 years ago
13

Given the following function definition

Computers and Technology
1 answer:
siniylev [52]3 years ago
3 0

Answer:

B. 1 6 3

Explanation:

Given function definition for calc:

void calc (int a, int& b)

{

int c;

c = a + 2;

a = a * 3;

b = c + a;

}

Function invocation:

x = 1;

y = 2;

z = 3;

calc(x, y);

cout << x << " " << y << " " << z << endl;

  • Since x is passed by value, its value remains 1.
  • y is passed by reference to the function calc(x,y);

Tracing the function execution:

c=3

a=3

b=c+a = 6;

But b actually corresponds to y. So y=6 after function call.

  • Since z is not involved in function call, its value remain 3.

So output: 1 6 3

You might be interested in
When you catch an Exception object, you can call ____ to display a list of methods in the call stack so you can determine the lo
KonstantinChe [14]

Answer:

printStackTrace()

Explanation:

printStackTrace() :- This method is present in Java.lang.Throwable class and it prints this Throwable it also prints other details with throwable like backtrace and class name. printStackTrace() prints a stack trace for this Throwable object on the output stream of standard error. So we conclude that the answer is printStackTrace().

3 0
3 years ago
What are the advantages and disadvantages of the various collision resolution strategies for hashes?
Digiron [165]

Linear probing

It does a linear search for an empty slot when a collision is identified

Advantages

Easy to implement

It always finds a location if there is one

Disadvantages

When clusters and keys fill most of the array after forming in adjacent slots of the table, the performance deteriorates

Double probing/hashing

The idea here is to make the offset to the next position probed depending on the key value. This is so it can be different for different keys.

Advantages

Good for double number generation

Smaller hash tables can be used.

Disadvantages

As the table fills up, the performance degrades.

Quadratic probing

It is used to resolve collisions in hash tables. It is an open addressing scheme in computer programming.

Advantage

It is more efficient for a closed hash table.

Disadvantage

Has secondary clustering. Two keys have same probe sequence when they hash to the same location.

6 0
3 years ago
Read 2 more answers
Given that the variables x and y have already been declared and assigned values, write an expression that evaluates to true if x
Eduardwww [97]

Answer:

The expression to this question can be defined as follows:

Expression:

(x >= 0 && y<0) //check condition using AND operator

Explanation:

In the given question it is defined that x and y are an integer variable that holds some value, in which it defines a condition that checks the value of variable x is positive, and the value of y is negative.

  • To check positive value a condition is used, that checks x greater than equal to 0, and to check negative value, it uses condition, that is y is less than 0.
  • In the above condition, the AND operator is used, which executes when both conditions are true.
3 0
3 years ago
Information systems include all of these
Ulleksa [173]

Answer:

D

Explanation:

because you need people to access software through hardware and data through information and procedures.

4 0
3 years ago
Design the logic for a program that allows a usher to continuously enter numbers until the usher enters 0. Display the sum of th
uysha [10]

int sum = 0, n;

do {cin>>n; sum+=n;}while (n!=0);

cout<<sum;

5 0
3 years ago
Other questions:
  • You're trying to decide which disk technology to use on your new server. the server will be in heavy use around the clock every
    10·1 answer
  • To gain one pound of fat, how many extra calories would you need to consume?
    12·1 answer
  • In your own words, explain the role of scientific investigation in the development of the Theory of Evolution.
    6·1 answer
  • The number of square units required to cover a surface.
    13·1 answer
  • In order to plan George's birthday, his father gave him a list of people who attended his birthday for the last five years. What
    5·1 answer
  • In no less than two paragraphs, explain the risks and compliance requirements of moving data and services into the cloud.
    11·1 answer
  • True or False: <br> The object reference can be used to polymorphically store any class in Java.
    13·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    11·2 answers
  • What is keyboard? answer me <br>​
    12·2 answers
  • How to connect two routers wirelessly to extend range.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!