User talk:Bigyansinghbasnyat

1 .The Employee table contains following attributes:

EmployeID LoginID Name Title

The EmployeeID and LoginId contain unique values. You have also observed that the values in the Name column are also unique. You need to create a primary key on the table. Which attribute is suitable for creating the primary key column? EmployeeID LoginID Name Title 2 . The Employee table contains following attributes:

EmployeID DepartmentID Name Title

The DepartmentID attribute should contain only those values that are stored in the DepartmentID attribute of the Department table. How will you ensure this? By creating Foreign Key on the DepartmentID attribute of the Department table. By creating Foreign Key on the DepartmentID attribute of the Employee table. By creating Primary Key on the DepartmentID attribute of the Department table. By creating Primary Key on the DepartmentID attribute of the Employee table. 3 . In an organization, an employee works under one manager. A manager is the head of many employees. What type of relationship exists between employee and manager? Many-to-Many One-to-Two One-to-One Many-to-One 4 . Which of the following services allows you to copy and distribute data and database objects from one database server to another? Service Broker Replication Full-text search Notification services 5. You need to develop a business application for an organization. The application performs the following tasks:

1. Accepts data as a input from the user. 2. Processes the data. 3. Stores data in the database server.

All the above tasks should be performed by different systems. The processing of data is very complex. So, the processing part needs to be divided into many smaller manageable units. Which type of architecture will you create for this application? Single-Tier Architecture Two-Tier Architecture Three-Tier Architecture N-Tier Architecture 6 . Which type of join returns all the matching and non-matching rows from both the tables? Full Outer Join Cross Join Self Join Equi Join 7. George is creating an Employee table. The table contains an EmployeeID attribute. No two values in this column can be same. Also, NULL value cannot be stored in the EmployeeID attribute. To ensure all this, which type of integrity needs to be enforced on the EmployeeID column? Entity integrity Domain integrity Referential integrity User-defined integrity 8. The HumanResources.Employee table contains the EmployeeID, Title and SickLeaveHours attributes. You need to display the EmployeeID of those employees whose sick leave hours are greater than the average sick leave hours of employees with title as 'Recruiter'. How will you perform this task? SELECT EmployeeId FROM HumanResources.Employee WHERE SickLeaveHours >(SELECT AVG(SickLeaveHours) FROM HumanResources.Employee WHERE Title = 'Recruiter') SELECT EmployeeId FROM HumanResources.Employee WHERE SickLeaveHours >(SELECT AVERAGE(SickLeaveHours) FROM HumanResources.Employee WHERE Title = 'Recruiter') SELECT EmployeeId FROM HumanResources.Employee WHERE SickLeaveHours >(SELECT AVG(SickLeaveHours) FROM HumanResources.Employee) SELECT EmployeeId FROM HumanResources.Employee WHERE SickLeaveHours >(SELECT SUM(SickLeaveHours) FROM HumanResources.Employee WHERE Title = 'Recruiter') 9.

The following statements are executed to create a HumanResources.EmployeeLeave table. The composite key is required to create on the table.

CREATE TABLE HumanResources.Employee ( EmployeeID int, JoinDate datetime CONSTRAINT cpkJoinDate COMPOSITE KEY(EmployeeID, JoinDate) )

However, when the above CREATE TABLE command is executed, it generates an error: Incorrect syntax near 'COMPOSITE'. Rectify the error? It is not possible to create a composite key on the table as there are only two columns. COMPOSITE is not the keyword. Replace it with PRIMARY COMPOSITE KEY should be created on the EmployeeID attribute. COMPOSITE KEY requires more than two columns. 10.

Which of the following statement is used to store values in a table? INSERT UPDATE DELETE MODIFY 11

which of the following index is created on column of XML data type? NonClustered Index Clustered Index Unique Index PATH Index 12 The Description column of the Orders table contains large amount of data. The query takes time to search for a particular word or pattern in the Description column. How will you improve the performance of the search query in this case? By creating full-text index on the Description column. By creating clustered index on the Description column. By creating unique clustered index on the Description column. By creating a view on the Description column.

13 You need to create a Value XML index on the Description column of the Orders table. The primary XML index, pidx_Orders_Description has already been created on the Description column. How will you create the Value index on that column? CREATE XML INDEX pidx_Orders_Description_VALUE ON Orders (Description) USING XML INDEX pidx_Orders_Description FOR PATH CREATE XML INDEX pidx_Orders_Description_VALUE ON Orders (Description) USING XML INDEX pidx_Orders_Description FOR VALUE CREATE XML INDEX pidx_Orders_Description_VALUE ON Orders (Description) USING XML INDEX pidx_Orders_Description FOR PROPERTY CREATE XML INDEX pidx_Orders_Description ON Orders (Description) USING XML INDEX pidx_Orders_Description FOR VALUE

14

You have created a following view displaying the EmployeeID and Title from the Employee table, and Rate from the EmployeePayHistory table:

CREATE VIEW vwEmpDetails AS SELECT i.EmployeeID, i.Title, j.Rate FROM HumanResources.Employee AS i JOIN HumanResources.EmployeePayHistory AS j ON i.EmployeeID = j.EmployeeID

You update the table through the view using the following statement:

UPDATE vwEmpDetails SET Title = 'Production Executive', Rate = 12.45 WHERE EmployeeID = 1

However, the above statement generates the following error: View or function 'vwEmpDetails' is not updatable because the modification affects multiple base tables.

Identify the problem? The data is being modified in two tables through a single update statement. It is not possible to update the table data through a view. The title 'Production Executive' does not exist. Rate of an employee cannot be modified.

15

Which of the following type of function returns a variable of a table data type from the result set of a single SELECT statement? Inline table-valued function Multistatement table-valued function Scalar function Multiline table-valued function 16

Employee table contains ModifiedDate column. The value in this column should be the current date. You need to ensure that when a record is inserted in the Employee table, the value for the ModifiedDate is checked. Which type of trigger would you create on the table to perform this task? INSERT UPDATE AFTER DELETE 17 The Employee table contains the employee details. A report containing the details of an employee is required frequently. Therefore, it was decided to create a stored procedure to generate the report. The procedure will accept id of an employee and display the details of that employee. How will you perform this task? CREATE PROCEDURE prcDisplayEmpDet @EmpId int AS BEGIN SELECT * FROM HumanResources.Employee WHERE EmployeeID = @EmpId END CREATE PROCEDURE prcDisplayEmpDet @EmpId int OUTPUT AS BEGIN SELECT * FROM HumanResources.Employee WHERE EmployeeID = @EmpId END CREATE PROCEDURE prcDisplayEmpDet @EmpId AS BEGIN SELECT * FROM HumanResources.Employee WHERE EmployeeID = @EmpId END CREATE PROCEDURE prcDisplayEmpDet @EmpId int AS BEGIN SELECT * FROM HumanResources.Employee WHERE @EmpId = EmployeeID END

18 The following function was created to calculate the monthly salary of an employee:

CREATE FUNCTION HumanResources.MonthlySal ( @Rate float) RETURNS char AS BEGIN RETURN (@Rate * 8 * 30) END

The function is executed using the following statement:

DECLARE @Sal float SET @Sal = HumanResources.MonthlySal(10.50) PRINT @Sal

However, the above statements generates the error: Arithmetic overflow error for type varchar, value = 2520.000000.

Identify the error? The variable name @Sal is not same as @Rate. The return data type should be of float instead of char in the CREATE FUNCTION statement. Arithmetic calculation cannot be performed inside the function definition. @Sal variable should be declared of char data type.

19 Employee table contains a Title column that stores the designation of the employee. When a employee is promoted, his title is changed in the Employee table. Also, the pay of the employee should also be modified accordingly. The pay of the employee is stored in the Rate column of the EmployeePayHistory table. Two UPDATE statements are executed simultaneously to modify both the tables. You need to ensure that both the UPDATE statements are executed simultaneously. If an error occurs while executing any of the UPDATE statement, none of them should be executed. What would you do to perform this task? Create a Stored Procedure Create a Transaction Create a Trigger Create a Function 20

You have created two AFTER INSERT triggers, Insert1 and Insert2 on the HumanResources.Employee table. The Insert1 is executed before the Insert2 trigger. You need to change the execution sequence of these two triggers so that Insert2 is fired first. How will you do this? sp_settriggerorder 'Insert2', 'FIRST', 'INSERT' sp_settriggerorder 'HumanResources.Insert1', 'FIRST', 'INSERT' sp_settriggerorder 'HumanResources.Insert2', 'FIRST' sp_settriggerorder 'HumanResources.Insert2', 'FIRST', 'INSERT' 21 Sam, the database developer used transactions while updating the data in the database. He wanted that till the transaction has not finished updating the data, no other trasnaction should be able to read it. In addition, in between the two statements, no other transaction should be able to update the data. For the same, he executed the following statement:

SET TRANSACTION ISOLATION LEVEL READ COMMITED BEGIN TRANSACTION TR BEGIN TRY UPDATE Person.Contact SET EmailAddress='jolyn@yahoo.com' WHERE ContactID = 1070

UPDATE HumanResources.EmployeeAddress SET AddressID = 32533 WHERE EmployeeID = 1 COMMIT TRANSACTION TR

PRINT 'Transaction Executed' END TRY BEGIN CATCH ROLLBACK TRANSACTION TR

PRINT 'Transaction Rollbacked' END CATCH

When he executed the update statement, he realised that even when the data is not updated, people are not able to read the data from the table. However, other transactions are able to update the data in between two statements. Analyze the previous statement and state the error. The isolation level of the transaction should be REPEATABLE READ The isolation level of the transaction should be READ UNCOMMITTED These update statements should be fired in separate transactions The transaction should not run in any of the isolation level 22 Which object in a service broker architecture acts as a container to store messages? Queue Contract Service Service program

23

You are required to create an assembly, asmOrderDetails. You need to ensure that the .NET code being imported is able to access some external resources, such as networks and registry. Which option will you specify while creating an assembly? SAFE UNSAFE EXTERNAL_ACCESS NOACCESS 24

Which shortcut key is used to access the Properties window of a form at design time? F12 F8 F4 F1 25You want to create a new customized control. This control should be reusable and should include the interface of a button and a textbox. What mechanism will you use to create this control? Create a user control and add a button and a textbox to the control in the user control designer view. Customize a button control to include a textbox control. Create a user control and inherit it from a button control and a textbox control. Implement the control class and add a button and a textbox object to it. 26

You have created a new custom renderer class RedTextRenderer in your application. Now you want to set the new custom renderer for all ToolStrip classes in your application. Which code snippet will you use to perform the desired task? toolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; ToolStripManager.Renderer = new RedTextRenderer; toolStrip.RenderMode = ToolStripRenderMode.Professional; ToolStripManager.Renderer = new RedTextRenderer; toolStrip.Renderer= ToolStripRenderMode.ManagerRenderMode; ToolStripManager.Renderer = new RedTextRenderer; toolStrip.Renderer = ToolStripRenderMode.Professional; ToolStripManager.Renderer = new RedTextRenderer;

27

Which of these is not a valid value of the TextDataFormat enum? CommaSeparatedValue Html Doc Text 28

Which property is used to display a check mark on a menu command by default? CheckOnClick Checked CheckedState DisplayStyle

29 Consider the following statements and choose the appropriate option.

Statement A: The CrystalReportViewer control can export a report to formats such as Portable Document Format, Microsoft Office Access, and Microsoft Office Excel. Statement B: The ReportViewer control can display compiled reports from the local file system or render the output from a remote report server. Statement A is true, and Statement B is false. Statement A is false, and Statement B is true. Both statements are true. Both statements are false.

30

You have added a HelpProvider component to your application. You have noticed that several new properties have automatically been added to all controls on the form and to the form itself. Identify these properties. a) HelpKeyword on b) HelpNavigator on c) HelpString on	a) HelpKeyword on b) HelpNavigator on c) HelpButton on	a) HelpKeyword b) HelpNavigator c) HelpString	a) HelpKeyword b) HelpNavigator c) HelpButton

31 You need to create an application that allows the user to load an image file to the PictureBox control pictureBox1, which is available on the form. You have created a Button control named button1, which opens the OpenFileDialog called openFileDialog1. This OpenFileDialog allows the user to select the image file to be opened. The code in the click event of button1 is given below:

openFileDialog1.InitialDirectory = "c:\\"; openFileDialog1.Filter = "JPG Image Files(*.JPG)|*.JPG|BMP Image Files(*.BMP)|*.BMP|GIF Image Files(*.GIF)|*.GIF"; openFileDialog1.FilterIndex = 1; openFileDialog1.RestoreDirectory = true; if(openFileDialog1.ShowDialog == DialogResult.OK) { pictureBox1.Image =openFileDialog1.FileName; }

However, an error is generated on executing this code. Analyze the error and suggest a possible solution. The value of the InitialDirectory property of openFileDialog1 is invalid. Correct it by setting it as "C:\". The value of the FilterIndex property of openFileDialog1 is invalid. Correct it by setting it as 3. The value of the Filter property of openFileDialog1 is invalid. Correct it by removing all the brackets. The Image property of pictureBox1 is invalid. Correct it by replacing it with the ImageLocation property of pictureBox1

32 Which control acts as a container for the ToolStripMenuItem, ToolStripComboBox, ToolStripSeparator, and ToolStripTextBox objects? ToolStrip MenuStrip StatusStrip ToolStripContainer 33You are creating an application that would be used to print text. You want to use the PrintDocument component to achieve this functionality. Identify the steps you would follow to configure the PrintDocument component in your application. 1. Drag the PrintDocument component from the ToolBox to your form and rename it to PrintDocument1. 2. Double-click the PrintDocument component in the component tray to create a BeginPrint event handler. 3. In the BeginPrint event handler, use the Graphics property of the PrintPageEventArgs class to inform the printer of what kind of text to print.

1. Drag the PrintDocument component from the ToolBox to your form and rename it to PrintDocument1. 2. Double-click the PrintDocument1 component in the component tray to create a PrintPage event handler. 3. In the PrintPage event handler, use the Graphics property of the PrintPageEventArgs class to inform the printer of what kind of text to print. 1. Drag the PrintDocument component from the ToolBox to your form and rename it to PrintDocument1. 2. Double-click the PrintDocument component in the component tray to create a BeginPrint event handler. 3. In the BeginPrint event handler, use the Graphics property of the PrintDocument class to inform the printer of what kind of text to print. 1. Drag the PrintDocument component from the ToolBox to your form and rename it to PrintDocument1. 2. Double-click the PrintDocument1 component in the component tray to create a PrintPage event handler. 3. In the PrintPage event handler, use the Graphics property of the PrintDocument class to inform the printer of what kind of text to print.

34 Consider the following statements and choose the appropriate option. Statement A: The FolderBrowserDialog component opens the Browse Folder dialog box, which enables users to browse for, select, and create folders. Statement B: The SelectedFolderPath property of the FolderBrowserDialog component returns the path of the folder selected by the user. Statement A is true, and Statement B is false. Statement A is false, and Statement B is true. Both statements are true. Both statements are false.

35 At the time of deploying the application in the client machine, the user gets an Application Install - Security Warning dialog box. What does this mean? The application is not signed with a trusted publisher's certificate. The application publisher's certificate has expired. The application is using an unsigned user control. The application prerequisites are not installed on the client machine. 36 You have created a method Factorial to calculate the factorials. You want to execute this method on a separate thread within your application. Which code snippet will you use to instantiate a thread object to start the Factorial function on this thread? FactorialThread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(this.Factorial)); FactorialThread.Start; FactorialThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.Factorial)); FactorialThread.Start; FactorialThread = new System.Threading.ThreadStart(this.Factorial); FactorialThread.Start; FactorialThread = new System.Threading. ParameterizedThreadStart (this.Factorial); FactorialThread.Start;.

37 Kevin is creating a multithreaded application using a BackGroundWorker component. He wants to submit a request to terminate the pending background operation and display a cancelled message to the user. Which of the following code snippet will allow him to perform the desired task? this.backgroundWorker1.CancellationAsync; if (backgroundWorker1.CancellationPending) { MessageBox.Show (Cancelled); }	this.backgroundWorker1.CancelAsync; if (backgroundWorker1.CancellationPending) { MessageBox.Show ("Cancelled"); }	this.backgroundWorker1.CancelAsync; if(backgroundWorker1.WorkerSupportsCancellation) { MessageBox.Show (Cancelled); }	this.backgroundWorker1.CancellationAsync; if (backgroundWorker1.WorkerSupportsCancellation) { MessageBox.Display ("Cancelled"); }

38 Angela is maintaining all the sales related files in the sales directory. She had to move all the transaction files to the directory transactions. However, by mistake she has copied these files. What command should Angela use to delete the files from the source location. rm /home/sales/*.* rm /home/sales/? mv /home/sales/*.* rm sales

39John needs send a mail to his team members regarding the details of the project that they need to start with. What are the sequence of steps he need to follow to send mail to his other team members? Step1: Type talk at the shell prompt and press Enter. Step2: Press C and type the name of the recipient in the To : block and press Enter. Step3: Type the subject block and press enter. Step4:Type the contents of mail and press Ctrl and x keys. Step1: Type pine at the shell prompt and press Enter. Step2: Press C and type the name of the recipient in the To : block and press Enter. Step3: Type the subject block and press enter. Step4:Type the contents of mail and press Ctrl and x keys. Step1: Type pine at the shell prompt and press Enter. Step2: Press D and type the name of the recipient in the To : block and press Enter. Step3: Type the subject block and press enter. Step4:Type the contents of mail and press x key. Step1: Type pine at the shell prompt and press Enter. Step2: Press C and type the name of the recipient in the To : block Step3: Type the subject block. Step4: Press Enter.

40 A customers calls up to ask GoodWill Electronics about the status of the orders placed. Ana at the reception, wants to urgently contact Bill at the marketing department to get the information. What should Ana do to get in touch with Bill? Use who command Use talk command Use pine command Use telnet command

ans wer

1 -1 2-1 3-4 4-2 5-4 6-1 7-1 8-1 9-2 10-1 11-4 12-1 13-2 14-1 15-1 16-1 17-1 18-2 19-2 20-4 21-1 22-1 23-3 24-3 25-1 26-1 27-3 28-2 29-2 30-1 31-4 32-2 33-2 34-1 35-1 36-2 37-2 38-2 39-3 40-2