What is the output of the following code? [code]disp(‘ ‘,lola!’ 2’)[/code]

Danh Trịnh

New member
What is the output of the following code?
Code:
disp(‘ ‘,lola!’ 2’)
A. ‘lola!’ 2
B. ‘ ‘lola!’ 2’
C. ‘lola! 2’
D. Error due to multiple arguments
 
Answer: d
Explanation: Within the ‘’, when we’re giving input to the disp command, the we cannot include another set of ‘’. This will given an error. The next set of ‘’ will be treated as an extra character argument while the first set of ‘’ will close itself once we give a ’ for our first set of single-inverted commas. This means, in the above command, after disp(‘ ‘..) the input argument is already taken as a space character by the command while starting from lola.. the entire thing is another argument.
 

Tìm kiếm

Back
Top