Visual Basic Questions and Answers – ControlChars.Newline Constant and Designing Default Button

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.
a) ControlChars.NewLine
b) ControlChars.NextLine
c) ControlChars.Line
d) ControlChars.blankLine
View Answer

Answer: a
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
View Answer

Answer: d
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?
a) *
b) ^
c) –
d) _
View Answer

Answer: d
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.
advertisement
advertisement

4. ControlChars.NewLine constant is a __________ constant.
a) Pure
b) Invariable
c) Character
d) Intrinsic
View Answer

Answer: d
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?

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
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 ;
View Answer

Answer: c
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.
advertisement

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
View Answer

Answer: d
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.
a) Esc
b) Alt
c) Ctrl
d) Shift
View Answer

Answer: a
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.
advertisement

8. How many default buttons can a form have?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: a
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
View Answer

Answer: d
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?
a) Form.default=button1
b) Form.defaultButton=button1
c) Form.AcceptButton=button1
d) Form.focused=button1
View Answer

Answer: c
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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.