Question

In: Computer Science

C#questions: T or F? Uncaught exceptions cause a program to terminate unexpectedly. Compared to traditional error...

C#questions:

T or F?

  1. Uncaught exceptions cause a program to terminate unexpectedly.
  2. Compared to traditional error handling techniques, exception handling is considered more efficient.
  3. Th Me keyword is a reference to the current instance of a class that is accessible from within the class definition.
  4. An abstract class cannot be instantiated.
  5. All members of an interface must be implemented.
  6. Value types can be used as base classes to derive other classes.
  7. You can define one namespace inside another namespace.
  8. Only one interface can be implemented on a class.
  9. One constructor can call another constructor in C#.
  10. Code in the finally block is always executed.

Solutions

Expert Solution


    Uncaught exceptions cause a program to terminate unexpectedly.

    Answer: True
    Exceptions must be caught and handled properly, otherwise the program will be
    crash and terminate

    Compared to traditional error handling techniques, exception handling is considered more efficient.

    Answer: True
    Efficient way of handling exceptions is to catch that exceptions and handled, then normal flow
    of execution of the program continues, after the handling the exception.


    Th Me keyword is a reference to the current instance of a class that is accessible from within the class definition.

    Answer: False
    "this" keyword is used to refer the current instance of a class in c#.

    An abstract class cannot be instantiated.

    Answer: True
    Abstract class cannot be instantiated. Object reference can be of Abstract type.

    All members of an interface must be implemented

    Answer: True
    Class implementing the interface must provide implementation for all the abstract methods in that interface.

    Value types can be used as base classes to derive other classes.
   Answer: No
    Eventhough value types are objects, they don't behave like other objects.


    You can define one namespace inside another namespace.

    Answer: True
   We can declare another namespace inside one namespace

    Only one interface can be implemented on a class.

   Answer: False
   We can implement more than one interface on a class.

    One constructor can call another constructor in C#.

    Answer: True
    we can call super class constructor from the derived class constructor.

    Code in the finally block is always executed.
  
    Answer: True

   Whether exceptions occurs in the program or not, always the code in the finally block will be
   exceuted.


Related Solutions

die's job is to output an error message alarmingly and terminate the program. You may copy...
die's job is to output an error message alarmingly and terminate the program. You may copy my function definition, or use your own: // The following 4 lines should be present if we have a die function: #include <iostream> // cout, endl #include <string> // string #include <cstdlib> // exit, EXIT_FAILURE using namespace std; bool die(const string & msg){ cout <<"Fatal error: " <<msg <<endl; exit(EXIT_FAILURE); } 4. Use rand to randomly choose one of the five operators * /...
Let f(t)=5t2−t. a) Find f(t+h): b) Find f(t+h)−f(t): c) Find f(t+h)−f(t)/h: side note: (f(t+h)=f(t) is on...
Let f(t)=5t2−t. a) Find f(t+h): b) Find f(t+h)−f(t): c) Find f(t+h)−f(t)/h: side note: (f(t+h)=f(t) is on top of fraction and h is on bottom) d) Find f′(t): pls circle the 4 answers
the z test gives more type I error for small samples compared to t test explain...
the z test gives more type I error for small samples compared to t test explain the reason in your own words
C++ in one program that ends with return 0} at the end f Write a program...
C++ in one program that ends with return 0} at the end f Write a program to calculate the salary paid to its salespersons at Pohanka. The salary is calculated based on a salesperson’s length of employment in years and employment category (full-time employee or part-time employee). The salary calculation rules are as following: 1) If an employee is a part-time employee and worked here for less than 5 years, the salary consists of only the commission amount; 2) If...
There are at least 10 errors in the following C program. For each error you can...
There are at least 10 errors in the following C program. For each error you can find you should list the location of the error, describe what the error is, and state how the error can be fixed (write updated code for that line if necessary). Each error you find is worth 1.5 marks. Note that missing brackets, braces, etc count as only one error, even though the missing brackets may occur at two places. The program is supposed to...
There are at least 10 errors in the following C program. For each error you can...
There are at least 10 errors in the following C program. For each error you can find you should list the location of the error, describe what the error is, and state how the error can be fixed (write updated code for that line if necessary). Each error you find is worth 1.5 marks. Note that missing brackets, braces, etc count as only one error, even though the missing brackets may occur at two places. The program is supposed to...
There are at least 10 errors in the following C program. For each error you can...
There are at least 10 errors in the following C program. For each error you can find you should list the location of the error, describe what the error is, and state how the error can be fixed (write updated code for that line if necessary). Each error you find is worth 1.5 marks. Note that missing brackets, braces, etc count as only one error, even though the missing brackets may occur at two places. The program is supposed to...
T/f: The mean absolute deviation is more sensitive to large deviations than the mean square error....
T/f: The mean absolute deviation is more sensitive to large deviations than the mean square error. T/f: A smoothing constant of 0.1 will cause an exponential smoothing forecast to react more quickly to a sudden change than a value of 0.3 will. T/f:An advantage of the exponential smoothing forecasting method is that more recent experience is given more weight than less recent experience. T/f: Linear regression can be used to approximate the relationship between independent and dependent variables. T/f:"Forecasting techniques...
Find the Fourier series of the function. c. f(t) = sin(3pit), -1</ t </ 1
Find the Fourier series of the function. c. f(t) = sin(3pit), -1</ t </ 1
Chapter 9 (Pointers) - Review Questions Find the Error Each of the following definitions and program...
Chapter 9 (Pointers) - Review Questions Find the Error Each of the following definitions and program segments has errors. Locate as many as you can. 46. int ptr* = nullptr; 47. int x, *ptr = nullptr; &x = ptr; 48. int x, *ptr = nullptr; *ptr = &x; 49. int x, *ptr = nullptr; ptr = &x; ptr = 100; //Store 100 in x cout << x << endl; 50. int numbers[] = {10, 20, 30, 40, 50}; cout <<...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT