upwork test

22
1 2 3 4

Upload: ram

Post on 07-Jul-2016

17 views

Category:

Documents


0 download

DESCRIPTION

Upwork TestQuestion and answer

TRANSCRIPT

Page 1: Upwork Test

1

2

3

4

Page 2: Upwork Test

5

6

7

8

Page 3: Upwork Test

9

10

11

12

13

Page 4: Upwork Test

14

15

16

17

Page 5: Upwork Test

18

19

20

21

Page 6: Upwork Test

22

23

24

25

26

Page 7: Upwork Test

27

28

29

30

31

Page 8: Upwork Test

32

33

34

35

Page 9: Upwork Test

36

37

38

39

40

Page 10: Upwork Test

41

42

43

44

Page 11: Upwork Test
Page 12: Upwork Test

You are creating an ASP.NET application that is hosted on your company’s Web server. You want to access a database with minimal effort. What you will not do?

Answers

1. Begin a transaction2. Create a connection to the database3. Create a data set using an adapter object4. Use the data set to display data or to change items in the database5. Update the database from the data set6. Close the database connection7. Check for transaction errors

Which of the following are aggregate functions in SQL?

Answers:1. Avg2. Select3. Order By4. Sum5. Union6. Group by7. Having

You create an ASP.NET application for an online insurance site PremiumInsurance. A page named PersonalDetails.aspx has the following Page directive:

<%@ Page Language=”VB” CodeBehind=”PersonalDetails.aspx.vb” AutoEventWireup=”false” inherits=”InsApp.PersonalDet”%>

PersonalDetails.aspx had a TextBox control named MemberID in which the user can enter a Personal MemberID. The HTML code for this control is as follows:

<asp:TextBox ID=”MemberID” Columns=”20″ Runat=”server”/>

You are implementing the TextChanged event handler. Which two courses of action should you take? (Each correct answer presents part of the solution. Choose two)

Answers

1. In the Page directive for PersonalDetails.aspx, ensure that the AutoEventWireup attributes is set to “true”.2. In the Page directive for PersonalDetails.aspx, ensure that the EnableViewState attribute is set to “true”.

3. In the MemberID HTML element, ensure that the AutoPostback attribute is set to “false”. Include code for the client-side onserverchange event to submit the Web Form for processing by the server.

4. In the MemberID HTML element, ensure that the AutoPostback attribute is set to “true”. Include code in the TextChanged event handler to query the XML Web service.

The simplest query must include at least________ and _________.

Answers:1. A select clause2. A where clause3. A from clause

You need to implement a TextChanged event handler for MemberID. You want this event handler to retrieve information about a person by using an XML Web service that charges for each access. The page will then be redisplayed with additional information about the vehicle obtained from the XML Web service.

Page 13: Upwork Test

4. A group by clause5. A having clause6. An order by clause

You are the software engineer for Premium Corp.. One of the pages in an ASP.NET application contains the following declaration:

<%@ Register Tagprefix=”WoodySideBankControls” Namespace=”WoodySideBankNameSpace” Assembly=”MyAssembly” %>

The assembly named MyAssembly contains a custom server control named CSC1. Which of the following code samples will properly render CSC1 on the Web page?

Answers:1. <WoodySideBankControls:CSC1 id=”Control1″ runat=”server” />2. <WoodySideBankNameSpace:CSC1 id=”Control1″ runat=”server” />3. <WoodySideBankControls:Control1 id=”CSC1″ runat=”server” />4. <WoodySideBankNameSpace:Control1 id=”CSC1″ runat=”server” />

LAST_NAME DEPARTMENT_ID SALARY

ALLEN 10 3000

MILLER 20 1500

King 20 2200

Davis 30 5000

Which of the following Subqueries will execute without any error?

Answers:

1. SELECT distinct department_id FROM employees Where salary = (SELECT AVG(salary) FROM employees GROUP BY department_id);2. SELECT distinct department_id FROM employees Where salary > (SELECT AVG(salary) FROM employees GROUP BY department_id);3. SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id);4. SELECT distinct department_id FROM employees Where salary > ALL (SELECT AVG(salary) FROM employees GROUP BY department_id);5. SELECT distinct department_id FROM employees Where salary < (SELECT AVG(salary) FROM employees GROUP BY department_id);

What will happen if you query the emp table as shown below:

select empno, DISTINCT ename, Salary from emp;

Answers:

1. EMPNO, unique value of ENAME and then SALARY are displayed2. EMPNO, unique value ENAME and unique value of SALARY are displayed3. DISTINCT is not a valid keyword in SQL4. No values will be displayed because the statement will return an error

Answers: 1. Command 2. Locals 3. Output 4. Breakpoints

You are debugging an ASP.NET application for Premium Corp.. Users will use the application to produce reports. Your application contains several Debug.WriteLine statements. Which window in Visual Studio .NET should you use to inspect output from the Debug.WriteLine statements?

Page 14: Upwork Test

Examine the query:-

select (2/2/4) from tab1;

where tab1 is a table with one row. This would give a result of:

Answers:

1. 42. 23. 14. .55. .256. 07. 88. 24

Is it possible to insert several rows into a table with a single INSERT statement?

Answers:

1. No2. Yes

You use a Command object to retrieve employee names from the employee table in the database. Which of the following will be returned when this command is executed using ExecuteReader method?

Answers:

1. DataRow2. DataSet3. DataTable4. DataReader

Which of the following are the valid methods of the SqlTransaction class?

Answers:

1. Commit2. Terminate3. Save4. Close5. Rollback

Which of the two statements is true?

(a)MSIL code is platform independent

(b)CLR is platform dependent

Answers:

1. Only (a) is true, (b) is false2. Only (b) is true, (a) is false3. Both (a) and (b) are true4. Both (a) and (b) are false

Page 15: Upwork Test

Consider the following two statements relating to ASP.NET and choose the most appropriate option:

Statement 1: Value types are allocated on a stack

Statement 2: Reference types are allocated on a managed CLR Heap

Answers:

1. Statement 1 is true and statement 2 is false2. Statement 2 is true and statement 1 is false3. Both statements 1 and 2 are true4. Both statements 1 and 2 are false

Answers:

1. The variable is not currently in scope.2. The variable has been defined as public.3. The variable has been defined as private.4. The variable has not been defined in this project.

Check the following code:

Public Shared Sub UpdateData(ByVal sql As String,ByVal connectionString As String, ByVal dataTable As DataTable)

Dim da As New OleDb.OleDbDataAdapter()

Dim cnn As New OleDb.OleDbConnection(connectionString)

dataTable.AcceptChanges()

da.UpdateCommand.CommandText = sql

da.UpdateCommand.Connection = cnn

da.Update(dataTable)

da.Dispose()

End Sub

Answers:

1. Add code to the Application_OnStart event handler in the Global.asax file to set the values of the text strings.2. Add code to the Application_BeginRequest event handler in the Global.asax file to set the values of the text strings.3. Add code to the Session_OnStart event handler in the Global.asax file to set the values of the text strings.4. Include code in the Page.Load event handler for the default application page that sets the values if the text strings when the5. IsPostback property of the Page object is False.

6. Include code in the Page.Load event handler for the default application page that sets the values of the text strings when the IsNewSession property of the Session object is set to True.

Examine the code given below:

SELECT employee_id FROM employees WHERE commission_pct=.5 OR salary > 23000

You are debugging a Visual Basic.NET application. You add a variable to the watch window. When Visual Basic enters break mode, the Value of the expression variable is “”. What is the most likely cause of the problem?

You are creating an ASP.NET application that will be used by companies to quickly create information portals customized to their business. Your application stored commonly used text strings in application variables for use by the page in your application. You need your application to initialize these text strings only when the first user accesses the application. What should you do?

Page 16: Upwork Test

Which of the following statements is correct with regard to this code?

Answers:

1. It returns employees whose salary is 50% more than $23,0002. It returns employees who have 50% commission rate or salary greater than $23,0003. It returns employees whose salary is 50% less than $23,0004. None of the above

Evaluate the following SQL statement:

What will happen if all the parentheses are removed from the calculation?Answers:

1. The value displayed in the CALC_VALUE column will be lower2. The value displayed in the CALC_VALUE column will be higher3. There will be no difference in the value displayed in the CALC_VALUE column4. An error will be reported

What should you do?

Answers:

1. Set the Enabled property of the GridView control to false.2. Set the EnableViewState property of the GridView to false.3. Write code in the Page.Load event handler that populates the GridView control only when the IsPostBack property of the page is false.4. Write code in the Page.Load event handler that populates the GridView control only when the IsPostBack property of the page is true.

Answers:

1. Finally block will be executed only if an error occurs2. Finally block is executed after Catch block when no error occurs3. Finally block is executed after Try block regardless of whether an error occurs4. Finally block is executed only when no error occurs

Answers:

1. View State2. Hidden fields

SELECT e.employee_id,( (.15* e.salary) + (.5 * e.commission_pct) + (s.sales_amount * (.35 * e.bonus))) AS CALC_VALUE FROM employees e, sales s WHERE e.employee_id = s.emp_id;�

You are creating an ASP.NET page for Premium Consultants. You create a GridView control that displays past purchases made by the user. The GridView control is populated from an existing database when the page is created. The page contains TextBox controls that allow users to update their personal information, such as address and telephone number. You need to ensure that the page is refreshed as quickly as possible when users update their contact information.

Sam is developing an application that enables the users to perform read and write operations on text files. He uses structured exception handling to handle the errors. He writes the code for closing all the files that were opened in the Finally block. Which of the following is true regarding the Finally block?

You are creating an ASP.NET application that will record each customer’s entry. It is possible that thousands of entries could be posted at any given time. Your application will be hosted on twenty Web servers. As customers enter information into your application, maintaining state information will be important. This information should be stored securely and should be capable of being restored in the event that a Web server is restarted. Customers will enter data into three separate pages in your application. Which of the following methods of storing state information would best suit the situation?

Page 17: Upwork Test

3. State Server4. Application state5. SQL Server

Answers:

1. EditCommand2. OnClick3. ButtonClicked4. ItemCommand

Which line of code should you use to copy the edited rows from dataset productInfo into another dataset productChanges?

Answers:

1. productChanges = productInfo.GetChanges(DataRowState.Detached)2. productChanges = productInfo.GetChanges()3. productChanges.Merge(productInfo, true)4. productChanges.Merge(productInfo, false)

ProductID

ProductName

CurrentStock

MinimumStock

Two possible queries are:

(a)select * from products where currentStock > MinimumStock + 50

(b)select * from products where currentStock – 50 > MinimumStock

Choose the appropriate option with regard to the above queries.

Answers:

1. (a) is correct2. (b) is correct3. (a) and (b) both are correct4. (a) and (b) both are incorrect

How you will generate a report with minimum network traffic?

Answers:

1. Use Microsoft SQL Server indexes to optimize the data calculations2. Implement the calculations in a business layer class3. Implement the calculations in a data layer class

4. Use Microsoft SQL Server stored procedures for the data calculations

You are creating an ASP.net application to enter timesheet data intuitively. Users will enter data using a DataGrid. You have added a button column to your DataGrid. The button column uses a custom button to allow users to initiate some calculations on the data in the grid. Which event does the DataGrid control raise when the custom button is clicked?

You are maintaining data for its products in the Products table, and you want to see those products, which are 50 items that is currentStock or more than 50 but less than the minimum stock limit of items. The structure of the Products table is:

You are creating an ASP.NET Web site for your company. The Web site will use both Microsoft(R) .NET Framework server controls and ActiveX controls. You want to use Microsoft Visual Studio(R) .NET to create a Setup and Deployment project to package the ActiveX controls. Which project type should you create?

Page 18: Upwork Test

Answers:

1. Cab2. Merge Module3. Web Setup4. Setup

In SQL Server, you should avoid the use of cursors because:Answers:

1. They are very difficult to implement2. Programs with cursors take more time to run, hence performance degrades3. Programs with cursors are more lengthy, hence they consume more space/memory4. No, you must maximize the use of cursors because they improve performance

Which one of the following correctly selects rows from the table myTable that have null in column column1?Answers:

1. SELECT * FROM myTable WHERE column1 is null2. SELECT * FROM myTable WHERE column1 = null3. SELECT * FROM myTable WHERE column1 EQUALS null4. SELECT * FROM myTable WHERE column1 NOT null5. SELECT * FROM myTable WHERE column1 CONTAINS null

Consider the following queries:1. select * from employee where department LIKE ‘[^F-M]%’;2. select * from employee where department = ‘[^F-M]%’;Select the correct option:Answers:

1. Query 2 will return an error2. Both the queries will return the same set of records3. Query 2 is perfectly correct4. Query 2 would return one record less than Query 1

Answers:

1. Use a Web installation package for the Web application. Use the Global Application Cache (GAc)utility, GACUtil.exe, to install the supporting assemblies into the GAC.

2. Use Xcopy deployment for the Web application and its supporting assemblies.3. Use Xcopy deployment to deploy the Web application. Use merge modules to install the supporting assemblies.4. Use a Web installation package to install the Web application and the supporting assemblies.

Which of the following is not a valid SQL operator?

Answers:

1. Between..and..2. Like3. In

You need to install an online parcel tracking application and its supporting assemblies so that the application and its assemblies can be uninstalled using the Add/Remove Programs Control Panel applet. What should you do?

Page 19: Upwork Test

4. Is null5. Having6. Not in7. All of the above are valid.

Answers:

1. Set the AutoPostBack property of txtDelDate to False. Write code in the ServerValidate event handler to validate the date.2. Set the AutoPostBack property of txtDelDate to True. Write code in the ServerValidate event handler to validate the date.

3. Set the AutoPostBack property of txtDelDate to False. Set the ClientValidationFunction property to the name of a script function contained in the HTML page that is sent to the browser.

4. Set the AutoPostBack property of txtDelDate to True. Set the ClientValidationFunction property to the name of a script function contained in the HTML page that is sent to the browser.

33. In ASP.NET, the exception handling should be used:

Answers:

1. to signal the occurrence of unusual or unanticipated program events2. to redirect the program’s normal flow of control3. in cases of potential logic or user input errors4. in case of overflow of an array boundary

34. How can you view the results of Trace.Write() statements?

Answers:

1. By enabling page tracing2. By enabling application tracing3. By enabling server tracing4. By looking up the system.log file

35. Which of the following are false for ASP.NET events?

Answers:

1. Events are specialized forms of delegates2. Events are used to support the callback event notification model3. The signature of any event handler is fixed4. All of the above are true

You create an ASP.NET page that allows a user to enter a requested delivery date in a TextBox control named txtDelDate. The date must be no earlier than two business days after the order date, and no later that 60 business days after the order date. You add a CustomValidator control to your page. In the Properties window, you set the ControlToValidate property to txtDelDate. You need to ensure that the date entered in the txtDelDate TextBox control falls within the acceptable range of values. In addition, you need to minimize the number of round trips to the server. What should you do?

Page 20: Upwork Test

36. What will happen if the Server configuration file and the Application configuration file have different values for session state?

Answers:

1. The Server configuration will always override the Application configuration2. The Application configuration will always override the Server configuration3. The Server configuration will override the Application configuration if allowOverride is set to “false” in the settings in the Server configuration file4. The Application configuration will override the Server configuration if allowOverride is set to “false” in the settings in the Server configuration file

37. A company has the following departments:

Marketing, Designing, production, Packing

What will be the result of the following query?

select * from table where department < ‘marketing’;

Answers:

1. The query will return “Designing, Packing”2. The query will return “Designing, production, Packing”3. The query will return “packing”4. Strings cannot be compared using < operator5. The query will return “Designing”

Answers:1. Use a RichTextBox object to hold the data as it is being concatenated.2. Use the Append method of the String class.3. Use the String class and the & operator.4. Use the StringBuilder class.

Answers:

1. A primary key should be created for the customer_id field in the customer table and also for the customer_id field in the order table2. A primary key should be created for the order_id field in the customer table and also for the customer_id field in the order table

3. A primary key should be created for the customer_id field in the customer table and a foreign key should be created for the customer_id field in the order table

4. A primary key should be created for the customer_id field in the customer table and a foreign key should be created for the order_id field in the order table

5. None of these

Your company, StoreIt Inc has stored the text of several journals in a Microsoft SQL Server 7.0 database. Each sentence is stored in a separate record so that the text can be retrieved with the finest granularity. Several of these works are many thousands of printed pages in length. You are building a Web application that will allow registered users to retrieve data from these volumes. When a user of your Web application requests large amounts of text, your application must return it in the most efficient manner possible. How should you build the large String object that is required to provide the most efficient response to the user?

The sales database contains a customer table and an order table. For each order there is one and only one customer, and for each customer there can be zero or more orders. How should primary and foreign key fields be placed into the design of this database?

You want to access data from the “Customer” table in the database. You generate a DataSet named “MyDataSet” by adding “Customer” table to it. Which of the following statements should you use to load the data from the database into “MyDataSet” which has been loaded with multiple tables, using a SqlDataAdapter named “MyAdapter”?

Page 21: Upwork Test

Answers:

1. MyAdapter.Fill(MyDataSet,”Customer”)2. MyAdapter.Fill(“MyDataSet”,Customer)3. MyAdapter.Fill(MyDataSet)4. MyAdapter.Fill(“MyDataSet”)

What is the order of precedence among the following operators?1 IN2 NOT3 AND4 ORAnswers:

1. 1,2,3,42. 2,3,4,13. 1,2,4,34. 1,4,3,25. 4,3,2,16. 4,1,2,37. 4,2,1,38. 3,2,1,4

Which query will display data from the Pers table relating to Analysts, clerks and Salesmen who joined between 1/1/2005 and 1/2/2005?

Answers:

1. select * from Pers where joining_date from ‘1/1/2005’ to ‘1/2/2005’, job= ‘Analyst’ or ‘clerk’ or ‘salesman’2. select * from Pers where joining_date between ‘1/1/2005’ to ‘1/2/2005’, job= ‘Analyst’ or job= ‘clerk’ or job= ‘salesman’3. select * from Pers where joining_date between ‘1/1/2005’ and ‘1/2/2005’ and (job= ‘Analyst’ or ‘clerk’ or ‘salesman’)4. None of the above

43. What is the correct order of clauses in the select statement?

1 select

2 order by

3 where

4 having

5 group by

Answers:

1. 1,2,3,4,52. 1,3,5,4,23. 1,3,5,2,44. 1,3,2,5,45. 1,3,2,4,56. 1,5,2,3,47. 1,4,2,3,58. 1,4,3,2,5

Which of the following queries is valid?

Answers:

Page 22: Upwork Test

1. Select * from students where marks > avg(marks);2. Select * from students order by marks where subject = ‘SQL’;3. Select * from students having subject =’SQL’;4. Select name from students group by subject, name;5. Select group(*) from students;6. Select name,avg(marks) from students;7. None of the above