Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/126

Click to flip

126 Cards in this Set

  • Front
  • Back
What does FCL stand for?
Framework Class Library
Objects are created from the blueprint defined by a ____
Class
The ______ method is an ideal place to put any cleanup code you may want to be executed
Dispose
Class that is responsible for managing a windows application and provides a set of properties for you to get information about the current application
Application Class
All methods and properties of the Application class are ____
Static
It is not possible to create an instance of the Application class. True or false?
True
If a form is ____ you can not interact with any other form until that form is closed
Modal
The .NET framework hides the _____ members of the base class from the derived class
Private
Add a handler to a form's mouse down event so that it uses the delegate form1_mousedown
AddHandler me.MouseDown, AddressOf me.form1_mousedown
A graphics class can not be directly created. Name the three ways to get a graphics object.
1. Through the PaintEventArgs passed to the Paint event
2.By calling the CreateGraphics method of a control or form
3. By calling the Graphics.FromHwnd method and passing to it the handle of the current form
4. By calling the static Graphics.FromImage method. This method takes an image object and returns a Graphics object
What two structures represent points in vb.net
Point and PointF
Draw the following text on a form from within the forms Paint event using a black brush: "Hello there"
Dim grfx as Graphics = e.Graphics
grfx.DrawString("Hello there", Font, Brushes.Black, 0, 0)
Calling the ________ method causes a Paint message to be sent to the form.
Invalidate
What namespace must be included in order to draw 2d shapes on a form?
System.Drawing.Drawing2D
What namespace must be included in order to work with images
System.Drawing.Imaging
The ______ object gives access to a drawing surface.
Graphics
What does IDE stand for?
Integrated Development Environment
Method used to change the data type of a given expression
CType(Expression,NameType)
What is the difference between a public property and a public field
A property does not have any storage location associated with it. A property uses a private field to store its data.
What is the purpose of organizing classes in namespaces
For organization puposes and so that you can uniquly name a class and not have it be confused with an existing class in another namespace.
What property would you use to control the shape of the mouse pointer when it passes over a specific area of a form?
The cursor property of a form can be used to specify the default mouse pointer shape for a form
How do you add a custom property to a form?
To add a custom property define a public property. The get and set accessors define what happens when you attempt to read or write the property value.
You are designing a Windows Form that will
work like a splash screen, giving the welcome
message and product information when the
application starts. What properties would you set
on the form to make it look like a splash screen?

A. Set the FormBorderStlye property to
FormBorderStyle.SizableToolWindow,
StartPosition property to
FormStartPosition.CenterScreen.

B. Set the FormBorderStyleProperty to Fixed3D,
MinimizeBox to False, MaximizeBox to False,
ControlBox to False and StartPosition to
CenterScreen.
C. Set the FormBorderStyle property to None,
set StartPosition to CenterScreen and
TopMost property to True.
D. Set the TopMost property to True,
ShowInTaskbar to False, BackColor to
Desktop and StartPosition to CenterScreen.
C. When you set the FormBorderStyle property
to None through the Properties window, the
form will have neither the title bar nor borders
displayed. In addition, splash screens are generally
displayed on the center of the screen and are
not resizable. Given these facts, C is the correct
answer.
You are designing a graphical Windows application
to allow your users to design their homes’
interiors. Users are very particular about getting
good quality printing of their designs and want a
fast performing application. What should you do
while using a Graphics object to create lines and
curves?
A. Set the SmoothingMode property of the
Graphics object to AntiAlias.
B. Set the SmoothingMode property of the
Graphics object to HighSpeed.
C. Set the SmoothingMode property of the
Graphics object to HighQuality.
D. Set the SmoothingMode property of the
Graphics object to Laser.
B. SmoothingMode has no effect whatsoever on
printing quality. Antialiasing involves extra work
and makes applications slower. So to increase
speed in this case, select the HighSpeed option.
The HighSpeed value is same as the AntiAlias
value so is not required in this case.
You are a Windows developer for a major component
vendor. Your company is planning to launch
a product that will provide a set of sophisticated
Windows Forms. Your customers can inherit
their forms from these forms to speed up their
development work. In one of the forms you have
certain properties that are for advanced use only.You don’t want these properties to be displayed in
the Properties window, but you would like programmers
to see these properties via the
IntelliSense help. Which of the following attributes
would you use for these properties?
A. <Browsable(true), _
EditorBrowsable(EditorBrowsableState.Never)>
B. <Browsable(false), _
EditorBrowsable(EditorBrowsableState.Always)>
C. <Browsable(true), _
EditorBrowsable(EditorBrowsableState.Always)>
D. <Browsable(false), _
EditorBrowsable(EditorBrowsableState.Never)>
B. Setting the Browsable attribute of a property
to False hides the property from the Properties
window. The EditorBrowsable attribute specifies
whether the property will be available through
IntelliSense help. So the correct answer is B.
You are a Windows developer for a company
developing shareware software. Your task is to
develop Personal Information Management software
that will run on a Windows platform. The
main form of the application has various controls
placed on it. You want to resize all the controls
when the form is resized. Which of the following
options would you choose?
A. Write the resizing logic for each control in its
own Resize event handler and set the
ResizeRedraw property to True for each one
of them.
B. Write the resizing logic in the form’s Paint
event handler.
C. Write the resizing logic in the form’s Paint
event handler and set the form’s ResizeRedraw
property to True.
D. Write the resizing logic for each control in its
own Paint event handler and set the
ResizeRedraw property to True for each one
of them.
C. Setting the ResizeRedraw property to True for
a form fires its Paint event whenever the form is
resized. Programming the Resize event for each
control won’t work, as when the form is resized,
the control is not resized, anyway.
You are developing a Windows application containing
a single Windows Form. You need to do
some initializations that will change the appearance
of the form and assign values to some fields
when the application starts. Where should you
put your code?
A. In the InitializeComponent method
B. In the form’s constructor
C. In a custom procedure
D. In the form’s Dispose method
B. A form’s constructor is the ideal place to put
all initialization, as it ensures that all initialization
is done at the time the form is created. Although
InitializeComponent procedure is also called
from form’s constructor it is not recommended to
put code there, as it can interfere with Windows
Forms Designer working.
You are drawing a big line of text on your form
displaying the company name. You would like to
fill the text with the image a of company logo.
Which Brush should you use?
A. SolidBrush
B. TextureBrush
C. HatchBrush
D. ImageBrush
B. Only TextureBrush can fill using an image.
There is no such brush as an ImageBrush.
You want to make a Windows Form completely
transparent when it is displayed. What should
you do?
A. Set TransparencyKey property to 0%.
B. Set TransparencyKey property to 100%.
C. Set Opacity property to 0%.
D. Set Opacity property to 100%.
C. Opacity sets the transparency level for a form,
whereas TransparencyKey will only make those
form areas transparent which match a specified
color. The use of TransparencyKey is also wrong
here.
You can see a property in the Properties window
for a Windows Form but cannot modify it. What
could be the cause?
A. The Browsable attribute for the property
must be False.
B. The property is a private property.
C. The Set accessor of the property is private.
D. The Set accessor of the property is not implemented.
D. You can make a property read only by not
implementing the property’s Set accessor. The
Browsable attribute just hides or shows the property
in the Properties window; the question mentions
that you can already see the property in
Properties window. Finally, you cannot set the
access modifiers, such as public or private on
accessor functions; you can only apply them to a
property as a whole
Which of the following methods can be used for
getting a Graphics object for a Windows Form?
A. Graphics.FromForm
B. Graphics.FromImage
C. Graphics.FromHwnd
D. Graphics.CreateObject
C. Graphics.Hwnd is the function that gets a
Graphics object for a Windows Form.
Graphics.FromImage can only get the Graphics
object for an image file. The other two methods
are nonexistent.
Which one of the following points has coordinate
x=0 and y=0 for a Windows Form:
A. Top-left corner of Client area of form
B. Center of the Client area of form
C. Top-right corner of Client area of form
D. Center of the user’s screen
A. The top-left corner of the Client area has
coordinates of (0, 0) for a Windows Form.
You want to change the property of a form so
that all text placed on it will appear in bold.
Which of the following statements would you use
in form’s constructor?
A. this.Font.Bold = true;
B. this.Font = new Font(this.Font,
FontStyle.Bold);
C. this.Font.FontStyle = FontStyle.Bold;
D. this.Font = new Font(this.Font,
this.Font.Bold);
B. You cannot directly set the Bold property of a
Font object, as its set accessor is not available. So
the only way to set the Font’s Bold property is by
calling its constructor to create a new Font object
and then use this newly created object.
You are designing an interactive Windows
application to respond to several user actions. You would like to change the form’s appearance
when the user moves a mouse over the form. You
have written an event handler that implements
this change and want it to attach to MouseMove
event. What statement should you use in your
form’s constructor?
A. AddHandler Me.MouseMove,
Me.MouseMoveHandler
B. RemoveHandler Me.MouseMove,
Me.MouseMoveHandler
C. RemoveHandler Me.MouseMove, AddressOf
Me.MouseMoveHandler
D. AddHandler Me.MouseMove, AddressOf
Me.MouseMoveHandler
D. To add an event handler, use the AddHandler
keyword and pass the address of the delegate
function that will handle the events.
You want to create a Windows application capable
of manipulating image files in GIF, JPG, and
PNG formats. Which class you should use in
your program?
A. Bitmap
B. Image
C. Icon
D. Metafile
A. Image is an abstract class, it so won’t help you
much in image-related operations. Bitmap is the
implementation of Image class that can work
with several types of image formats including
GIF, JPG, and PNG formats.
You are using objects of HatchBrush class in your
program but have forgotten to include the reference
of its namespace
System.Drawing.Drawing2D through a using
directive at the top of program. Which of the following
statement holds true for this scenario?
A. You will get a compile-time error while compiling
the Import statements.
B. You will get an error at runtime while executing
the Import statements.
C. The compilation should be okay if you refer
to the HatchBrush class as
System.Drawing.Drawing2D.HatchBrush in
your program.
D. The compilation should be okay if you refer
to all HatchBrush objects by prefixing them
with System.Drawing.Drawing2D namespace.
C. When you are not including an Import directive
for a namespace, you need to fully qualify
any class belonging to that namespace in your
program. The compiler only needs to qualify the
class names, not the object names; therefore
answer D is not correct. Problems with namespace
qualifications can only lead to a compiletime
error, not to a runtime error, so answer B is
also not correct. Missing a using directive will not
give compile error at the using statements, but it
might give error later in the program if it is
unable to uniquely identify a class, so answer A is
incorrect.
You are creating an object of the GraphicsPath
class in your program. When you compile the
program, you get an error saying that the type or
namespace name cannot be found. What should
you do?
A. Add reference to System.Drawing.dll in your
program.
B. Include an Imports System.Drawing statement
at top of your program.
C. Include an Imports
System.Drawing.Drawing2D statement at the
top of your program.
D. Include an Imports System.Drawing.Imaging
statement at the top of your program.
C. GraphicsPath class belongs to
System.Drawing.Drawing2D namespace. This
namespace must be included with a using directive
to uniquely identify GraphicsPath class in
your program.
It is possible to add controls to a form programmatically. While
doing so, you must remember to add code to do the following three
things:
1. Create a private variable to represent each of the controls you
want to place on the form.
2. In the form’s constructor place code to instantiate each control
and to customize each control using its properties, methods, or
events.
3. Add each control to the form’s control collection.
You can place controls on any container object. Container objects include..
windows forms.
panel controls.
groupbox controls.
A container control has a property called ____ which is the collection of controls that the container contains.
controls
To make a form's button function like a custom dialog box, you must set the button's ______ property.
DialogResult
Use ____ to display a modal dialog box. Use ____ to display a modless dialog box.
ShowDialog
Show
The __________ class provides the ability to start and stop processes on your computer.
system.diagnostic.process
Create a bitwise expression that will work for a check box and changes lblsampletext font style. It should toggle between the current font style and bold.
lblsampletext.font.style Xor fontstyle.bold

In this example if the labels font style was already bold it would un-bold it, and visa versa.
What class is used to create long strings in vb.net
StringBuilder
The selected index property in the listbox, checkedlistbox, and combobox will return ______ if no item is selected
-1
Write the code to load all of the system fonts into a combo box called cbofont
cbofont.items.addrange(FontFamily.Families)
What three ways can a textbox control be displayed
1. Ordinary text
2. Password text
3. Multiline
Write code to change a lbels text color based on what color is selected in a domainupdown control called dudcolor
label1.forecolor = coloe.fromname(dudcolor.text)
Write code to change the font size of a label based on a value in a numericupdown control
label1.font = new font(label1.font.fontfamily, CType(nudfont.value,double)
True or False? When the word wrap property of a rich text box is true, the horizontal scroll bars do not display regardless of the scrollbars property settings.
True
What do you need to make sure to do when you add a toolbar control to a form?
Set the z-order of the control by right clicking it and choose send to back.
The Clipboard object consists of what two public static methods?
GetDataObject and SetDataObject. These get and set the data from the clipboard.
Where can controls be placed in a form? What
are the two ways to add controls?
Controls are placed on any container control or
directly in a form. You can add controls to a container
control either by using the Windows
Forms Designer or by hand coding them
What is the shortcut way to create an event handler
for the default event of a control?
Double click the control
When should you choose a combo box instead of
a list box in your application?
A combo box can save space on a form because
the full list is not displayed until the user clicks
the down arrow (unless its DropDownStyle property
is set to ComboBoxStyle.Simple). Another
reason for choosing a combo box might be that it
contains a text box field, so choices not in its list
can be typed in (unless the DropDownStyle property
is set to ComboBoxStyle.DropDownList).
What different modes of selection are possible in
a list box control?
The different modes of selection possible in a list
box are multiple selections
(SelectionMode.MultiSimple); multiple selections
with the help of Ctrl, Shift, and arrow keys
(SelectionMode.MultiExtended); single selection
(SelectionMode.One); and no selection
(SelectionMode.None)
How can you create modal and modeless dialog
boxes?
Modal and modeless dialog boxes are created in
the same way but are displayed by calling different
methods. Modal dialog boxes are displayed by
calling Form.ShowDialog method, and calling
Form.Show method shows modeless dialog boxes
What different styles can be used to draw a
combo box?
The combo box can be represented in different
styles by setting its DropDownStyle property to
different values of the DropDownStyle enumeration.
It can appear as DropDown, which is the
default style (in which you click the arrow button
to display the items, and the text portion is
editable), as DropDownList (in which it displays
the list of items when the arrow button is clicked,
but you cannot edit the text portion), or as
Simple (in which the list portion is always visible
without any arrow buttons, and the text portion
is also editable).
What is the use of the Tag property of a control?
The Tag property is commonly used to store data
associated with a control. For example, you can
store a reference to a MenuItem object in a
ToolBarButton object’s Tag property. By doing
this you have a reference available to the corresponding
menu item that can be used to perform
an action on the MenuItem object when the
ToolBarButton object is clicked. If using the
Properties window, you can only assign a string
to the Tag property, but in your program, you are
free to assign any type derived from Object class
to the Tag property.
When does the PopUp event of the menu fire?
What is the major use of this event?
The Popup event of a menu is fired just before
displaying its menu items. If a menu has no items
in its submenu, the Popup event is not fired.
What is the difference between the
DateTimePicker control and the MonthCalendar
control? What must you do to display a custom
format in DateTimePicker control?
The MonthCalendar allows you to select a range
of dates, while the DateTimePicker control allows
you to select a date and time. To display a date in
a custom format, the Format property should be
set to DateTimePicker.Custom, and the custom
format should be assigned to the CustomFormat
property of the DateTimePicker control.
How do you merge the menu items of child window
with those of the parent MDI window?
Menu items of child windows are automatically
merged with menu items of the MDI window
depending upon the settings of the MergeType
property and the MergeOrder property. As a side
note, if you want to merge two menus that are
not part of an MDI application, you can use the
MergeMenu method of the MainMenu or
ContextMenu classes.
You are designing a Windows application with a
variety of controls on its user interface. You want
to prevent the user from being able to give focus
to some of the controls under any circumstance.
Which of the following options should you use?
A. Set the controls’ TabIndex property to 0.
B. Set the controls’ TabStop property to 0.
C. Set the controls’ TabStop property to False.
D. Set the controls’ Enabled property to False.
D. To prevent the user from giving focus to a
control under any circumstance, you must set the
control’s Enabled property to False. All other
options will only affect the user’s navigation with
the Tab key. The user could still use the mouse as
long as the Enabled property was True.
of the Windows Forms of your application. You
want to allow the user to select multiple items
from this CheckedListBox. Which value of
SelectionMode property should you choose?

A. SelectionMode.None
B. SelectionMode.One
C. SelectionMode.MultiSimple
D. SelectionMode.MultiExtended
B. The CheckedListBox only supports two values
for the SelectionMode property:
SelectionMode.None, which does not allow any
selection, and SelectionMode.One, in which multiple
selections are allowed. If the other two selection
modes are set through the properties
Window, the IDE generates an error message. If
set programmatically, they will raise an
ArgumentException.
You are using a TreeView control on one of your
Windows Forms. When the user clicks a Tree
node to select it, you need to get the newly
selected node in your program. Which of the following
will give you the correct result?
A. Use the SelectedNode property in the Click
event handler of the TreeView control.
B. Use the SelectedNode property in the
DoubleClick event handler of the TreeView
control.
C. Use the SelectedNode property in the
BeforeSelect event handler of the TreeView
control.
D. Use the SelectedNode property in the
AfterSelect event handler of the TreeView
D. The Click and DoubleClick events are inherited
from the Control class, and they occur
before the new selection is set to the
SelectedNode property. The BeforeSelect event is
also fired just before a Tree node is selected.
Therefore, accessing a SelectedNode property in
these events will return the old selection. The
correct event to program is the AfterSelect event
because this event is fired after the newly selected
node is set in the SelectedNode property.
You are using a CheckBox control on a Windows
Form. The application requires that users either
check or uncheck the check box, but your program
should be also capable of setting the check
box to Indeterminate state depending on the
application’s current state. Which of the following
will satisfy these requirements?
A. Set the ThreeState property of the check box
to False.
B. Set the ThreeState property of the check box
to True.
C. Set the CheckState property to
CheckState.Checked.
D. Set the CheckState property to
CheckState.Unchecked.
A. When the ThreeState property is set to False,
the check box can be set to an Indeterminate
state only through the program and not by any
user interaction.
You are designing a menu that has some mutually
exclusive options. You have set the RadioCheck
property of all the menu items to True and their
OwnerDraw property to false. Still, you are able
to check multiple items from the menu when you
run the program. Which of the following events
should you program to set the mutual exclusion
between menu items?
A. Click
B. Select
C. Popup
D. DrawItem
C. The Popup event is fired just before a menu’s
list of items is displayed. You can use this event
to check or uncheck menu items. Remember that
setting the RadioCheck property to True does not
implicitly set mutual exclusion for menu items;
you can still check several of them together. So
the Popup event is the right place to check the
appropriate item and uncheck all others.
You have placed a rich text box on a Windows
Form. You want both a horizontal scrollbar and a
vertical scrollbar to appear with the control in all
cases. Which of the following choices should you
make? (Select two.)
A. Set the ScrollBars property to
RichTextScrollBars.Both.
B. Set the ScrollBars property to
RichTextScrollBars.ForcedBoth.
C. Set the WordWrap property to False.
D. Set the WordWrap property to True.
B, C. If the WordWrap property of a rich text
box is True (which is the default setting), the horizontal
scrollbar is not displayed, regardless of the
setting in the ScrollBars property. So, if you need
to display the horizontal scrollbar, you need to set
WordWrap as False. If you also want to display
scrollbars all the time, setting the ScrollBars
property to RichTextScrollBars.ForcedBoth will
do that provided that the WordWrap property is
False.
You are modifying an existing Windows Form
application. You have placed a TextBox control on
an existing panel. When you run the program, the
text box appears to be disabled. Which of following
could be the reasons? (Select all that apply.)

A. The Enabled property of text box is False.
B. The ReadOnly property of text box is True.
C. The Enabled property of panel is False.
D. The Enabled property of form is False.
A, C, D. A Control’s Enabled property will
depend on its parent container controls. If the
text box is disabled, it might be because its own
Enabled property is False, or because any of its
parent controls’ (Panel as well as the Form)
Enabled properties are False.
Your application represents an XML document in
a TreeView control. You are working on a module
that gathers all data from the tree and stores it
back in an XML document. Which of the following
properties gives you access to the entire collection
of items in the TreeView?
A. Controls
B. Container
C. Nodes
D. TopNode
C. The Nodes property of a TreeView control
gets the collection of TreeNode objects in the
TreeView. As opposed to this, the TopNode gets
just the first fully visible node in the TreeView.
You want to apply a Bold FontStyle to a Label
control’s Text displayed on your form. This
should not affect any other FontStyle (such as
italic or underline) that the control might already
have. Which of the following expression will
return the correct FontStyle value?
A. lblSampleText.Font.Style Or _
FontStyle.Bold
B. lblSampleText.Font.Style Xor _
FontStyle.Bold
C. lblSampleText.Font.Style And _
FontStyle.Bold
D. lblSampleText.Font.Style Or _
(FontStyle.Underline And _
FontStyle.Italic)
A. The FontStyle enumeration has a
FlagAttribute attribute that allows bitwise operations
on FontStyle values. When you use an
expression such as
lblSampleText.Font.Style Or FontStyle.Bold the FontStyle.Bold represents all Bold
bits set as 1. The result of bit-wise OR
operation with a value 1 is always 1, and
hence the above expression will return a
FontStyle value that adds Bold to the
existing FontStyle of lblSampleText.
You are creating a graphic application in which
you will manipulate a variety of image formats.
You have created an OpenFileDialog object in
your program and have set its Filter property as:
ofdPicture.Filter=”Image Files (BMP, “ & _
“GIF, JPEG, etc.)|*.bmp;*.gif;*.jpg;” & _
“*.jpeg;*.png;*.tif;*.tiff|BMP Files “ & _
“(*.bmp)|*.bmp|GIF Files (*.gif)|” & _
“*.gif|JPEG Files (*.jpg;*.jpeg)|” & _
“*.jpg;*.jpeg|PNG Files (*.png)|” & _
“*.png|TIF Files (*.tif;*.tiff)|” & _
“*.tif;*.tiff|All Files (*.*)|*.*”
You have created a button with its Text property
set to Open Image.... When you click this button,
the Open File dialog box should display the
GIF Files as its first choice in the list of File
Types. Which value for FilterIndex property must
you select to achieve this in the event handler of
button’s Click event?
A. 0
B. 1
C. 2
D. 3
D. The FilterIndex property specifies the filter
currently selected in the file dialog box. It is a
one-based index, so the GIF Files have an index
of 3 in this example.
You are developing a purchase order form. The
form has a View menu with several menu items.
One of the menu items has its Name property set
to mnuViewComments, the Text property set as
C&omments, and the Shortcut property set as
CtrlO. You don’t want to allow users to view
comments unless they have first created some
comments. Which of the following solutions
should you select for this?

In the Popup event of the View menu, set the
Visible property of mnuViewComments to
True if number of comments > 0; otherwise
set the Visible property to False.
B. In the Click event of the View menu, set the
Visible property of mnuViewComments to
True if number of comments > 0; otherwise
set the Visible property to False.
C. In the Popup event of the View menu, set the
Enabled property of mnuViewComments to
True if number of comments > 0; otherwise
set the Enabled property to False.
D. In the Popup event of the
mnuViewComments menu item, set its
Enabled property to True if number of comments
> 0; otherwise set the Enabled property
to False.
C. You should set the Enabled property of
mnuViewComments to True if number of comments
> 0; otherwise, set it to False. When the
menu item is disabled, the user will be unable to
select it from the menu or by pressing the shortcut
key associated with it. The Visible property
hides the menu item from display, but the shortcut
key will still work because the menu item
itself is enabled.
You are designing a form that needs to display a
date in a long date format. This might not be the
operating system’s native format. Which format
property of the DateTimePickerFormat enumeration
should you select?
A. DateTimePickerFormat.Short
B. DateTimePickerFormat.Long
C. DateTimePickerFormat.Time
D. DateTimePickerFormat.Custom
D. You must select
DateTimePickerFormat.Custom, as the other
three will always display date/time according to
the settings in the operating system.
Assume that the menu designer has been already
used to create a menu structure for a form. For
menus to provide functionality required, how are
the menu items assigned program code?
A. By attaching an event handler to the Click
event of each menu item
B. By attaching an event handler to the Select
event of each menu item
C. By attaching an event handler to the Popup
event of each menu item
D. By attaching an event handler to the
DrawItem event of each menu item
A. The action associated with a menu item is performed
when the user clicks the menu, so you
must program the event handler of its Click
event to do the associated task.
You are designing an MDI application in which
the parent container and the child window each
has its own menu structure. You need to suppress
some of the menu items in the child window that
collide with parent menu items. Which of the
following options should you select?
A. Set the MergeType property to
MergeType.Remove for the items that need to
be suppressed.
B. Set the Visible property to False for the items
that need to be suppressed.
C. Set the MergeOrder property to 0 for the
items that need to be suppressed.
D. Set the MdiList property to False for the
items that need to be suppressed.
A. Set the MergeType property to
MergeType.Remove to suppress the menu from
appearing in the Mdi container’s main menu. If
you set it to visible, although the menu item will
be hidden, it can still be invoked by pressing its
associated shortcut key.
What is the default behavior of the .NET framework when an exception occurs?
The .NET framework terminates the application
after displaying an error message when an exception
is raised.
Which is the base class of all the exceptions that
provides the basic functionality for exception
handling? What are the two main types of exception
classes and their purposes?
The Exception class is the base class that provides
common functionality for exception handling.
The two main types of exceptions derived from
Exception class are SystemException and
ApplicationException. SystemException represents
the exceptions thrown by the common language
runtime, whereas ApplicationException
represents the exceptions thrown by user code.
Explain the Message and InnerException properties
of the Exception class.
The Message property describes the current exception.
The InnerException property represents an
exception object associated with the exception
object; this property is helpful when a series of
exceptions are involved. Each new exception can
preserve information about a previous exception
by storing it in InnerException property.
Can you associate custom error messages with the
exception types defined by the CLR? If yes, how
can you do this?
Yes, you can associate custom error messages with
the exception classes defined by the Common
Language Runtime to provide more meaningful
information to the caller code. The constructor of
these classes that accepts the exception message as
its parameter can be used to pass the custom
error message.
What are some of the points you should consider
before creating custom exceptions?
Custom exceptions should be derived from
ApplicationException and should be created only
if existing classes do not meet the requirements of
your application. They should have a name ending
with the word Exception and should implement
the three constructors (default, Message,
and Message and Exception) of their base class.
What is the importance of the Validating event?
The Validating event is the ideal place to store
the field-level validation logic for a control. The
Validating event handler can be used to cancel
the event if validation fails, thus forcing the focus
to the control. This forces the user to enter correct
data.
Explain the purpose of the ErrorProvider
component.
The ErrorProvider component in the Visual
Studio .Net toolbox can be used to show validation-
related error icons and error messages to the
user.
You are creating a data import utility for a personal
information system that you designed
recently. When the record in the source data file
is not in the required format, your application
needs to throw a custom exception. You will create
an exception class with the name
InvalidRecordStructureException. Which of the
following classes would you choose as the base
class for your custom exception class?
A. ApplicationException
B. Exception
C. SystemException
D. InvalidFilterCriteriaException
A. When creating a class for handling custom
exceptions in your programs, the best practice is
to derive it from the ApplicationException class.
The SystemException class is for system-defined
exceptions. The Exception class is the base class
for both ApplicationException and
SystemException classes and should not generally
be derived from directly.
You are assisting your colleague in solving the
compiler error that his code is throwing. The
problematic portion of his code is
Try
Dim success As Boolean = GenerateNewton-
Series(500, 0)
‘ more code here
Catch dbze As DivideByZeroException
‘ exception handling code
Catch nfne As NotFiniteNumberException
‘ exception handling code
Catch ae As ArithmeticException
‘ exception handling code
Catch e As OverflowException
‘ exception handling code
End Try
To remove the compilation error, which of the
following ways would you modify the code?
A.
Try
Dim success As Boolean = GenerateNewton-
Series(500, 0)
‘ more code here
Catch dbze As DivideByZeroException
‘ exception handling code
Catch ae As ArithmeticException
‘ exception handling code
Catch e As OverflowException
‘ exception handling code
End Try
B.
Try
Dim success As Boolean = GenerateNewton-
Series(500, 0)
‘ more code here
Catch dbze As DivideByZeroException
‘ exception handling code
Catch ae As Exception
‘ exception handling code
Catch e As OverflowException
‘ exception handling code
End Try
C.
Try
Dim success As Boolean = GenerateNewton-
Series(500, 0)
‘ more code here
Catch dbze As DivideByZeroException
‘ exception handling code
Catch nfne As NotFiniteNumberException
‘ exception handling code
Catch e As OverflowException
‘ exception handling code
Catch ae As ArithmeticException
‘ exception handling code
End Try
D.
Try
Dim success As Boolean = GenerateNewton-
Series(500, 0)
‘ more code here
Catch dbze As DivideByZeroException
‘ exception handling code
Catch nfne As NotFiniteNumberException
‘ exception handling code
Catch ae As Exception
‘ exception handling code
Catch e As OverflowException
‘ exception handling code
End Try
C. When you have multiple Catch blocks associated
with a Try block, you must write them in
order from the most specific to the most general
one. The Catch block corresponding to the
ArithmeticException should come at the end
because it is a more general class than the three
(DivideByZeroException,
NotFiniteNumberException and the
OverFlowException) classes derived from it.
You need to debug a program containing some
exception handling code. To understand the program
better, you created a stripped down version
of it and included some MessageBox statements
that give clues about the flow of its execution.
The program has the following code:
Try
Dim num As Integer = 100
dim den as Integer = 0)
MessageBox.Show(“Message1”)
Try
Dim res As Integer = num / den
MessageBox.Show(“Message2”)
Catch ae As ArithmeticException
MessageBox.Show(“Message3”)
End Try
Catch dbze As DivideByZeroException
MessageBox.Show(“Message4”)
Finally
MessageBox.Show(“Message5”)
End Try
Which of these is the order of messages that you
receive?
A.
Message1
Message2
Message3
Message4
Message5
B.
Message1
Message3
Message5
C.
Message1
Message4
Message5
D.
Message1
Message2
Message4
Message5
B. When an exception occurs in a Try block, it
will search for a matching Catch block associated
with that Try block. In this case, the
ArithmeticException generates a match for
DivideByZeroException because
DivideByZeroException is derived from
ArithmeticException, and the exception is handled
right there. In all cases the Finally block is
executed.
What is the output displayed by the MessageBox
in the following code segment?
Try
Try
Throw _
New ArgumentOutOfRangeException()
Catch ae As ArgumentException
Throw New ArgumentException( _
“Out of Range”, ae)
End Try
Catch ex As Exception
MessageBox.Show( _
ex.InnerException.GetType().ToString())
End Try
A. System.Exception
B. System.ApplicationException
C. System.ArgumentException
D. System.ArgumentOutOfRangeException
D. The message box displays
System.ArgumentOutOfRangeException because
you caught and wrapped that exception in the
InnerException property of the exception caught
later by the outer Catch block.
The Validating event of a text box in your
Windows application contains the following
code. The MyValidatingCode method validates
the contents of the text box. If the contents are
invalid, this method throws an exception and
retains the focus in the text box. The line numbers
in the code sample are for reference purpose
only.
01 Private Sub TextBox1_Validating( _
02 ByVal sender As System.Object, _
03 ByVal e As System.EventArgs) _
04 Handles TextBox1.Validating
05 Try
06 MyValidatingCode()
07 Catch ex As Exception
08
09 TextBox1.Select(0,
➥textBox1.Text.Length)
10 ErrorProvider1.SetError(textBox1,
➥ex.Message)
11 End Try
12 End Sub
Which of the following line of code should be in
line 8?
A. e.Cancel = True
B. e.Cancel = False
C. TextBox1.CausesValidation = True
D. TextBox1.CausesValidation = False
A. When you want to retain the focus inside a
control after the Validating event is processed,
you must set the Cancel property of the
CancelEventArgs argument in the Validating
event, so the correct answer is e.Cancel = True.
The CausesValidation property has a different
purpose: It decides whether a Validating event
will be fired for a control.
You have designed a Windows Form that works
as a login screen. The form has two TextBox controls
named txtUserName and txtpassword. You
want to ensure that the user can only enter lowercase
characters in the controls. Which of the following
methods should you use?
A. Set the form’s KeyPreview property to True and
program the KeyPress event of the form to
convert uppercase letters to lowercase letters.
B. Create a single event handler attached to the
KeyPress event of both txtUserName and
txtpassword. Program this event handler to
convert the uppercase letters to lowercase.
C. Use the CharacterCasing property of the
controls.
D. Use the Char.ToLower method in the
TextChanged event handlers of the controls.
C. The CharacterCasing property when set to
CharacterCasing.Lower for a text box will convert
all uppercase letters to lowercase as you type
them. It is the preferred way to enforce either
lowercase or uppercase input in a text box.
You must create a custom exception class in your
Windows application. You have written the following
code for the exception class:
Public Class KeywordNotFound
Inherits ApplicationException
Public Sub New()
‘ Code here
End Sub
Public Sub New( _
ByVal message As String, _
ByVal inner As Exception)
MyBase.New(message, inner)
‘ Code here
End Sub
End Class
A code review suggests that that you did not followed
some of the best practices for creating a
custom exception class. Which of these changes
should you make? (Select two.)
A. Name the exception class
KeywordNotFoundException.
B. Derive the exception class from the base class
Exception instead of ApplicationException.
C. Add one more constructor to the class with
the following signature:
Public Sub New(ByVal message As String)
MyBase.New(message)
‘ Code here
End Sub
D. Add one more constructor to the class with
the following signature:
Public Sub New(ByVal inner As Exception)
MyBase.New(inner)
‘ Code here
End Sub
E. Derive the exception class from the base class
SystemException instead of
ApplicationException
A, C. The best practices for exception handling
recommend that you end the name of your
exception class with the word Exception. In addition,
an exception class must implement three
standard contructors. The missing constructor is
the one given in option C.
In your Windows application, you have created a
dialog box that allows the user to set options for
the application. You have also created a Help button
that the user can press to get help on various
options in the dialog box. You validate the data
entered by the user in a TextBox control labeled
Complex Script; if the user enters an invalid value
in this text box, you set the focus back in the control
by setting the cancel property of the
CancelEventArgs object to True. While testing the
application, you discovered that once you enter
invalid data in the text box, you could not click
on the Help button without correcting the data
first. What should you do to correct the problem?
A. Set the CausesValidation property of the text
box to False.
B. Set the CausesValidation property of the text
box to True.
C. Set the CausesValidation property of the Help
button to False.
D. Set the CausesValidation property of the Help
button to True.
C. When you want a control to respond regardless
of the validation statuses of other controls,
set the CausesValidation property of that control
to True. Then the Help button should have its
CausesValidation property set to False.
You are writing exception handling code for an
order entry form. When the exception occurs,
you want to get information about the sequence
of method calls and the line number in the
method where the exception occurs. Which property
of your exception class can help you?
A. HelpLink
B. InnerException
C. Message
D. StackTrace
D. The StackTrace property of the Exception class
and the classes that derive from it contains information
about the sequence of method calls and
the line numbers in which the exception occurred.
Therefore, it is the right property to use.
Your code uses the Throw statement in this
fashion:
Catch e As Exception
Throw
Which of these statements is true about this
code?
A. The Throw statement catches and rethrows
the current exception.
B. The Throw statement catches, wraps, and
then rethrows the current exception.
C. The Throw statement must be followed by an
exception object to be thrown.
D. The Throw statement transfers control to the
Finally block following the Catch block.
A. The Throw statement just catches and throws
the current exception.
You are creating a Windows Form that works as a
login screen for an Order Entry system designed
for the sales department of your company. Which
of the following strategies should you follow?
A. Design a ValidateUser method. Throw a new
custom exception named EmployeeNotFound
when the entered username is not in the database.
B. Design a ValidateUser method. Throw an
ArgumentException exception when the user
types special characters in the User name or
Password text boxes.
C. Design a ValidateUser method. It returns
True if the username and password are correct;
otherwise it returns False.
D. Design a ValidateUser method. Throw an
ApplicationException when the entered username
is not in the database.
C. It is obvious that user can make typing mistakes
while typing her username or password. You
should not throw exceptions for these situations;
you should rather design a ValidateUser method
that returns a result indicating whether the login
was successful.
You want to capture all the exceptions that escape
from the exception handling code in your application
and log them to Windows event log. Which
of the following techniques would you use?
A. Write all the code of the application inside a
Try block, attach a generic Catch block to
that Try block, and handle the exception
there.
B. Write all the code of the application inside a
Try block, attach a Catch block that catches
the super type of all exceptions (the
Exception objects), and write code to make
entries in the event log there.
C. Program the ProcessExit event handler of the
AppDomain class.
D. Program the UnhandledException event handler
of the AppDomain class.
D. To capture all unhandled exceptions for an
application, you must program the
UnhandledEvent event handler of its
AppDomian class.
Which of the following is generally the most
robust way to record the unhandled exceptions in
your application?
A. Create an entry in Windows event log.
B. Create an entry in the application’s custom
event log.
C. Create an entry in a table in Microsoft SQL
Server 2000 database.
D. Send an email using SMTP.
A. Logging to the Windows event handler is the
most robust solution because the other solutions
have more assumptions that can fail. Sometimes
your application can loose connectivity with the
database or with the SMTP server, or you might
have problems writing an entry in a custom log
file.
The structured exception handling mechanism of
the .NET Framework allows you to handle which
of the following types of exceptions? (Select all
that apply.)
A. Exceptions from all CLS-compliant languages
B. Exceptions from non-CLS–compliant languages
C. Exceptions from unmanaged COM code
D. Exceptions from unmanaged nonCOM code
A, B, C, D. The .NET Framework allows you to
handle all types of exceptions including cross-language
exceptions for both CLS- and nonCLScomplaint
languages. It also allows you to handle
exceptions from unmanaged code, both COM
and nonCOM.
What is the result of executing this code snippet?
Const someVal1 As Int32 = Int32.MaxValue
Const someVal2 As Int32 = Int32.MaxValue
Dim result As Int32
result = someVal1 * someVal2
A. The code will generate an
OverflowException.
B. The code will execute successfully without
any exceptions.
C. The code will cause a compile-time error
D. The code executes successfully but the value
of the variable result is truncated.
C. Since you are multiplying two maximum possible
values for integers, the result cannot be
stored inside an integer. The compiler will detect
it and will flag a compile-time error.
Define a custom exception class
Public Class BaderrorException
Inherits ApllicationException

Public Sub Nex()

End Sub

Public Sub New(ByVal message as String)
MyBase.New(message)
End Sub

Public Sub New(ByVal message as String, ByVal inner as Exception)
MyBase.New(message,inner)
End Sub
Does the KeyPress event fire when you press a function key?
No. The KeyPress event only fires if the key pressed generates a character value. You won't get a KeyPress event from keys such as function keys, control keys, and the cursor movement keys.
Can you programmatically set the value of the text property larger than the maxlength value of that control?
Yes. The max length property on limits the length input by users.
What are the three different ways in which
Windows components can be created?
The three different ways in which Windows components
can be created are
• Creating a nonvisual component by deriving
from the Component class.
• Creating a control that paints its own UI by
deriving from the Control class or any of its
derived classes.
• Creating a composite control based on existing
controls by deriving from the
UserControl class or any of its derived classes.
What is the usual signature of an event handler?
The event handler method usually contains two
parameters The first is the object on which the
event occurred, and the second is the object of
type System.EventArgs (or one of its derived
classes) that contains event-related data.
What steps must be performed to create and
implement an event?
To create and implement an event, you must take
the following steps:
• Define the EventArgs class that will contain
the event-related data. This is required only if
you want to pass specific event-related information
to the event handlers.
• Create a Delegate object to store a reference
to the event handler. This is required only if
you want to pass specific event-related information
to the event handlers.
• Define the event itself as an object of the
Delegate type.
• Define a method that notifies the registered
objects of the event. Usually this method has
a name such as OnChanged, where Changed
is an event name.
• Call the method defined in the above step
whenever the event occurs.
How do you set the classID value when creating
object elements to render a Windows control in a
Web page?
The classID should be assigned the assembly
(DLL) path and the control name to be hosted,
separated with a # (pound sign).
When you create a control by inheriting from
Control class, what is the extra step you need
to do?
When you create a control by inheriting from the
Control class, the control does not have a UI.
Therefore, the Paint event should be handled to
paint the desired user interface for the control.
How can you assign a custom Toolbox icon to a
component?
You can assign a custom Toolbox icon
with a component by associating the
ToolBoxBitmap attribute with the class definition. The bitmap file (16×16) should have the same
base name as that of the component, should
reside in the same folder as the class file, and
should have a BMP file extension.
What is the purpose of the assembly manifest?
An assembly manifest stores the assembly’s metadata.
The metadata provides self-describing information
like the name and version of the assembly,
the files that are part of the assembly and
their hash values, the files’ dependencies on other
assemblies, and so on. This subset of information
in the manifest makes assemblies self-sufficient.
What type of assemblies should be stored in the
Global Assembly Cache?
Shared assemblies (those used by more than one
application) should be stored in the machinewide
Global Assembly Cache. Shared assemblies are
digitally signed and have a strong name.
What are resource-only and satellite assemblies?
Resource-only assemblies are those that contain
just resources and no code. Resource-only assemblies
that store culture-specific information are
known as satellite assemblies.
You want to decrease the time it takes for a component
to load for the first time. Which of the
following tools can help you?
A. gacutil.exe
B. resgen.exe
C. sn.exe
D. ngen.exe
D. The Native Image Generator tool (ngen.exe)
converts Microsoft intermediate language to
processor-specific native code. These native assemblies
will load faster the first time the code is
called because the work JIT compiler would do
normally has been already done by the ngen tool.
The other three choices are not relevant because
gacutil.exe allows you to view and manipulate the
contents of Global Assembly Cache. The
resgen.exe is the Resource Generator tool that is
used to compile XML-based resource files (resx
files) into binary .resources files. The sn.exe is
used to assign assemblies with a strong name so
they can be placed in the Global Assembly Cache.
You have converted your application’s assembly
files to native images using the Native Image
Generation tool (ngen.exe). Which of the following
statements hold true for your assemblies?
(Select two.)
A. Applications that use a native assembly will
run faster for the initial run.
B. Applications using a native assembly will have
consistently faster performance as compared
to a JIT-compiled assembly.
C. The native assemblies are portable. You
should be able to use them on any machine
that has the Common Language Runtime
installed on it.
D. The native assemblies can be used in debugging
scenarios.
A and D. The native assemblies will load faster
the first time because the work JIT compiler
would do normally has been already done by the
ngen tool, but for subsequent usage the native
assemblies would show the same performance as
their JIT-compiled equivalents. The natively generated
assemblies are processor-specific: They
can’t be ported across a different processor architecture.
The ngen.exe tool provides a /debug
switch to generate native assemblies for debugging
scenarios.
You have developed a graphics application. Before
you create a setup program you want to package
some of the image files in a satellite assembly. You
have created an XML-based resource file for these
files and named it App.resx. Which of the following
steps would you take to convert this file in a
satellite assembly?
A. Use the vbc.exe tool followed by the al.exe
tool.
B. Use the resgen.exe tool followed by the al.exe
tool.
C. Use the resgen.exe tool followed by the
vbc.exe tool.
D. Use the vbc.exe tool followed by the
resgen.exe tool.
B. To create a satellite assembly, you first compile
the XML-based resource file into a binary
resource file using the Resource Generator tool
(resgen.exe). Then you use the Assembly
Generation tool (al.exe) to create a satellite
assembly.
You have developed a utility network library that
will be used by several applications in your company.
How should you deploy this library?
A. Sign the library using the Strong Name tool
(sn.exe) and place it in Global Assembly
Cache.
B. Sign the library using the File Signing tool
(signcode.exe) and place it in Global
Assembly cache.
C. Sign the library using both the Strong Name
tool and the File Signing tool and place it in
the bin directory of each application using it.
D. Keep the library at a central place such as
C:\CommonComponents and use each application’s
configuration files to point to it.
A. If an assembly is used by several applications, it
is a good idea to place the assembly in the Global
Assembly Cache because GAC provides benefits
including versioning and security checks. To place
an assembly in GAC you must assign a strong
name to it. You can use the sn.exe tool to assign a
strong name. The File Signing tool (signcode.exe)
can digitally sign an assembly with a third-party
software publisher’s certification. It is not a
requirement for an assembly to be placed in GAC.
You are a programmer for a popular gaming software
publishing company. The company has
recently designed a series of games using the
.NET Framework. All these new game applications
share some components. Some of these
components are shipped in the box with the
application and others are deployed over the
Internet. Which of the following commands will
you use for these components before packaging
them for deployment.
A. Use sn.exe to sign the components.
B. Use signcode.exe to sign the components.
C. Use sn.exe followed by signcode.exe to sign
your components.
D. Use signcode.exe followed by sn.exe to sign
your components.
C. Since your components are being shared
between several games published by your company,
they are good candidates to be placed in the Global
Assembly Cache of the target machine. Before a
component can be placed in GAC, it must be
signed using the Strong Name tool (sn.exe). Your
company is also deploying software over the
Internet; in this case, it is a good idea to digitally
sign your code with a software publisher’s certificate
obtained by a respected certification authority. Once you obtain the certificate you can use signcode.
exe to sign your component. When you are
using both sn.exe and signcode.exe with your
assembly, you should always use sn.exe before using
signcode.exe.
You want to implement a versioning policy on all
the components of your windows application.
Which of the following options will you use?
A. Use the File Signing Tool (signcode.exe) to
assign the version information.
B. Use the resgen.exe tool to create a resource
file containing version information.
C. Create an XML-based configuration file that
maintains version information for each component.
D. Use the Strong Name tool (sn.exe) to assign a
Strong Name to all the assemblies.
D. Versioning is done only for the assemblies
having a Strong Name, so you must sign your
components using the Strong Name tool (sn.exe)
before they can participate in versioning.
You are designing a Contact Management system
for the salespersons of your company. You note
that you will be often required to create forms
capable of accepting and validating addresses
including information like Name, Street Name,
State, Country, and ZIP code by displaying controls
such as a TextBox or a ComboBox. You
think it is a good idea to package your address
input and validation code in a component so you
can reuse your efforts in several forms throughout
the application. Which of the following classes
would you prefer to be the base class of your
component?
A. System.Windows.Forms.Control
B. System.Windows.Forms.UserControl
C. System.Windows.Forms.Form
D. System.ComponentModel.Component
B. The System.Windows.Forms.UserControl class
provides the functionality to quickly create a
reusable component by assembling existing
Windows Controls.
You are creating a time-tracking application to be
used companywide. Several forms in this application
show the user a clock. The clock has the
look and action of an analog clock with a circular
face and hands of different size for the hour,
minute, and second. You decided to code the
analog clock as a reusable component. Which of
the following classes would you choose as the
base class for creating this control?
A. System.Windows.Forms.Control
B. System.Windows.Forms.UserControl
C. System.Windows.Forms.Form
D. System.ComponentModel.Component
A. You should inherit from the Control class if
you want to provide a custom graphical representation
of your control or functionality not available
through standard controls.
You are using the C# language compiler from the
command line. You want to compile a C# program
but do not want the compiler to write an
assembly manifest in it. Which of the compiler
option would you choose?
A. /target:exe
B. /target:library
C. /target:module
D. /target:winexe
C. You will use /target:module. This is the only
option that instructs the VB .NET compiler not
to include an assembly manifest in the compiled
code.
You have defined a custom component for your
application that manages user authentication.
This component raises an Authenticated event
whenever a user is successfully authenticated. At
that point, you must make the user’s name and
SID (security identifier) available to the control
container. How should you do this?
A. Place the user’s name and SID in properties
of the component for the container to
retrieve.
B. Pass the user’s name and SID as parameters of
the Authenticated event.
C. Define global variables in a separate module
and place the values in those variables.
D. Define a custom AuthenticatedEventArgs
class that inherits from the EventArgs class,
and pass it as a parameter of the
Authenticated event.
D. Using a class derived from EventArgs to pass
event parameters is preferable to using individual
arguments because it’s more readily extended in
case you need to pass additional parameters in
the future.
One of your colleagues is trying to host a control
in Internet Explorer. He has created the control
and tested it successfully on a Windows Form, but
he can’t make it show up in Internet Explorer. The name of the control is
SolidControls.ColorMixer, and it is stored in a
DLL named SolidControlsLib.dll. Your colleague
has also placed both the HTML page and the
DLL in the same virtual directory.
He shows you the HTML file that he has
designed to host this control. Part of his HTML
code is as listed here (line numbers are for reference
purpose only).
01: <html>
02: <body>
03: <object id=”colorMixerX1”
04: classid=”http://localhost/WebDir/
➥SolidControlsLib.dll”
05: height=”300” width=”300”>
06: </object>
07: </body>
08: </html>
What changes would you suggest to make this
control work in Internet Explorer?
A. Change the code in line 4 to:
classid=”http://localhost/WebDir/
➥ SolidControlsLib.dll#SolidControls.
➥ColorMixer”
B. Change the code in line 4 to:
classid=”http://localhost/WebDir/
➥SolidControlsLib.dll
➥ ?SolidControls.ColorMixer”
C. Change the code in line 4 to:
classid=”SolidControls.ColorMixer”
D. Change the code in line 4 to:
classid=”http://localhost/WebDir/
➥SolidControlsLib.dll?
➥ classid=SolidControls.ColorMixer”
A. The correct usage is to give the classID a
string with the virtual path to the control and the
namespace-qualified name of the control class,
separated by a pound sign (#).
You have designed a UserControl by assembling
five TextBox controls and two Button controls.
You do not want the client application to be able
to access the contained objects within your control.
Which modifiers should you use with your
contained objects to achieve this goal? (Select
two.)
A. Private
B. Friend
C. Protected
D. Public
A and B. When you declare the contained
objects within a control as Friend or Private, they
are not accessible to the client application for
direct manipulation. See “Creating and
Managing .NET Components.”
You are designing a component to enable your
applications to interact with the computers in a
network. The component does not have any visual
representation but should provide you a
design-time interface that will help a client application
designer to set its properties and behavior.
Which of the following types is your best choice
as the base class for creating this control?
A. System.Windows.Forms.Control
B. System.Windows.Forms.UserControl
C. System.Windows.Forms.Form
D. System.ComponentModel.Component
D. Components that provide no visual interface
should derive directly from the
System.ComponentModel.Component class.
Your Windows application is using some graphics
files. You want to embed the graphics files in the
application’s EXE itself so that you don’t have to
distribute additional files with your application.
What should you do?
A. Create a satellite assembly for storing
graphics.
B. Set the BuildAction property of the graphics
files to Content.
C. Set the BuildAction property of the graphics
files to Compile.
D. Set the BuildAction property of the graphics
files to Embedded Resources.
D. When you set the Build Action property of a
graphics file to Embedded Resources, the file is
embedded with the main project output, whether
that output is a DLL or an EXE.
Which of the following statements is true for a
multifile assembly?
A. Each file in a multifile assembly must contain
an assembly manifest.
B. Only one of the files in the multifile assembly
can contain the assembly manifest.
C. You can find the assembly to which a file
belongs by opening that file with the MSIL
Dissambler (ildasm.exe).
D. You can have two files with the same name
but different versions in a multifile assembly
without any versioning conflicts.
B. Only one of the files in a multifile assembly
can contain the assembly manifest. You cannot
find the name of the assembly to which a file
belongs by viewing it in ILDASM because only
the assembly manifest contains this information.
It is not possible to have two files with the same
name in an assembly, and the most elementary
unit of versioning is the assembly itself, so the files
contained in it cannot have additional versions.