SpringCM On-Site Flashcards
What is a namespace
A namespace is designed for providing a way to keep one set of names separate from another. The class names declared in one namespace does not conflict with the same class names declared in another. Similar to a package in Java
What is using keyword
It is similar to an import statement. It means that you are bringing in a namespace to another location. Or namespace
Name 3 ways to pass parameters to a method
Value parameters : This method copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument.
Reference parameters : This method copies the reference to the memory location of an argument into the formal parameter. This means that changes made to the parameter affect the argument.
Out parameters : This method helps in returning more than one value.
What is the ultimate base class for everything in C#
The Object class.
Boxing vs. Unboxing
Boxing: When a value type is converted to an object. Think int to Integer.
Unboxing: When an object is converted to a value type
what are dynamic type variables?
You can assign these to variables and their types are checked at RUNTIME
How to extend a class in C#
MyClassSub : MySuperClass
What is a sealed class?
A class that cannot be inherited
Difference between value type and reference type
Value type directly contain data (i.e int, char, float)
Reference types do not contain actual data of variable but a reference to the the variable. Points to memory location
pointer types in c#?
store the memory address of another type. behave like pointers in c#. these are
How do you cast in c#
you can use the as keyword. Obj as StringBuilder
(Stringbuilder) Obj <= java equivalent
what are Nullable types?
These are types similar to normal value types but also allow a null. Nullable would allow for a null integer.
How can you enforce garbage collection in .NET
System.GC.Collect();
Stack vs Heap
stack: stores value types
heap: stores reference types
How would you improve your solution?
Maybe use a lambda or two? It would make it easier to code, but i believe I wrote my solution to be as readable as possible
I think using an enumuration for the test text files would be better. However, I believe C# doesn’t support String enums.
I think for larger text files, it would make sense to divide the content into chunks. This could split the work into separate threads. However, it seemed as if it finally took a millisecond around a couple thousand words.
Could I have used LINQ to possibly make a query? LINQ is a bit more expressive. It might have been easier to do this instead