0

programming languages Online Quiz - 169

Description: programming languages Online Quiz - 169
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

You are the developer of a web application that is retrieving historical books information from a database server and displays it to the users of your application. What cache strategy will give you the best performance ?

  1. Use the output cache

  2. Use the cache object

  3. Use the ASP.NET central cache

  4. Use the client cache


Correct Option: A

AI Explanation

To answer this question, you need to understand the different cache strategies available in web development. Let's go through each option to understand why it is correct or incorrect:

Option A) Use the output cache - This option is correct because the output cache stores the generated output of a web page or user control, which can significantly improve performance by serving the cached content instead of re-executing the entire page or control. This strategy is especially useful for static or infrequently changing content.

Option B) Use the cache object - This option is incorrect. The cache object is used to store data in memory for a specific duration or until it is removed from the cache. While it can improve performance by reducing the need to retrieve data from a database or other external sources, it is not the best strategy for this scenario as it doesn't specifically address the retrieval of historical books information.

Option C) Use the ASP.NET central cache - This option is incorrect. The ASP.NET central cache, also known as the System.Web.Caching.Cache class, is a shared cache that can be accessed by multiple applications running on the same server. While it can provide some performance benefits by allowing multiple applications to share cached data, it is not the best strategy for this scenario as it doesn't specifically address the retrieval of historical books information.

Option D) Use the client cache - This option is incorrect. The client cache refers to storing data on the client-side, typically in the user's browser. While it can improve performance by reducing the need to retrieve data from the server, it is not the best strategy for this scenario as it doesn't specifically address the retrieval of historical books information.

The correct answer is A) Use the output cache. This option is correct because it specifically addresses the caching of generated output, which can greatly improve performance by serving the cached content instead of re-executing the entire page or control.

Which is not ture about Smartnavigation ?

  1. retain only the last page visited in the browser's history

  2. eliminate any flash caused by navigation

  3. Doesn't work with sites protected with SSL

  4. persist scroll position when moving from page to page


Correct Option: C

Which is true about ASP.net support ?

  1. ASP.NET doesn't support server-side includes

  2. ASP.NET doesn't support server-side includes but supports server-side object tags

  3. ASP.NET doesn't server-side object tags

  4. ASP.NET support server-side includes and server-side object tags


Correct Option: D

How to protect view state from tampering when it's passed over an unencrypted channel ?

  1. In Page directive set EnableViewStateMac="true"

  2. In Register directive set EnableViewStateMac="true"

  3. In web config set Protectviewstate="true"

  4. In IIS set Viewstate protection.


Correct Option: A

AI Explanation

To protect view state from tampering when it's passed over an unencrypted channel, you can set the "EnableViewStateMac" attribute to "true" in the Page directive.

Option A) In Page directive set EnableViewStateMac="true" - This option is correct because by setting the "EnableViewStateMac" attribute to "true" in the Page directive, it enables the use of a message authentication code (MAC) to verify the integrity of the view state. This helps protect against tampering.

Option B) In Register directive set EnableViewStateMac="true" - This option is incorrect. The "Register" directive is used to register custom controls, and it does not have an "EnableViewStateMac" attribute.

Option C) In web config set Protectviewstate="true" - This option is incorrect. The "ProtectViewState" attribute in the web.config file is used to enable or disable view state validation, which helps protect against tampering, but it does not specifically address passing view state over an unencrypted channel.

Option D) In IIS set ViewState protection - This option is incorrect. IIS (Internet Information Services) does not have a specific setting for protecting view state. View state protection is typically handled within the application code or configuration.

The correct answer is A) In Page directive set EnableViewStateMac="true". This option enables the use of a message authentication code (MAC) to protect the view state from tampering when passed over an unencrypted channel.

  1. The Paint() method

  2. The Control_Build() method

  3. The Render() method

  4. The default constructor


Correct Option: C

What is used to validate complex string patterns like an e-mail address ?

  1. Extended expressions

  2. Regular expressions

  3. Irregular expressions

  4. Basic expressions


Correct Option: B

What does ASP stand for ?

  1. All Standard Pages

  2. Active Server Pages

  3. A Server Page

  4. Active Standard Pages


Correct Option: B

What ASP.NET object is used to get information about the web servers ?

  1. The Server object

  2. The Application object

  3. The Request object

  4. The Response object


Correct Option: A

What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time ?

  1. Synchronize()

  2. Lock() and UnLock()

  3. Lock()

  4. Asynchroize()


Correct Option: B
  1. The event registration

  2. A protected class member for the control

  3. A default event handler for the click event

  4. A default class that inherits from the control’s base class


Correct Option: C

What attribute must be set on a validator control for the validation to work ?

  1. Validate

  2. ValidateControl

  3. ControlToBind

  4. ControlToValidate


Correct Option: D

AI Explanation

To answer this question, let's review each option:

Option A) Validate - This option is incorrect because there is no attribute called "Validate" for a validator control.

Option B) ValidateControl - This option is incorrect because there is no attribute called "ValidateControl" for a validator control.

Option C) ControlToBind - This option is incorrect because there is no attribute called "ControlToBind" for a validator control.

Option D) ControlToValidate - This option is correct because the "ControlToValidate" attribute must be set on a validator control for the validation to work. This attribute specifies the ID of the control that should be validated.

Therefore, the correct answer is option D) ControlToValidate.

Given an ASP.NET Web Form called WebForm1, what class does the WebForm1 class inherit from by default ?

  1. System.Web.Form

  2. System.Web.GUI.Page

  3. System.Web.UI.Page

  4. System.Web.UI.Form


Correct Option: C

AI Explanation

To answer this question, we need to understand the inheritance hierarchy of ASP.NET Web Forms.

In ASP.NET, a Web Form is represented by a class. By default, the WebForm1 class in ASP.NET inherits from the System.Web.UI.Page class.

Let's go through each option to understand why it is correct or incorrect:

Option A) System.Web.Form - This option is incorrect because there is no class called System.Web.Form in ASP.NET. The correct class is System.Web.UI.Page.

Option B) System.Web.GUI.Page - This option is incorrect because there is no namespace called System.Web.GUI in ASP.NET. The correct namespace is System.Web.UI.

Option C) System.Web.UI.Page - This option is correct because the WebForm1 class in ASP.NET inherits from the System.Web.UI.Page class by default. System.Web.UI.Page is the base class for all ASP.NET Web Forms.

Option D) System.Web.UI.Form - This option is incorrect because there is no class called System.Web.UI.Form in ASP.NET. The correct class is System.Web.UI.Page.

The correct answer is Option C) System.Web.UI.Page. This option is correct because the WebForm1 class in ASP.NET inherits from the System.Web.UI.Page class by default.

Can two different .net programming languages be mixed in a single ASPX file ?

  1. Yes

  2. No

  3. May be

  4. None of the above


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of programming languages in the .NET framework.

In a single ASPX file, you can only use one .NET programming language. This is because the .NET framework is designed to compile code written in a specific programming language. Mixing different .NET programming languages in a single ASPX file would result in a compilation error.

Option A) Yes - This option is incorrect because you cannot mix different .NET programming languages in a single ASPX file. Option B) No - This option is correct because you cannot mix different .NET programming languages in a single ASPX file. Option C) May be - This option is incorrect because mixing different .NET programming languages in a single ASPX file is not possible. Option D) None of the above - This option is incorrect because Option B is the correct answer.

The correct answer is B) No. This option is correct because you cannot mix different .NET programming languages in a single ASPX file.

A simple macro to double a number was written as follows #define double(X) X*X #include using namespace std; int main() { std::cout<

  1. 12

  2. 15

  3. 10

  4. 9

  5. Compilation error

  6. 24


Correct Option: B
  1. Sure , Why not?

  2. No This will not compile , Since the header file stdio.h is not included

  3. The code will compile but will fail to link.

  4. I dont Know :)


Correct Option: A

which of the following are true about static variables in C?

  1. Static variables are global variables

  2. static variales have local to the file/Scope they are declared , but exist throught the program life time

  3. static variables are scoped, Meanaing that they will be destroyed once out of scope

  4. Oh come on , Static variales are only in Java , Do not exist in C

  5. static variales have local to the file they are declared , and they will be destroyed once out of scope


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Static variables are global variables - This option is incorrect. Static variables can be declared both globally and locally within a function or block.

Option B) Static variables have local scope to the file/scope they are declared, but exist throughout the program lifetime - This option is correct. When a variable is declared as static, it retains its value between function or block calls. It has local scope to the file or function it is declared in, meaning it can only be accessed within that file or function. However, its lifetime extends throughout the entire program execution.

Option C) Static variables are scoped, meaning that they will be destroyed once out of scope - This option is incorrect. Static variables are not destroyed once out of scope like automatic variables. They retain their value until the program terminates.

Option D) Oh come on, static variables are only in Java. They do not exist in C - This option is incorrect. Static variables also exist in C and function in a similar way to Java.

Option E) Static variables have local scope to the file they are declared, and they will be destroyed once out of scope - This option is incorrect. As mentioned earlier, static variables are not destroyed once out of scope. They persist throughout the program execution.

The correct answer is B) Static variables have local scope to the file/scope they are declared, but exist throughout the program lifetime. This option is correct because static variables retain their value across function or block calls and have local scope to the file or function they are declared in.

A variable i of type int is stored in memory location 0x22ff74. Now assuming that I have a pointer to i , What does the following C/C++ code produce as output.(assume standard sizes) int main() { int i=20; int *ptr=&i; ptr=ptr-1; cout<

  1. 0x22ff74

  2. 0x22ff70

  3. 0x22ff73

  4. Compiler error

  5. 19


Correct Option: B
- Hide questions