Prov International .Net Fresher Interview questions with Answers – PART 1

Hi in this post we are going to discuss Prov International .Net Fresher Interview questions with Answers. Let us explore them briefly;

 Prov International .Net Fresher Interview questions with Answers – PART 1

1.What is object-oriented programming (OOP)?

OOP’s overview:
=>Object-oriented programming (OOP) is the core ingredient of the .NET framework.
=>The basic idea behind OOP is to combine into a single unit both data and the methods that operate on that data; such units are called an object.
=>Let’s now take a brief look at OOPs concepts.
A.Encapsulation:
Encapsulation binds together code and the data it manipulates. Encapsulation is a protective container that prevents code and data from being accessed by other code defined outside the container.
B.Inheritance:
Inheritance is the process by which one object acquires the properties of another object. A type derives from a base type. It adds functionality to an existing type.
C.Polymorphism:
Polymorphism is a feature that allows one interface to be used for a general class of action. This concept is often expressed as “one interface, multiple actions”.
D.Reusability:
Once a class has been written, created and debugged, it can be distributed to other programmers for use in their own program. This is called reusability, or in .NET terminology this concept is called a component or a DLL.
E.Abstraction:
Abstraction is important because it can hide unnecessary details from reference objects to names. Instead of showing how an object is represented, it focuses on what an object does. Data abstraction is often used for managing large and complex programs.

2.What is a class?

A class
=>Can support inheritance
=>Are reference (pointer) types
=>The reference can be null
=>Have memory overhead per new instance
=>A class in C# can directly inherit from one base class.
=>Are compound data types typically used to contain a few variables that have some logical relationship
=>Can contain methods and events
=>Can support interfaces
=>Classes are declared using the keyword class.
SAMPLE CODE:
class TestClass
{
// Methods, properties, fields, events, delegates
// and nested classes go here.
}

3.What is an object?

=>Object, in C#, is an instance of a class that is created dynamically.
=>Object is also a keyword that is an alias for the predefined type System.
=>An object consists of instance members whose value makes it unique in a similar set of objects.
=>All the objects used in C# code are of object type.
SAMPLE CODE:
using System;
using System.Text;
class Program
{
static void Main()
{
// Use an object reference.
object val = new StringBuilder();
Console.WriteLine(val.GetType());
}
}
SAMPLE OUTPUT:
System.Text.StringBuilder

4.What is Reference type?

=>A reference type is a code object that is not stored directly where it is created, but that acts as a kind of pointer to a value stored elsewhere.
=>A reference type refers to an object in some external memory space.
=>This is in contrast to value types, that are stored where they are created.
SAMPLE OUTPUT:

static void Increment(ref int i)
{
i = i + 1;
}
static void Main()
{
int x = 1;
Increment(ref x);
Console.WriteLine(“The value of x is: ” +x);
Console.Read();
}

SAMPLE OUTPUT:
“The value of x is: 2”

5.What is collection?

=>A collection is a set of similar type of objects that are grouped together.
=>System.Collections namespace contains specialized classes for storing and accessing the data.
=>Each collection class defined in .NET has a unique feature.
=>There are some basic operations that are possible on any collection.
    A.Search specific object in the collection.
    B.Adding or removing objects dynamically in the collection.
    C.List the objects in the collection by iterating through it.
=>Types of collections:
I.Arrays
Arrays can store any type of data but only one type at a time. The size of the array has to be specified at compilation time.
II.Advanced Collections
To perform different operations like inserting, deleting, sorting, searching, comparing, and so on advanced collections are used. Advanced collections are found in System.Collections namespace.

6.What is variable?

=>A variable is nothing but a name given to a storage area that our programs can manipulate. =>Each variable has a specific type, which determines the size and layout of the variable’s memory and the set of operations that can be applied to the variable.
=>The Dim statement is used for variable declaration and storage allocation for one or more variables. The Dim statement is used at module, class, structure, procedure or block level.
=>Syntax for variable declaration is;
[ < attributelist > ] [ accessmodifier ] [[ Shared ] [ Shadows ] | [ Static ]]
[ ReadOnly ] Dim [ WithEvents ] variablelist
=>The basic data variable types are as follows;

           Type                                               Example
Integral types SByte, Byte, Short, UShort, Integer, UInteger, Long, ULong and Char
Floating point types Single and Double
Decimal types Decimal
Boolean types True or False values, as assigned
Date types Date

7.What is instance?

=>An “instance” is an object allocated in memory, which is most often a built-in language-feature.
=>An instance is a concrete implementation of the class/blueprint, also characterized by its identity, state and behavior.
=>In simple word instance means creating reference of object.

To be continued…

References:
https://www.loginworks.com/blogs/object-oriented-programming-concepts-c/
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/class
https://www.dotnetperls.com/object
https://www.infoworld.com/article/3043992/application-development/a-deep-dive-value-and-reference-types-in-net.html
https://www.c-sharpcorner.com/article/collections-in-net/
https://www.tutorialspoint.com/vb.net/vb.net_variables.htm