MEA 493 FINAL
What is the output for the following set of expressions? >>c=4; >>d=5; >>clear d; >>c*d
Ans= 20
>>>
Undefined function for variable 'd'
Undefined function for variable 'c'
>>whos x; what does this command do?
The whos command brings up a spreadsheet type window that show the variable type and current value(s).
The whos command provides a text output in the command window that lists the name, size, and class (data-type) of the variable
The whos command declares the variable x.
The whos command stands for 'who is' and lists information about the user working on the system.
A user is entering a command that includes a variable that has not been defined. What will MATLAB do?
MATLAB will print an error message in red 'Undefined function or variable' and return to the input prompt
MATLAB will ignore the command and return to the input prompt.
MATLAB will exit.
MATLAB will generate a log file 'messages.txt'. The log file contains a detailed description of the error.
What is the output of ....... >>my_string = 'Hello World'
Name Size Bytes Class Attributes
No output
Hello World
My_string = Hello world
Which of the following is true about variables
Variables are containers that holds either text or a number.
Variables are not case sensitive.
Variables must be defined by the user prior to use, except for the built in variables pi, inf, and nan
Each variable has a unique data type.
>> x = 4; >>y=5; >>x >= 4 || y<3
True
False
What does the command '||' mean
Both have to be true to be true
One can be true and one can be false to be true
Both have to be false to be true
>> ~ (4 > 0)
True
False
What does the command "~=' mean
Nothing
The opposite of the answer given
>> a = 1 >> b = 2 >> b > a && false
True
False
What do single comparisons evaluate to?
True
False
1
0
What does the command '&&' mean
True if both operants are true and false in all other cases
true and true in all other cases
false and false in all other cases
false and false in all other cases
Which of the following is not correct?
and &&
Or ||
Not ~
Maybe $
WHich of the following is not ture about MATLAB scripts
Scripts are text files with .m extensions
Executing a script is identical to manually copying the content of the script to the command window line by line.
Scripts automatically execute when opened with the MATLAB editor.
Variables defined during script execution are available in the Workspace window.
>> a = 4; >> b = 5; >> c = true; What does the expression below evaluate to? >> c && ~ (b >= a)
1
0
What is the output of the following set of statements? >> a = 2.45; >> b = 2 * (a - 1.20); >> fprintf('Measured rainfall was %4.2f inches\n', b);
Measured rainfall was %4.2f inches
Measured rainfall was 2.45 inches
Measured rainfall was 2.50 inches
Measured rainfall was 4.20 inches
Which of the following is true about MATLAB scripts?
They can contain multiple statements
All statements must be terminated with a semicolon
They must contain exactly one fprintf statement
They can include variable assignment statements
Which of the following statements is true about the if/else/elseif/then/end construct in MATLAB?
If statements can be nested
The else ... End block is mandatory.
There can only be one line of code between the each of the blocks.
The expression is one that reduces to a logical value (true/false)
The else ... End block is optional.
A =8; b=2; if a>b ..... y=a*b; ....elseif a==b ....y =a; ... else ...y =b; ... end ... y=a;
Y= 8
Y=2
Y= 16
Number = -10; value = 2; x = 0; if number > 0.... If value == 2; ... x = 1; ... end ... else ...if value == 2; ... x=2; ...end...end
2
-10
0
1
X = 3; y = 1; if x > 3 .... y = x; ..... end
1
3
True
False
Which of the following are true about elseif blocks in MATLAB's if elseif else construct?
You can nest another if statement within an elseif block
An if elseif else construct may have any number of associated elseif blocks, including 0
If an if elseif else construct includes an elseif block an else block must also be included
Any elseif blocks must be after the if block and before the else block, if present
An if elseif else construct may include either 0 or 1 elseif blocks, but cannot include 2 or more
Th syntax for I is..
Start stop step
Start step stop
Stop start step
Which of the following statements about for and while loops are correct?
The number of iterations of a for loop is known at the entry point of the loop.
A mathematical sum can be computed with a for loop.
The number of iterations of a while loop is known at the entry point of the loop.
Some for loops never terminate.
Any for loop can be expressed as a while loop.
Some while loops never terminate.
{"name":"MEA 493 FINAL", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"What is the output of >>>C =1;, What area lists all of the litst all of the defined variables for a current session?, What window is ues to evaluate expressions","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
More Quizzes
Hoe goed ken je me? Groet Zarah
6315
Which Committee Member Could You Beat in a Fight?
320
The Latest Model of Artificial Womb Technology
5224
Hydroelectricity
520
Module 37
231224
Which Club For You?
840
Employee Appreciation Lunch
210
WHAT DID I LEARNED TODAY
1360
Testa hur bra koll du har pƄ rollen som byggprojektledare!
940
The Water Cycle
520
Įįįįį įįį į¤įįįįį£į į
502521
Blood
15812