Branching – 1 MCQ’s

Read Time:1 Minute, 50 Second

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Branching – 1″.

1. What is the output of the following code?

if(x~=c)
p=0;
end

a) p=0
b) Output will be suppressed
c) Error
d) Cannot be determined

2. The end statement is given multiple times in _________
a) Multiple elseif
b) Nested if
c) elseif
d) if

3. Amongst multiple elseif and nested if, which would take less runtime?
a) multiple elseif
b) nested if
c) elseif
d) elseif & nested if

4. What is the output of the following code?

syms x;
if(x>50)
fprintf('Error')
end

a) Error
b) Prints Error
c) Does not print error
d) Cannot be determined

5. What will happen if we don’t give an otherwise block to our switch structure?
a) Error
b) Infinitely demands a correct variable for case
c) Returns 0
d) Moves on to the next block

6. What is the output of the following code?

syms x c; 
if(x~=c)
fprintf(‘Error’); 
end

a) Error
b) Error due to x
c) Error due to c
d) Error due to x and c

7. While developing a switch-case structure, the value for case can be _________
a) Single only
b) Multiple
c) Infinite
d) 0

8. Menu-driven architecture should be done by ________
a) if-else structure
b) switch-case structure
c) stack
d) loop structure
View Answer

9. What is the output of the following code?

sym x c; 
if(x~=c)
fprintf('Error');
end

a) Error
b) Error due to x
c) Error due to c
d) Output suppressed

10. Giving conditions using characters, we give them using ____
a) ‘’
b) ””
c) No special character
d) []

11. The program to check the highest of n numbers can be done by ________
a) Sorting
b) If-else structure
c) Switch-case structure
d) Depends on the nature of n

12. The switch-case structure is a _________
a) Conditional structure
b) Logical structure
c) Multidimensional structure
d) Hierarchical structure

13. What is the output of the following code?

if()
p=9;
end

a) Error
b) p=9
c) Output is suppressed but p=9
d) 0

14. What is the output of the following code?

if(x=99)
var=92;
end

a) Error
b) var=92
c) Output is suppressed but var=92
d) Nan

15. The if structure is a _________
a) Conditional structure
b) Logical structure
c) Nested structure
d) Biased structure

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous post Sparse Matrices – 2 MCQ’s
Next post Branching – 2 MCQ’s