Good vs. Bad Rubrics

This is a wonderful example of good vs. bad rubrics. As you can see in table 1 and table 2, they are both descriptive of what they want for an outcome of the student to be. The problem with table 1’s…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




LCA Week 14 Blog

Which methods can we use to sort the elements of the array in descending order?

You can use a reverse Comparator or Collections.reverseOrder() method to sort an object array in descending order e.g. String array, Integer array or Double array. The Arrays.sort() method is overloaded to accept a Comparator, which can also be a reverse Comparator.

Describe what Jagged Arrays are?

A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an “array of arrays.” The following examples show how to declare, initialize, and access jagged arrays.

What is the difference between ref & out parameters?

Variables passed as out may also be passed to a function without being initialized. out specifies that the parameter is an output parameters, i.e. it has no value until it is explicitly set by the method. ref specifies that the value is a reference that has a value, and whose value you can change inside the method.

Discuss something you’re learning about this week as if someone just asked you.

This week I learned how to use interfaces. In the interfaces you can create empty strings or methods that all other classes will have then implement them into each class.

List out some of the exceptions in C#? And why we might get each.

1) Separation of Error Handling code from Normal Code: In traditional error handling codes, there are always if else conditions to handle errors. These conditions and the code to handle errors get mixed up with the normal flow. This makes the code less readable and maintainable. With try catch blocks, the code for error handling becomes separate from the normal flow.

2) Functions/Methods can handle any exceptions they choose: A function can throw many exceptions, but may choose to handle some of them. The other exceptions which are thrown, but not caught can be handled by caller. If the caller chooses not to catch them, then the exceptions are handled by caller of the caller.
In C#, a function can specify the exceptions that it throws using the throw keyword. The caller of this function must handle the exception in some way (either by specifying it again or catching it)

3) Grouping of Error Types: In C#, both basic types and objects can be thrown as exception. We can create a hierarchy of exception objects, group exceptions in namespaces or classes, categorize them according to types.

Add a comment

Related posts:

Overwhelmed and Exhausted?

Have you ever felt like you’re trapped in a never-ending cycle of working a job that underpays you and leaves you feeling exhausted and overwhelmed? You’re not alone. In fact, it seems like this is a…