Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is C++ 1 . ) Given the function definition: void something (int a, int&b) { int c; c= a + 2; a= a *

This is C++

1.) Given the function definition:

void something (int a, int&b)

{

int c;

c= a + 2;

a= a * 3;

b= c + a;

}

what is the output of the following code fragment that invokes something?

(All variables are of type int.)

r= 1;

s=2;

t=3;

something(t, s)

cout<

a. 1 14 3

b. 1 10 3

c. 5 14 3

d. 1 14 9

e. None of these

2.) What is the output of the following code fragments?

int trial(int&a, int b)

{

if(b>a)

{

a=b;

return -a;

}

else

{

return 0;

}

}

int x= 0, y=10,z;

z= trial(y,x);

cout<

a. -10 0 0

b. 0 10 0

c. 10 0 0

d. 0 0 10

3.) What does the following function do?

double min(int x, int y, int z){

if(x>y){

if (y>z) return z;

else return y;

}

else{

if (x>z) return z;

else return x;

}

}

a. returns the minimum value among x, y, and z

b. it actually return the maximum value among x, y, and z although the function name is min

c. there is a syntax error

d. there is a logical error

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What are copyrights and how are they used?

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago