0

Programming with .NET Introduction

Description: This test is useful for GATE and CS students. This test has many useful questions related to Dot Net framework concepts
Number of Questions: 15
Created by:
Tags: Dot Net GATE CS Programming
Attempted 0/15 Correct 0 Score 0

Which of the following is not applicable in INamingContainer interface?

  1. It provides data binding.

  2. It is used to route events to its child controls.

  3. INamingContainer interface is used to create controls in the specified condition.

  4. It provides the data management.

  5. It provides the data control in a specific format.


Correct Option: D
Explanation:

Naming interface does not provide any data management.

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;
 }
}
  1. 3

  2. 4

  3. 5

  4. Compilation error

  5. It will compile, but there will be no output.


Correct Option: B
Explanation:

This is correct output, as the variable 'a' will be incremented due to reference of variable 'i'.

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;
 }
}
  1. 3

  2. 4

  3. 0

  4. Will not compile due to uninitialization

  5. Will not compile due to error in out keyword syntax


Correct Option: B
Explanation:

This is correct as out keyword takes the reference of variableĀ i in the method.

What is the significance of Load method in ASP.NET controls?

  1. It causes a server control to perform final clean up.

  2. It checks the accessibility of the object.

  3. It is used to search a container for a specified control.

  4. This method is fired when the control is loaded in the page.

  5. This method is loaded when the data is retrieved.


Correct Option: D
Explanation:

It is the task of Load method.

Which of the following is not applicable for IPostBackEventHandler interface in web controls?

  1. This interface is used to transfer the events that are generated from the client side to the server.

  2. It is used to update its state or raise events on the server after examining the postback data.

  3. IPostBackEventHandler interface can transfer the postback events.

  4. This interface can control the postback event.

  5. This interface controls the procedures.


Correct Option: E
Explanation:

It does not control 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();
   }
}
  1. 10.5

  2. 3.52

  3. 0

  4. It will not compile.

  5. Null


Correct Option: D
Explanation:

It will not compile as it cannot implicitly convert the double values into long data type.

How does 'page rendering' work in ASP.NET page life cycle?

  1. The control properties are set using the view state and control state values.

  2. The request is postback and the related event handler is called.

  3. The view state for the page and all the controls are saved.

  4. The view state for the page and all the controls are deleted.

  5. This is the stage, in which all the page events are synchronised.


Correct Option: C
Explanation:

This is page rendering and the page calls the Render method for each control and the output of rendering is written to the OutputStream class of the Page's Response property.

How does the 'page initialisation' stage' work in ASP.NET page life cycle?

  1. At this stage, the control properties are set using the view state and control state values.

  2. The controls are set by assigning a unique ID.

  3. The rendered page is send to the client.

  4. At this stage, the view controls and pages are saved.

  5. It controls the execution state.


Correct Option: B
Explanation:

During page initialization stage, the controls are set with a unique identifier.

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();
 }
}
  1. 10

  2. 20

  3. 30

  4. 0

  5. Compilation error


Correct Option: B
Explanation:

This is the correct output.

Which of the following is incorrect about the components in the .NET framework?

  1. CLR, .NET framework class library and windows forms are the components of .NET framework 3.5.

  2. Windows Presentation Foundation and Windows Communication Foundation (WCF) are not included in the components of .NET framework.

  3. The CLS (Common Language Specification) component provides the language integration.

  4. CTS provides data types based on the specification.

  5. These components include base class libraries too.


Correct Option: B
Explanation:

These are also included in the .NET 3.5.

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();
 }
}
  1. 2 2

  2. 2 4

  3. 4 4

  4. Null

  5. It will not compile.


Correct Option: A
Explanation:

The method in the class Demo1 will be called twice, as new keyword is used for method hiding of the child class.

What is the role of Windows CardSpace in .NET framework 3.5?

  1. This component provides safety of accessing resources and sharing personal information on the internet.

  2. It is used for data querying capabilities to .Net languages using a syntax which is similar to the tradition query language SQL.

  3. It determines the separation between the user interface and the business logic.

  4. This component is responsible for the storage of data.

  5. It is responsible for the data retrieval.


Correct Option: A
Explanation:

Windows CardSpace provides the resource utilization and sharing of the information.

Which of the following is the incorrect statement about ASP.NET server controls?

  1. Data source controls provide data binding to different data sources.

  2. ASP.NET provides graphical user controls.

  3. Master pages come under the category of server controls.

  4. There are no custom controls present in ASP.NET server controls.

  5. These controls have user interface modules.


Correct Option: D
Explanation:

This is false as the custom controls are there in the ASP.NET server controls.

Which of the following is incorrect about the CLR (Common Language Runtime) in .NET framework?

  1. CLR includes the CTS (Common Type System).

  2. CLR is responsible for memory management.

  3. CLR is the base layer in .NET framework.

  4. CLR provides the monitoring of the complete life cycle of the object.

  5. CLR executes the .dll file.


Correct Option: E
Explanation:

CLR does not execute this 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);
 }
}
  1. Compilation error due to invalid cast of Object to String.

  2. Compilation error due to invalid cast of String to Object.

  3. Welcome

  4. Null

  5. Exception is possible.


Correct Option: C
Explanation:

Correct output as it is a valid conversion for Object class.

- Hide questions