.NET Framework and ASP.NET Fundamentals
Test your knowledge of .NET framework concepts including C# programming fundamentals, ASP.NET web controls and page lifecycle, CLR (Common Language Runtime), and .NET framework 3.5 components. Ideal for GATE and CS students.
Questions
Which of the following is not applicable in INamingContainer interface?
- It provides data binding.
- It is used to route events to its child controls.
- INamingContainer interface is used to create controls in the specified condition.
- It provides the data management.
- It provides the data control in a specific format.
What will be the output of the following code?
class Demo {
static void Main(string[] args) {
int a = 3;
Site(ref a);
Console.WriteLine(The value of variable is + a);
}
public static void Site(ref int i) {
++i;
}
}
- 3
- 4
- 5
- Compilation error
- It will compile, but there will be no output.
Identify the output of the code:
class Site {
static void Main(string[] args) {
int a;
Site(out a);
Console.WriteLine("The value of variable is" + a);
}
public static void Site(out int i) {
i = 4;
}
}
- 3
- 4
- 0
- Will not compile due to uninitialization
- Will not compile due to error in out keyword syntax
What is the significance of Load method in ASP.NET controls?
- It causes a server control to perform final clean up.
- It checks the accessibility of the object.
- It is used to search a container for a specified control.
- This method is fired when the control is loaded in the page.
- This method is loaded when the data is retrieved.
Which of the following is not applicable for IPostBackEventHandler interface in web controls?
- This interface is used to transfer the events that are generated from the client side to the server.
- It is used to update its state or raise events on the server after examining the postback data.
- IPostBackEventHandler interface can transfer the postback events.
- This interface can control the postback event.
- This interface controls the procedures.
Identify the output of the code given below:
using System;
class Program {
static void Main(string[] args) {
long[] numbers = {10.5, 3.52, 4.3456, 100.43, 3.4 };
Console.Write(numbers[1]);
Console.ReadLine();
}
}
- 10.5
- 3.52
- 0
- It will not compile.
- Null
How does 'page rendering' work in ASP.NET page life cycle?
- The control properties are set using the view state and control state values.
- The request is postback and the related event handler is called.
- The view state for the page and all the controls are saved.
- The view state for the page and all the controls are deleted.
- This is the stage, in which all the page events are synchronised.
How does the 'page initialisation' stage' work in ASP.NET page life cycle?
- At this stage, the control properties are set using the view state and control state values.
- The controls are set by assigning a unique ID.
- The rendered page is send to the client.
- At this stage, the view controls and pages are saved.
- It controls the execution state.
Predict the correct output of the code given below:
using System;
class Program {
static void Main(string[] args) {
Byte[] numbers = {
10,
20,
30,
40
};
Console.Write(numbers[1]);
Console.ReadLine();
}
}
- 10
- 20
- 30
- 0
- Compilation error
Which of the following is incorrect about the components in the .NET framework?
- CLR, .NET framework class library and windows forms are the components of .NET framework 3.5.
- Windows Presentation Foundation and Windows Communication Foundation (WCF) are not included in the components of .NET framework.
- The CLS (Common Language Specification) component provides the language integration.
- CTS provides data types based on the specification.
- These components include base class libraries too.
Identify the output of the code given below:
using System;
class Demo1 {
public void X() {
Console.WriteLine("2");
}
}
class Demo2: Demo1 {
public new void X() {
Console.WriteLine("4");
}
}
class Test {
static void Main(string[] args) {
Demo1 s = new Demo1();
s.X();
Demo1 a = new Demo2();
a.X();
}
}
- 2
2 - 2
4 - 4
4 - Null
- It will not compile.
What is the role of Windows CardSpace in .NET framework 3.5?
- This component provides safety of accessing resources and sharing personal information on the internet.
- It is used for data querying capabilities to .Net languages using a syntax which is similar to the tradition query language SQL.
- It determines the separation between the user interface and the business logic.
- This component is responsible for the storage of data.
- It is responsible for the data retrieval.
Which of the following is the incorrect statement about ASP.NET server controls?
- Data source controls provide data binding to different data sources.
- ASP.NET provides graphical user controls.
- Master pages come under the category of server controls.
- There are no custom controls present in ASP.NET server controls.
- These controls have user interface modules.
Which of the following is incorrect about the CLR (Common Language Runtime) in .NET framework?
- CLR includes the CTS (Common Type System).
- CLR is responsible for memory management.
- CLR is the base layer in .NET framework.
- CLR provides the monitoring of the complete life cycle of the object.
- CLR executes the .dll file.
Identify the correct output of the code given below:
using System;
class welcome {
static void Main(string[] args) {
String s = "Welcome";;
Object s3 = s.Clone();
Console.WriteLine( "" + s3);
}
}
- Compilation error due to invalid cast of Object to String.
- Compilation error due to invalid cast of String to Object.
- Welcome
- Null
- Exception is possible.