1.

How would you express a pi as a character and an integer? Choose the correct code.(a) a=pi;b=’pi’;(b) a=22/7; b=pi;(c) a=3.1415; b=22/7;(d) a=3.1429;b=’pi’;This question was posed to me during an interview for a job.I'm obligated to ask this question of Managing Variables in portion MATLAB Basics of MATLAB

Answer»

Correct answer is (a) a=pi;b=’pi’;

The best I can explain: After ENTERING the code in MATLAB, the WORKSPACE VIEW is:

A character VARIABLE is stored by declaring the character value within a pair of single inverted commas. An INTEGER variable is stored by simply declaring the variable with the integer value. pi is stored in MATLAB as an integer value itself of 3.1416.



Discussion

No Comment Found

Related InterviewSolutions