You are developing a Windows application. The user needs to work with multiple windows of
the application at the same time and needs a simplified interface. The application needs to be
compatible with different display configurations, such as multiple monitors. Which of the
following interfaces should you create?
A) Create a Multiple Document Interface (MDI) Application. Open a single instance of the application.
B) Create a Single Document Interface (SDI) Application. Open multiple instances of the
application.
C) Create a Multiple Document Interface (MDI) Application. Open a single instance of the
D) Create a Multiple Document Interface (MDI) Application. Open multiple instances of the
application.
B) Create a Single Document Interface (SDI) Application. Open multiple instances of the
application.
You have developed a Windows Forms application that stockbrokers will use. The
stockbrokers need to view data for multiple stocks at the same time. You need to change the
display and behaviour of a Windows Form so that it can contain multiple child windows. What
should you do?
A) Set the IsMdiContainer property of the form to true.
You are developing a Windows Form with a multiple document interface (MDI). You need
to write code that arranges the child windows vertically within the client region of the MDI
parent form. Which of the following MdiLayout values should you pass to the LayoutMdi
method?
A) MdiLayout.TileVertical
You are developing a Windows forms application used by a government agency. You need to develop a distinct user interface element that accepts user input. This user interface will be reused across several other applications in the organization. None of the controls in the Visual Studio toolbox meets your requirements; you need to develop all your code in house. Which of the following actions should you take?
A) Develop a custom control for the user interface.
Difficulty: Medium
Section Reference: Designing a Windows Form
You need to develop a custom control because you need reusable functionality but also want to develop the code in house. You cannot use Windows Forms because they cannot be reused easily. You cannot use console applications because they do not provide distinct user interface. You cannot buy a control from third-party because you need to develop the code in house.
You are developing a user interface component that responds to user actions such as keystrokes. Which of the following programming constructs should you use to accomplish this requirement?
A) event
Difficulty: Medium
Section Reference: Designing a Windows Form
Events are generated when users take an action such as pressing keystrokes. You need to handle these events to respond to user actions.
You need a Windows Form similar to the W_RecForm form that is being already used by the application. However, you need a couple of extra controls on your form that is not available on W_RecForm. You need to make sure that you accomplish this requirement with the least coding effort. In future, if the W_RecForm is enhanced, you need to make sure that those enhancements are available in your form as well. What should you do?
A) Copy the code for W_RecForm to a new form. Modify the code for the new form.
B) Use visual inheritance to inherit the new form from W_RecForm. Add the new functionality to the new control.
.
C) Modify the code for W_RecForm. Copy the code to create a new form.
You are developing a data-entry application that receives user input in multiple data fields.
The application allows users to enter the data either by using a keyboard or by using a bar-code
scanner. When a code is entered, a picture of the product appears onscreen. The application also
needs to log its operation to a console window. Occasionally, the operator will look at the
console window to monitor communication with the scanner. What project should you choose to
create such an application?
A) a Windows Forms application project with the Output type set to Console Application
To enable reading from or writing to the console from a Windows Forms application, set
the project’s Output type to Console Application in the project’s properties. If you set the
Output type to Windows Application, you lose any input or output that you send to the
command line.
You are developing an application that receives orders over the Internet via Electronic Data
Interface (EDI). The application needs to run constantly the background and wait for orders.
There is no user interface. The application writes messages to the Windows application event
log. The application must continue to run even after a user logs off from the computer. Which
type of application should you develop for this requirement?
D) Windows Service application
Difficulty: Medium
Section Reference: Understanding Windows Services
The nature of Windows services make them ideal for creating long-running programs that
run in the background and do not provide any direct user interaction. Because a Windows
service can run in the background, it does not need a logged-on user to function. Windows
services run in their own Windows session in the specified security context.
You need an application that updates the inventory every morning when you log in to the
workstation. If an error occurs during update, the application needs to log messages to a text file.
The application doesn’t need any user interaction. You want to automate the process that
launches the application. You want to minimize the efforts for developing, installing, and
updating the application. Which type of application should you create?
You need to develop a console-based application. A console-based application provides
minimal or no user interface and requires the least effort to program, install, and update.
You can use the Windows Startup settings to launch the console application automatically
when the user logs in. Finally, the console application can also log messages to a text file.
You are developing a new Windows service application. The application contains three
different Windows services. Each service will have a different start type. Which of the following
classes will help you perform the installation tasks specific to each service? You must suggest a
solution that requires the least coding effort.
C) System.ServiceProcess.ServiceInstaller class
Difficulty: Medium
Section Reference: Understanding Windows Services
The System.ServiceProcess.ServiceInstaller class performs the installation tasks
specific to a single Windows service, such as setting the ServiceName and StartType. The
ServiceProcessInstaller class performs installation tasks common to all the Windows
services in an application. The Installer and ComponentInstaller classes are not
specifically useful for configuring a Windows service application.
8. You are developing an application that writes messages to the Windows application event log
for the local machine. What should you use to view the messages written by the application?
D) Event Viewer
Difficulty: Medium
Section Reference: Understanding Windows Services
Use the Windows Event Viewer utility to view the messages in event logs. The event viewer
messages cannot be opened directly by Notepad. The XPS Viewer can open only the XPS
files. The Remote Desktop Connection utility is used to connect to remote computers, but
the question is in the context of a local computer.
11. You are developing a new Windows service application. The application contains three
different Windows services. Before these services can be used, they must be installed in the
Windows service database. What action should you take to ensure that your services can be
installed by a Windows installer tool?
C) Add a service installer to the Windows service project.
Difficulty: Medium
Section Reference: Understanding Windows Services
Before a Windows service can be used, it must be installed in the Windows service database
by adding a service installer to the Windows service project. The other answer choices do
not directly relate to the installation of a Windows service.
10. You are developing a new Windows service application that process orders. The system
administrator must be able to suspend order processing while maintenance operations are in
progress. When maintenance operations are completed, order processing must be resumed
without the loss in any information. How should you configure this Windows service?
D) Set the CanPauseAndContinue property of the service to true.
Difficulty: Medium
Section Reference: Understanding Windows Services
The value of the CanPauseAndContinue property indicates whether the service can be
paused and resumed without losing information. When you override the OnPause and
OnContinue methods, you can specify the actions that need to be taken when a Windows
service is paused or resumed.
12. You are developing a new Windows application that needs to write messages to the event
log. You use the EventLog class to write these messages. Each event log message must specify
the name of the application writing to an event log. Which property of the EventLog class should
you use?
D) Source
Difficulty: Medium
Section Reference: Understanding Windows Services
The Source property of the EventLog class is used to specify the application name to use
when writing to an event log. The Log property specifies the name of the log to read from
or write to. The Site property specifies the ISite of the Component. The MachineName
property specifies the name of the computer on which to read or write events.
You are updating an existing Windows Forms application. The form hosts a
DateTimePicker control named dateTimePicker1. You need to write code that executes when
the value of the dateTimePicker1 control is changed. You write a method,
ProcessValueChanged, that contains the code you want to execute. What code should you write
to invoke the ProcessValueChanged method? Any code that you write must not affect existing
functionality of the application.
a) dateTimePicker1.ValueChanged += new System.EventHandler(
ProcessValueChanged);
b) dateTimePicker1.ValueChanged = new System.EventHandler(
ProcessValueChanged);
c) dateTimePicker1.Value += new System.EventHandler(ProcessValueChanged);
d) dateTimePicker1.Value = new System.EventHandler(
ProcessValueChanged);
a)dateTimePicker1.ValueChanged += new System.EventHandler(ProcessValueChanged);
Difficulty: Medium
Section Reference: Understanding Windows Forms Event Model
The correct answer is to write the following code:
dateTimePicker1.ValueChanged += new System.EventHandler(
ProcessValueChanged);
If you use the = assignment operator rather than the += operator, you lose the existing
functionality. The Value member is a property; ValueChanged is an event.
You have developed a Windows service that needs to access data stored in the Windows
Registry. Which of the following accounts should you use for running this Windows service?
A) LocalSystem
Difficulty: Medium
Section Reference: Understanding Windows Services
The LocalSystem value specifies a highly privileged account. The Windows service will
need these privileges to access Windows Registry. The other answer choices are incorrect
because these accounts do not have access to Windows Registry.
You have developed a Windows Forms application that stockbrokers will use. The
stockbrokers need to view data for multiple stocks at the same time. You need to change the
display and behavior of a Windows Form so that it can contain multiple child windows. What
should you do?
D) Set the IsMdiContainer property of the form to true .
You need to set the IsMdiContainer property of the form to true. The IsMDIContainer
property indicates whether the form is a container for multiple-document interface (MDI)
child forms. The IsMDIChild property is a read-only property that specifies whether a form
is an MDI child window. The MdiParent property specifies the current multiple-document
interface (MDI) parent form for the given form. In the question, you want the given form
to be an MdiParent.
You are developing a Windows Form with a multiple document interface (MDI). You need
to write code that arranges the child windows vertically within the client region of the MDI
parent form. Which of the following MdiLayout values should you pass to the LayoutMdi
method?
When the value is MdiLayout.TileVertical, all MDI child windows are tiled vertically
within the client region of the MDI parent form. When the value is
MdiLayout.TileHorizontal, all MDI child windows are tiled horizontally within the client
region of the MDI parent form. When the value is MdiLayout.Cascade, all MDI child
windows are cascaded within the client region of the MDI parent form. When the value is
MdiLayout.ArrangeIcons, all MDI child icons are arranged within the client region of the
MDI parent form.
You are developing an application that will be run from the command line. Which of the
following methods would you use for getting input from to the command line?
Console-based applications do not have a graphical user interface but use a text-mode
console window to interact with users. Use the Read method to get input from the console
and the Write method to send output to the console.
You have developed two console applications. The first, DisplayFile.exe, accepts the name of
a text file as a command-line argument and displays the file’s contents. The second,
ToUpper.exe, accepts text from users and converts the text to uppercase letters. You need to
combine both commands so that contents of a given file (sample.txt) can be displayed in
uppercase letters. Which of the following commands would you choose?
a) ToUpper | DisplayFile Sample.txt
b) DisplayFile Sample.txt | ToUpper
c) ToUpper > DisplayFile Sample.txt
d) DisplayFile Sample.txt > ToUpper
The | character works as a pipe between commands, so the console output from
DisplayFile.exe works as console input to the ToUpper.exe. By using pipes, you can chain
multiple simple commands to accomplish complicated tasks. The answer ToUpper |
DisplayFile Sample.txt is incorrect because you first need to display the file’s contents
before you can convert them to uppercase letters. The > symbol is a redirection operator
that can save the output to a file.
You need to start a Windows service named ProcService from the command line. Which
command should you use?
C) net start ProcService
Difficulty: Medium
Section Reference: Understanding Windows Services
The net.exe command-line utility comes installed with Windows. This utility allows you to
perform various networking commands, including control of Windows services. Use the
start parameter to start a Windows service.
You have developed a Windows service and need to install it to implement its functionality.
Which of the following options should you use to accomplish this task?
A) InstallUtil.exe
Difficulty: Medium
Section Reference: Understanding Windows Services
The Installer tool (installutil.exe) allows you to install and uninstall server resources such
as Windows services by executing the installer components in a specified assembly.