Which of the following expressions does NOT compute the average of two integers a and b?

Module 2 Quiz >>> Which of the following expressions does NOT compute the average of two integers a and b >>> Getting Started with Go

 

==============================

Correct! The Replace() function is used to replace the first 2 instances of “ni” with “in”. There are only 2 instances of “ni” in the original string, so all instances of “ni” are replaced.

==============================

That’s right! This code does not compile correctly. The variable y is declared to be a pointer, but x is not a pointer, it is an integer. The statement “x = &y” attempts to assign x to be a pointer to a pointer. Since x is not a pointer at all, this causes an error.

==============================

That’s correct! All of the types are equally accurate. The number of bits only reflect the range of integers (maximum and minimum) that can be represented.

==============================

Correct! The loop generates successive numbers in the fibonacci series. The loop iterates 5 times and x1 and x2 are initialized to the first 2 numbers in the series, so the 7th number in the series is generated, 8.

==============================

==============================

Correct! The integer 10 is assigned to the variable i since Atoi() produces an integer. Variable y then receives a value of 20 since it is i multiplied by 2.

 

Leave a Comment