User Input and Screen Output – 2 MCQ’s

Read Time:1 Minute, 31 Second

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “User Input and Screen Output – 2″.

1. What is the output of the following code?

sprintf(‘%E’,912)

a) 9.120000E+02
b) 9.120E+02
c) 9.1200E+02
d) 9.12000E+02

2. What is the output of the following code?

sprintf(‘%d %d %d’,.1, .2.3)

a) Error
b) ‘1.000000e-01 2.000000e-01 3.000000e-01’
c) 1.000000e-01 2.000000e-01 3.000000e-01
d) []

3. What is the output of the following code?

sprint(‘%i’,91293)

a) 91293
b) Syntactical Error
c) The format specifier does not exist
d) ‘91293’

4. What is the output of the following code?

disp({12 })

a) [12]
b) 12
c) [12 ]
d) Error

5. What is the output of the following code?

sprintf('%04.2f',2.9121)

a) ‘2.91210000000000000000’
b) ‘2.91’
c) 2.91
d) Error

6. What is the output of the following code?

size(‘’)

a) 0
b) Error
c) 0 0
d) 1 1

7. What is the output of the following code?

sprintf(); disp();

a) Error due to disp
b) Error due to sprintf()
c) Both gives an error
d) No output is displayed

8. How can we influence the disp command with format specifiers?
a) Not possible
b) Via the sprintf() command
c) Use format specifiers as string input
d) Give format specifiers as input only

9. What is the output of the following code?

P=disp(234)

a) Error
b) P=234
c) 234
d)

     P=
        234

10. What is the output of the following code?

fprintf(“%f”,.123)

a) .123000
b) %f
c) Error
d) .123

11. What is the output of the following code?

disp(“12”)

a) ‘12’
b) “12”
c) 12
d) Error

12. What is the size of ans variable after the following code?

sprintf('23 23')
ans=
      ’23 23’

a) 14 bytes
b) 10 bytes
c) Error
d) 1*5

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 User Input and Screen Output – 1 MCQ’s
Next post Evaluation – 1 MCQ’s