Lesson 4: Understanding Web Applications
1. You are developing a Web page for a medium-sized business.
You want to separate the formatting and layout of the page from its content.
Which of the following technologies should you use to define the formatting and
layout of the page content?
a) Cascading Style Sheets (CSS)
b) Hypertext Markup Language (HTML)
c) JavaScript
d) Hypertext Transmission Protocol (HTTP)
Answer: a
Difficulty: Medium
Section Reference: Understanding Web Page Development
Cascading Style Sheets (CSS) help you define the formatting
and layout of a page’s content and store that separately from the content. HTML
is a text-based language that uses various markup tags that describe how
content is displayed. JavaScript is scripting language that you use to add
functionality and behavior to a Web page. HTTP is the underlying communication
protocol used by the World Wide Web.
2. You want to display an image on your Web page. The image
is stored on a separate Web server but can be accessed with a public URL. Which
of the following HTML tags should you use to ensure that the image is displayed
when the user navigates to your Web page?
a) <LINK>
b) <IMG>
c) <A>
d) <HTML>
Answer: b
Difficulty: Easy
Section Reference: Understanding HTML
The HTML <IMG> tag is used to display the
images on a Web page. The source of the image can be on the same or a different
Web server. The <LINK> tag is used to link a CSS file with the HTML
page. The <A> tag is used to create anchor links. The <HTML>
tag is used to specify the contents of a Web page.
3. You are developing a new Web page. You need to create
hyperlinks that point to other pages on the World Wide Web. Which of the
following methods should you use to create these hyperlinks on your Web page?
a) the SRC attribute of the <IMG>
tag
b) the HREF attribute of the <A>
tag
c) the HREF attribute of the <LINK>
tag
d) the XMLNS attribute of the <HTML>
tag
Answer: b
Difficulty: Easy
Section Reference: Understanding HTML
To create a hyperlink to another Web page, use the HREF
attribute of the <A> tag. The IMG tag is
used to specify the location of an image. The LINK tag is
used to link to a CSS resource. The HTML tag is used to specify the
contents of a Web page.
4. You need to perform data validation to ensure that the
input fields are not empty and the user’s email address and phone numbers have
been provided in the required format. You need to minimize the transmission of
information across the networks. Which of the following coding approaches
should you follow?
a) Use JavaScript code that executes on the Web server.
b) Use C# code that executes on the Web server.
c) Use JavaScript code that executes in the browser.
d) User C# code that executes in the browser.
Answer: c
Difficulty: Medium
Section Reference: Understanding JavaScript
JavaScript is a client-side scripting language that runs
inside Web browsers to help create far more interactive Web pages than are
possible with only HTML. C# code does not run within Web browsers. Writing code
that runs on a Web server increases transmission of information across networks
and provides slow response to the users.
5. You write large amount of JavaScript code for your Web site.
You need to take advantage of caching techniques to make sure that Web pages
load as quickly as possible. You also need to ensure that you can modify the
JavaScript code with the least amount of effort. What should you do?
a) Write JavaScript code inside the <SCRIPT>
tag. Include the <SCRIPT> within the <HEAD>
tag of the HTML page.
b) Write JavaScript code inside the <SCRIPT>
tag. Include the <SCRIPT> within the <BODY>
tag of the HTML page.
c) Write JavaScript code in a separate file. Use the SRC
attribute of the <SCRIPT> tag to link to the JavaScript file.
d) Write JavaScript code in a separate file. Use the HREF
attribute of the <LINK> tag to link to the JavaScript file.
Answer: c
Difficulty: Medium
Section Reference: Understanding JavaScript
You should write JavaScript code in a separate file and then
use the SRC
attribute of the <SCRIPT> tag to link to the JavaScript file. When
the JavaScript code is in an external file, it can be cached on the client side
and doesn’t need to be downloaded with every page. Writing the JavaScript code
inside the <SCRIPT> code and including the <SCRIPT>
tag within <HEAD> or <BODY> increases the Web
page’s size and causes the JavaScript code to be downloaded with each page
request, thereby slowing down page loads. Using the <LINK>
tag will not work because it is used to link to the external CSS file.
6. Which of the following processes is responsible for
providing the ASP.NET functionality?
a) inetinfo.exe
b) iexplore.exe
c) aspnet_isapi.dll
d) aspnet_wp.exe
Answer: d
Difficulty: Medium
Section Reference: Understanding ASP.NET Application
Development
The aspnet_wp.exe (ASP.NET Worker Process) file handles the Web
requests for ASP.NET resources. The ASP.NET ISAPI extension (aspnet_isapi.dll) is
responsible for invoking the ASP.NET worker process (aspnet_wp.exe), which, in
turn, controls the execution of the request. The inetinfo.exe is the Internet
Information Services process. The iexplore.exe process is for the Internet
Explorer Web browser.
7. You are developing an ASP.NET Web page that displays
status of a shipment. You need to write some code that will change the Web
page’s appearance and assign values to some controls. Where should you put this
code?
a) In the InitializeComponent method
b) In a method that handles the Load event
c) In a method that handles the Init event
d) In a method that handles the PreRender event
Answer: b
Difficulty: Medium
Section Reference: Understanding ASP.NET Page Life Cycle and
Event Model
The method that handles the Load event is
the most appropriate place for writing initialization code such as this. You
should not be including the Visual Studio InitializeComponent
method in your code. The method that handles the Init event
does not have access to the controls because they are available only after the
page is initialized. If you write the code in the method that handles the PreRender
event, any changes to the control’s properties do not have a visible effect
because the page is already ready to be rendered.
8. You write the following code in your Web page:
protected void Page_Load
(object sender, EventArgs e)
{
/* additional code here */
}
You expect this code to be executed in response to the Load
event of the ASP.NET page. However, when you request the page, you notice that
the method is not executed. What should you do to make sure that the Page_Load
method is executed when the Load event of the Web page is fired?
a) Set the AutoEventWireup attribute of the @Page
directive to true.
b) Set the AutoEventWireup attribute of the @Page
directive to false.
c) Set the IsCallBack property of the Page class
to true.
d) Set the IsPostBack property of the Page
class to true.
Answer: a
Difficulty: Medium
Section Reference: Understanding ASP.NET Page Life Cycle and
Event Model
When the AutoEventWireup attribute of the @Page
directive is set to true, specially named methods such as Page_Load are
automatically wired up with their corresponding events. When the AutoEventWireup
attribute of the @Page directive is set to false, the Page_Load
method is not associated with the Load event of the Page class. The
IsCallBack
property of the Page class indicates whether the page request is the
result of a callback. The IsPostBack property of the Page
class indicates whether the page request is the result of a post-back operation.
9. You need to display specific messages to the users when
their browser is not running JavaScript. Which of the following code segment
should you use?
a) <script runat="server"> …
</script>
b) <script> ... </script>
c) <% … %>
d) <noscript> ... </noscript>
Answer: d
Difficulty: Medium
Section Reference: Understanding Web Page Development
Use <noscript> element to display a
specific message to users when their browser is not running JavaScript. The <script>
tag is ignored when JavaScript is not enabled. The <% ... %>
and <script
runat="server"> … </script> tags are used only
for server-side programming.
10. You are developing an ASP.NET application using C#. On
your Web page, you want to display the results returned by a C# method named GetShipmentStatus
when the page is rendered to the client. Which of the following code segments
should you use to call the GetShipmentStatus method?
a) <script
language="c#" runat="server">
Response.Write(GetShipmentStatus());
</script>
b) <script
language="c#" runat="client">
Response.Write(GetShipmentStatus());
</script>
c) <script
language="c#">
Response.Write(GetShipmentStatus());
</script>
d) <%=
GetShipmentStatus() %>
Answer: d
Difficulty: Medium
Section Reference: Understanding Client-Side vs. Server-Side
Programming
The <%= ... %> construct is used to
display values from ASP.NET code, such as a method call. Using the <script>
tag is incorrect because this tag is used for defining class-level methods,
properties, and variables.
11. You are developing an ASP.NET application using C#. You
create a code-behind class named Status that contains the business
logic. This class is under the namespace Northwind and is stored in a file
named status.aspx.cs. You need write the user interface code that uses this
class. Which of the following code segments should you use?
a) <% Page
Language="c#" Codebehind="status.aspx.cs"
ClassName="Northwind.Status" %>
b) <% Page
Language="c#" Codebehind="status.aspx.cs" Inherits="Northwind.Status"
%>
c) <% Page
Language="c#" Src="status.aspx.cs" Inherits="Northwind.Status"
%>
d) <% Page
Language="c#" Src="status.aspx.cs"
ClassName="Northwind.Status" %>
Answer: c
Difficulty: Medium
Section Reference: Understanding ASP.NET Application
Development
The Inherits attribute in the @Page
directive specifies a fully qualified name of the code-behind class from which
the code should inherit. The Src attribute specifies the name of
the source code file. The Codebehind attribute is used only by
Visual Studio and is not used at runtime. The Classname
attribute does not link ASP.Net pages with the code-behind class or file.
12. You are developing a restaurant locator Web site in
ASP.NET and C#. As users browse through the Web site, each of the Web pages
must display a list of the recently viewed restaurant in the lower left corner.
You want this information to be available across Web pages and browser restarts
but do not want to use server-side resources to accomplish this. Which of the
following state management techniques will help you accomplish this requirement
with minimum effort?
a) hidden fields
b) view state
c) cookies
d) sessions
Answer: c
Difficulty: Medium
Section Reference: Understanding State Management
Use cookies because they allow you to store a small amount
of information on the user’s computer. Hidden fields, view state, and sessions
are not correct because these options cannot store information across browser
restarts.
13. You are developing an order-entry application that will
be used by all employees in your company. You use ASP.NET to develop this
application and deploy it on the company’s Internet Information Services (IIS) server.
What should you install on the users’ computers before they can access the
order-entry application?
a) .NET Framework redistributable
b) .NET Framework Software Development Kit (SDK)
c) Visual Studio Express Edition
d) Web browser
Answer: d
Difficulty: Easy
Section Reference: Understanding Web Page Development
You need to deploy only a Web browser to access the
application. A .NET Framework redistributable is required only when code is
executed on the client side, such as in a Windows Forms or a Windows
Presentation Foundation (WPF) application. .NET Framework SDK and Visual Studio
Express Edition are needed only on the development workstation.
14. You create an ASP.NET Web Service that tracks the
shipment of orders. The Web service includes a class named StatusService,
which contains the following method:
public string GetStatus()
{
/* additional code here */
}
You note that you can instantiate the StatusService
class from a Web service client project, but the GetStatus
method is not available. What could be the problem?
a) Only properties can be part of the public interface of a
Web service.
b) You must mark the method with the WebService
attribute.
c) The methods of a Web service can return only object data.
d) You must mark the method with the WebMethod
attribute.
Answer: d
Difficulty: Easy
Section Reference: Understanding Web Service Development
Adding the WebMethod attribute to a public method
makes it callable from remote Web clients. Methods can be part of the public
interface of a Web service. The WebService attribute is applied only
to the Web service class. You already can instantiate the StatusService
class, so the WebService attribute is not a problem here. The methods
of a Web service can return any type of data.
15. You have created a new Web service that provides mapping
data. You are working in a Visual Studio environment and use C# as your
programming language. You need to test the Web service to ensure that it is
returning correct results. What is the easiest way to test your new Web service?
a) Copy and paste the Web service code into an ASP.NET Web
Application. Run the Web application to see the results.
b) Invoke the Web service from an ASP.NET client. Run the
Web application to see the results.
c) Run the Web services project from within Visual Studio
and use the test page that is displayed in the Web browser.
d) Have a large number of beta testers use the Web service
and check for incorrect results.
Answer: c
Difficulty: Easy
Section Reference: Understanding Web Service Development
The easiest way to test a Web service is to use the built-in
test page that you get when you run the Web service project within Visual
Studio. The other answers are incorrect because they require additional efforts
to test the Web service.
16. You are developing an ASP.NET application that calls a
Web service to retrieve earthquake predictions for a given geographical area. The
Web service performs complex, time-consuming calculations to generate the
predictions. It is hosted on a government Web server, where you have permission
only to invoke the Web service. The users of your Web application complain that
the user interface freezes when they attempt to retrieve the predictions. You
have full access to the Web server that hosts your ASP.NET application. Which
of the following approach should you use to resolve this issue?
a) Move the ASP.NET application to a faster computer.
b) Connect to the Web service over a faster Internet
connection.
c) Install additional memory on the Web server that hosts
the ASP.NET application.
d) Use asynchronous calls to invoke the Web service from
within your ASP.Net application
Answer: d
Difficulty: Medium
Section Reference: Understanding Web Service Development
An asynchronous call to the Web service returns control to
users without waiting for the complete execution of the Web service. This
approach of invoking Web services helps make the user interface responsive. Having
a faster computer or a computer with more memory does not solve the problem
because these upgrades to the client computer do not improve Web service
performance. Having a faster Internet connection also does not help because the
server will still take time to process and return the results.
17. You are developing an ASP.NET application that calls a
Web service to retrieve inventory information. You know the URL of the Web
service. You need to invoke the methods of this Web service within your Web
application. How can you generate the client-side proxy classes so that you can
use the Web methods?
a) Use the Web service discovery tool.
b) Copy the .ASMX file from the Web server to the ASP.NET
application project.
c) Copy the build output from the Web server to the ASP.NET
application project.
d) Set a Web reference to point to the Web service.
Answer: d
Difficulty: Medium
Section Reference: Understanding Web Service Development
Set the Web Reference to point to the Web Service. This
creates a client-side proxy class that you can use to invoke Web service
methods. The Web service discovery tool can locate the files related to a Web
service, but it does not generate any proxy classes. Copying files from the Web
server does not generate a client-side proxy.
18. You are invoking a Web service method that returns an ArrayList
object. The client application is written in C#, whereas the Web service is
written in Visual Basic. The Web service is outside your corporate firewall.
You receive an “object not found” error when you call the method that returns
the ArrayList
object but can call other methods successfully from the same Web service. What
could be the problem?
a) The client and the Web service are not written in the
same programming language.
b) The firewall is blocking all SOAP calls.
c) The client project does not contain a reference to the System.Collection
namespace.
d) The ArrayList class cannot be serialized.
Answer: c
Difficulty: Medium
Section Reference: Understanding Web Service Development
The client applications must contain a reference to the
objects that they are going to manipulate. So the client project must contain a
reference to the System.Collection namespace before it can use a Web
service method that returns ArrayList. The client and the server
code can be written in different languages. If the firewall is blocking SOAP
calls, you could not call any methods on the Web service. The ArrayList class
is marked with a Serializable attribute and can be serialized.
19. You are developing an ASP.NET application that uses a
Web service created by one of your large customers. This Web service provides
you with the Order object, which has several properties. The developer
of the Web service has informed you that a new property named Priority has
been added to the Order object. What should you do to be able to use the Priority
property in your code with minimum effort?
a) Create a new ASP.NET application and add a Web reference
to the Web service in the new application.
b) Delete and re-create the Web reference in the existing
ASP.NET application.
c) Update the Web reference in the existing ASP.NET
application.
d) Ask the developer of the Web service for the updated DLL
file of the Web service. Add a reference to the DLL in your ASP.NET project.
Answer: c
Difficulty: Medium
Section Reference: Understanding Web Service Development
You should be able to get the Priority
property available in your code just by updating the Web reference to the Web
service. Creating a new client application is not needed. Deleting and re-creating
the Web reference is essentially the same as updating but requires more effort.
You don’t need to ask for the DLL of the Web service because the code is not
executing locally but remotely on the Web server.
20. You develop a new ASP.NET inventory application on the
Northwind Web server. You deploy the files in the folder c:\WebInventory. The
application should be available via the URL www.northwind.com/inventory. The
URL www.northwind.com is already set up
to point to the Northwind Web server. What should you do to make your inventory
application available at the expected URL?
a) Change the name of the directory c:\WebInventory to
c:\Inventory.
b) Create a virtual directory named Inventory and point it
to c:\WebInventory.
c) Create a virtual directory named WebInventory and point
it to c:\Inventory.
d) Move the directory c:\WebInventory to the
c:\inetpub\wwwroot directory.
Answer: b
Difficulty: Medium
Section Reference: Understanding IIS Web Hosting
To have your application available at the expected URL, you
should create a virtual directory named Inventory and point it to
c:\WebInventory. Just changing the name of the physical directory does not map
it to the correct URL. If you name your virtual directory as WebInventory, the
application is available at www.northwind.com/WebInventory,
which is not what is expected. Moving the WebInventory directory to
c:\inetpub\wwwroot does not create a virtual directory by the name Inventory.
Really very good questions you post.Its very useful for every technical candidate.
ReplyDeletejava script certification
Thankew for your Feedback
DeleteHiện nay, nhu cầu người tiêu dùng mua hàng trên amazon cao. Hôm nay chúng tôi xin chia sẽ Kinh nghiệm mua hàng trên Amazon để bạn có thể mua hàng trên amazon một cách đơn giản và nhanh nhất. Có nhiều bạn đọc thắc mắc rằng: Mua hàng trên amazon có uy tín không hãy cùng tham khảo bài viết để tìm ra cho mình câu trả lời chính xác nhất nhé.
ReplyDeleteNếu sử dụng chăn điện một cách nguyên tắc như đã kể trên thì đây là một sản phẩm tuyệt đối an toàn khi sử dụng do thiết kế với một lớp ruột cách điện, chống cháy dùng chăn điện có an toàn không. Ngày cưới là một ngày trọng đại của các cặp đôi, và chăn ga gối đệm cho ngày cưới là một trong những vật dụng không thể thiếu. Vậy mua chăn ga gối đệm cho phòng cưới ở đâu giá rẻ và đẹp nhất, thích hợp nhất cho ngày cưới. Chúng tôi chuyên cung cấp mua chăn ga gối đệm ở đâu rẻ và đẹp nhất năm 2017 tại likado.
wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries. keep it up.
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery
Hello, I have browsed most of your posts. This post is where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject. Salt Lake City custom software development
ReplyDeleteAgile software development Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though.
ReplyDeleteReally I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. Agile software development
ReplyDeleteI admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. Buy Fresh Sniff Stuff Inbox Mailer
ReplyDeleteUnicc shop forum facebook Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info.
ReplyDeleteThis blog is a great source of information which is very useful for me.
ReplyDeletegraphic design courses in tambaram
graphic design courses in Porur
graphic design courses in Chennai
Excellent Blog to read. You have shared a useful information. Thank you.
ReplyDeleteRanorex Test Automation Online Certification
Ranorex Test Automation Online Training
Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. Offshore development team
ReplyDeleteThank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. Offshore development services
ReplyDeleteWonderful Blog. Thanks for the information.
ReplyDeleteFull Stack Developer Course In Chennai
Full Stack Developer Training In Chennai
Thinking of starting your own website designer ? Here are some important factors to think about before you start Firstly, you need to decide how you want to build your site - do you want to do it yourself, or hire a web designer.
ReplyDeleteI have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! best server
ReplyDeleteI have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! linkedin automation tool
ReplyDeleteI’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... social automation tool
ReplyDeleteI have really enjoyed reading your blog posts.Thank you for sharing this amazing information with us Custom Software Development near me
ReplyDeleteI have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! windows 10 betriebssystem kaufen
ReplyDeleteThank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. knowledge management system
ReplyDeletePositive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. windows 11 home
ReplyDeleteThanks:It is very so much valuable content. I hope these Commenting lists will help to my website power apps development
ReplyDeleteVisit CMOLDS Dubai one of the leading web developers in Dubai company offering web design and development services across the globe.
ReplyDeleteNice Post….!!!! Greps Ai specializes in transforming businesses with cutting-edge technology solutions. Leveraging expertise in Digital Marketing, Chatbot Development, API Development, and Software Development Designing, Greps Ai empowers companies to achieve exponential growth. By integrating AI-driven strategies and innovative software, Greps Ai for Business Growth ensures scalable solutions tailored to meet diverse business needs, fostering efficiency and competitive advantage in today's dynamic market landscape.
ReplyDeleteThis article provides excellent insights into web application development, especially for those keen on creating efficient web pages and applications. For businesses in Dubai, web development is crucial, and having skilled professionals on board ensures seamless user experiences. That's why hiring experienced Software Developers in Dubai can significantly enhance your website's performance, security, and functionality. Their expertise in handling HTML, JavaScript, and ASP.NET will ensure your web applications are built with the best practices in mind, providing high-quality, interactive user interfaces.
ReplyDelete