Skip to main content

ASP.NET Questions

Why are you more likely to use HtmlControls rather than WebControls when migrating from ASP?
Choice 1
ASP pages are made from HTML elements, not controls, which map to the HtmlControls better.
Choice 2
HtmlControls involve less development effort.
Choice 3
HtmlControls have the same syntax as ASP HtmlControls.
Choice 4
HtmlControls can be used to transfer ASP session state.
Choice 5
ASP also uses HtmlControls.

In a Web application, how many security-related events does the global.asax file provide?
Choice 1
1
Choice 2
2
Choice 3
3
Choice 4
4
Choice 5
More than 4

Why does the Page object have an IsPostback property?
Choice 1
It is used to know that control events need to be thrown.
Choice 2
It is used in the Application_BeginRequest event to decide whether to authenticate a user.
Choice 3
It is used so that the Page can determine whether to load Viewstate.
Choice 4
It is used to determine whether to throw the Page_PostBack event.
Choice 5
It is used so that the controls can be loaded with their initial state when the page is first loaded.
ASP.NET Fundamentals, Question 10 of 40

A relationship between two DataTables within a DataSet is represented by which one of the following?
Choice 1
ForeignKey object
Choice 2
DataColumn object
Choice 3
DataTable object
Choice 4
PrimaryKey object
Choice 5
DataRelation object

Which one of the following do you use to add a new cookie to store a 'LastVisit' date with the current time?
Choice 1
Response.Cookies.Add( new HttpCookie("LastVisit", DateTime.Now.ToString()) );
Choice 2
Response.Cookies.Add( new Cookie("LastVisit", DateTime.Now.ToString()) );
Choice 3
Response.Add( new Cookie("LastVisit", DateTime.Now.ToString()) );
Choice 4
Response.Cookies.Add( new HttpCookie("LastVisit", DateTime.Now) );
Choice 5
Response.Add( new HttpCookie("LastVisit", DateTime.Now.ToString()) );


Assuming viewstate is enabled, what is wrong with the above code?
Choice 1
You need to check IsPostBack and bind the data only once.
Choice 2
The OnClick event fires before the Page_Load event.
Choice 3
The OnClick event does not fire until after the code is rendered.
Choice 4
The OnClick event will NEVER fire.
Choice 5
You cannot bind data in the Page_Load event.


Which object do you use as a means of reading a forward-only stream of rows when connecting to SQL Server 2000 database?
Choice 1
SqlServerDataAdapter
Choice 2
OleDbDataReader
Choice 3
SqlDataAdapter

Choice 4
OleDbDataAdapter
Choice 5
SqlDataReader


What line in the above control needs to be added for Wednesday to be selected by default?
Choice 1

Choice 2

Choice 3

Choice 4

Choice 5




Which server setting must be set in order to be able to store objects outside of a page in an application?
Choice 1
Enable application storage
Choice 2
Enable variable storage
Choice 3
Enable server-side variables
Choice 4
Enable session state
Choice 5
Enable Web forms



Under which one of the following situations is using a class inheriting from System.IO.Stream NOT appropriate?
Choice 1
Sending information across a network
Choice 2
Manipulating an XML DOM
Choice 3
Saving a file to disk
Choice 4
Loading a file from disk
Choice 5
Implementing a pipe
ASP.NET Fundamentals



Sample Code

For the code referenced above to work correctly in your application, in which one of the following directories does the compiled DLL from the file MyPage.aspx.cs need to be?
Choice 1
The same directory as the .aspx file calling it
Choice 2
The Web root for the application
Choice 3
/bin directory of the application
Choice 4
The Web root for the site
Choice 5
The directory named support

Comments

Popular posts from this blog

Using of global variables in C# - Drawbacks & Solutions

How using global variables can have implications on the design, maintainability, and test-ability of C# code: Harder to understand and reason about the code:       class Program     {         public static int globalCounter = 0;         static void Main()         {             globalCounter++;             Console.WriteLine(globalCounter);         }     }   In this example, the global variable globalCounter is accessible from anywhere in the program, including the Main method. It's not clear where the value of the globalCounter is updated, it could be updated in other methods or classes, making it harder to trace the flow of data and understand the source of bugs.   More prone to errors:       class Program     {         public static string globalString;         static void Main()         {             globalString = "Hello" ;             Method1();             Method2();         }         static void Method1()         {

Task Parallel Library (TPL) and Akka.NET Alternatives

Task Parallel Library (TPL) and Akka.NET are among the most commonly used libraries for parallel and concurrent programming in the .NET ecosystem. However, there are also several other options available, depending on your specific needs: Parallel Language Integrated Query (PLINQ) is a parallel programming feature of .NET that provides an easy and efficient way to perform operations on collections in parallel. LINQ (Language Integrated Query) is a powerful feature in .NET that allows developers to work with data in a more declarative and language-integrated manner. While LINQ queries are inherently sequential, PLINQ extends LINQ by providing parallel versions of the query operators, allowing some queries to execute faster by utilizing multiple processors or cores on a machine. PLINQ is great when you are working with large collections where operations might be CPU-intensive or I/O-bound and could potentially be sped up by parallel execution. Here is a simple example of a PLI

SOLID Principles with Real World examples in C#

  SOLID Principles with Real World examples in C#   SOLID principles are formed by using S Single Responsibility Principles (SRP) O Open Closed Principle (OCP) L Liskov’s Substitution Principle (LCP) I Interface Segregation Principle (ISP) D Dependency Inversion Principle (DIP)   S Single Responsibility Principles (SRP) There should never be more than one reason for a class to change, to be precise one class should have only one responsibility Single Responsibility Principles (SRP) Real world example, A perfect match for SRP is Microservices , a Microservice will not contain functionalities other than the one it is designated to do,  Example ·                   Order Processing Service, ·                   Shipment Management Service, ·                   User Authentication Service, ·                   Catalogue List Service       class OrderProcessor     {         public void Process(Order order)         {             // Check inven