C# ASP .Net Quiz

Description: C# ASP .Net Quiz
Number of Questions: 14
Created by:
Tags: .net asp c-sharp
Attempted 0/14 Correct 0 Score 0

Method overloading is

c #
  1. Static polymorphism

  2. Dynamic polymorphism

  3. Both static and dynamic polymorphism

  4. Not a polymorphism.


Correct Option: A
Explanation:

To answer this question, the user needs to have a basic understanding of polymorphism.

Method overloading is a feature in object-oriented programming where a class can have multiple methods with the same name but with different parameters. This allows the same method name to be used for different actions, making the code more readable and easier to use.

Now, let's go through each option and explain why it is right or wrong:

A. Static polymorphism: This option is correct. Method overloading is an example of static polymorphism because the method to be called is determined at compile-time based on the number, types, and order of parameters passed to the method.

B. Dynamic polymorphism: This option is incorrect. Dynamic polymorphism is when the method to be called is determined at runtime based on the object type. This is different from method overloading, which is an example of static polymorphism.

C. Both static and dynamic polymorphism: This option is incorrect. Method overloading is an example of static polymorphism only.

D. Not a polymorphism: This option is incorrect. Method overloading is a type of polymorphism, specifically static polymorphism.

Therefore, the correct answer is: A. Static polymorphism.

What namespace does a page belong in the .net framework class hierarchy?

  1. System.Web.Control

  2. System.Web.RootBuilder

  3. System.Web.UserControl

  4. system.Web.UI.Page


Correct Option: D

What is last stage of a web forms life cycle?

  1. Page Events

  2. Page_Load

  3. Page_Unload

  4. Page_Init


Correct Option: C

In which method can the final changes to the controls can be done before the page is rendered?

  1. Init

  2. Load

  3. Prerender

  4. Render


Correct Option: C

We can programmitically set theme for a web page in

  1. Init event

  2. PreInit event

  3. Load event

  4. Can be set only at design time.


Correct Option: B
Explanation:

To programmatically set a theme for a web page, the user needs to know the ASP.NET page life cycle events and how they are used to modify the page's behavior.

Now, let's go through each option and explain why it is right or wrong:

A. Init event: This event occurs when the page is initialized, and it is too early in the page life cycle to set the theme. This event is used to set the initial property values of controls on the page.

B. PreInit event: This event occurs after the page has been initialized but before it has been loaded, making it the ideal place to set the page theme programmatically. This means that option B is the correct answer.

C. Load event: This event occurs after the page has been loaded, which is too late to modify the page's theme. This event is used to perform any final initialization steps.

D. Can be set only at design time: This option is incorrect. While themes can be set at design time, they can also be set programmatically at run time using the PreInit event.

Therefore, the correct answer is:

The Answer is: B. PreInit event

  1. using base keyword

  2. using super keyword

  3. creating object of parent within child

  4. using this keyword


Correct Option: A

Find out the output for the code snippet given below:- int i=10; Console.WriteLine(i++);

  1. 10

  2. 11

  3. 12

  4. 9


Correct Option: A
  1. Sealed

  2. Abstract

  3. Private

  4. Protected


Correct Option: A

By default, session is stored as

  1. InProc

  2. in State Server

  3. in SQL Server

  4. None of the above


Correct Option: A
Explanation:

To answer this question, the user needs to know what session refers to in web development and the different ways in which session data can be stored.

In web development, session refers to a way of storing and maintaining user-specific data across multiple requests. This allows for a more personalized and customized user experience. Session data can be stored in different ways, including:

A. InProc: This option stores session data in memory on the web server. This is the default option in ASP.NET and is suitable for small-scale applications with a limited number of users. However, if the application is scaled up, this option may not be the best as it may lead to memory issues.

B. In State Server: This option stores session data in a separate process outside of the web server. This helps to reduce memory usage on the web server and allows for better scalability. However, it requires additional configuration and may impact performance.

C. In SQL Server: This option stores session data in a SQL Server database. This is a good option for large-scale applications with high traffic as it allows for better scalability and fault tolerance. However, it requires additional configuration and may impact performance.

D. None of the above: This option is incorrect as session data must be stored somewhere. If not in one of the above options, then it must be in a custom storage solution.

Therefore, the correct answer is:

The Answer is: A. InProc

What is the name given to an assembly that contains localized resources?

  1. Spoke

  2. Hub

  3. Satellite

  4. Sputnik


Correct Option: C
Explanation:

To answer this question, we need knowledge about the terminology used in computer programming or software development.

The correct answer is: C. Satellite

Explanation:

A satellite assembly is an assembly that contains localized resources such as strings, images, and other types of data specific to a particular culture or language. These assemblies are used in internationalization and localization of software applications to provide different language versions or regional variations of the application.

Option A: Spoke is not the correct answer. In the context of computer programming or software development, "spoke" is not a term used to describe an assembly that contains localized resources.

Option B: Hub is not the correct answer. In the context of computer programming or software development, "hub" is not a term used to describe an assembly that contains localized resources.

Option D: Sputnik is not the correct answer. In the context of computer programming or software development, "sputnik" is not a term used to describe an assembly that contains localized resources.

Therefore, the correct answer is C. Satellite.

We use the 'new' keyword in

  1. Overriding

  2. Overloading

  3. Shadowing

  4. Method Hiding

  5. Both c and d


Correct Option: E

AI Explanation

To answer this question, we need to understand the concepts of overriding, overloading, shadowing, and method hiding.

Overriding: Overriding is a concept in object-oriented programming where a subclass provides a specific implementation of a method that is already defined in its superclass. The 'new' keyword is not used in overriding.

Overloading: Overloading is a concept in object-oriented programming where multiple methods can have the same name but different parameters. The 'new' keyword is not used in overloading.

Shadowing: Shadowing is a concept in object-oriented programming where a variable or a method in a subclass has the same name as a variable or method in its superclass. The 'new' keyword can be used to explicitly indicate that the subclass is intentionally shadowing the superclass member.

Method Hiding: Method hiding is a concept in object-oriented programming where a subclass defines a static method with the same name as a static method in its superclass. The 'new' keyword can be used to explicitly indicate that the subclass is intentionally hiding the superclass method.

Based on the above explanations, we can conclude that the 'new' keyword is used in both shadowing and method hiding. Therefore, the correct answer is E) Both C and D.

Method Overriding is

  1. Static polymorphism

  2. Dynamic polymorphism

  3. Both static and dynamic polymorphism

  4. Not a polymorphism


Correct Option: B

Ternary operator is

  1. +=

  2. *=

  3. ?=

  4. ?:


Correct Option: D
- Hide questions