Question 1 1 Point Consider the function definition void OhN

Question 1: (1 Point) Consider the function definition void OhNo int& nuuml double num2) num1 num1 2; 2- num1 3.5 num2 What will display after the execution of the following statements? int nl 10 double n2 1.1 ohNo (n1, n2) cout n1 O 10 23 5 O 201.1 O 101.1 O 20 235 20 23

Solution

Question 1)

Answer is :20 1.1

why?
n1 is reference is passed where as n2 only the values is been passed. so what ever the changes took place in OhNo() will reflect to n1 in main but not n2
so the values is been double in num1 in OhNo()
so its been printed as 20 1.1

Question 2)

Answer is :120 10

why?
Same as above question
gamma is reference is passed where as delta only the values is been passed. so what ever the changes took place in OhNo() will reflect to n1 in main but not n2
so the values is been add with 100 to num1 in DoThis()
so its been printed as 120 10

Question 3)

Answer is: false

why?
as because 2.4 is equal to 0.0 so it return false back to called function.

Question 4)

Answer is : 30

Why?

what does justDoIt return
if alpha > beta it return alpha +10
else it return 2 * beta

for the first time, aplha 5 , beta 4 .. it return 15
and second time aplha 5 and , beta 15 ... it return 30
Answer is 30

Question 5)

only statement 1 is correct

as because

statement 1 is been calling with 2 integer parameter
statement 2 fires error ambiguous overload for \'operator>>\'
statement 3 syntax error TopIt(TopIt(3,4),TopIt(1,0);
           correct is TopIt(TopIt(3,4),TopIt(1,0)); missing \')\' at the end

 Question 1: (1 Point) Consider the function definition void OhNo int& nuuml double num2) num1 num1 2; 2- num1 3.5 num2 What will display after the executio

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site