What are the contents of a after the following events? [code]function p=avg(x) n = length(x); Command Window: >> x=[1 2 3 4 5] >> dbstop

What are the contents of a after the following events?
Code:
function p=avg(x)
n = length(x);
Command Window: 
>> x=[1 2 3 4 5]
>> dbstop in avg at 2 if length(x)>4
>> a=avg(x)
A. Enters debugging mode
B. Error in the command window
C. Error in the function
D. 5
 
Answer: a
Explanation: This is a simple code. The kernel will enter the debugging mode since the condition given by dbstop is not satisfied. The length of the x vector is 5 in the command window which results in the kernel to shift to the debugging mode.
 

Tìm kiếm

Back
Top