Q1.
What is an OOPS?
A1. Object oriented
is a type of methodology used for building software application. It consists of
classes, object and method.
Q2.
What is a Data Type?
A2. Data Type defines
the type of data that can be stored in a variable.
Q3.
What is a compiler?
A3. The compiler is
special programs that process the statement written in a particular programming
language and convert them into machine language.
Q4.
What is a Class?
A4. Class is a set of
object that shares a common structure and behavior.
Q5.
What is a Main () Function?
A5. Main () function
is the entry point of the application.
Q6.
What is an Object?
A6. An object is an
instance of a class. We can create object to access member variables and member
function of a class.
Q7.
What is a Variable?
A7. A variable is a
location in the memory that has a name and contains a value. The value would be
integer, decimal or character.
Q8.
Explain Types of Data Types?
A8.
Value
Type: - Value
type directly contains data. Ex. Char, int, float
Reference
Type: - The
reference type do not maintain data but they contain a reference to the
variable, which are stored in memory. Ex. string
Q9.
What is an Explicit Conversion?
A9. Converting one
data type to the other data type is called the explicit conversion.
Q10.
What is a Using Keyword?
A10. The using keyword
is used to include the namespaces in the program.
Q11.
What is the Comment Entry?
A11. Comment entry is
a message for a programmer that describes a class, a method or a statement. The
compiler does not execute a comment entry.
Q12.
What is a function?
A12. Function is a set
of statements that performance specific task in response to a message.
Q13.
What is a Loop?
A13. Loop structures are used to execute one or
more lines of code repetitively.
Q14.
What is an Abstraction?
A14. An abstraction is
process of reducing information content in an order to retain only the relevant
information for a particular purpose.
OR
An
abstraction involves extracting only the relevant information.
Q15.
What is an Encapsulation?
A15. An encapsulation
is a process of hiding all the details of an object that do not contribute to
its essential characteristics.
OR
An
encapsulation involves packaging one or more component together.
Q16.
What is an Access Specifier?
A16. An access
specifier defines the scope of class member.
Q17.
Explain Type of Access Specifiers?
A17.
Public - Access is not restricted.
Private - Access is limited to the containing
type.
Protected - Access is limited to the containing
class or types derived from the containing class.
Internal - Access is limited to the current
assembly.
Protected
Internal
- Access is limited to the
current assembly or types derived from the containing class.
Q18.
What is a Method?
A18. A method is a set
of one or more program statement, which can be executed by referring to the
method name.
Q19.
What is a Parameter?
A19. A parameter is
place holders in a program that accept a user define values whenever the
program is executed.
Q20.
What is a Static Variable?
A20. Static variable
are class variables it instantiated only once for a class at class load time.
Static variable is a variable whose single copy in memory is shared by all
objects. So any modification to the static variable will modify its value in
all objects. It value remains constant for the entire class. It variable
remains the same data throughout the execution of a program.
Q21.
What is a Static Function?
A21. Static function
is function which can access only static variables and we can invoke these methods
without an instance of class, only using class name.
Q22.
What is an Enumeration?
A22. An enumeration is
a value type data type, which contains its own value and cannot inherit or
cannot pass inheritance. Enumeration allows assigning symbolic names to
integral constant.
Q23.
What is an Array?
A23. An array is
collection of value of same data type. An array is reference type variable.
Ex.
string [] a = {"a","b","c"}; int [] b = {1, 2,
3};
Here
a and b are store in heap. "a","b","c" and 1,2,3
are store in stack.
Q24.
What is a Collection?
A24. Collections are
class used to store arbitrary object in an organized manner.
Collection
is a single object representing a group of object. The object in the collection
is called element.
Q25.
What is a Structure?
A25. A single variable
hold the related data of various data type is called atructure. It is a value type data type.
Q26.
What is boxing?
A26. The conversion of
value type to reference type variable is called boxing.
Q27.
What is Unboxing?
A27. Unboxing means
converting from reference type to value type is called unboxing.
Q28.
What is a constructor?
A28. Constructor is a
special type of method that is invoked when we create a new instance of class.
It is used to initialize the member of the class. The name of a constructor is
the same as the name of the class that contains it.
Q29.
Explain the type of Constructor?
A29.
Instance
constructors
An
instance constructor is called whenever an instance of a class is created.
These constructors are used to initialize data member of the class.
Static
Constructor
Static
constructors are used to initialize the static variable of a class. These variables
are created using the static keyword and they store values that can be shared
by all the instance of a class. These constructors have an implicit private
access. This constructors will be
invoked only once during the execution of a program.
Q30.
What is a Destructor?
A30. Destructors are
special methods that are used to release the instance of a class from memory. A
class can have only one destructor.
Q31.
What is Garbage Collection?
A31. Garbage
collection is a process that automatically frees the memory of object that is
no more in use. Garbage collection only unreferenced object are destroyed.
Q32.
What is a Polymorphism?
A32. The term
polymorphism was derived from the Greek words ‘poly’ and ‘morphos’, which mean
‘many’ and ‘forms’ respectively. Polymorphism can either be static or dynamic.
In static polymorphism the response to a function decided at compile time. In
dynamic polymorphism the response to the function decided at run time.
Static
Polymorphism
Function
Overloading
Operator
Overloading
Dynamic
Polymorphism
Abstract
classes
Virtual
function
Q33.
What is a Function Overloading?
A33. Function overloading
is a process of using same name for two or more functions.
Q34.
What is a Operator Overloading?
A34. Operator
overloading provides additional capabilities to C# operators when are applied
to user-defined data type.
Q35.
What is a Function Signature?
A35. Passing different
type of parameter, sequence of parameter, or number of parameters for a
function is called function signature. The return type is not a part of
function’s signature.
Q36.
What is a Function Overriding?
A36. The subclass
redefine the function of super class is called function overriding.
Q37.
What is a Unary Operator?
A37. Unary operators
are operators that act on a single operand. Ex. ++,--
Q38.
What is a Binary Operator?
A38. Binary operators
are operators that work with two operands. Ex. +=, -=, <, > etc.
Q39.
What is an Inheritance?
A39. An inheritance is
process of creating a new class by adding some features to an existing class is
known as inheritance.
Q40.
What is Base Class?
A40. The class from
which attributes are derived is called the base class.
Q41.
What is Derived Class?
A41. A class that
inherits or derives attributes from another class is called the derived class.
Q42.
What is an Abstract Class?
A42. An abstract class
contains one or more abstract methods and can have non abstract methods. It
cannot be initiated but they can be extended into sub classes. An abstract
class is useful when there is common functionality implement in a super class.
Rule:-
Cannot
create an instance of an abstract class.
Cannot
declare an abstract method outside an abstract class.
Cannot
be declared sealed.
Q43.
What is a Sealed Class?
A43. Sealed class is a
class which cannot be extended.
Q44.
What is a Sealed Method?
A44. In C# a method
can’t be declare sealed. However, when we override a method in derived class,
we can declare the overridden method as sealed. By declaring it as sealed, we
can avoid further overriding of this method.
Q45.
What is an Interface?
A45. An interface
defines the syntactical contract that all derived classes should follow.
Interfaces contain only the declaration of member i.e. properties, method, and
event.
Q46.
What is different between an Abstract class and an Interface?
A46.
An Abstract
class
|
An interface
|
A
class extends only one abstract class
|
A
class implements multiple interfaces
|
An
abstract class is a class which contains one or more abstract methods which
has to implement by sub classes.
|
An
interface is a java object containing method declaration and doesn’t contain
implementation. The classes which have implementing the interfaces must
provide the method definition for all the methods.
|
An
abstract class contains one or more abstract methods.
|
An
interface contains all abstract method and final declaration
|
An
abstract class contains method definition of the some methods
|
An
interface contains only method declaration no definition provided
|
An
abstract class are useful in a situation that some general method should be
implemented and specialization behavior should be implemented by child class
|
An
interface are useful in a situation that all properties should be implemented
|
Q47.
What is a Stream?
A47. The stream is a
sequence of byte travelling from a source to a destination over a communication
path.
Q48.
What is an Exception?
Q48. An exception is
an erroneous situation that occurred during program execution. Exception
situation arises when operation cannot be completed normally.
Q49.
What is a Syntax Error?
A49. Syntax error
occurs when compiler cannot compile code.
Q50.
What is a Runtime error?
A50. Runtime error
occurs when an application attempts to perform an operation which is not
allowed at runtime. It is also called an exception.
Q51.
What is a Logical error?
A51. Logical error
occurs when an application compiles and runs properly but does not produce the
expected results.
Q52.
What is an Exception handling?
A52. An exception
handling is a process of providing an alternative path of execution when the
program is unable to execute as a desire.
Q53.
What is a Thread?
A53. Thread is the execution
path of a program used to run application that performed large and complex
computation.
Q54.
Define Thread Methods?
A54.
Start
() -
Start a thread.
Sleep
() -
makes the thread to pause for a period of time.
Abort
() –
Terminates the thread.
Suspend
() –
Suspend a thread. If thread is already suspended it has no effect.
Resume
() –
Resumes the suspended thread.
Q55.
What is a Race Condition?
A55. When two or more
thread simultaneously access a variable at least one thread tries to write a
value in the variable. This is called
the race condition.
Q56.
What is a Deadlock Condition?
A56. This condition
arises in a computer system when two threads wait for each other to complete
their operations before performing their individual action.
Q57.
What is a Lock starvation?
A57. This limitation
arises when the execution of a thread is postponed because of its low priority.
Q58.
What is the disadvantage of multithreading?
A58. Race Condition,
Deadlock Condition, and Lock starvation.
Q59.
Define Thread Priority?
A59. Thread priority
is the property that specifies the priority of one thread with respect to the
priority of another thread.
Above
normal
Below
normal
Highest
Lowest
Normal
Q60.
What is a Delegate?
A60. Delegate is a
reference type variable, which holds the reference to a method. This reference
can be change at runtime, as desired
Q61.
Define Type of Delegates?
A61.
Single-cast
Delegate
A
single-cast delegate derives from the System.Delegate class. It contains
reference to one method at a time.
Multicast
Delegate
A
multicast delegate derives from the System. MulticastDelegate class. It
contains an invocation list of multiple methods.
Q62.
What is an Event?
A62. An event is an
action or occurrence, such as clicks, key presses, mouse movement, or system
generated notification.
Q63.
What is a Publisher?
A63. A publisher is an
object that contains the definition of the event and the delegates.
Q64.
What is a Subscriber?
A64. A subscriber is
an object that wants to accept the event and provide a handler to the event.
Q65.
What is an Attribute?
A65. An attribute is a
declarative tag that is used to convey information to runtime about the
behavior of programmatic element such as classes, enumerations, and assemblies.
A declarative tag is depicted by square ([ ]) brackets placed above the
definition of an element such as class or a method. Ex. Conditional, WebMethod, DllImport, and
Obsolete.
Q66.
What is a Reflection?
A66. Reflection is
used in the process of obtaining type of information at runtime.
Q67.
What is a Common Language Runtime (CLR)?
A67. The CLR is one of
the most essential components of the .NET Framework. CLR is the environment
where all program using .NET technologies are executed. It provides service
such as code compilation, memory allocation, and garbage collection. The CLR
allows the execution of code across different platform by translating code into
Intermediate Language (IL). IL is low level language that the CLR understands.
Q68.
What is an Intermediate Language (IL)?
A68. IL is converted
into machine language during execution by the Just-In-Time (JIT) compiler.
During JIT compilation, code is also checked for type safety.
Q69.
What is a Common Language Specification (CLS)?
A69. CLR consists of a
set of common rules followed by all the languages of the .NET framework. This
set of rules is known as a Common Language Specification (CLS). CLS enables an
object or application to interact with the objects or application of other
languages.
Q70.
What is a Common Type System (CTS)?
A70. One of the
specifications defined in CLS is Common Type System (CTS), which provides a
type system that is common across all languages. CTS define how data type are
declared, used, and managed in the code at run time.
The
CTS also defines the rules that ensure that the data types of objects written
in various languages are able to interact with each other.
Q71.
What is a Managed Code?
A71. The code
developed in .NET is called managed code.
Q72.
What is a Namespaces?
A72. Namespaces is
logical groups of related classes and interfaces, which can be used by any
languages targeting the .NET Framework.
Q73.
What is Assemblies?
A73. An assembly is
the single (smallest) deployable unit that contains all the information about the
implementation of classes, structures, and interfaces.
Q74.
What is Metadata?
A74. The assembly
stores all the information about itself. This information is called metadata
and includes the name and version number of the assembly, security information
about the dependencies, and a list of the files that constitute the assembly.
Q75.
What is a pointer?
A75. Pointer is a
variable that stores the memory address of another variable.
Q76.
What is a package?
A76. Package is a
group of sub packages, classes and interfaces.
Q77.
What is an Assertion?
A77. An assertion is a
way to test certain assumption about the logic of a program.
Q78.
What is an identifier?
A78. An identifier is
a name given to a class variable or method.
Q79.
What is block or compound state?
A79.
Block
is a group of statement that are correlated together.
OR
Compound
statement is a group of statement bounded by opening or closing braces ({}).
Ex.
Block.
Q80.
What is a Final Class?
A80. Final class is a
class which cannot be subclasses.
Q81.
What is a Final Variable?
A81. Final variable is
a variable which value is constant. Any attempt to change the value of final
variable causes a compiler error.
Q82.
What is Final Method?
A82. Final method is a
method which cannot be overridden.
Q83.
What is an Iterator?
A83. An iterator is an
interface enables us to scan forward through any collection.
Q84.
What is a Socket?
A84. Socket is the
name given in one particular programming model to the endpoints of
communication link between processes.
Q85.
What is a Property?
A85. Properties are
use to determine the appearance of various controls (items) at runtimes.
Q86.
What is an Analysis?
A86. An analysis is
the stage where users and developer of the system get together and arrive at a
common understanding of system. The purpose of analysis is to provide a
description (solution) of the problem.
Q87.
What is Design?
A87. Design is the
blue print of the system that to be implemented.
Q88.
What is an Operator?
A88. An operator is a
set of one or more characters that is used for computation or comparison.
Q89.
What is a Pooling?
A89. Pooling is the
process in which a single event is executed at a time.
Q90.
What is a Client Id?
A90. A unique
identification number used when sending data to a specific client.
Q91.
What is a GUID?
A91. GUID stands for Global
Unique Identifier. It’s generating random number of string each time.
Ex.
System.Guid.NewGuid.ToString();
Q92.
Class vs. Structure?
A92. Both can contain
member such as fields and methods. Both require a constructor to create a new
instance of them and like all type in the .NET Framework. Both inherit from object.
The key difference between class and structure is that class is reference type
and structure is value type. On a low level this means that the instance data
for class is allocated on the heap, whereas the instance data for structure is
allocated on the stack.
Note:-
Structure
cannot have a parameter less constructors but he has parameterize constructors
and also structure does not have destructor like class.
Q93.
Different between String and StringBuilder?
A93.
String
is immutable. It means that you can't modify string at all.
StringBuilder
is mutable. It can be modified in any way and it doesn’t require creation of
new instance. When work is done .ToString() can be called to get the string.
Q94.
Const Vs Readonly Vs Static Keyword?
A94.
A
const field requires a value to be provided at compile-time.
|
A
readonly field cannot be assigned to (except in a constructor or a variable
initializer)
|
A
static variable is a variable that has been allocated statically whose
lifetime
Or
"extent" extends across the entire run of the program.
|
Const
field value cannot be change once assigned.
|
Q95.
Var vs Dynamic keyword?
A95.
Var
keyword provides compile time initialization.
|
Dynamic
keyword provides runtime initialization.
|
Once
you can initialize the type of value, you can’t change it.
|
You
can initialize the type of value at runtime.
|
You
can re- initialize the dynamic variable.
|
|
Example
var
strA = 10;
strA
= "Hello";
Here,
strA value assigned 10 i.e. strA containing an integer value. If you try to
assigned the string value to strA variable you will get the following error.
Cannot
implicitly convert type 'string' to 'int'
|
Example
dynamic
strA = 10;
strA
= "Hello";
Here,
strA value assigned 10 i.e. strA containing an integer value. If you change
the value as string, dynamic variable behave as a string variable at runtime.
|
Q96.
What is the “this” keyword?
A96.
The
this keyword refers to the current instance of the class and is also used as a
modifier of the first parameter of an extension method.
Q97.
What is the “base” keyword?
A97.
The
base keyword is used to access members of the base class from within a derived
class.
Q98.
What is the “extern” keyword?
A98.
The
extern modifier is used to declare a method that is implemented externally. A
common use of the extern modifier is with the DllImport attribute when you are
using Interop services to call into unmanaged code. In this case, the method
must also be declared as static.
No comments:
Post a Comment