Question: 1. (2 points) For each of the programs below, explain whether or not it will compile, if it will crash, and justify your answer. Programs


1. (2 points) For each of the programs below, explain whether or not it will compile, if it will crash, and justify your answer. Programs Explanation (compile/crash/result) void F1(int b) { long a = b; } Does it compile? (Y/N): Does it crash? (Y/N/NA): Justification: void F2(int b) { short a = b; } Does it compile? (Y/N): Does it crash? (Y/N/NA): Justification: Justification is more important than the rest. public class Cat Animal public class Animal { public String Eat) return "Yummy!"; ) public class Dog: Animal { public String Eat() { return "Yummy woof!"; 3 public String Puer) { return "Purr!"; } public String Bark { return "Woof!!"; ) Programs Explanation (compile/crash/result) void F10) { Dog aDog - new Dog(); Animal anotherAnimal aDog Console.WriteLine(anotherAnimal. Eat(); } Does it compile? (Y/N): Does it crash? (Y/N/NA): Result: Justification: void F20) Does it compile? (Y/N): Does it crash? (Y/N/NA): Justification: Animal anAnimal - new Animal(); Cat acat - anAnimal } void F30 { Cat acat = new Cat(); Animal anotherAnimal aCats Console.WriteLine(anotherAnimal.Purr(); Does it compile? (Y/N): Does it crash? (Y/N/NA): Result: Justification: void 74) { Animal anAnimal - new Animal); Dog aDog (Dog) anAnimals Console.WriteLine(aDog. Bark } Does it compile? (Y/N): Does it crash? (Y/N/NA): Result: Justification
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
