MATLAB MCQ Banner

MATLAB Multiple Choice Questions (MCQs) and Answers

Master MATLAB with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of MATLAB. Begin your placement preparation journey now!

Q121

Q121 Which block in Simulink is used to integrate a signal?

A

Integrator block

B

Scope block

C

Gain block

D

Sum block

Q122

Q122 What is the role of the "Scope" block in Simulink?

A

Visualizing signals

B

Integrating signals

C

Multiplying signals

D

Differentiating signals

Q123

Q123 Which block is used to generate a sine wave in Simulink?

A

Sine Wave block

B

Signal Generator block

C

Scope block

D

Constant block

Q124

Q124 How do you open a new Simulink model from the MATLAB Command Window?

A

simulink

B

open_system

C

new_model

D

start_simulink

Q125

Q125 Write a MATLAB command to set the simulation stop time to 10 seconds in Simulink.

A

set_param('model', 'StopTime', '10')

B

simset('StopTime', '10')

C

set_time('model', '10')

D

set_stop_time('model', '10')

Q126

Q126 Write a MATLAB code snippet to programmatically add a Gain block to a Simulink model.

A

add_block('simulink/Commonly Used Blocks/Gain', 'model/Gain')

B

add('Gain', 'model')

C

add_gain('model')

D

add_block('Gain', 'model')

Q127

Q127 Why does "Unable to find block" error occur in Simulink?

A

Block name is incorrect

B

Model is not loaded

C

Block is deleted

D

All of the above

Q128

Q128 Why does "Solver configuration is missing" error occur in Simulink?

A

No solver specified for the model

B

Incorrect block connections

C

Missing block parameters

D

All of the above

Q129

Q129 What is the purpose of the "fit" function in MATLAB?

A

Fits a curve to data

B

Calculates the derivative

C

Generates random values

D

Solves linear equations

Q130

Q130 What is the role of the Optimization Toolbox?

A

Solves linear and nonlinear optimization problems

B

Generates plots

C

Processes images

D

Creates statistical models

Q131

Q131 Which MATLAB function is used for nonlinear curve fitting?

A

lsqcurvefit

B

polyfit

C

fitnlm

D

fminsearch

Q132

Q132 Write a MATLAB command to fit a polynomial of degree 2 to data x and y.

A

polyfit(x, y, 2)

B

fit(x, y, 2)

C

polycurve(x, y, 2)

D

polynomialfit(x, y, 2)

Q133

Q133 Write a MATLAB code snippet to perform linear optimization using "linprog".

A

linprog(f, A, b)

B

linopt(f, A, b)

C

optimize(f, A, b)

D

linearprog(f, A, b)

Q134

Q134 Write a MATLAB code to fit an exponential model to data using "fit".

A

fit(x, y, 'exp1')

B

fitexp(x, y)

C

exponentialfit(x, y)

D

fit(x, y, 'exponential')

Q135

Q135 Why does MATLAB throw "Matrix dimensions must agree" during optimization?

A

Mismatched input dimensions

B

Invalid constraints

C

Undefined variables

D

Incorrect syntax

Q136

Q136 Why does "Solver failed to converge" occur in optimization?

A

Poor initial guess

B

Incorrect model

C

Large dataset

D

All of the above

Q137

Q137 What is the purpose of the "persistent" keyword in MATLAB?

A

To retain variable values across function calls

B

To declare global variables

C

To define a constant

D

To create temporary variables

Q138

Q138 What is the difference between "parfor" and "for" loops in MATLAB?

A

"parfor" runs iterations in parallel, "for" runs sequentially

B

"parfor" runs sequentially, "for" runs in parallel

C

Both are identical

D

"for" is faster than "parfor"

Q139

Q139 Which function is used to profile the performance of MATLAB code?

A

profile

B

timing

C

measure

D

benchmark

Q140

Q140 Write a MATLAB command to create a handle to an anonymous function f(x) = x^2.

A

f = @(x) x^2

B

f = anonymous(x) x^2

C

f = function(x) x^2

D

f = handle(x) x^2

Q141

Q141 Write a MATLAB code snippet to create a custom class with a property and a method.

A

classdef MyClass, properties, Value, end, methods, function obj = set.Value(obj, val), obj.Value = val; end, end, end

B

class MyClass {int Value; method setValue();}

C

classdef MyClass(Value), end

D

class MyClass {methods Value}

Q142

Q142 Why does MATLAB throw "Undefined function for input arguments of type double"?

A

Function not defined for double input

B

Incorrect input type

C

Function is private

D

All of the above

Q143

Q143 Why does "Variable appears to change size on every loop iteration" warning occur?

A

Variable is dynamically resized

B

Variable is not initialized

C

Variable name conflict

D

Incorrect loop syntax

Q144

Q144 What is a common use case for MATLAB in engineering?

A

Simulation and analysis of control systems

B

Creating web applications

C

Processing financial transactions

D

Performing data entry

Q145

Q145 How is MATLAB used in image processing applications?

A

Enhancing images and extracting features

B

Performing financial analysis

C

Generating audio signals

D

Building web servers

Q146

Q146 What is the primary role of MATLAB in financial modeling?

A

Risk assessment and portfolio optimization

B

Generating statistical reports

C

Creating dashboards

D

Building data warehouses

Q147

Q147 Write a MATLAB code snippet to perform basic signal filtering.

A

filtered_signal = filter(b, a, input_signal);

B

filtered_signal = signal_filter(input_signal);

C

filtering(input_signal);

D

signal_process(input_signal);

Q148

Q148 Write a MATLAB code snippet to simulate a simple pendulum's motion.

A

theta = sin(omegat);

B

theta = Acos(omegat);

C

theta = Asin(omega*t); t = linspace(0, 10, 100); plot(t, theta);

D

theta = sin(t); plot(theta);

Q149

Q149 Why does "Matrix dimensions must agree" error occur in case studies?

A

Input dimensions are mismatched

B

Incorrect syntax

C

Undefined variables

D

All of the above

Q150

Q150 Why does "Singular matrix" error occur in MATLAB applications?

A

Determinant is zero

B

Incorrect matrix multiplication

C

Unsupported operation

D

All of the above

ad verticalad vertical
ad