Question 1
Can we save a MATLAB program while in debugging mode?
A. TRUE
B. FALSE
View Answer
Answer: Option B
Explanation:
While in debugging mode, we are really trying out the function. So, when the debugging mode starts, the command line is halted at a certain line in the function and the evaluation of the function is stopped. Hence, it’s not possible to bring a change in the function and save it in the directory. We’ve to exit from the debugging mode and then we can save the function.
Question 2
The dbcont command, if placed in an m.file, will __________
A. not allow the function to be saved
B. give error when we enter dbcont in debug mode
C. will give an error during function call
D. dbcont does not exist
View Answer
Answer: Option B
Explanation:
The function will be saved and it will run. After enter the debugging mode, and making any desirable change, when we enter the dbcont command, the function will keep working until it invokes the dbcont command. Then it will result in an error and the control will break the evaluation of the function entirely.
Question 3
The dbquit command, if placed in an m.file, will __________
A. never run the debugging mode
B. exit from the debugging mode
C. result in an error while running the function
D. dbquit does not exist
View Answer
Answer: Option C
Explanation:
This command will result in an error if it is placed within an m.file. This is because debugging commands can only be used when the control enters debug mode and we need to give these commands only from the command window.
Question 4
The dbstop command, for anonymous functions __________
A. Pauses, for debugging, after the line which dbstop indicates
B. Pauses, for debugging, before the line which dbstop indicates
C. exits from the debugging mode after the line which dbstop indicates
D. exits from the debugging mode before the line which dbstop indicates
View Answer
Answer: Option A
Explanation:
For anonymous functions, the dbstop command works differently in contrast to pre-defined functions. This nature of working is only for anonymous functions which are not stored in the MATLAB memory. The dbquit command is used to exit from the debugging mode.
Question 5
The dbstop command, for functions stored in the system memory, with a line mentioned will __________
A. pause the evaluation of the function before the mentioned line
B. exit the evaluation of the function before the mentioned line
C. pause the evaluation of the function during the mentioned line
D. pause the evaluation of the function after the mentioned line
View Answer
Answer: Option A
Explanation:
In contrast to anonymous functions, the dbstop command will pause the working of a function just before the mentioned line. It will pause the evaluation and enter the debugging mode.
Question 6
The debug commands can be run in
A. functions
B. live scripts
C. command window
D. nowhere
View Answer
Answer: Option C
Explanation:
The debug commands can only be run from the command window. If they are present in user-defined functions or live scripts, the working of the function would entirely stop when any debug command is invoked while evaluation of the function.
Question 7
The return command is similar to the dbcont command.
A. TRUE
B. FALSE
View Answer
Answer: Option A
Explanation:
The working of the return command is similar to the dbcont command. It will get from the debugging mode and return to evaluate the function completely.
Question 8
To end the debugging mode, we use the __________
A. dbquit
B. dbend
C. debugend
D. No such function
View Answer
Answer: Option A
Explanation:
The dbquit command can be used to exit from the debugging mode. This is pre-defined in MATLAB. dbend and debugend commands don’t exist.
Question 9
To enter a value and change the course of working of a function while it is working, we use the __________
A. dbstop
B. db
C. keyboard
D. enter
View Answer
Answer: Option C
Explanation:
The keyboard command is pre-defined in MATLAB and allows us to enter the debugging mode. We need to give the command in our m.file where we want to start debugging and then the control will return to the keyboard where we will be able to give new value to the parameters involved in the function.
Question 10
What is dbstop command?
A. exits from the debugging mode
B. pauses for the debugging mode when a condition is reached only
C. exits the debugging mode at any point in the function
D. does not exist
View Answer
Answer: Option B
Explanation:
The dbstop command stops the debugging mode. Now, we can give the dbstop command in many ways. One of the ways is mentioning a condition, regarding when the working of the function should stop, to enter the debugging mode. To exit from the debugging mode, we need to use the dbquit command.
Question 11
Which of the following command would allow us to continue the evaluation of a function in the debugging mode?
A. dbcont
B. dbcontinue
C. continue
D. debugcont
View Answer
Answer: Option A
Explanation:
The dbcont command would allow us to continue the working of our function after we have entered the debugging mode. The continue command is used in loops, it won’t help us in this case.