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.

51.

What are the functions to see the graph of a continuous and a discrete function?(a) plot() & stem()(b) cont() & disc()(c) plot() & disc()(d) cont() & stem()This question was posed to me in my homework.This intriguing question originated from Graphics in division MATLAB Basics of MATLAB

Answer»

Right choice is (a) plot() & stem()

Best EXPLANATION: The pre-defined function in MATLAB to view the graph of a CONTINUOUS and DISCRETE functions is plot() and stem() RESPECTIVELY. There is no such function as cont() or DISC().

52.

To determine whether an input is MATLAB keyword, command is?(a) iskeyword(b) key word(c) inputword(d) isvarnameI got this question by my school principal while I was bunking the class.I'd like to ask this question from Input and Output topic in section MATLAB Basics of MATLAB

Answer» CORRECT option is (a) iskeyword

To EXPLAIN I would say: Command iskeyword uses the MATLAB command FORMAT. iskeyword returns a list of all MATLAB keywords. It gives output in the form of 1 and 0.
53.

The nature of data while using pie plots is ___________ data.(a) Discrete(b) Continuous(c) Polar(d) Time-seriesThis question was posed to me in exam.This key question is from Statistics topic in chapter MATLAB Basics of MATLAB

Answer»

The correct choice is (B) Continuous

Best EXPLANATION: Pie plots show the percentage, a category occupies, amongst a DATASET containing several categories. Now, if this dataset is not discrete- it is preferable to USE pie plot since the height of bar plots might be very close to each other to show significant changes. Hence, pie plots REPRESENT continuous data mainly.

54.

A student has to plot a graph of f(x)=t and g(y)=t in the same graph, with t as a parameter. The function he uses is ____(a) plot3(x,y,t)(b) plot(x,y,t)(c) disp(d) stem(x,y)I have been asked this question in semester exam.The question is from Graphics topic in portion MATLAB Basics of MATLAB

Answer»

Right choice is (a) plot3(x,y,t)

The explanation is: The function to be used is plot3(x,y,t). This will allow him to DRAW a 3d PLOT as asked. The plot will SHOW both the functions ‘F’ and ‘g’ with t on the z-axis.

55.

Which line is treated as H1 line?(a) Comment line succeeding function definition(b) Comment line preceding function definition(c) Comment line after function(d) All lines before and after function definitionThe question was posed to me in exam.I need to ask this question from Functions in division MATLAB Basics of MATLAB

Answer»

Correct answer is (c) COMMENT line after function

To explain I would say: When we have MANY FUNCTIONS nested in a primary function, it is a good practice to place comment lines which would help anybody to understand the purpose of the function- making the function more versatile. This comment line introduced right after the function definition is treated as H1 line. All other comment lines after or preceding the function definition won’t be returned as H1 line when the H1 line is sought in MATLAB.

56.

What happens if dsolve does not return any numerical solution?(a) The equations have no solution(b) The equations have a trivial solution(c) The equations have infinite no. of solutions(d) The equation has to be solve separatelyThe question was asked in an interview.My doubt is from Solving Equations topic in section MATLAB Basics of MATLAB

Answer»

The correct OPTION is (d) The equation has to be solve separately

For explanation: We have to solve the DIFFERENTIATION numerically. To do it in MATLAB, we need to use ode45 after CONVERTING the differential equation to a SYSTEM of first order differential equation.

57.

What is the syntax to solve simultaneous equations easily?(a) solve[“equation-1”,”equation-2”];(b) sol[“equation-1” “equation-2”];(c) sol[‘equation-1’‘equation-2’];(d) solve[‘equation-1’,‘equation-2’];The question was posed to me in a national level competition.Query is from Solving Equations in chapter MATLAB Basics of MATLAB

Answer»

The correct option is (d) solve[‘equation-1’,‘equation-2’];

The explanation is: To solve equations simultaneously, we NEED to place the equations within the pre-defined MATLAB function ‘solve’ as string arguments within a pair of single INVERTED commas and separated by a COMMA. The function sol can also be used but the syntax within the third bracket is same. So, solve[‘equation-1’,‘equation-2’]; is correct.

58.

Which symbol is used to initialise a variable?(a) =(b) ->(c) ==(d) initThis question was posed to me during an online exam.My doubt stems from Variables and Assignments topic in chapter MATLAB Basics of MATLAB

Answer» RIGHT CHOICE is (a) =

To ELABORATE: The symbol, ‘=’, is used to initialise a variable with a particular data type. ‘==’ checks whether the LEFT hand side is equal to its’ right hand side. ‘init’ is a SEPARATE function in MATLAB.
59.

From the following desktop view of workspace, choose the correct code.(a) a=10;b=’pi’;syms c; d=[1,2;0;4];(b) a=10;b=’pi’;syms c; d=[1,2;0,4];(c) a=10;b=pi;syms (c); d=[1,2;0,4];(d) a=10;b=’pi’;syms c; d=[1,2;0,4];I have been asked this question in exam.The doubt is from Managing Variables topic in portion MATLAB Basics of MATLAB

Answer»

Correct option is (a) a=10;b=’pi’;SYMS c; d=[1,2;0;4];

For EXPLANATION I would say: ‘b’ is a character variable, WITHIN inverted commas. ‘a’ is a double variable. ‘c’ is a symbolic object while ‘d’ is a 2*2 MATRIX. The declaration of the VARIABLES is in accordance to the following code:

a=10;b=’pi’;syms c; d=[1,2;0;4];

60.

To display the runs scored by a batsman towards different directions in a field, one uses(a) Bar graph(b) Angle histogram(c) Histogram(d) No graph is suitableI have been asked this question by my college professor while I was bunking the class.This interesting question is from Statistics topic in division MATLAB Basics of MATLAB

Answer»

Correct option is (a) Bar graph

To explain I would SAY: The ANGLE histogram graph plots a histogram circularly. So, VIEWING the FIELD as a CIRCLE, one can easily find the area in the field where the batsman has scored the most runs.

61.

What is the condition on x in bar(x,y)?(a) No condition as such(b) Should change linearly(c) Should increase of decrease monotonously(d) IncomprehensibleI got this question during an internship interview.The above asked question is from Graphics topic in section MATLAB Basics of MATLAB

Answer»

Correct option is (c) Should INCREASE of decrease monotonously

The best explanation: The values of X should be INCREASING monotonously or decreasing monotonously. This is due to the fact that each argument in x refers to the PARTICULAR POSITION of a bar in the bar plot.

62.

What is the name of a primary function?(a) Name of M-file(b) Name of Script File(c) Name of Help file(d) Name of Private-FileThis question was posed to me in a national level competition.This interesting question is from Functions in portion MATLAB Basics of MATLAB

Answer»

Right CHOICE is (a) Name of M-file

The BEST explanation: M-files are text files which can be created in any text editor and it contains the description of a PROGRAM written for a particular purpose.The program description is mainly a self-contained set of statements which comprises of lines of codes or different KINDS of functions. Thus the name of the primary function, where the program description is described, is the M-file.

63.

To bring the scale of each axis to logarithmically spaced, the student entered ‘semilogx()’. What really happened?(a) The plot will appear with both axis now logarithmically spaced(b) semilogx() is an invalid function(c) The plot will appear with x axis logarithmically spaced(d) ErrorThe question was asked in my homework.This interesting question is from Graphics topic in chapter MATLAB Basics of MATLAB

Answer»

Correct OPTION is (C) The plot will appear with x axis logarithmically SPACED

For explanation: semilogx() is a pre-defined logarithmic plot function in MATLAB. It will help to bring down the scale of the x axis in out plot to logarithmically spaced values.

64.

What is the advantage of MATLAB over other computing software with matrix dimensions?(a) No advantage(b) Real time pre-defined memory allocation(c) Real time user-defined memory allocation(d) Matrix operations are easily computedThis question was addressed to me during an online interview.I'd like to ask this question from Vectors and Matrices topic in division MATLAB Basics of MATLAB

Answer»

Right option is (c) Real TIME user-defined memory allocation

The EXPLANATION: In many softwares, while DECLARING a matrix- the user has to assign a size of the matrix before entering any values to it. But in MATLAB, the user does not need to MENTION any size; mentioning the number of ELEMENTS is enough for MATLAB to determine the size of the matrix required.

65.

What are Max and Min in the Workspace shown below?(a) They show the maximum and minimum value of the variable(b) The show the maximum and minimum length of the variable(c) They show the maximum and minimum value present in an array(d) They show the median and mode of the variableThis question was addressed to me in my homework.My question is based upon Managing Variables in division MATLAB Basics of MATLAB

Answer»

The correct option is (C) They show the maximum and MINIMUM value present in an array

For explanation: The COLUMNS ‘Min’ and ‘Max’ show the maximum and minimum values present in a VARIABLE. So, if the variable is an array, the ‘Min’ and ‘Max’ may or may not be same. Here, a is a variable having a single CONSTANT value so they are same.

66.

What operator helps in the transpose of a matrix?(a) “ .’ ”(b) “ ‘ ”(c) “./ ”(d) “ .\ ”I have been asked this question in final exam.I'd like to ask this question from Variables and Assignments topic in portion MATLAB Basics of MATLAB

Answer»

Correct answer is (a) “ .’ ”

For explanation: ‘ .’ ‘ is used to get the transpose of a MATRIX. ‘ ‘ ‘ is used to get the complex CONJUGATE transpose of a matrix. ‘ ./ ’ is used for the RIGHT DIVISION while the operator, ‘ .\’ is used for LEFT division.

67.

What happens if we don’t assign a variable to an expression which evaluates a numerical value?(a) MATLAB shows error(b) Nothing happens(c) The evaluated values are assigned to a variable ans automatically(d) Depends on the numerical valueThe question was asked in examination.This key question is from Algebra in division MATLAB Basics of MATLAB

Answer» RIGHT option is (c) The evaluated values are ASSIGNED to a variable ans automatically

Explanation: This is common for MATLAB. The evaluated numerical values are assigned to a variable ans if there is no BODY in the right hand side of a numerical expression. So the OPTIONS MATLAB shows error is false.
68.

To stop the execution of a MATLAB command, used keys?(a) ctrl+c(b) ctrl+s(c) ctrl+b(d) ctrl+enterThis question was addressed to me in my homework.The origin of the question is Input and Output in division MATLAB Basics of MATLAB

Answer» CORRECT choice is (a) ctrl+c

For explanation I would SAY: Ctrl+C stop execution for files that run a long time, or that CALL built-ins or MEX-files that run a long time. Ctrl+Break is also USED to stop the execution.
69.

To place a text on the plot using a mouse, the command used is _________(a) gtext(b) text(c) title()(d) atextI have been asked this question by my school principal while I was bunking the class.Question is from Graphics in portion MATLAB Basics of MATLAB

Answer»

Correct choice is (a) gtext

The explanation: This is a pre-defined FUNCTION in MATLAB. If we WANT to PLACE a text at a position, of our interest, in a graph- we need to USE the gtext command.

70.

What are persistent variables?(a) Variables which retain values between calls to the function(b) Variables which help in calling a function(c) Variables which deal with functions(d) Variables global to the functionI had been asked this question in a national level competition.The query is from Functions topic in division MATLAB Basics of MATLAB

Answer»

The correct option is (a) Variables which retain values between CALLS to the function

For explanation I would say: PERSISTENT variables help to retain the value which has been produced by a sub-function. They are LOCAL to the sub-function but MATLAB reserves permanent storage for them so they might seem like global variables. They are never SHOWN in the workspace so they DIFFER from global variables.

71.

If the program demands evaluation of multiple, only decimal, values of the same function, what is the better way amongst the following?(a) Using anonymous functions or inline functions(b) Using str2func(c) Using private functions(d) Using any functionThis question was addressed to me by my college professor while I was bunking the class.Enquiry is from Functions in chapter MATLAB Basics of MATLAB

Answer»

The correct answer is (b) Using str2func

Easy explanation: The function str2cat() returns FLOATING point or decimal expressions for INTEGER values or fractional values. Anonymous FUNCTIONS and inline return decimal values for fractional values but not for integer values. HENCE, str2cat is PREFERABLE.

72.

What is the difference between who and whos command?(a) The former shows the names of the variables being used while the latter shows the details of the variables in the ongoing program(b) The latter shows the the names of the variables being used while the former shows the details of the variables in the ongoing program(c) No difference at all(d) There is no such function as who and whosI had been asked this question by my college professor while I was bunking the class.I would like to ask this question from Managing Variables in chapter MATLAB Basics of MATLAB

Answer»

Correct answer is (a) The FORMER shows the names of the variables being used while the latter shows the details of the variables in the ongoing PROGRAM

For explanation I would say: The function ‘who’ shows the names of the variables used. The function ‘whos’ shows the details of the variables in the ongoing program but it doesn’t SHOW the ATTRIBUTES of the variables.

73.

Which is the invalid variable name in MATLAB?(a) x6(b) last(c) 6x(d) zI have been asked this question during an interview.I need to ask this question from Input and Output topic in division MATLAB Basics of MATLAB

Answer»

Right CHOICE is (c) 6x

To explain: A valid variable NAME starts with a letter, followed by letters, DIGITS, or UNDERSCORES. MATLAB is case sensitive, so A and a are not the same VARIABLES, and in 6x digit is followed by a letter which is invalid.

74.

What happens if we don’t stop the implementation of the hold function?(a) Nothing happens(b) MATLAB keeps on generating multiple plots in the same window(c) Error is generated(d) Plot function won’t workThe question was asked in an interview for internship.The doubt is from Plotting Multiple Curves topic in section MATLAB Basics of MATLAB

Answer»

Right answer is (b) MATLAB keeps on generating multiple plots in the same window

The best I can explain: Suppose we PLOT 2 graphs on the same window by USING the hold command. If we don’t stop the IMPLEMENTATION of the hold FUNCTION, MATLAB will keep on generating plots on the same window. So the user won’t get a separate plot if he wants.

75.

How do we access a global variable in nested functions?(a) Simply seek the variable from the primary function(b) Make a copy of the global variables from the primary function(c) Declare the variable within the function(d) Declare the variable as globalI got this question in exam.Question is taken from Functions topic in portion MATLAB Basics of MATLAB

Answer»

Right choice is (d) DECLARE the VARIABLE as global

To ELABORATE: Any global variable, in the primary function, if required to be accessed by a nested function- the variable needs to be declared with the global keyword within the function which requires ACCESS to it. This allows sharing the variable amongst the primary and other functions. If the variable is declared without using the global keyword, the variable MIGHT bring an error to the function.

76.

To exhibit time-series or spatial-series data, what kind of diagrams are suitable?(a) Pie-bar(b) Pie-chart(c) Ratio-chart(d) Bar-diagramI got this question during an internship interview.My question is from Statistics topic in division MATLAB Basics of MATLAB

Answer»

The correct option is (d) BAR-DIAGRAM

Explanation: Time-series or spatial-series data would COMPRISE of quantitative characters. So they can be represented as a Bar diagram, the height of the bar would demonstrate the QUANTITY of a category.

77.

The solve[] command can do which of the following things?(a) Produce the exact solution(b) Produce a symbolic solution(c) Produces exact roots(d) Produces complex rootsI got this question during an interview.The query is from Solving Equations in division MATLAB Basics of MATLAB

Answer»

Correct choice is (b) Produce a symbolic solution

Easy explanation: The SOLVE[] function is an inbuilt function to generate the solutions of ONE or more than one equations. But the result is always produced in symbolic form. So, even if the answer CONTAINS the value of square root of 5, solve[] will return the value as sqrt(sym(5)).

78.

In the function vpa(‘9^81’,10), why do we put 9^81 within inverted commas?(a) We can choose to not put the value within a pair of single inverted comma(b) We do it so that we don’t get an approximated value(c) We do it to get the exact value as MATLAB computes exact values, of numerical expressions, when declared within a string(d) We do it to get a floating-point approximated value, approximated to 14 digitsThe question was asked in examination.I'm obligated to ask this question of Algebra topic in portion MATLAB Basics of MATLAB

Answer»

Correct choice is (c) We do it to GET the exact value as MATLAB computes exact values, of numerical expressions, when declared within a string

The BEST I can explain: Variable precision arithmetic in MATLAB is perfected by COMPUTING exact values and exact values are evaluated if the numerical expression is within a string. By not PLACING the pair of inverted COMMAS, we get a floating point approximated value.

79.

Is histogram a kind of multiple plots?(a) True(b) False(c) Cannot be determined(d) There is no such thing called HistogramThe question was posed to me by my school principal while I was bunking the class.The doubt is from Plotting Multiple Curves in portion MATLAB Basics of MATLAB

Answer»

The correct answer is (a) True

Easy explanation: We are plotting a PARTICULAR data set for different ENTITIES. The data set may comprise of the same set but each entity is inherently independent from each other. So, we are plotting multiple FUNCTIONS of the same VARIABLES. Hence, the HISTOGRAM is a kind of multiple plots.

80.

What kind of a plot is this?(a) Polar plot(b) Cartesian plot(c) Complex plot(d) Not a MATLAB plottingI got this question by my school principal while I was bunking the class.The above asked question is from Graphics topic in portion MATLAB Basics of MATLAB

Answer»

Right answer is (a) Polar PLOT

The best I can explain: MATLAB GENERATES a polar plot to REPRESENT the polar co-ordinates of a trigonometric function. This is done with the help of the function ‘polar(angle,RADIUS)’. The angle INCREASES in the anti-clockwise direction.

81.

If we put bar(x,y,1.2), we will get _____ bars.(a) Uniform(b) Damped(c) Overlapping(d) NoThis question was addressed to me in exam.I'm obligated to ask this question of Graphics topic in portion MATLAB Basics of MATLAB

Answer»

Right choice is (c) Overlapping

To EXPLAIN I would say: Usually, the default value of width is 0.8 for the function ‘bar()’. Now, if we INCREASE bar width to a value more than 1, the bars would OVERLAP on each other- resulting in a bar plot of overlapping bars.

82.

Variables need to have same name while being passed from the primary function to the sub-function.(a) True(b) FalseI have been asked this question in an internship interview.My question comes from Functions in division MATLAB Basics of MATLAB

Answer»

Right option is (b) False

Easiest explanation: It is dependent upon the programmer to choose the variable NAME while establishing a connection between a global and a PERSISTENT variable. Essentially, one MAY choose to keep the variable name same to AVOID CONFUSION in case of multiple sub-functions. But it is not necessary if there are a small number of sub-functions.

83.

What is the difference between primary and secondary data in statistics?(a) No difference(b) The former is collected from the field of the investigation while the latter is collected from a separate entity(c) The first set of data received is Primary data while the next set is secondary data(d) The important data is primary data while the lesser important data is secondary dataI have been asked this question in an internship interview.I would like to ask this question from Statistics topic in portion MATLAB Basics of MATLAB

Answer»

The correct choice is (b) The former is collected from the field of the investigation while the latter is collected from a SEPARATE entity

Easiest EXPLANATION: Data collected directly from the field of purposeful investigation is primary data because it is directly used by the one who collects it. If the data, gathered by an agency or a person, is used by a different agency or person for some PURPOSE- there is no direct link between the data and the person REQUIRING it. Thus this is secondary data.

84.

What is the difference between stem plot and histogram plot?(a) No difference(b) Histogram does not have negative values while stem may have negative values(c) Histogram cannot relate 3 variable while stem can(d) Histogram cannot be created in MATLABI have been asked this question in an online quiz.This is a very interesting question from Statistics in chapter MATLAB Basics of MATLAB

Answer»

Correct choice is (b) Histogram does not have negative VALUES while stem may have negative values

To elaborate: Histograms are USED to see the frequency distribution of a variable to show the frequency of a CLASS over any interval. So, naturally, a variable cannot repeat with a negative frequency. Stem plot only RELATES the two arguments it gets in terms of their projected values. So stem() can have negative values.

85.

What is the replacement for the whos function?(a) Workspace window(b) Command window(c) Current folder window(d) Remembering all the variables usedThis question was addressed to me in my homework.I want to ask this question from Managing Variables topic in section MATLAB Basics of MATLAB

Answer»

Right choice is (a) Workspace window

The explanation: The workspace window constantly gets updated with inclusion of any variable in the program. It SHOWS the Value, Size, Bytes, CLASS and many other attributes of the variables used. Hence it is more USEFUL than the WHOS FUNCTION.

86.

If a character input is given to a command which only takes integers, it’ll always give an error.(a) True(b) FalseThe question was asked during an interview.I need to ask this question from Errors in Input topic in division MATLAB Basics of MATLAB

Answer»

Right ANSWER is (a) True

The BEST explanation: MATLAB is very SENSITIVE to the nature of INPUTS defined for a particular command. If the input to a command has to be an integer but we give a character input, it’ll give an error.