This set of Visual Basic Multiple Choice Questions & Answers (MCQs) focuses on “ControlChars.Newline Constant and Designing Default Button”.
1. The __________ constant instructs the computer to advance the insertion point to the next line in control.
Explanation: The ControlChars.NewLine constant when inserted at the right location in the code, the control shifts to the next line. Thus it instructs the computer to advance the insertion point to the next line in control.
2. __________ can be used to advance the insertion point in a file or on the printer.
a) Advance pointer
b) Nextpoint pointer
c) NextLine constant
d) ControlChars.NewLine constant
Explanation: The ControlChars.NewLine constant when inserted at the right location in the code, the control shifts to the next line. Thus it can be used to advance the insertion point in a file or the pointer.
3. Which of the following is called the line continuation character?
Explanation: When a code line exceeds the view, one can use the _ to extend it code into the next line. The line continuation character must be immediately preceded by a space and appear at the end of a physical line.
4. ControlChars.NewLine constant is a __________ constant.
Explanation: Intrinsic constant is one which is built into Visual Basic. ControlChars.NewLine is inbuilt in Visual basic, that is the code for this function, that is its control is already predefined. Thus it is an intrinsic constant.
5. What is wrong with the below statement?
Msg.Text=”This is an example”&ControlChars.NewLine&“Example”.
a) Used double quotes, should have used single quotes
b) No errors
c) There should be spaces before and after each &
d) Should have ended with a ;
Explanation: The & operator is used to concatenate strings and should be preceded and followed by a space. It is a logical operator. Thus the syntax of the above statement is wrong, as there is no space in before and after & operator.
6. What is the specialty of the Default button?
a) Always focused by default
b) Always clears the form it is in
c) Can be selected by the Enter key even when not focused
d) Can be selected by the Shift key even when not focused
Explanation: The Default button is the one that is most commonly used and is assigned the Enter key as shortcut. Thus the Default button can be used that is it can be selected by Shift key even when not focused.
7. The Cancel Button’s procedure is accessed by __________ key.
Explanation: The cancel button is assigned as the Esc key which is used to exit the current form. Thus to exit from the current form we press the Esc key since the Cancel’s button procedure is accessed by Esc key.
8. How many default buttons can a form have?
Explanation: The default button is used to send the information of the current file. In such a case only one button is required per form. Thus a form can have only one default button, to send its own information.
9. How is a default button designated?
a) Default keyword in the definition of the button
b) Setting the setfocus property to on
c) Keeping the button at the bottom of the form
d) By connecting the AcceptButton property to it
Explanation: The AcceptButton property is used to send over the form information hence the button which calls it is set as the default button. Thus the Default Button is designated by connecting the Accept button property to it.
10. What is the correct syntax to designate a default button?
Explanation: The default button is set as form.AcceptButton=button-name. We use to set the default button using the Accept button property, thus we need to give as .AcceptButton to designate a default button in the form.
Sanfoundry Global Education & Learning Series – Visual Basic.
To practice all areas of Visual Basic, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Practice Computer Science MCQs
- Buy Computer Science Books
- Apply for Visual Basic Internship
- Apply for Computer Science Internship
- Buy Visual Basic Books