Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the purpose of the line command if the plot command can be used to directly accept the arguments and generate a plot?(a) Saves complexity(b) We can refrain from using the hold function(c) There is no separate, definite purpose(d) Cannot concludeI got this question in an interview for job.This interesting question is from Plotting Multiple Curves in section MATLAB Basics of MATLAB

Answer»

Correct option is (d) Cannot conclude

For explanation: The use of the line command is primarily seen in plotting the graphs without the HOLD command. But we can put the ARGUMENTS within the plot command itself so that we don’t have to put an EXTRA line of code. This SAVES COMPLEXITY, although we have increased the length of our code.

2.

What would you use to show comparisons of profit of 3 industries over 3 quarters?(a) Histogram plot(b) Bar plot(c) Bode plot(d) Frequency plotThe question was posed to me in unit test.My enquiry is from Statistics in portion MATLAB Basics of MATLAB

Answer»

Right OPTION is (b) Bar PLOT

The EXPLANATION: The data contains 3 parameters- profit, industry, quarter. We can use the histogram plot if the profits are strikingly different but usually it is not so. So, we should use Bar plot to draw 3 BARS for 3 industries showing 3 separate profits over 3 separate quarters.

3.

How does MATLAB help in passing function arguments?(a) By call by value and call by reference(b) Only by call by value(c) Only by call by reference(d) By call by addressI had been asked this question in homework.This interesting question is from Functions in chapter MATLAB Basics of MATLAB

Answer» CORRECT option is (a) By call by value and call by reference

To explain I would SAY: Like C, MATLAB allows to pass almost all arguments by value. But, if the argument passed into the function is only for mathematical purpose then it is passed as a reference. This helps in SAVING the memory reserved for the ORIGINAL value of the argument.
4.

If the dimensions of vectors don’t match, the plot command will always give an error.(a) True(b) FalseThis question was addressed to me in an internship interview.This is a very interesting question from Vectors and Matrices in portion MATLAB Basics of MATLAB

Answer» RIGHT OPTION is (b) False

The best I can EXPLAIN: In the following case: plot([a],[1:10]), the plot command takes x as [a-1:.2:a+1]. Hence, the above statement is not true. A GRAPH will EVENTUALLY get plotted.
5.

Which operator set is used for left and right division respectively?(a) .\ and ./(b) ./ and .\(c) Left division and right division is not available in MATLAB(d) / and \This question was posed to me in quiz.I need to ask this question from Vectors and Matrices topic in chapter MATLAB Basics of MATLAB

Answer»

Correct choice is (a) .\ and ./

Explanation: In MATLAB, if we WANT to perform left division of TWO matrices we NEED to write a.\b while for the right division we have to write a./b. for left division respectively.

6.

Choose the correct option as an inference from the following workspace view.(a) ‘ans’, ‘p’ and ‘ap’ are double variables(b) ‘ans’ and ‘p’ are double variables while ‘c’ is a character variable(c) ‘ap’ is symbolic object, ‘c’ is a double variable(d) ‘c’ is a symbolic characterI had been asked this question by my college director while I was bunking the class.This interesting question is from Managing Variables topic in section MATLAB Basics of MATLAB

Answer» CORRECT answer is (b) ‘ans’ and ‘P’ are DOUBLE variables while ‘c’ is a character variable

For EXPLANATION I would SAY: It is to be noted that ‘ans’ and ‘p’ are double integer variables, ‘c’ is a character variable while ‘ap’ is a symbolic object.
7.

MATLAB stands for?(a) matrix laboratory(b) math library(c) matric library(d) matrix libraryI have been asked this question in homework.This key question is from Input and Output in chapter MATLAB Basics of MATLAB

Answer»

Correct choice is (a) matrix LABORATORY

Explanation: MATLAB stands for matrix laboratory which is multi-paradigm numerical COMPUTING environment and fourth-generation PROGRAMMING LANGUAGE.

8.

A student has to find the solution of an equation cos(x)=1/2. She has to write the program such that exact values are shown at output. Which of the following codes would help her?(a) syms x;eqn = cos(x) == 1/2;vpa( solve(eqn,x))(b) syms x;eqn = cos(x) == 1/2;solve(eqn,x)(c) vpa(solve(‘cos(x)=1/2’))(d) syms x;eqn = cos(x) = 1/2;vpa(solve(eqn,x))The question was asked in homework.My enquiry is from Solving Equations topic in portion MATLAB Basics of MATLAB

Answer»

The CORRECT answer is (c) vpa(solve(‘cos(x)=1/2’))

The explanation is: To find the exact value of non-integer constants, we use the function ‘vpa()’. MATLAB won’t understand SIN(x)=1 as an equation until we initialise x as a symbolic VARIABLE. syms x;eqn = cos(x) == 1/2;vpa( solve(eqn,x)) would’ve generated the same answer but it has 3 LINES while vpa(solve(‘cos(x)=1/2’)) has only 1 line. Once we introduce the variable x as a string, MATLAB understands that it is a symbolic object.

9.

What is the difference between the expressions (9*1-8) & (9-1*8)?(a) Computational difference(b) Final results are different(c) No difference(d) Cannot be determinedThis question was addressed to me by my school teacher while I was bunking the class.My question is from Variables and Assignments in division MATLAB Basics of MATLAB

Answer»

The correct answer is (a) Computational difference

For EXPLANATION: MATLAB follows a precedence of operators while doing any computation. So (9*1-8) is DONE like this: 9*1-8=9-8=9. But (9-1*8) is done like this: 9-1*8=9-8=1. Even though the answers are same, there is a computational difference between evaluation of the TWO expressions in MATLAB.

10.

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.

11.

The student receives an error while trying to plot multiple graphs using the hold command. What is there error if there is no a syntactical error?(a) Cannot be determined(b) The plot function is not defined with a constant variable range(c) There is no hold command(d) There has to be a syntactical error onlyThe question was asked in semester exam.The origin of the question is Plotting Multiple Curves in section MATLAB Basics of MATLAB

Answer»

Correct answer is (b) The PLOT function is not defined with a constant variable RANGE

For explanation: If the student is USING the hold command, the student has to keep the SCALE and range of one axis same. Then he can plot the functions of other dependent variables, which depend on the independent variable range previously defined. If the plot function contains an ENTIRELY different set of arguments, MATLAB will produce an error.

12.

What is the difference between hold on and hold all?(a) no difference(b) hold all holds every plot while hold on holds a specific plot in the chain of argument(c) hold all does not exist(d) hold on is syntactically incorrectI got this question in final exam.My query is from Plotting Multiple Curves in chapter MATLAB Basics of MATLAB

Answer»

Right answer is (a) no difference

Explanation: Both HOLD on and hold all COMMANDS are used to hold the graph of a FUNCTION. There is no difference between them. To avoid confusion, one can only WRITE hold to hold a graph and again enter the COMMAND hold to release the graph.

13.

If we want to plot matrix arguments, which of the following gets plotted?(a) Column wise inter-relation of two arguments(b) Row wise inter-relation of two arguments(c) Diagonally inter-relation of two arguments(d) The arguments are incomprehensibleI have been asked this question in a national level competition.This key question is from Graphics in chapter MATLAB Basics of MATLAB

Answer» CORRECT answer is (a) COLUMN wise inter-relation of TWO arguments

Best explanation: We have to keep in mind the order while trying to plot two matrix arguments. MATLAB will take the column wise relation between the two arguments.

So, if x=[x1 X2 x3];y=[y1 y2 y3]; plot(x,y)- MATLAB will generate a plot between (x1,y1),(x2,y2) and so on.
14.

What is the function used to multiply a matrix, A, with itself n times?(a) mtimes(A,n)(b) ntimes(A,n)(c) mtimes(n,A)(d) mtimes(A^n)I have been asked this question during an interview for a job.Enquiry is from Vectors and Matrices in chapter MATLAB Basics of MATLAB

Answer»

Right answer is (a) mtimes(A,N)

To explain: The syntax of the function to multiply a MATRIX with itself n TIMES is ‘mtimes(A,n); where A is the matrix itself and n is the number of times the matrix need to be multiplied to itself. There are no function ntimes() in MATLAB and the rest of the options show incorrect syntax.

15.

Command is used to save command window text to file.(a) saveas(b) texttofile(c) diary(d) todiaryThis question was addressed to me in an internship interview.This is a very interesting question from Input and Output in division MATLAB Basics of MATLAB

Answer»

Right choice is (c) diary

Easy explanation: The diary function creates a LOG of keyboard input and the resulting TEXT output, with some exceptions. The output of diary is an ASCII file, suitable for searching in, printing, INCLUSION in most reports and other DOCUMENTS.

16.

If A and B are two matrices, such that a./b=b.\a, what is concluded?(a) Nothing special(b) A = A^T(c) A = A^-1(d) A = AThe question was posed to me by my college professor while I was bunking the class.I would like to ask this question from Vectors and Matrices topic in portion MATLAB Basics of MATLAB

Answer»

The CORRECT CHOICE is (a) Nothing special

The best I can explain: a./b is same as b.\a. In the former, we are PERFORMING left division so b is divided by a. In the latter, we are performing right division so b is again divided by a. Thus, it is obligatory that a./b=b.\a. Hence, nothing special can be said about the TWO matrices A and B.

17.

After trying to plot a pie-chart, the student finds that the function he used is rose(). What is the nature of data used by the student if an output graph is generated?(a) Angles in radians(b) Linear bivariate(c) Logarithmic(d) This is not possible in MATLABThe question was asked in an online quiz.Question is from Graphics topic in chapter MATLAB Basics of MATLAB

Answer»

Correct CHOICE is (b) Linear bivariate

Best explanation: The student GETS an angle histogram plot. So, he used the wrong function. But the plot was GENERATED. So, his lines of code have defined the date in terms of ANGLES. PLUS he has used the rose command in place of the pie command.

18.

All matrices are vectors but all vectors are not matrices in MATLAB.(a) True(b) FalseI have been asked this question during an online interview.This intriguing question originated from Vectors and Matrices in division MATLAB Basics of MATLAB

Answer»

Correct ANSWER is (a) TRUE

Explanation: If a=[], a is a matrix but not a VECTOR in MATLAB. Hence, the above statement is true.

19.

What is the symbol used to evaluate the transpose of a vector?(a) “ ^ ”(b) “ * ”(c) “ ‘ ”(d) “ ~ ”I have been asked this question in my homework.This intriguing question originated from Vectors and Matrices in division MATLAB Basics of MATLAB

Answer»

Correct CHOICE is (c) “ ‘ ”

Explanation: It is pre-defined in MATLAB that if we WANT to find the transpose of a vector, we will have to use the “ ‘ ” symbol following the vector or the vector name. “ ^ ” is used to raise the power of a VARIABLE while “ * ” is used for multiplication purposes. “ ~ ” is used to denote not-equal to the OPERATOR which is “ !~ ”. HENCE option “ ‘ ” is correct.

20.

Which is an escape sequence constant?(a) Esc(b) /n(c) \b(d) nargoutThis question was posed to me during an internship interview.I'm obligated to ask this question of Variables and Assignments in division MATLAB Basics of MATLAB

Answer» CORRECT ANSWER is (c) \b

Explanation: An escape sequence character constant is used in functions which are used to show output. ‘\b’ means BACKSPACE. ‘Esc’,‘/N’, are strings. ‘nargout’ is a pre-defined function in MATLAB.
21.

The uniform distribution can range from -infinity to 0 or 0 to Infinity but not from -infinity to infinity.(a) True(b) FalseI have been asked this question in final exam.This intriguing question originated from Errors in Input topic in division MATLAB Basics of MATLAB

Answer»

The correct option is (b) False

Explanation: The uniform distribution can TYPICALLY RANGE from (-Inf,Inf), i.e. the lower and UPPER LIMITS of the distribution cannot be LESS than or -Infinity or more than Infinity respectively. Hence, this leads to an error.

22.

What is the size of double and symbolic variables holding integer constants?(a) 8 bytes and 16 bytes(b) 16 bytes and 112 bytes(c) 32 bytes and 26 bytes(d) 23 bytes and 112 bytesThis question was addressed to me in an interview for job.My question is taken from Managing Variables in chapter MATLAB Basics of MATLAB

Answer»

Correct option is (a) 8 bytes and 16 bytes

For EXPLANATION: The SIZE of double variables holding integer constants is 8 bytes. The size of symbolic variables is 112 bytes. These are predefined data type sizes in MATLAB.

23.

How would you simplify log(x^20) – log(x^13) – log(x^7)in MATLAB? (Assume x is defined as a string variable)(a) simplify(log(x^20)-log(x^13)–log(x^7));(b) log(x^20) – log(x^13) – log(x^7)(c) simplify(log(x^20)-log(x^13)–log(x^7),’IgnoreAnalyticConstraints’,true)(d) simplify(log(x^20)-log(x^13)–log(x^7))I have been asked this question in an interview for job.Question is from Algebra in section MATLAB Basics of MATLAB

Answer»

Correct option is (c) SIMPLIFY(log(x^20)-log(x^13)–log(x^7),’IgnoreAnalyticConstraints’,TRUE)

The explanation is: Option simplify(log(x^20)-log(x^13)–log(x^7),’IgnoreAnalyticConstraints’,true) would evaluate to 0. The cases are used to produce a GREATER simplified EXPRESSION for a polynomial. simplify(log(x^20)-log(x^13)–log(x^7)) does not give any different output but the expression itself. Option log(x^20) – log(x^13) – log(x^7) is incorrect since the powers should be represented as log(x^20) in MATLAB.

24.

Which command is used to clear a command window?(a) clear(b) close all(c) clc(d) clear allThe question was posed to me in an internship interview.The origin of the question is Input and Output topic in chapter MATLAB Basics of MATLAB

Answer»

The correct option is (c) clc

Easiest explanation: clc clears all INPUT and output from the COMMAND Window display and provide a “clean screen”. After using clc, you cannot use the SCROLL bar to SEE the history of functions, but you still can use the up ARROW key, ↑, to recall statements from the command history.

25.

Does the plot function take multiple arguments to a plot?(a) True(b) False(c) Sometimes(d) Only if the functions are in time domainI have been asked this question by my college professor while I was bunking the class.My question is based upon Plotting Multiple Curves topic in portion MATLAB Basics of MATLAB

Answer» RIGHT choice is (a) True

The best explanation: The plot FUNCTION can take MULTIPLE INPUT arguments to plot multiple GRAPHS. This is an inbuilt function so the nature of the function is, inherently, to take multiple arguments if the arguments are defined.
26.

A student has created a plot of y(t)=t^2. He is need to show another graph of z(t)=t^3 in the same plot. But every time he hits the plot() function- MATLAB generates a plot of z(t) vs t but on a different window. What is the error?(a) It is not possible to plot multiple plots(b) He is not using the line function(c) Maybe he is using stem() instead of plot()(d) He is not using the hold functionI have been asked this question during an interview.Question is from Plotting Multiple Curves topic in portion MATLAB Basics of MATLAB

Answer»

The correct option is (d) He is not using the hold function

For explanation I would say: The hold command is used to hold the cursor, DEVELOPED after creating a plot, so that the NEXT GRAPH, when PLOTTED, will appear on the same window where the initial graph was plotted. He may use the line function, but in the code he is using the plot function. So he has to enter the function hold before PLOTTING the graph of z(t).

27.

To specify different curves in an angle histogram plot, we use the _________ function.(a) legend(b) display(c) gtext()(d) mtextThis question was addressed to me in final exam.This is a very interesting question from Statistics topic in division MATLAB Basics of MATLAB

Answer» CORRECT ANSWER is (a) legend

The best I can EXPLAIN: The legend function is pre-defined in MATLAB. It is used to PRINT the names of the curves present in a PLOT. The function is the same for both 2d and 3d plots.
28.

A cubic system can be represented using the function ____(a) plot3(b) stem()(c) display(d) legendI have been asked this question in quiz.My question comes from Statistics topic in chapter MATLAB Basics of MATLAB

Answer»

Right OPTION is (a) plot3

The best I can explain: The function ‘plot3()’ is USED to PLOT a 3d graph. The axes of the system can be mentioned as x,y,z so the plot which will be returned will be for a CUBE if the length cut off from each axis are equal.

29.

How can the formulation of polynomial be done from its roots?(a) poly(r), r is a row vector, containing the roots of the polynomial(b) poly([roots as a coloumn vector])(c) poly([roots as a row vector])(d) poly([roots in descending order as a coloumn vector])This question was posed to me by my college professor while I was bunking the class.My enquiry is from Algebra topic in section MATLAB Basics of MATLAB

Answer»

Right option is (b) poly([roots as a COLOUMN vector])

The BEST I can explain: To FIND the roots, one has to store the given roots in a 1*n column vector, SAY p, and then extract the co-efficients of the polynomial by typing poly(p). This would return the co-efficients of the polynomial in descending order from left to right.

30.

Choose the correct option.(a) any() shows all the elements in a matrix while all() shows every element of a vector(b) any() is ‘true’ if elements in a vector is zero(c) all() is ‘true’ if every element in a vector is non zero(d) all() is ‘true’ if every element in a vector is 0The question was posed to me during an online exam.The origin of the question is Variables and Assignments in chapter MATLAB Basics of MATLAB

Answer» RIGHT choice is (c) all() is ‘true’ if every element in a VECTOR is non zero

Easy explanation: ‘any()’ and ‘all()’ are pre-defined FUNCTIONS in MATLAB. The function ‘any()’ returns 1 if every element of the vector, mentioned WITHIN the PARENTHESES, is non-zero. The function ‘all()’ returns 1 if any element of the vector is non-zero.
31.

Command used to display the value of variable x.(a) displayx(b) disp(x)(c) disp x(d) vardisp(‘x’)This question was addressed to me during an online interview.I need to ask this question from Input and Output in chapter MATLAB Basics of MATLAB

Answer»

Right answer is (b) disp(x)

The explanation: disp(X) displays the value of VARIABLE X without printing the variable NAME. ANOTHER way to display a variable is to type its name, but this displays a leading “X =”, which is not always IDEAL. If a variable contains an empty array, disp returns without displaying anything.

32.

How to introduce a title to describe the subplots generated in MATLAB?(a) Use a function(b) Use the title function(c) Use the legend function(d) Use uipanel()I had been asked this question by my college director while I was bunking the class.This key question is from Plotting Multiple Curves in division MATLAB Basics of MATLAB

Answer»

Right answer is (d) USE uipanel()

For explanation I WOULD say: The uipanel can be used to give a major title to the SUBPLOTS CREATED. The title name is given as a string input by the following way:

f=figure;

c=uipanel(‘PARENT’,f,’BorderType’,’none’);

c.Title=’Title Name’;

c.TitlePosition=’centertop’

33.

To display the partnership of 3 batsman with one batsman, one uses _________(a) Bar-graph(b) Histogram(c) Pie plot(d) Cannot be displayedThis question was posed to me in examination.My query is from Statistics topic in section MATLAB Basics of MATLAB

Answer»

The CORRECT answer is (b) Histogram

For explanation I WOULD SAY: A bar graph is USED to show the contribution of 3 batsmen with one batsman in a partnership. Thus it can be inferred who has CONTRIBUTED highest to the partnership among the three.

34.

Which command can be used for single step execution in debugging mode?(a) dbstep(b) dbstepin(c) dbstatus(d) dbcontI had been asked this question in examination.My enquiry is from Functions topic in chapter MATLAB Basics of MATLAB

Answer»

Correct option is (a) dbstep

The EXPLANATION is: The function ‘dbstep’ helps in single step execution while ‘dpstepin’ helps to enter into a function. The function ‘dbstatus’ helps to list all the BREAKPOINTS in a function while ‘dbcont’ helps to continue execution. These are the pre-defined debugging commands in MATLAB.

35.

If solve does not return any solution, what does it imply?(a) The equation has no definite solution(b) The equation has a solution for a specific interval(c) The equation may be solvable but the function ‘solve’ cannot produce a solution(d) There is no function ‘solve’The question was asked in examination.This intriguing question comes from Solving Equations topic in chapter MATLAB Basics of MATLAB

Answer»

Correct choice is (c) The equation may be solvable but the function ‘solve’ cannot PRODUCE a solution

To elaborate: It may so happen that an equation may not be solvable but DUE to some mistake, the function solve0 has encountered an argument which is an equation whose Left hand side could never be equal to the right hand side. It may ALSO happen that some separate solution is present but the function cannot produce the solutions. We need to CHECK separately for such cases by applying some other methods of solving equations though, generally, this does not happen.

36.

What is the disadvantage of the whos function in MATLAB?(a) It does not show the values of the variable(b) It does not show the size of the variable(c) It does not show the class of the variable(d) It does not show the name of the variableThe question was posed to me in quiz.Origin of the question is Managing Variables in chapter MATLAB Basics of MATLAB

Answer»

Correct answer is (a) It does not show the values of the VARIABLE

To explain: whos returns the name, size, bytes and class of the variables USED in the current program. To GET the value of any variable, we need to TYPE the variable and press Enter.

37.

What is the difference between syms ‘x’ and sym ‘x’?(a) there is no difference, they are the same functions(b) they are equivalent(c) syms ‘x’makes the declaration long lasting while sym ‘x’ makes the declaration short lasting(d) syms ‘x’ makes the symbol short lasting while sym ‘x’ makes the declaration long lastingThe question was asked in an interview.My question comes from Algebra in chapter MATLAB Basics of MATLAB

Answer»

The correct choice is (c) syms ‘x’MAKES the declaration long lasting while sym ‘x’ makes the declaration short lasting

The explanation: sym ‘x’ makes the declaration short lasting. If it is ASSIGNED to a VARIABLE, x say, the FUNCTION is EQUIVALENT to syms ‘x’. This makes syms ‘x’ long lasting.

38.

Predominantly, what are the two kinds of errors in MATLAB programs?(a) Syntax and runtime(b) Syntax and logic(c) Logic and runtime(d) Syntax and algorithmicI had been asked this question during an interview for a job.Origin of the question is Functions in portion MATLAB Basics of MATLAB

Answer»

The correct answer is (a) Syntax and runtime

Easiest explanation: Usually, there are two KINDS of errors in any programming language. They are syntactical errors and runtime errors. Syntactical errors arise DUE to the programmer not FOLLOWING language specific syntaxes. Runtime errors RISE due to faulty logic decided for the program, the error is called Runtime error.

39.

The function to plot vector fields is ___________(a) quiver()(b) pie3(c) ezplot()(d) contour()This question was addressed to me in exam.I want to ask this question from Plotting Multiple Curves in division MATLAB Basics of MATLAB

Answer»

Correct answer is (a) quiver()

To explain I WOULD say: The function ‘quiver()’ is a pre-defined function in MATLAB. It is often USED to plot vector fields in MATLAB. The pie3 function is used to plot a 3-d pie plot. The ezplot() generates a 3d plot while the CONTOUR() is used to generate the contour plot of a SPECIFIED MATRIX.

40.

What is the difference between a[] and a{}?(a) a[] is for empty cell array while a{} is for empty linear array(b) a[] is for empty linear array while a{} is for empty cell array(c) No difference(d) a[] is an empty row vector while a{} is an empty column vectorThis question was posed to me during an interview for a job.I would like to ask this question from Vectors and Matrices in section MATLAB Basics of MATLAB

Answer»

The correct answer is (b) a[] is for empty linear ARRAY while a{} is for empty CELL array

Explanation: To INITIALISE a cell array, named a, we use the SYNTAX ‘a{}’. If we need to initialise a linear array, named a, we use the syntax ‘a[]’. This is pre-defined in MATLAB.

41.

Vectors depend upon brackets while scalars don’t.(a) True(b) FalseThe question was posed to me in a job interview.I'd like to ask this question from Vectors and Matrices in section MATLAB Basics of MATLAB

Answer»

The correct answer is (a) True

Explanation: To declare a scalar, we only need to declare a variable in MATLAB with a constant expression. We don’t need to include the expression with any KIND of brackets. But, we need to put the EXPRESSIONS within a bracket for row or COLUMN vector.

42.

All MATLAB computations are done in(a) Single Precision(b) Double Precision(c) Linear accuracy(d) Multi-level precisionThe question was asked during an interview.This is a very interesting question from Variables and Assignments topic in portion MATLAB Basics of MATLAB

Answer»

The correct option is (b) DOUBLE Precision

For EXPLANATION I would say: MATLAB stores any integer VARIABLE as a double data type of 64 bits. For single precision, the function is ‘single()’ but if not mentioned, the value will be stored in double precision.

43.

The expression cos(90) is equal to1 in MATLAB.(a) True(b) FalseI had been asked this question by my college professor while I was bunking the class.Enquiry is from Variables and Assignments in section MATLAB Basics of MATLAB

Answer»

Correct option is (b) False

Best explanation: Any argument within the PARENTHESES of the FUNCTIONS ‘sin()’, ‘cos()’ are taken to be in radians. If the argument is to be processed in DEGREES, the FUNCTION is modified as sind() and COSD().

44.

What does the Workspace show?(a) Attributes of variables, functions from command window(b) Attributes of variables, script files from command window(c) Attributes of variables, script files, functions from command window(d) Attributes of variables from command windowThe question was posed to me during an internship interview.I want to ask this question from Managing Variables topic in portion MATLAB Basics of MATLAB

Answer»

Correct option is (c) Attributes of variables, script FILES, functions from command window

To elaborate: The WORKSPACE window shows the attributes of variables, script files, functions from the command window for an ongoing PROGRAM. It is more descriptive than the whos function.

45.

If a./b=(b./a)^T, what can be concluded about the matrices a and b?(a) a = b^T(b) a = b^-1(c) a = b’(d) nothing specialI have been asked this question in quiz.I would like to ask this question from Vectors and Matrices in chapter MATLAB Basics of MATLAB

Answer»

The correct option is (a) a = B^T

For explanation: ‘a./b’ means that elements of a are divided b while ‘b./a’ means that the elements of b are divided by a. If the result of the latter is the transpose of the former, it SUGGESTS that a=b^T. This is because element-wise division is performed by the operator ‘./’. So the resultant MATRIX is a direct symbolisation of the nature of occurrence of elements in EITHER matrix. Hence option a=b^T is correct.

46.

Which function is preferable to find the magnitude of a complex number?(a) abs()(b) sqrt()(c) cart2pol()(d) MATLAB does not support complex argumentsThe question was posed to me in an interview for internship.This interesting question is from Variables and Assignments topic in portion MATLAB Basics of MATLAB

Answer»

Right CHOICE is (a) ABS()

EXPLANATION: In the function sqrt(), we have to write the polynomial which shows the sum of squares of the real and imaginary part within the parentheses. But in abs(), we only have to enter the variable which we’ve used to define the complex NUMBER. So abs() is more preferred.

47.

What is the difference between sqrt(10) and sqrt(sym(10))?(a) There is no difference(b) sqrt(sym(10)) is incorrect(c) There is no function as sqrt(d) sqrt(10) returns exact value while sqrt(sym(10)) returns 10^(1/2)This question was addressed to me in an international level competition.The question is from Solving Equations topic in division MATLAB Basics of MATLAB

Answer»

The correct ANSWER is (d) sqrt(10) returns exact value while sqrt(sym(10)) returns 10^(1/2)

To explain I would say: ‘sqrt()’ is a predefined FUNCTION used to FIND a square root of large numbers to reduce the complexity of equation. sqrt(sym(10)) introduces 10 as a symbolic object to the MATLAB workspace.

Thus it will return 10^(1/2) as a symbolic expression and won’t DIVULGE the exact root. This helps often to reduce an equation before INCREASING program complexity in MATLAB.

48.

The function to evaluate the value of a polynomial,l for a constant value of the independent variable(say a)in the polynomial is ______(a) poly(p,a), p is a row vector(b) polyder(p)(c) polyint(p)(d) polyval(c,a), c is a row vectorThis question was addressed to me during an internship interview.My query is from Algebra topic in division MATLAB Basics of MATLAB

Answer»

The correct ANSWER is (d) polyval(c,a), c is a ROW vector

To elaborate: polyder(p)and polyint(p) produces the differentiation and integration of the polynomial p. Polyval(c,a) is the correct form of the function to evaluate the value of a polynomial whose INDEPENDENT variable is a. The value of a has to be provided FIRST before WRITING the function.

49.

Largest and smallest values for integer classes is 127 to -128.(a) True(b) FalseThis question was posed to me in an interview for job.This question is from Arithmetic topic in chapter MATLAB Basics of MATLAB

Answer» RIGHT option is (a) True

To ELABORATE: Obtain these values with the intmax and intmin functions:

intmax(‘int8’)

ans = 127

intmin(‘int8’)–

ans = 128.
50.

Can we have multiple 3d plots in MATLAB?(a) Yes(b) No(c) Maybe(d) Cannot be determinedThe question was asked in class test.I would like to ask this question from Plotting Multiple Curves topic in chapter MATLAB Basics of MATLAB

Answer» RIGHT answer is (a) Yes

To elaborate: The plot3() function is a pre-defined function in MATLAB. So, it will allow the use to generate multiple 3d PLOTS. This is inherent to the SYSTEM.