Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

using signal flow graph

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago