You are currently viewing matlab linkedin quiz answers
matlab linkedin quiz answers_theanswershome

matlab linkedin quiz answers

1. Which is not a feature of the inputParser object?

  • It creates name-value pair arguments.
  • It customizes error messages.
  • It gives optional parameters default values.
  • It validates arguments.

2. Which choice uses the proper syntax for an if else statement?

3. What kind of files are stored with the .mat extension?

  • function files
  • stored variable files
  • figure files
  • script files

4. You are debugging a function and have set a breakpoint on the line before the error occurs. You look at the variable values and suspect the cause of the error is that a is 9 but should be 10. The next statement after the breakpoint will use a. Which action would help you test if a=10 solves the problem?

  • Type “a = 10; continue” into the command window.
  • Type “a = 10;” into the function file, before the statement that’s throwing an error. Then type “return;” into the command window.
  • Type “a = 10” into the command window. Then click the Run button in the debugger window.
  • Type “a = 10:” into the function file, before the statement that’s throwing an error. Then click the Run button in the debugger window.

5. At what will MATLAB look first for a called function?

  • functions within the current file
  • built-in functions
  • functions within the current directory
  • functions on the path

6. How is the random seed for MATLAB's random number generator first initialized in a MATLAB session?

  • Seed is undefined until it is initialized by the user.
  • Seed is set to a value based on the current time on startup.
  • Seed is set to a value based on the current time when user first calls rand().
  • Seed is set to a static default value on startup.

7. What is a reason to save a MAT-file using the -v7. 3 flag?

  • to avoid HDF5 overhead in MAT-file
  • to include a variable greater than 2GB
  • to ensure backward compatibility
  • to use compression by default

8. What is a key difference between && and &?

  • && is a logical operator and & is not.
  • && employs short-circuiting behavior and & does not.
  • & & is a bitwise operator and & is not.
  • && is always slower than &.

9. What is the result of this code?

s="abcd"; s(3)='x'

  • a 1x 3 string array
  • abxd
  • a run-time error
  • “abxd”

10. You would like to randomly reorder every element in array a and put the results in b. Which code block will not necessarily do that?

a = 1:10;

11. For a 5 x5 array, the two subscript index (4,2) indexes the same location as linear index _____ .

  • 8
  • 7
  • 17
  • 9

12. Which statement returns a cell array of the strings containing 'burger from menu?

menu = {'hot dog' 'corn dog' 'regular burger' 'cheeseburger' 'veggie burger'};

  • menu{strfind (menu, ‘burger’ )}
  • menu (strfind(menu, ‘burger’) )
  • menu (contains (menu, ‘burger’))
  • menu{contains (menu, ‘burger’ ) }

13. What is the set of possible values that a may contain?

a = randi(10, [1,10]);
a(3) = 11;
a(a>2)=12;

  • 2, 11, 12
  • 1, 2, 12
  • 1, 12
  • 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

14. my func is a function as follows. What is the value of a at the end of the code beneath?

function a = my_func(a)
a = a + 1;
end


------------

a = 0;
for i = 1:3
my_func(a);
end
a = my_func(a);

  • 3
  • 1
  • 4
  • 0

15. Which statement returns the character array 'alone'?

b = ['stand' 'alone'];

  • b(2)
  •  b(7:11)
  • b(1,2)
  • b(6:end)

Leave a Reply