Matlab Functions Quiz
35 essential questions on using built-in functions, understanding inputs/outputs, accessing documentation, and creating anonymous functions.
Question 1
What is the correct syntax to call a function named 'myFunc' with input 'x' and store the result in 'y'?
Question 2
How do you capture two output arguments from a function, such as 'max'?
Question 3
Which command displays a brief summary of a function's usage directly in the Command Window?
Question 4
What does the command 'doc plot' do?
Question 5
How do you define an anonymous function that squares its input?
Question 6
Which of the following is a valid name for a user-defined function?
Question 7
If a function returns two values but you only want the second one, how can you ignore the first?
Question 8
What happens if you call a function with fewer inputs than it expects (and it doesn't handle defaults)?
Question 9
What is the data type of 'f' in 'f = @(x) x+1'?
Question 10
Can an anonymous function contain multiple statements or loops?
Question 11
Which built-in variable inside a function tells you how many input arguments were passed?
Question 12
How do you call a function that requires no inputs?
Question 13
What is the maximum length of a function name in MATLAB?
Question 14
If you have a function handle 'h', how do you evaluate it with input 5?
Question 15
Which command lists all functions in the current folder?
Question 16
Can you define a function inside a script file?
Question 17
What is the purpose of 'varargin' in a function definition?
Question 18
Which function allows you to find the path of a built-in function file?
Question 19
What is the scope of variables defined inside a standard function?
Question 20
How do you create an anonymous function with two inputs, x and y?
Question 21
What does 'lookfor keyword' do?
Question 22
Which symbol is used to separate multiple output arguments in a function definition?
Question 23
If you define 'a = 5' in the Command Window, can an anonymous function 'f = @(x) x + a' use 'a'?
Question 24
What is the primary difference between a Script and a Function?
Question 25
Which naming convention is most commonly recommended for standard MATLAB functions?
Question 26
What does the 'disp' function do?
Question 27
How can you pass a function as an argument to another function (e.g., to 'fplot')?
Question 28
What does 'nargout' allow you to do?
Question 29
Which keyword starts a function definition in a file?
Question 30
What is the result of 'feval(@sin, pi/2)'?
Question 31
Can a function name contain a period (e.g., 'my.func')?
Question 32
What does the 'input' function do?
Question 33
If you want to create a function that accepts any number of inputs and returns their sum, which tool is essential?
Question 34
What is a 'local function'?
Question 35
How do you access the documentation for a specific operator, like the colon operator?
