Bank exam questions and answers

Group exam questions and answers

Technical questions and answers

1. What is C#? 

C# is the best language for writing Microsoft .NET applications. C# provides the rapid application development found in Visual Basic with the power of C++. Its syntax is similar to C++ syntax and meets 100% of the requirements of OOPs like the following:

Abstraction

Encapsulation

Polymorphism

Inheritance
2. What is Boxing and Unboxing?

Boxing:

Boxing is the process of converting a value type data type to the object or to any interface data type which is implemented by this value type. When the CLR boxes a value means when CLR is converting a value type to Object Type, it wraps the value inside a System.Object and stores it on the heap area in application domain.

Unboxing:

Unboxing is also a process which is used to extract the value type from the object or any implemented interface type. Boxing may be done implicitly, but unboxing have to be explicit by code.
3. What is the difference between a struct and a class in C#?

Class and struct both are the user defined data type but have some major difference:

Struct

The struct is value type in C# and it inherits from System.Value Type.

Struct is usually used for smaller amounts of data.

Struct can’t be inherited to other type.

A structure can't be abstract.

No need to create object by new keyword.

Do not have permission to create any default constructor.

Class

The class is reference type in C# and it inherits from the System.Object Type.

Classes are usually used for large amounts of data.

Classes can be inherited to other class.

A class can be abstract type.

We can’t use an object of a class with using new keyword.

We can create a default constructor.
4. How do I spawn a thread?

We need to create an instance of a System.Threading.Thread object and passing it an instance of a ThreadStart delegate that will be executed on the new thread.

class MyDemoThread

{

public MyDemoThread( string initData )

{

m_data = initData;

m_thread = new Thread( new ThreadStart(ThreadMain) );

m_thread.Start();

} // ThreadMain() is executed on the new thread.

private void ThreadMain()

{

Console.WriteLine( m_data );

}

public void WaitUntilFinished()

{

m_thread.Join();

private Thread m_thread;

private string m_data;

}

}
5. What is the difference between Interface and Abstract Class?

Theoretically their are some differences between Abstract Class and Interface which are listed below:

A class can implement any number of interfaces but a subclass can at most use only one abstract class.

An abstract class can have non-abstract methods (concrete methods) while in case of interface all the methods has to be abstract.

An abstract class can declare or use any variables while an interface is not allowed to do so.

In an abstract class all data member or functions are private by default while in interface all are public, we can’t change them manually.

In an abstract class we need to use abstract keyword to declare abstract methods while in an interface we don’t need to use that.

An abstract class can’t be used for multiple inheritance while interface can be used as multiple inheritance.

An abstract class use constructor while in an interface we don’t have any type of constructor.
6. Difference between System.String vs. System.StringBuilder classes?

System.String Class

System.String is immutable.

Append keyword is not used.

System.String is slow.

System.StringBuilder Class

System.StringBuilder is mutable.

Append keyword is used.

System.StringBuilder is fast.
7. What is the Constructor Chaining in C#?
constructor chaining is a way to connect two or more classes in a relationship as Inheritance, in Constructor Chaining every child class constructor is mapped to parent class Constructor implicitly by base keyword so when you create an instance of child class to it’ll call parent’s class Constructor without it inheritance is not possible.
8. What is an interface class?
An interface class is an abstract class with public abstract methods. You can inherit the class and have the methods over-ridden.
9. How does C# differ from C++?

C# doesn't support multiple inheritances while C++ does.

- We can use switch statement with string values in C# while in C++ only Character and integer values supported.

- Casting is Safer in C# than C++.

- C# doesn’t require semicolon on completion of class definition while C++ use.

- In C#, Command line parameter acts differently as compared to C++.
10. Name the namespace used to create a localized application?

System.Globalization

System.Resources

The classes contained in the System.Globalization namespace are useful for writing globalized (internationalized) applications. It contains classes that define culture-related information such as language, the country/region, the calendars in use, the format patterns for dates, currency, and numbers, and the sort order for strings.

The System.Resources namespace contains classes and interfaces which allow to create, store, and manage various culture-specific resources used in an application.
div itemprop="description">AptTree.com is enhanced solution for learning and training all categories of Group&bank Questions and Answers.
Date published: 01/01/2015
5 / 5 stars