We read your photo as:

Which indexing returns the second row of matrix A? A) A(:,2) B) A(2,:) C) A(2,2) D) A(2)

Computer Science

ScanSolve AI Answer

Here are the solutions to the questions:

12. The function that generates a row vector of evenly spaced values is

  • C) linspace()
    • linspace(x1, x2, n) generates n points between x1 and x2 (inclusive).

13. One of the following commands creates a 3x3 zero matrix

  • D) zeros(3,3)
    • The zeros(m,n) function creates an m \times n matrix of zeros. zeros(3) would also create a 3 \times 3 zero matrix.

14. What is returned by the command eye (3)?

  • B) Identity matrix
    • The eye(n) function creates an n \times n identity matrix.

15. Which indexing returns the second row of matrix A?

  • B) A(2,:)
    • In MATLAB, A(row, column) is used for indexing. The colon : indicates all elements in that dimension. So, A(2,:) selects all columns of the second row.

16. One of these is a built-in MATLAB function.

  • C) round()
    • round() is a standard built-in MATLAB function used to round numbers to the nearest integer.

17. function keyword is required to define a user-defined function in MATLAB.

  • B) function keyword
    • User-defined functions in MATLAB begin with the function keyword.

18. User-defined functions can be saved at

  • D) .m files
    • All MATLAB script and function files are saved with the .m extension.

19. One of the following keywords is used to terminate a function in matlab.

  • B) end
    • The end keyword is used to terminate the definition of a function, if statements, for loops, and while loops in MATLAB.

20. One of the following is a function used to calculate the square root in MATLAB.

  • B) sqrt()
    • The sqrt() function calculates the square root of a number.

21. The command used for basic 2D plotting is

  • B) plot()
    • The plot() function is the primary command for creating 2D line plots in MATLAB.

22. Which function creates 3D surface plots?

  • A) surf()
    • The surf() function creates 3D surface plots from matrix data.

23. Which command is used to label the x-axis of a graph in MATLAB?

  • A) xlabel()
    • The xlabel() function adds a label to the x-axis of a plot.

24. Indicate how to hold a plot to add more data series?

  • C) hold on
    • The hold on command retains the current plot in the axes so that new plots added to the axes do not delete existing plots.

25. title() is a function used to set the title of a plot?

  • B) title()
    • The title() function adds a title to the current plot.

26. Which loop repeats a block a fixed number of times?

  • D) for
    • A for loop is used when you know in advance how many times you want to execute a block of code.

27. The conditional statement used to check multiple conditions is termed as

  • C) elseif
    • The elseif statement is used in conjunction with if and else to check multiple conditions sequentially.

28. The output of mod (9,4) is

  • B) 1
    • The mod(a,n) function returns the remainder after division of a by n.
    94=2 with a remainder of 1\frac{9}{4} = 2 \text{ with a remainder of } 1 Therefore, mod(9,4) is 1.
Was this helpful?

Still stuck on this one?

Ask a follow-up, and the answer starts from this question.

Got a different question?Ask your own question