Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. Suppose the folowing code is written to define variables called ny dub and yo

ID: 3753412 • Letter: 4

Question

4. Suppose the folowing code is written to define variables called ny dub and your dub to store arrays of doubles. What statement below is true double your dub-114.3, 10.8. 5.0) a. the array contents of ny dub and your dub are stored on the heap b. the array contents of my dub and your dub are stored on the stack c. the array contents of ny dub is stored on the stack; the array contents of your the array contents of my dub is stored on the heap: the array contents of your dub is stored on the stack dub is stored on the heap d. 5. Consider the following code snippet int my arel1-11, 2, 3, 45 What is the value of (your arr (21)7 a. b. 2 C. 5 d. 6 e. Error: array out of bounds 6. Suppose the following code is written in main, all necessary libraries are included, the code compiles and is executed: int arll-(10, 15,20,25,0 int par: int out0 while (out-p printrrid",out) What is printed? a. 10 15 20 25> b. 10 15 20 25 c. 10 15 20 25 d. Segmentation error e. None of the above

Explanation / Answer

4) Answer:d
d.the array contents of my-dib is stored on the heap; the array contents of your_dub stack

Reason: memory created dynamically will get created in heap section where as stack is used for static memory allocation. malloc is a command used to create memory dynamically

5) The answer is 5.

your_arr[0],your_arr[1],your_arr[2] will contain address of my_arr[2],my_arr[1],my_arr[4]

and * is way of accessing the content in given address so,

*your_arr[0] will contain 3
*your_arr[1] will contain 1
*your_arr[2] will contain 5

your_arr is of length 3 with indexex 0,1,2

6) Answer: C

After reading all the values till 25 and printing them to console the last value of array 0 will come to the condition check and out value becomes zero.Hence the loop breaks.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote