0

programming languages Online Quiz - 90

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

If method is marked as protected internal who can access it?

  1. Access is limited to current assembly

  2. Access is limited to the containing class or types derived from containing class

  3. Access is limited to the containing type

  4. Access is limited to current assembly or types derived from the containing class.


Correct Option: D

How can you sort the elements of the array in descending order

  1. By calling ReverseSort()

  2. By calling SortReverse()

  3. By calling Descend()

  4. By calling Sort() and then Reverse() method


Correct Option: D

Which of following statement correctly declares a 2 dimensional array in c#.

  1. int[,] myarray

  2. int[][] myarray

  3. int[2] myarray

  4. none of above


Correct Option: B

Give some examples of generic classes.

  1. List ,HashSet

  2. Queue

  3. Stack

  4. LinkedList

  5. All of Above


Correct Option: E

What is default access modifier for top level class , which are not nested in other classes

  1. Public

  2. Private

  3. Protected

  4. Internal


Correct Option: D

What is difference between interface and abstract class

  1. An abstract class may only contain on complete method

  2. An interface may contain complete or incomplete method

  3. A class may inherit several interfaces , A class may inherit only one abstract class.

  4. A class implementation an abstract class has to implement all methods of abstract class , but same is not required in case of an interface.

  5. All


Correct Option: C

Does this code compile? Public interface MyInterface { string MyProp { get; } }

  1. Yes

  2. No, because the interface name does not start with 'I'

  3. No, because MyProp is not declared as public

  4. No, because interfaces can't contain property declaration


Correct Option: A

The default type of enum is integer and has default value 1

  1. True

  2. False


Correct Option: B

What is the last stage of the webforms cycle?

  1. Event Handling

  2. Page_Load

  3. Validate

  4. Page_Unload


Correct Option: D

What is the size for double data type in c#

  1. 1 Byte

  2. 2 Byte

  3. 4 Byte

  4. 8 Byte

  5. 16 Byte


Correct Option: D

If method is marked as protected internal who can access it?

  1. Access is limited to current assembly

  2. Access is limited to the containing class or types derived from containing class

  3. Access is limited to the containing type

  4. Access is limited to current assembly or types derived from the containing class.


Correct Option: D

AI Explanation

To answer this question, we need to understand the accessibility levels in C#.

In C#, the protected internal access modifier is a combination of two other access modifiers: protected and internal.

The protected access modifier allows access to members within the same class or within derived classes. It provides access to the member from any code that is derived from the containing class, regardless of the assembly in which the derived class is located.

The internal access modifier allows access to members within the same assembly. It provides access to the member from any code within the same assembly, but not from code in other assemblies.

When a method is marked as protected internal, it means that the method can be accessed from any code that is derived from the containing class, regardless of the assembly in which the derived class is located, as well as from any code within the same assembly.

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

Option A) Access is limited to the current assembly - This option is incorrect because protected internal allows access not only within the current assembly but also from types derived from the containing class in any assembly.

Option B) Access is limited to the containing class or types derived from the containing class - This option is incorrect because protected internal allows access not only to the containing class and types derived from it, but also to types derived from the containing class in any assembly.

Option C) Access is limited to the containing type - This option is incorrect because protected internal allows access not only to the containing type but also to types derived from the containing class in any assembly.

Option D) Access is limited to the current assembly or types derived from the containing class - This option is correct because protected internal allows access to the method from any code within the same assembly, as well as from code in other assemblies if they are derived from the containing class.

Therefore, the correct answer is option D. Access is limited to the current assembly or types derived from the containing class.

How can you sort the elements of the array in descending order

  1. By calling ReverseSort()

  2. By calling SortReverse()

  3. By calling Descend()

  4. By calling Sort() and then Reverse() method


Correct Option: D

Which of following statement correctly declares a 2 dimensional array in c#.

  1. int[,] myarray

  2. int[][] myarray

  3. int[2] myarray

  4. none of above


Correct Option: B

Give some examples of generic classes.

  1. List ,HashSet

  2. Queue

  3. Stack

  4. LinkedList

  5. All of Above


Correct Option: E

What is default access modifier for top level class , which are not nested in other classes

  1. Public

  2. Private

  3. Protected

  4. Internal


Correct Option: D

What is difference between interface and abstract class

  1. An abstract class may only contain on complete method

  2. An interface may contain complete or incomplete method

  3. A class may inherit several interfaces , A class may inherit only one abstract class.

  4. A class implementation an abstract class has to implement all methods of abstract class , but same is not required in case of an interface.

  5. All


Correct Option: C

Does this code compile? Public interface MyInterface { string MyProp { get; } }

  1. Yes

  2. No, because the interface name does not start with 'I'

  3. No, because MyProp is not declared as public

  4. No, because interfaces can't contain property declaration


Correct Option: A

AI Explanation

To answer this question, we need to analyze the given code and understand the rules and requirements for interface declaration in C#.

The given code is:

public interface MyInterface {
    string MyProp { get; }
}

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

Option A) Yes - This option is correct because the code will compile successfully. The code declares a public interface named MyInterface with a single property MyProp of type string. The property is declared using the shorthand syntax for read-only properties in C#, which is allowed in interfaces.

Option B) No, because the interface name does not start with 'I' - This option is incorrect. While it is a recommended convention to start interface names with the letter 'I', it is not a requirement for the code to compile. The code will compile regardless of whether the interface name starts with 'I' or not.

Option C) No, because MyProp is not declared as public - This option is incorrect. In an interface, all members (including properties) are implicitly public. Therefore, there is no need to explicitly specify the access modifier public for the property MyProp in the interface declaration.

Option D) No, because interfaces can't contain property declaration - This option is incorrect. Interfaces in C# can contain property declarations. The property MyProp in the given code is a valid property declaration in an interface.

Based on the analysis above, the correct answer is Option A. The code will compile successfully.

How does asp.net store session IDs by default?

  1. In Cache

  2. Cookies

  3. In Global variable

  4. URL Strings


Correct Option: B

Whst is the name given to the type of assembly that contains localized resources

  1. Spoke

  2. Hub

  3. Sputnik

  4. Satellite


Correct Option: D

AI Explanation

To answer this question, you need to understand the concept of assemblies and localized resources.

An assembly is a unit of deployment in .NET that contains compiled code, resources, and metadata. It can be a DLL or an executable file. Assemblies can include localized resources, which are specific to a particular language or culture.

In the given question, the name given to the type of assembly that contains localized resources is:

D) Satellite

Option D is the correct answer because a satellite assembly in .NET is an assembly that contains localized resources. These resources can include translated strings, images, sounds, or any other resource that is specific to a particular language or culture. Satellite assemblies are used to provide localized versions of an application or component without having to modify the main assembly.

Options A, B, and C are incorrect because they do not specifically refer to the type of assembly that contains localized resources in .NET.

Web security is very important by default on any website. By default, a .net website is configuesd with which type of authentication?

  1. Anonymous

  2. Basic

  3. Integreted windows authentication

  4. 1 & 3


Correct Option: D
- Hide questions