# Welcome to the MATLAB Basics MCQs Page

Dive deep into the fascinating world of MATLAB Basics with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of MATLAB Basics, a crucial aspect of MATLAB. In this section, you will encounter a diverse range of MCQs that cover various aspects of MATLAB Basics, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within MATLAB.

Check out the MCQs below to embark on an enriching journey through MATLAB Basics. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of MATLAB.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of MATLAB Basics. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

### MATLAB Basics MCQs | Page 1 of 17

Q1.
What would be the output of the following code (in editor window)?
A = [0 1; 1 0]	;	B=2	;	C = A + B
Answer: (b). 2 3
3 2
Q2.
What would be the output of the following code (in editor window)?
A = [1 0 2]	;	b = [3 0 7]	;	c=a.*b;
Answer: (b).[3 0 14]
Q3.
What would be the output of the following code (in editor window)?
a=1:5	;	c=a.^2
Answer: (d). [1 4 9 16 25]
Q4.
What would be the output of the following code (in editor window)?
A = [1	1	0	0]
B = [1	;2	;3	;4]
C=A*B

a.

0

c.

3

Q5.
What would be the output of the following code (in editor window)?
A = [1	2;	3	4]
C = A^2
Answer: (a).[7 10; 15 22]
Q6.
What would be the output of the following code (in editor window)?
A=1:5;
B=cumprod(A)
Answer: (a).b=[1 2 6 24 120]
Q7.
Create an array of logical values.

A = [true false true; true true false]
A = 1 0 1
1 1 0
B = cumprod(A,2)

Find the cumulative product of the rows of A.
Answer: (b). B = 1 0 0
1 1 0
Q8.
Find the cumulative sum of the columns of A.
  A =1     4     7
2     5     8
3     6     9
B = cumsum(A)
Answer: (d).B = 1 4 7
3 9 15
6 15 24
Q9.
Create a 4-by-2-by-3 array of ones and compute the sum along the third dimension.
A = ones(4,2,3);
S = sum(A,3)
Answer: (a).S = 3 3
3 3
3 3
3 3
Q10.
Round each value in a duration array to the nearest number of seconds greater than or equal to that value.
t = hours(8) + minutes(29:31) + seconds(1.23);
t.Format = 'hh:mm:ss.SS'
t = 08:29:01.23   08:30:01.23   08:31:01.23
Y1 = ceil(t)
Y2 = ceil(t,'hours')
Answer: (a). Y1 = 08:29:02.00 08:30:02.00 08:31:02.00
Y2 = 09:00:00.00 09:00:00.00 09:00:00.00
Page 1 of 17

# Suggested Topics

Are you eager to expand your knowledge beyond MATLAB? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!