Section 1

Preview this deck

Passing parameter by value?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (71)

Section 1

(50 cards)

Passing parameter by value?

Front

when you call a method and pass parameter by value the value will not be changed.

Back

How can we sort the elements of the Array in descending order?

Front

Using Sort() methods followed by Reverse() method.

Back

What is the difference between constants and read-only?

Front

Constant variables are declared and initialized at compile time. The value can't be changed afterward. Read-only is used only when we want to assign the value at run time.

Back

What's the difference between the System.Array.CopyTo() and System.Array.Clone()?

Front

Using Clone() method, we creates a new array object containing all the elements in the original Array and using CopyTo() method. All the elements of existing array copies into another existing array. Both methods perform a shallow copy

Back

List down the commonly used types of exceptions in .net

Front

ArgumentException, ArgumentNullException, ArgumentOutOfRange Exception, Arithmetic Exception, DivideByZeroException ,OverflowException, IndexOutOfRange Exception ,Invalid Cast Exception ,InvalidOperation Exception, IOEndOfStream Exception, NullReferenceException, OutOfMemoryException, StackOverflowException etc.

Back

How to use nullable types in .Net?

Front

Value types can take either their normal values or a null value. Int? someID = null;

Back

What's a multicast delegate?

Front

A delegate having multiple handlers assigned to it is called multicast delegate. Each handler is assigned to a method.

Back

What is an object?

Front

An object is an instance of a class through which we access the methods of that class. "New" keyword is used to create an object. A class that creates an object in memory will contain the information about the methods, variables, and behavior of that class.

Back

What happens if the inherited interfaces have conflicting method names?

Front

Implement is up to you as the method is inside your own class. There might be a problem when the methods from different interfaces expect different data, but as far as compiler cares you're okay.

Back

What are the different ways a method can be overloaded?

Front

Methods can be overloaded using different data types for a parameter, different order of parameters, and different number of parameters.

Back

What is Jagged Arrays?

Front

The Array which has elements of type array is called jagged Array. The elements can be of different dimensions and sizes. We can also call jagged Array as an Array of arrays.

Back

What is the difference between a Struct and a Class?

Front

Structs are value-type variables, and classes are reference types. Structs stored on the Stack causes additional overhead but faster retrieval. Structs cannot be inherited.

Back

What is an object pool in .NET?

Front

An object pool is a container having objects ready to be used. It tracks the object that is currently in use, total number of objects in the pool. This reduces the overhead of creating and re-creating objects.

Back

What is the difference between public, static, and void?

Front

Public declared variables or methods are accessible anywhere in the application. Static declared variables or methods are globally accessible without creating an instance of the class. Static member are by default not globally accessible it depends upon the type of access modified used. The compiler stores the address of the method as the entry point and uses this information to begin execution before any objects are created. And Void is a type modifier that states that the method or variable does not return any value.

Back

Define Constructors

Front

A constructor is a member function ina class that has the same name as its class. The constructor is automatically invoked whenever an object class is created. It constructs the values of data members while initializing the class.

Back

How to implement a singleton design pattern in C#?

Front

A console application is an application that can be run in the command prompt in Windows. For any beginner on .Net, building a console application is ideally the first step, to begin with.

Back

How do you inherit a class into other class in C#?

Front

Colon is used as inheritance operator in C# . Just place a colon and then the class name.

Back

What is C#?

Front

C# is an object-oriented, type-safe, and managed language that is compiled by.Net framework to generate Microsoft Intermediate Language.

Back

What is the difference between method overriding and methoc overloading?

Front

In method overriding, we change the method definition in the derived class that changes the method behavior. Method overloading is creating a method with the same name within the same class having different signatures.

Back

What is method overloading?

Front

Method overloading is creating multiple methods with the same name with unique signatures in the same class. When we compile, the compiler uses overload resolution to determine the specific method to be invoke.

Back

What are indexers in C# .NET?

Front

Indexers are known as smart arrays in C#. It allows the instances of a class to be indexed in the same way as an array.

Back

What are C# attributes and its significance?

Front

C# provides developers a way to define declarative tags on certain entities, eg. Class, method, etc. are called attributes. The attribute's information can be retrieved at runtime using Reflection.

Back

What is serialization?

Front

When we want to transport an object through a network, then we have to convert the object into a stream of bytes. The process of converting an object into a stream of bytes. For an object to be serializable it should implement ISerialize Interface. Deserialization is opposite.

Back

What are circular references?

Front

Circular reference is situation in which two or more resources are interdependent on each other causes the lock condition and make the resources unusable.

Back

Can a private virtual method can be overridden?

Front

No, because they are not accessible outside the class.

Back

Why can't you specify the accessibility modifier for methods inside the interface?

Front

In an interface, we have virtual methods that do not have method definition. All the methods are there to be overridden in the derived class. That's why they all are public.

Back

What's the difference between an interface and abstract class?

Front

Interfaces have all the methods having only declaration but no definition. In an abstract class, we can have some concrete methods. In an interface class, all the methods are public. An abstract class may have private methods.

Back

What is the base class in .net from which all the classes are derived from?

Front

System.Object

Back

Can we use "this" command within a static method?

Front

We can't use 'This' in a static method because we can only use static variables/methods in a static method.

Back

What is the difference between Finalize() and Dispose() methods?

Front

Dispose() is called when we want for an object to release any unmanaged resources with them. On the other hand, Finalize() is used for the same purpose, but it doesn't assure the garbage collection of an object.

Back

What are Custom Exceptions?

Front

Sometimes there are some errors that need to be handled as per user requirements. Custom exceptions are used for them and are used defined exceptions.

Back

Can multiple catch blocks be executed?

Front

No, Multiple catch blocks can't be executed. Once the catch proper code executed, the control is transferred to the finally block, and then the code that follows the finally block gets executed.

Back

How can we set the class to be inherited, but prevent the method from being over-ridden?

Front

Declare the class as public and make the method sealed to prevent it from being overridden.

Back

What is the use of 'using' statement in C# ?

Front

The 'using' block is used to obtain a resource and process it and then automatically dispose of when the execution of the block completed.

Back

What are generics in C #.NET?

Front

Generics are used to make reusable code classes to decrease the code redundancy, increase type safety, and performance. Using generics, we can create collection classes. To create generic collection, System.Collections.Generic namespace should be used instead of classes such as ArrayList in the System.Collections namespace. Generics promotes the usage of parameterized types.

Back

What are the differences between System.String System.Text.StringBuilder classes?

Front

System.String is immutable. When we modify the value of a string variable, then a new memory is allocated to the new value and the previous memory allocation released. System.StringBuilder was designed to have a concept of a mutable string where a variety of operations can be performed without allocation separate memory location for the modified string.

Back

How we can create an array with non-default values?

Front

We can create an array with non-default values using Enumerable.Repeat.

Back

What is an interface class? Give one example of it

Front

An Interface is an abstract class which has only public abstract methods, and the methods only have the declaration and not the definition. These abstract methods must be implemented in the inherited classes.

Back

What are value types and reference types?

Front

Value types are stored in the Stack, whereas reference types stored on heap.

Back

Give an example of removing an element from the queue

Front

The dequeue method is used to remove an element from the queue.

Back

What is the difference between Array and Arraylist?

Front

In an array, we can have items of the same type only. The size of the array is fixed when compared. To an arraylist is similar to an array, but it doesn't have a fixed size.

Back

What are Custom Control and User Control?

Front

Custom Controls are controls generated as compiled code (Dlls), those are easier to use and can be added to toolbox. Developers can drag and drop controls to their web forms. Attributes can, at design time. We can easily add custom controls to Multiple Applications (If Shared Dlls). So, If they are private, then we can copy to dll to bin directory of web application and then add reference and can use them. User Controls are very much similar to ASP include files, and are easy to create. User controls can't be placed in the toolbox and dragged -dropped from it. They have their design and code- behind. The file extension for user controls is ascx.

Back

What is difference between "is" and "as" operators in c#?

Front

"is" operator is used to check the compatibility of an object with a given type, and it returns the result as Boolean. "as" operator is used for casting of an object to a type or a class.

Back

What are delegates?

Front

Delegates are same are function pointers in C++, but the only difference is that they are type safe, unlike function pointers. Delegates are required because they can be used to write much more generic type-safe functions.

Back

Describe the accessibility mod ifier "protected internal"

Front

Protected Internal variables/methods are accessible within the same assembly and also from the classes that are derived from this parent class.

Back

What is difference between the "throw" and "throw ex" in .NET?

Front

"Throw" statement preserves original error stack whereas "throw ex" have the stack trace from their throw point. It is always advised to use "throw" because it provides more accurate error information.

Back

What is access modifiers

Front

level of accessibility. Public can be accessed in entire solution. Private access modifier can be accessed only in a class it was declared. Protected access modifier can be used in the class that it was declared in and the class that inherits this class.

Back

Write down the C# syntax to catch an exception

Front

if every statement works in the block it will never go to catch. If even one line doesn't work in the block it will go to catch. You can have multiple catches: most specific ones will go first. The generic one will come last. If you have an error and went to the first catch it will never go to any other catches. You can have finally which will be always executed.

Back

What are sealed classes in C#?

Front

We create sealed classes when we want to restrict the class to be inherited. Sealed modifier used to prevent derivation from a class. If we forcefully specify a sealed class as base class, then a compile- time error occurs

Back

What is the difference between ref & out parameters?

Front

An argument passed as ref must be initialized before passing to the method whereas out parameter needs not to be initialized before passing to a method.

Back

Section 2

(21 cards)

Abstract class

Front

Combination of class and interfaces Has abstract methods with declaration and no implementation. And also has methods with declaration and implementation inside. Class can inherit from 1 abstract class Every abstract method must be implemented in the class.

Back

Boxing

Front

Prpcess of converting a value type into reference type. Unboxing is opposite.

Back

Members of the class?

Front

events, method, properties, operators, constructors

Back

What is using

Front

Uses I disposable interface to clear memory

Back

Encapsulation

Front

A process of hiding the data and behavior that are not necessary to its user. Encapsulation enables a group of properties, methods and other members to be considered as a single unit or object.

Back

Why C# is object oriented language

Front

parents because its based on polymorphis, encapsulation, abstraction and inheritance

Back

Passing parameter by reference?

Front

when you call a method and pass parameter by ref the value can be changed.

Back

What is a class

Front

combination of code and data. Class has a declaration of the methods and implementation inside.

Back

Virtual method

Front

Allows a child of a class it was declared in to make changes in the method. You can not change the return type. In order to use a method in the child class virtual is changed to override

Back

The purpose of an empty constructor

Front

responsible for initialization of the data members of the class.

Back

Interface

Front

Has declaration of the method and NO implementation inside Public by default, no access modifier. Class can inherit from multiple interfaces. Every methods must be implemented.

Back

Auto-implemented property vs property

Front

1. Auto-implemented property doesn't have a field associated with it. 2.When we are creating a POCO class, we should use an auto-implemented prop. 3.When we are planning to do a data manipulation in the class by using custom constructor(s) we should use full properties.

Back

What is constructor?

Front

Empty constructor. Custom constructor. Constructor does not have a return data type. Empty initializes all the members of the class. Custom constructor passes parameters.

Back

Generics

Front

Type of collection that allows you to add complex type

Back

Polymorphism

Front

relates to inheritance, when 2 different objects are treated the same because they have the same parents

Back

Singleton

Front

It's a pattern to have only one object which is an instance of the class. If you have more it will refer to the first one.

Back

Indexer

Front

Is a special type of property that allows you to access a member of the collection by using index and code

Back

What is array

Front

it is a collection of the same data type elements, that has a predefined size

Back

Override

Front

if in a parent class in declaration of the method we have a key word virtual, that means that in the child class, that inherits from parent class, this method can be overridden. That means you can extend the method, completely change the method.

Back

What is a static class?

Front

It is a class that you can not create an object of this class. Its good for security and memory safe. In order to get the members of the static class you have to write theNameoftheClass.member

Back

What is inheritance?

Front

One class can inherit from the other class to use existing methods. Child(derived) class has all the members of a parent(base) class, besides private and sealed. Class can inherit only from one class. Hierarchical inheritance uses more than 2 classes.

Back