Download Windows Form FPT-Aptech confidential

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Clusterpoint wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Database model wikipedia , lookup

Versant Object Database wikipedia , lookup

Transcript
Windows Form
Which of the following is not a possible value for the RowState property of a DataRow object?
1
a)
Added
b)
Altered
c)
Deleted
d)
Modified
The Windows Form classes are located in the ________ namespace
2
a)
System.Windows.Forms
c)
System.WinForms
b)
System.WindowsForms
d)
Windows.Forms
The _____ argument and the _____ argument are always passed as parameters to events for a control (choose 2)
3
4
a)
System.Object
b)
System.EventArgs
c)
System.EventHandler
d)
System.Controls
You have Visual Studio .NET to develop a Windows-based application that interacts with a Microsoft SQL Server
database. Your application contains a form name EmployeeForm. You add the following design-time component to
the form
+ SqlConnection object name EmpConn
+ SqlDataAdapter object name EmpDA
+ DataSet object name EmpDS
+ Five TextBox controls to hold the values exposed by EmpDS
At design-time, you set DataBindings property of each TextBox control to appropriate column in the DataTable
object of EmpDS. When you test this application you can successfully connect to the database. However, no data
is displayed in any TextBox.
You need to modify your application code ensure that data is displayed appropriately. Which behavior should occur
while the EmployeeForm.Load event handler is running?
a) Execute the BeginInit method of EmpDS
b) Execute the Open method of EmpConn
c)
d)
Execute the FillSchema method of EmpDA and pass in EmpDS
Execute the Fill method of EmpDA and pass in EmpDS
Which of the following events is best suitable to validate the data?
5
a)
KeyUp
b)
Validated
c)
Validating
LostFocus
d)
6
You use Visual Studio .NET to create a Windows-based application. The application includes a form name CertK,
which displays statistical date in graph format. You use a custom graphing control that does not support resizing.
You must ensure that users cannot resize, minimize or maximize CertK. Which three actions should you take?
(choose 3)
a) Set CertK.MinimizeBox to False
b) Set Cert.MaximizeBox to false
c)
d)
Set Cert.ControlBox to false
Set Cert.ImeMode to Disabled
FPT-Aptech confidential
Page 1
7
8
9
10
e)
Set Cert.WindowState to Maximized
f)
Set Cert.FormBorderStyle to one of the Fixed Styles
You develop a Visual Studio .NET application that dynamically adds controls to its form at runtime. You include the
following statement at the top of your file:
using System.Windows.Forms;
In addition, you create the following code to add Button controls:
Button tempButton = new Button();
tempButton.Text = NewButtonCaption;
tempButton.Name = NewButtonName;
tempButton.Left = NewButtonLeft;
tempButtonTop = NewButtonTop;
this.Controls.Add(tempButton);
tempButton.Click += new EventHandler(ButtonHandler);
Variables are passed into the routine to supply values for the Text, Name, Left, Top properties.
When you compile this code, you receive an error message indicating that ButtonHandler is not declared.
You need to add a ButtonHandler routine to handle the Click event for all dynamically added Button controls.
Which declaration should you use for ButtonHandler?
a) public void ButtonHandler()
b) public void ButtonHandler(System.Windows.Forms.Button sender)
c)
public void ButtonHandler(System.Object sender)
d)
public void ButtonHandler(System.Windows.Forms.Button sender, System.EventArgs e)
e)
public void ButtonHandler(System.Object sender, System.EventArgs e)
Your application uses a DataSet object to maintain a working set of data for your users. Uses frequently change
information in the DataSet object.
Before you update your database, you must run data validation code on all user changes.
You need to identify the data rows that contain changes. First you create a DataView object. What should you do
next?
a) Set the RowStateFilter.CompareTo method
b) Set the RowStateFilter.Equals method
c)
Set the RowStateFilter property to CurrentRow
d)
Set the RowStateFilter property to ModifiedCurrent
You need to develop a Windows form that provides online help for users. You want the help functionality to be
available when users press F1 key.
Help text will be displayed in a popup window for the textbox has focus.
To implement this functionality, you need to call a method of HelpProvider control and pass the text box and the
help text. What should you do ?
a) SetShowHelp
b) SetHelpString
c)
SetHelpKeyword
d)
ToString
You use Visual Studio .Net to develop a Windows-based application. Your application will display customer order
information from a Microsoft SQL Server database. The orders will be display on Windows Form that includes a
DataGrid control which is bound to a DataView object. Users will be able to edit order information directly in the
DataGird control.
You must give users the option of displaying only edited customer orders and updated values in the DataGrid.
What should you do?
a)
Set the RowStateFilter property of the DataView object to DataViewRowState.ModifiedOriginal.
b)
Set the RowStateFilter property of the DataView object to DataViewRowState.ModifiedCurrent
FPT-Aptech confidential
Page 2
11
c)
Set the RowFilter property of the DataView object to DataViewRowState.ModifiedOriginal.
d)
Set the RowFilter property of the DataView object to DataViewRowState.ModifiedCurrent
You use Visual Studio.Net to develop a Microsoft Windows-based application. Your application contains a form
named CustomerForm, which is includes the following design-time controls:
• SQL Connection object named CustConnection
• SQL DataAdapter object named CustDataAdapter
• DataSet object named CustomerDataSet
• Five TextBox controls to hold the values exposed by CustomerDatSet
• Button control named saveButton
At design time you set the DataBindings properties of each TextBox control to the appropriate column in the
DataTable object of CustomerDataSet.
When the application runs, users must be able to edit the information displayed in the text boxes. All user changes
must be saved to the appropriate database when saveButton is executed. The event handler for saveButton
includes the following code segment:
CustDataAdapter.Update(CustomerDataSet);
You test the application. However, saveButton fails to save any values edited in the text boxes. You need to correct
this problem.
What should your application do?
a) Call the InsertCommand method of CustDataAdapter
b) Call the Update method of CustDataAdapter and pass in CustConnection
12
c)
Before calling the Update method, ensure that a row position change occurs in CustomerDataSet.
d)
Reestablish the database connection by calling the Open method of CustConnection.
You are deploping a Window-based application that logs hours worked by employees. Your design goals require
you to maximize application performance and minimize impact on server resources.
Your need to implement a SqlCommand object that will send a SQL INSERT action query to a database each time
a user makes a new entry.
To create a function named LineItemInsert, you write the following code (Line numbers are included for reference
only).
01 : public int LineItemInsert(int empID, int projectID,
02 : decimal hrs, SqlConnection con)
03 : {
04 : string SQL;
05 : int Ret;
06 :
07 : SQL = String.Format (
08 : “INSERT INTO TimeEntries (EmpID, ProjectID, Hours)”
09 + 10 : “VALUES ({0},{1},{2})”,
11 : empID, projectID, hrs);
12 : SqlCommand cmd = new SqlCommand(SQL, con);
13 :
14 : //Insert new code
15 : }
You code must execute the SQL INSERT action query and verify the number of database records that are affected
by the query.
Which code segment should you add on line 14 ?
a)
con.Open();
Ret = cmd.ExecuteNonQuery(); con.Close(); return Ret;
b)
c)
con.Open(); Ret = cmd.ExecuteScalar(); con.Close(); return Ret;
SqlDataReader reader; con.Open(); reader = cmd.ExecuteReader();
con.Close(); return reader.RecordsAffected;
SqlDataReader reader; con.Open(); reader = cmd.ExecuteReader();
con.Close(); return reader.GetValue();
d)
FPT-Aptech confidential
Page 3
The_________ event of the Form control is used to perform tasks such as allocating resources used by the form.
13
a)
b)
c)
d)
Activate
Load
Allocate
Activated
When a Data Form is created using the Data Form Wizard, which of the following classes are used by default?
(choose 4 )
14
a)
OleDbDataReader
b)
OleDbConnection
c)
OleDbCommand
d)
OleDbDataWriter
e)
OleDbDataAdapter
To create an instance of the Font class using existing Font and FontStyle, the constructor is:
15
a)
public Font(Font f, FontStyle fs);
b)
public Font(string fontname, float size);
c)
public void Font(Font f, FontStyle fs);
d)
public void Font(string fontname, float size);
Which control is used to display a short, customized help message for individual controls on a form?
16
a)
ToolClass
b)
HelpTool
c)
HelpText
d)
ToolTip
Statement 1: Tree View displays folders, drives etc.
Statement 2: List View displays current folder contents.
17
a)
Both the statements are true
b)
Only Statement 1 is true
c)
Only Statement 2 is true
d)
both the statements are false
Which class represents shortcut menus that can be displayed when the user clicks the right mouse button over a
control or area of the form?
18
19
a)
Menu
b)
FileMenu
c)
ContextMenu
d)
ToolsMenu
Name the object which notifies other objects about an event?
FPT-Aptech confidential
Page 4
20
a)
Publisher
b)
Subscriber
c)
Consumer
d)
Tester
Leo would like to populate a select dropdown combo box with data in a data store. He wants a fast, forward only,
read-only database connection using ADO.NET.
Given the above scenario, which one of the following objects should Leo use?
a)
A DataAdatpter object
c)
A DataReader object
b)
A Command object
d)
A Connection object
Which class is the base class for all the controls that can be used in Windows Forms?
21
a)
Objects
b)
Forms
c)
Controls
d)
Control
Which of the following statements about event handlers is not true?
22
a)
Event handlers cannot be removed dynamically
b)
Event handlers are methods that handle events
c)
Event handlers can handle multiple events
d)
Multiple event handlers can be associated with an event
Which of the following namespaces defines the Trace and Debug classes?
23
a)
System.Diagnostics
b)
System.Collection
c)
System.Security
d)
System.ComponentModel
By setting the _________ in a control, I can make sure that my code is not change if someone inherits my form.
24
25
a)
the Private value of the Modifiers property
b)
the Unchanged value of the Modifiers property
c)
the Restricted value of the Modifiers property
d)
the Limited value of the Modifiers property
You are using Visual Studio.Net to develop a Windows- based application that contains a single form. This form
contains a label control named labelUser and a textbox control named textUser, labelUser displays a caption that
identifies the purpose of textUser. You want to write code that enables users to place focus in textUser when they
press Alt + U. This key combination should be identified to users in the display of labelUser.
Which 3 actions should you take? (choose 3)
FPT-Aptech confidential
Page 5