Tag: programming languages

Questions Related to programming languages

  1. a. An abstract class may only contain incomplete methods (abstract methods)

  2. b. An interface may contain complete or incomplete methods

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

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


Correct Option: C
  1. a. Access is limited to the current assembly

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

  3. c. Access is limited to the containing type

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


Correct Option: D
Explanation:

To understand who can access a method marked as protected internal, the user needs to know about access modifiers in C#.

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

A. Access is limited to the current assembly: This option is partially correct. When a method is marked as internal, it can only be accessed within the same assembly. However, when a method is marked as protected internal, it can be accessed by derived types from any assembly as well as within the same assembly. Therefore, option A is incorrect.

B. Access is limited to the containing class or types derived from the containing class: This option is incorrect. When a method is marked as protected, it can be accessed by the containing class or types derived from the containing class. However, when a method is marked as protected internal, it can be accessed by derived types from any assembly as well as within the same assembly. Therefore, option B is incorrect.

C. Access is limited to the containing type: This option is incorrect. protected internal access modifier provides more accessibility than protected access modifier. When a method is marked as protected, it can be accessed by the containing class or types derived from the containing class. However, when a method is marked as protected internal, it can be accessed by derived types from any assembly as well as within the same assembly. Therefore, option C is incorrect.

D. Access is limited to the current assembly or types derived from the containing class: This option is correct. When a method is marked as protected internal, it can be accessed by derived types from any assembly as well as within the same assembly. Therefore, option D is the correct answer.

The Answer is: D

  1. a. true

  2. b. false

  3. c. an exception is thrown

  4. d. depends


Correct Option: C
  1. a. yes,all access specifiers are valid for namespace members

  2. b. No,only private access specifiers are possible

  3. c. No,implicitly all members are protected

  4. d. No,the namespace allows only public and internal elements as its members


Correct Option: D
  1. a. Yes

  2. b. No

  3. c. Under certain conditions

  4. d. May be


Correct Option: B
  1. a. readonly value can be changed later

  2. b. const items are dealt at compile time however readonly is dealt at runtime

  3. c. const value can be changed later

  4. d. const items are dealt at runtime however readonly is dealt at compile time


Correct Option: B

A variable declared inside a method is called

  1. a. local variable

  2. b. global variable

  3. c. static variable

  4. d. private variable


Correct Option: A

In programming languages, which language's version name is also known as "Scorpio" ?

  1. JAVA

  2. C

  3. ColdFusion

  4. HTML 5


Correct Option: C
  1. a, b

  2. b, c

  3. a, d

  4. a, e


Correct Option: D
Explanation:

To solve this question, the user needs to know about abstract classes and abstract methods in Java.

An abstract class is a class that cannot be instantiated on its own and is often used as a template for other classes. Abstract methods are methods that are declared but have no implementation in the abstract class.

Option a declares an abstract class Digit with an abstract method print(). This is a valid declaration of an abstract class.

Option b declares a class Digit with an abstract method print(). This is not a valid declaration because a non-abstract class cannot have an abstract method.

Option c declares an abstract class Digit with an abstract method print() that has an empty implementation. This is not valid because an abstract method cannot have an implementation in the abstract class.

Option d declares an abstract class Digit with a non-abstract method print(). This is not valid because an abstract class must have at least one abstract method.

Option e declares a non-abstract class Digit with a non-abstract method print(). This is a valid declaration of a non-abstract class.

Therefore, the correct answer is:

The Answer is: D