Q & A - CSharp Question & Answers


Q&A 1.

Explain namespaces in C#?

Namespaces are containers for the classes. We will use namespaces for grouping the related classes in C#. "Using" keyword can be used for using the namespace in other namespace.

Q&A 2.

What are Jagged Arrays in C#?

If the elements of an array is an array then it’s called as jagged array. The elements can be of different sizes and dimensions.

Q&A 3.

List out the differences between Array and ArrayList in C#?

Array stores the values or elements of same data type but arraylist stores values of different datatypes. Array is strongly typed while ArrayList can store any type of items or elements.

Q&A 4.

When we use "finally" block is C#?

"Finally" block will be executed irrespective of exception. So while executing the code in try block when exception is occurred, control is returned to catch block and at last "finally" block will be executed. 

Q&A 5.

What is Static class in C#?

Static keyword can be used for declaring a static member. If the word static is applied to the class then every member in the class must be declared static. If the variable is made static then it will have a single instance and if there is any value change is updated in this instance.

Q&A 6.

What is the use of dynamic keyword in C#?

Dynamic keyword is use to initialize object of any kind. It was introduced in C# 4.0, and is used to tell the compiler that a variable's type can change or that it is not known until runtime. Think of it as being able to interact with an Object without having to cast it.

dynamic object; // make dynamic object while initializing.

object = stringArray str[] {"World", "celebrate", "new", "year"}; // assign object of string array type to dynamic object above.

Q&A 7.

What are design patterns?

Design patterns are common solutions to common design problems.

Q&A 8.

What are functional and non-functional requirements?

Functional requirements defines the behaviour of a system whereas non-functional requirements specify how the system should behave; in other words they specify the quality requirements and judge the behaviour of a system.

Q&A 9.

Give the differences between a stack & a heap?

Stack is a place in the memory where value types are stored. Heap is a place in the memory where the reference types are stored.

Q&A 10.

What is Boxing/Unboxing?

Boxing is used to convert value types to object. While unboxing is used to convert the object back to the value type.

Related Quiz Content

This website is using cookies to make user experience of the site better. More info. OK