Project

Coding Basics

1. Creates a matrix \'A\' of size 1X5 and stores the values 1, 2, 3, 4, 5 in it.

Output: A = 1 2 3 4 5

2. Creates a matrix \'B\' of size 5X1 and stores the values 1, 2, 3, 4, 5 in it.

Output: B = 1

2

3

4

5

3. Output is not possible. Since, dimensions are incorrect for matrix multiplication ( A is 1X5 and B\' is 1X5).

4. Multiplies \'B\' matrix with \'A\' matrix and stores it in C.

Expected output:

C =

1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25

5. Prints the value of the matrix \'A\'.

Expected output:

ans = 1 2 3 4 5

6. Prints the first 2 values of the matrix \'A\'.

Expected output:

ans = 1 2

7. Output is not possible. Since, the index 3 exceeds the total no. of columns (i.e. 1).

8. length(B)-2 = 5-2 = 3. Therefore, B(3) is displayed.

Expected output:

ans = 3

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.