Live Help (Start Chat)
View Count: 0
Duration: 45 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 23 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 46 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 32 mins
Accessed date:
Not Yet Viewed
Post your comment / feedback here
 
 

Be the first one to comment about this video

Question No: 1 of 57
Generics in C#.Net is used to_________ 
Options:
  1. Solve the problem of type safety
  2. Reuse the code
  3. Increase the performance
  4. All the above
View Answer/Explanation:
d
Explanation:
A Generic Class is not specific to any particular Data Type. But the instance of such a class would be specific to a given Data Type mentioned at the time of creating the instance/object that class. Generic classes and methods combine reusability, type safety and efficiency in a way that their non-generic counterparts cannot. Generic collection classes are like Templates in C++. Code Reusability: if we write a Generic Class or method once we can use that throughout our program. hence it is code reuse Performance By using Generics performance increases as we are not using the concept of boxing/unboxing or casting the variables Generic methods can often be called without employing any special syntax by using a feature called type inference.

Question No: 2 of 57
The built-in collections found in the System.Collections namespace are________ 
Options:
  1. A. Ordered collections
  2. B. Indexed collections
  3. C. Keyed collections
  4. D. All the above
View Answer/Explanation:
d
Explanation:
Ordered collections: Collections that implement only the ICollection interface are usually distinguished by the fact that insertion order controls the order in which objects may be retrieved from the collection. The System.Collections.Stack and System.Collections.Queue classes are both examples of ICollection collections. Indexed collections: IList-implementing collections are distinguished by the fact that their contents can be retrieved via a zero-based numeric index, like an array. The System.Collections.ArrayList object is one example of an indexed collection. Keyed collections: Collections implementing the IDictionary interface contain items that can be retrieved by an associated key value of some kind. The contents of IDictionary collections are also usually sorted in some fashion based on the key value and can be retrieved in sorted order by enumeration. The System.Collections.HashTable class implements the IDictionary interface

Question No: 3 of 57
How many types of collections are available in .net? 
Options:
  1. 2
  2. 3
  3. 4
View Answer/Explanation:
a
Explanation:
1. Non-Generic Collections in System.Collections namespace : These are not type safe. • ArrayList • SortedList • Stack • Queue • HashTable • BitArray 2. Generic Collections in System.Collections.Generic: these are type safe. • List • Dictionary • Linked List • Stack • Queue

Question No: 4 of 57
How to use Dictionary class in Systems.Collections.Generic? 
Options:
  1. Create a Dictionary object and populate it and enumerate it to display key value pairs.
  2. Create collections object and populate them with values and create adictinary object.
  3. Both A and B
  4. None of the above
View Answer/Explanation:
a
Explanation:
For example, to create a Dictionary object that has integer as key and string as value, we can create dictionary object in the following way: Dictionary dictNames =new Dictionary(); dictNames.Add(1,”Raj”); dictNames.Add(3,”Ravi”); dictNames.Add(5,”Kevin”); In order to retrieve above value enumerate it i.e use foreach loop and use KeyValuePair object as the elements are retrieved as KeyValuePair objects foreach(KeyValuePair kvpName in dictNames) Console.WriteLine(kvpName.Key+” “+kvpName.Value);

Question No: 5 of 57
Differences between hashtable and arraylist are: 
Options:
  1. Retrieving the data in arraylist is faster than retrieving the data in hashtable
  2. Array list is a collection of objects and hashtable is a collection that takes key and corresponding values.
  3. ArrayList Class implements the Icollection Interface where as Hashtable implemets the Idictinary Interface
  4. All the above
View Answer/Explanation:
b c
Explanation:
Both are used to store collection of objects of a similar type. In arraylist elements are accessed using index wheareas in Hashtable elements are accessed using keys.

Question No: 6 of 57
_____________is the compiler's ability to infer which type arguments to use with a generic method, without  specifying explicitly. 
Options:
  1. Multiple inference
  2. Static type inference
  3. Generic type inference
View Answer/Explanation:
c
Explanation:
Ex: public class MyClass { public void MyInstanceMethod(T t) {...} public static void MyStaticMethod(T t) {...} }

Question No: 7 of 57
Constraints in generics are used to__________ 
Options:
  1. Add contextual information to type parameters
  2. To limit the range of types
  3. Add information about type arguments
  4. All the above
View Answer/Explanation:
d
Explanation:
If we want to check an item in generic list whether it is a valid or if if it is to be compared it with the other item, the compiler should have the guarantee that the method or operator that is used to call is supported by the any types of the arguments which might be specified by the client code. This kind of guarantee will be provided by applying one or more constraints to the generic class definition.

Question No: 8 of 57
Which namespace has to be added for using generic list (List, where T is datatype)in C# ? 
Options:
  1. System.Generic.Collections
  2. System.Collections.Generic
  3. System.Collections
  4. All the above
View Answer/Explanation:
b
Explanation:
The System.Collections.Generic namespace contains interfaces and classes that define generic collections, which allow users to create strongly typed collections that provide better type safety and performance than non-generic strongly typed collections.

Question No: 9 of 57
How to Serialize the generic types ? 
Options:
  1. Use GenericSerialize attribute
  2. Use Serialize attribute
  3. Use Obsolete attribute
  4. None of the above
View Answer/Explanation:
b
Explanation:
By using the attribute: [Serializable] [Serializable] public class TestClass { }

Question No: 10 of 57
You are creating an undo buffer that stores data modifications. You need to ensure that the undo functionality undoes the most recent data modifications first. You also need to ensure that the undo buffer permits storage of strings only. Which code segment should you use? 
Options:
  1. Stack undoBuffer = new Stack();
  2. Stack undoBuffer = new Stack();
  3. Queue undoBuffer = new Queue();
  4. Queue undoBuffer = new Queue();
View Answer/Explanation:
a
Explanation:
This is a Last-In-First-Out requirement that requires a strongly typed collection. Each of the members in the collection will be of string type.

  1