Tag: c sharp
Questions Related to c sharp
How can a child class constructor access parent class constructor?
-
using base keyword
-
using super keyword
-
creating object of parent within child
-
using this keyword
Find out the output for the code snippet given below:- int i=10; Console.WriteLine(i++);
-
10
-
11
-
12
-
9
A class which cannot be derived is
-
Sealed
-
Abstract
-
Private
-
Protected
What is the name given to an assembly that contains localized resources?
-
Spoke
-
Hub
-
Satellite
-
Sputnik
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
-
Overriding
-
Overloading
-
Shadowing
-
Method Hiding
-
Both c and d
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.
-
Static polymorphism
-
Dynamic polymorphism
-
Both static and dynamic polymorphism
-
Not a polymorphism
-
Serial
-
Local
-
Private
-
Static
Feature of a local variable
-
It can be used anywhere in the program
-
It must accept a class
-
It must be declared within a method
-
It represent a class object
AI Explanation
To answer this question, we need to understand the concept of a local variable in programming.
A local variable is a variable that is declared and used within a specific block of code, typically within a method or function. It is only accessible within the scope of that block of code and cannot be accessed from outside.
Let's go through each option to understand why it is correct or incorrect:
Option A) It can be used anywhere in the program - This option is incorrect because a local variable is limited to the scope in which it is declared. It cannot be used outside of that specific block of code.
Option B) It must accept a class - This option is incorrect because a local variable does not necessarily have to accept a class. It can store any data type, including primitive data types like integers or booleans.
Option C) It must be declared within a method - This option is correct. A local variable must be declared within a method or function. It is typically declared at the beginning of the method and is only accessible within that method.
Option D) It represents a class object - This option is incorrect. A local variable does not necessarily represent a class object. It can represent any data type, not just class objects.
The correct answer is Option C. A local variable must be declared within a method.
Which of the following jobs are NOT performed by Garbage Collector?
-
Freeing memory on the stack.
-
Avoiding memory leaks.
-
Freeing memory occupied by unreferenced objects.
-
Closing unclosed database collections.
-
Closing unclosed files.
AI Explanation
To answer this question, let's go through each option and determine whether it is performed by the Garbage Collector:
Option A) Freeing memory on the stack - This option is NOT performed by the Garbage Collector. The Garbage Collector is responsible for freeing memory occupied by objects on the heap, not on the stack.
Option B) Avoiding memory leaks - This option is performed by the Garbage Collector. The Garbage Collector identifies and collects memory that is no longer referenced, preventing memory leaks.
Option C) Freeing memory occupied by unreferenced objects - This option is performed by the Garbage Collector. The Garbage Collector identifies objects that are no longer referenced by the program and frees the memory occupied by those objects.
Option D) Closing unclosed database collections - This option is NOT performed by the Garbage Collector. Closing unclosed database collections is typically the responsibility of the programmer or the database management system, not the Garbage Collector.
Option E) Closing unclosed files - This option is NOT performed by the Garbage Collector. Closing unclosed files is typically the responsibility of the programmer or the operating system, not the Garbage Collector.
Therefore, the correct answer is A, D, and E. These options are not performed by the Garbage Collector.