FINAL SERVER SIDE

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which line of C# code will execute the Stored Procedure?Use the following code to complete this question: // Stored Procedure Code CREATE PROCEDURE UpdateProductPrice @theProductID int,@thePrice float AS UPDATE Products SET Price = @thePrice WHERE ProductID = @theProductID RETURN 1 // C# Code DBConnect db = new DBConnection();SqlCommand myCommand = new SqlCommand(); myCommand.CommandType = CommandType.StoredProcedure;myCommand.CommandText = "UpdateProductPrice"; Sqlparameter myParameter = new SqlParameter("returnValue", 0); myParameter.Direction = ParameterDirection.ReturnValue; myParameter.SqlDbType = SqlDbType.Int; myCommand.Parameters.Add(myParameter);

db.DoUpdateUsingCmdObj(myCommand);

Which code snippet will convert the GridView from edit view mode to normal view mode?

gvCars.EditIndex = -1;

In ASP.NET, which attribute is used to attach a JavaScript function to an ASP Button (WFC) in an ASPX page?

onclientclick

In AJAX, which JavaScript property is used to retrieve the Web server or Web API's response?

responseText

What URL will match the following routing template? "services/payment/{controller=Account}/{action=TransactionHistory}/{accountID}/{applicationID?}"

services/payment/Account/TransactionHistory/123/

How do you retrieve the value of the following form control from C# server-side code? <input name="txtPhone" id="txtPhone" value="(215) 555-1234" type="text" runat="server" />

txtPhone.value

How do you retrieve the value of the following form control from C# server-side code? <asp:Button id="txtQuantity" runat="server" />

txtQuantity.Text

What is the file extension for Custom Web Form Controls (custom user controls)?

.ASCX

List the stages of the ASPX Page Life-Cycle. Your answer must list the stages in numerical order and include the name of the stage. Do not describe the stages.

1. Page Instantiation (Start Stage) 2. Page Initialization 3. Page Load 4. Postback Eventhandler 5. Page Render 6. Page Unload

What is the following attribute called in ASP.NET Core Web APIs?[HttpPost]

Action Verb

Why is there no HTML tag, BODY tag, and other important HTML in the ASP/HTML markup of a Custom Web Form Control?

An ASCX Custom Web Form Control is added to an ASPX page that already contains the HTML tag, BODY tag, Web Form, and other important HTML for the page.

What class was used to perform the actual serialization and deserialization of objects in our class examples? FileStream

BinaryFormatter

What property of the SqlCommand object is used to specify the name of the Stored Procedure to execute?

CommandText

What is a Web API in ASP.NET Core?

Controller

What state management objects could be used to store a person's username and password for faster future logins to our Web Application where the username and password are auto-filled in the textboxes of a login page. (select all that apply)

Cookie

After a successful login, what state management objects are best used to store the current user's name that will be needed by multiple pages of your Web Application. (select all that apply)

Cookie, HTTP QueryString, Session

What is the purpose of using Custom Web Form Controls in building Web applications? Be sure to explain their role and give an example to explain your answer.

Custom Web Form Controls allow the developer to create reusable components, which are essentially reusable parts of an ASPX page, that can be part of other ASPX pages and other Web applications. For example, many Web applications utilize Shopping Carts that contain a set of controls that handle the display of products in the cart and a set of controls that allow the user to manage (add/remove, edit) the cart. Instead of recreating the GUI and programming the functionality of a shopping cart on many different Web applications, the programmer can create a Custom Web Form Control that handles the shopping cart display and operations, and reuse it in other pages or Web applications.

What is the name of the class that I gave you to perform database operations?

DBConnect

What are the two primary reasons for using serialization in applications?

Data persistence and transmission.

What method of the database connection class that I gave you is used to perform an SQL INSERT or DELETE statement?

DoUpdate

HTTP Response is sent to the server each time a user interacts with an ASPX page like clicking a button. True or False?

False

TRUE or FALSE: ASP.NET can detect when a session ends because the browser sends an HTTP Request with information regarding the browser closing.

False

TRUE or FALSE: an HTML Form Control is turned into a programmatic object that your C# code has full control over.

False

TRUE or FALSE: data stored in class-level variables exists across postbacks.

False

TRUE or FALSE: data stored in the ViewState of one page can be accessed across multiple postbacks of that page and other ASPX pages in a Web Application.

False

When executing code in the CodeBehind of an ASPX page that utilizes an ASMX Web Service, the client of the Web Service is the Web browser?

False

the HTTP Response sent to a client requesting an ASPX page contains HTML, JavaScript, ASP Markup, and CSS. True or False?

False

the client needs the .NET framework in order to use an ASPX page. True or False?

False

TRUE or FALSE: the Page Unload Stage is the last stage in the ASPX Page Life-Cycle that the programmer can use to modify the values in the form controls to display output to the user.

False The Page Unload Stage is too late in the Page Life-Cycle to make modifications to the page because the response containing the page's HTML, JavaScript, and CSS has already been sent to the client.

What is a Postback?

For example a users change a value of a textbox on a page and click save, the page reload and the values changed but the url and the page itself does not chage. The content on the form are postback into the same link or URL as the form.

The following code is an example of which type of server-side code placement? <%= "Hello CIS3342" %>

Inline scripting

What stage of the ASPX Page Life-Cycle involves creating all the objects needed by the page including server-side form controls, Request object, Response object, and the object that represents the page itself?

Instantiation or Start Stage or Page Instantiation

What is the name of the collection in a Repeater that contains objects that represent each row of the repeater?

Items

What concurrency handling technique is used by SQL Server and most databases by default?

Last One In Wins

Which method is used to create an instance of a Custom Web Form Control at run-time to add to an ASPX page?

LoadControl

What is another term used for serialization?

Marshalling

What object was used to temporarily store the serialized data?

MemoryStream

What server software is responsible for handling HTTP Requests and Responses?

Microsoft Internet Information Server

Which method is used to setup a new AJAX request before it is sent?

Open

What stage of the ASPX Page Life-Cycle is similar to the Form Load in a Windows Form Application?

Page Load

What property is used to pass inputs to a Stored Procedure?

Parameters

When using the Lock() and UnLock() methods of the Application object, what type of concurrency handling technique is being used to safely work with data in the Application object?

Pessimistic

When executing code in the CodeBehind of an ASPX page that utilizes an ASMX Web Service, what object is responsible for communicating with the ASMX Web Service?

Proxy object

What does the acronym REST represent?

Representational State Transfer

How do you retrieve the department value from the following HTTP QueryString? You do not need a complete C# statement. You only need to show how to access the data from the correct state management object.http://cis-iis2.temple.edu/store/Products.aspx?DeptNumber=EP101&ProductID=SMG432&CartID=CP25

Request.QueryString["DeptNumber"]

How do you retrieve the value of the following form control from C# server-side code? <input name="txtAddress" id="txtAddress" value="Street Address" type="text" />

Request["txtAddress"]

What component does ASP.NET Core use to handle mapping URLs to the correct Web API and Web API method?

Routing Component

There are two types of Web API standards. Besides REST, what is the other type of Web API?

SOAP

What communication protocol is used by ASMX Web Services?

SOAP

What control handles the generating and loading of JavaScript library files used to handle AJAX in an ASPX page?

ScriptManager

What GridView event handler is fired when a Select Command Field button is clicked?

SelectedIndexChanged

Where does the C# code get executed for web Serverapplications?

Server

What object can work with a medium like a text file, memory buffer, or network stream for obtaining input in an application?

StreamReader

Which line of C# code will retrieve the Stored Procedure's return value?Use the following code to complete this question: // Stored Procedure Code CREATE PROCEDURE UpdateProductPrice @theProductID int,@thePrice float AS UPDATE Products SET Price = @thePrice WHERE ProductID = @theProductID RETURN 1 // C# Code DBConnect db = new DBConnection();SqlCommand myCommand = new SqlCommand(); myCommand.CommandType = CommandType.StoredProcedure; myCommand.CommandText = "UpdateProductPrice"; Sqlparameter myParameter = new SqlParameter("returnValue", 0); myParameter.Direction = ParameterDirection.ReturnValue; myParameter.SqlDbType = SqlDbType.Int;myCommand.Parameters.Add(myParameter);

String value = myCommand.Parameters["returnValue"].Value.ToString();

Which .NET namespace must be imported to use the stream related classes like MemoryStream, FileStream, NetworkStream, etc...? System.Data

System.IO

Which type of GridView field is used to place a control like a textbox, label, checkbox, or dropdown list?

Template Field

What server component is responsible for handling HTTP Requests that request an ASPX page?

The application server (ASP.NET)

What are some concerns regarding data storage and retrieval in regards to using the Application object?

The biggest issues application object would be security. Since the application object data is shared to all users across the web application. Also the data that is stored will be gone when the application ends

What is the purpose of the Page Directive (first line of code in the HTML/ASP Markup code) in an ASPX page?

The page directive is used by ASP.NET to determine the programming language and compiler to use, the file that contains the code, and the class to instantiate in the Page Instantiation Stage.

A reason for disabling ViewState for a page?

The page size has significantly increased causing longer download and upload times for an ASPX page.

What server component is responsible for processing JSP or JSPX pages?

Tomcat

What is the name of Microsoft's version of SQL that includes programming language constructs with SQL?

Transact-SQL

TRUE or FALSE: Custom Web Form Controls have page level events like ASPX pages.

True

TRUE or FALSE: Stored Procedures help prevent SQL Injection attacks.

True

TRUE or FALSE: a Custom Web Form Control cannot contain a Web Form.

True

TRUE or FALSE: a Web API's action method can respond to multiple routes.

True

TRUE or FALSE: an ASPX page can only contain one Web Form.

True

TRUE or FALSE: the Postback Event Handling Stage is skipped on the first page load.

True

TRUE or FALSE: the Session_Start and Session_End event handlers are located in the Global.asax file.

True

TRUE or FALSE: you cannot have more than one ScriptManager on an AJAX-enabled ASPX page.

True

TRUE or FALSE: you do not need to use a callback function when using the synchronous communication mode.

True

In Microsoft AJAX, what control is used to contain the part of the page that will be updated during an asynchronous postback?

UpdatePanel

What file is generated during the Discovery Process that describes the Web Service and its Web Methods?

WSDL

Explain a situation where you would need to use a Cookie over Session to store data. Make sure to give an example and explain why in your answer.

When a page is closed and reopen again, session will be clear while cookie is saved

By default, what data format is exchanged between the client and an ASMX Web Service?

XML

What is the name of the JavaScript object used in AJAX?

XmlHttpRequest

Explain the role of serialization and deserialization in Web APIs or an ASMX Web Service. Make sure your answer explains how it is specifically used with Web APIs and give an example. You answer should discuss the proper terminologies and technologies we discussed in class.

Your Answer: WEB API default serilization is JSON or XML, when a WEB API is called, it grab the information and serialize the information and that information could be string, object, etc, etc and that information come back as JSON or XML (as a default). After that we have to deserilization the JSON or XML file to get the actual values to use it. A good example if I write a fucntion to call the Web API by creating a string URL. I use DataStream and DataReader to read the JSON or XML file from the web API. I then deserialize that information into either a string, object, or etc etc and uses it.

Write the necessary code to call and execute the stored procedure in C#. Use the following code to complete this question. // Stored Procedure CodeCREATE PROCEDURE GetProductAS SELECT ProductID, Title, Description, Price FROM Products // C# Code DBConnect db = new DBConnection();SqlCommand myCommand = new SqlCommand();

Your Answer: myCommand.CommandType = CommandType.StoredProcedure; myCommand.CommandText = "GetProduct"; db.GetDataSetUsingCmdObj(myCommand);

Which of the following is an example of Attribute Routing?

[HttpGet("GetAccountByID/{id}")]

What attribute is used in an ASMX Web Service to expose a Web Method to clients of the Web Service?

[WebMethod]

What attribute is used in an ASMX Web Service to include a copy of a class in the Web Service's description file during the Discovery Process?

[XmlInclude]

Which URL uses tokens to pass data to a Web API Get action method?

api/Cars?id=25 api/Cars id=5/ api/Cars/25 ----- CORRECT WEBA API / VALUES


Kaugnay na mga set ng pag-aaral

Chapter 28 The Child with Endocrine Dysfunction

View Set

ECONOMICS/CHAPTER 14:FIRMS IN COMPETITIVE MARKETS-NOTES

View Set

Computer Science Review Part 3: Chapter 11

View Set

Practice questions for insurance test

View Set

Lesson 4: Dietary Guidelines for Americans 2020-2025

View Set

World Civilizations Since 1500 Final Exam Review - Previous Quiz Questions

View Set

BCIS 3610 CH 5 + some from previous

View Set